url
stringlengths 38
157
| content
stringlengths 72
15.1M
|
---|---|
https://redis.io/docs/latest/operate/rs/clusters/configure/rack-zone-awareness/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Rack-zone awareness in Redis Enterprise Software
</h1>
<p class="text-lg -mt-5 mb-10">
Rack-zone awareness ensures high availability in the event of a rack or zone failure.
</p>
<p>
Rack-zone awareness helps ensure high availability in the event of a rack or zone failure.
</p>
<p>
When you enable rack-zone awareness in a Redis Enterprise Software cluster, you assign
a
<a href="#rack-zone-id-rules">
rack-zone ID
</a>
to each node. This ID is used to map the node to a
physical rack or logical zone. The cluster can then ensure that master shards, corresponding replica shards, and associated endpoints are placed on
<a href="#node-layout-guidelines">
nodes in different racks or zones
</a>
.
</p>
<p>
In the event of a rack or zone failure, the replicas and endpoints in the remaining racks and zones are promoted. This ensures high availability when a rack or zone fails.
</p>
<p>
There is no limitation on the number of racks and zones per cluster. Each
node can belong to a different rack or multiple nodes can belong to the
same rack.
</p>
<p>
Rack-zone awareness affects various cluster, node, and database actions, such as node rebalancing, node removal, node replacement, shard and endpoint migration, and database failover.
</p>
<h2 id="rack-zone-id-rules">
Rack-zone ID rules
</h2>
<p>
The rack-zone ID must comply with the following rules:
</p>
<ul>
<li>
Maximum length of 63 characters.
</li>
<li>
Characters consist of letters, digits, and hyphens ('-'). Underscores ('_') are also accepted as of Redis Enterprise Software
<a href="/docs/latest/operate/rs/release-notes/rs-6-4-2-releases/rs-6-4-2-61/">
6.4.2-61
</a>
.
</li>
<li>
ID starts with a letter and ends with a letter or a digit.
</li>
</ul>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Note:
</div>
Rack-zone IDs are
<strong>
case-insensitive
</strong>
(uppercase and lowercase letter are treated as the same).
</div>
</div>
<h2 id="node-layout-guidelines">
Node layout guidelines
</h2>
<p>
Avoid placing the majority of nodes in one availability zone.
</p>
<p>
If a Redis Enterprise Software cluster consists of three nodes (the recommended minimum), follow these guidelines:
</p>
<ul>
<li>
<p>
For high availability, the three nodes must be distributed across three
<em>
distinct
</em>
racks or zones.
</p>
</li>
<li>
<p>
When using availability zones, all three zones should exist within the same
<em>
region
</em>
to avoid potential latency issues.
</p>
</li>
</ul>
<h2 id="set-up-rack-zone-awareness">
Set up rack-zone awareness
</h2>
<p>
To enable rack-zone awareness, you need to configure it for the
cluster, nodes, and
<a href="#enable-database-rack-zone-awareness">
databases
</a>
.
</p>
<h3 id="new-cluster">
New cluster
</h3>
<p>
You can set up rack-zone awareness for the cluster and its nodes during
<a href="/docs/latest/operate/rs/clusters/new-cluster-setup/">
cluster creation
</a>
:
</p>
<ol>
<li>
<p>
In the
<strong>
Cluster
</strong>
screen's
<strong>
Configuration
</strong>
section, enable
<strong>
Rack zone awareness
</strong>
.
</p>
</li>
<li>
<p>
Select
<strong>
Next
</strong>
to continue to the
<strong>
Node
</strong>
configuration screen.
</p>
</li>
<li>
<p>
Enter a
<strong>
Rack-zone ID
</strong>
for the current node.
</p>
</li>
<li>
<p>
Finish
<a href="/docs/latest/operate/rs/clusters/new-cluster-setup/">
cluster setup
</a>
.
</p>
</li>
<li>
<p>
For every
<a href="/docs/latest/operate/rs/clusters/add-node/">
node you add to the cluster
</a>
, assign a different
<strong>
Rack-zone ID
</strong>
.
</p>
</li>
</ol>
<h3 id="existing-cluster">
Existing cluster
</h3>
<p>
If you did not configure rack-zone awareness during cluster creation, you can configure rack-zone awareness for existing clusters using the
<a href="/docs/latest/operate/rs/references/rest-api/">
REST API
</a>
:
</p>
<ol>
<li>
<p>
For each node in the cluster, assign a different rack-zone ID using the REST API to
<a href="/docs/latest/operate/rs/references/rest-api/requests/nodes/#put-node">
update the node
</a>
:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">PUT /v1/nodes/<node-ID>
</span></span><span class="line"><span class="cl"><span class="o">{</span> <span class="s2">"rack_id"</span>: <span class="s2">"rack-zone-ID"</span> <span class="o">}</span>
</span></span></code></pre>
</div>
</li>
<li>
<p>
<a href="/docs/latest/operate/rs/references/rest-api/requests/cluster/policy/#put-cluster-policy">
Update the cluster policy
</a>
to enable rack-zone awareness:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">PUT /v1/cluster/policy
</span></span><span class="line"><span class="cl"><span class="o">{</span> <span class="s2">"rack_aware"</span>: <span class="nb">true</span> <span class="o">}</span>
</span></span></code></pre>
</div>
</li>
</ol>
<h2 id="enable-database-rack-zone-awareness">
Enable database rack-zone awareness
</h2>
<p>
Before you can enable rack-zone awareness for a database, you must configure rack-zone awareness for the cluster and its nodes. For more information, see
<a href="#set-up-rack-zone-awareness">
set up rack-zone awareness
</a>
.
</p>
<!--
To enable rack-zone awareness for a database using the Cluster Manager UI:
1. From **databases**, [create a new database](/docs/latest/operate/rs/databases/create/) or edit an existing database's **configuration**.
1. Expand the **High availability & durability** section.
1. Enable [**Replication**](/docs/latest/operate/rs/databases/durability-ha/replication/).
1. Select **Rack-zone awareness**.
<a href='/docs/latest/images/rs/screenshots/databases/config-rack-zone-awareness.png' sdata-lightbox="/images/rs/screenshots/databases/config-rack-zone-awareness.png">
<img src='/docs/latest/images/rs/screenshots/databases/config-rack-zone-awareness.png'
alt="Select the Rack-zone awareness checkbox to enable rack-zone awareness for the database."
/>
</a>
1. **Create** or **Save** your database.
1. [Rearrange database shards](#rearrange-database-shards) to optimize an existing database for rack-zone awareness.
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5"><svg width="21" height="21" viewBox="0 0 21 21" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5"/>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2"/>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2"/>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">Note:</div>
If you enabled rack-zone awareness during database creation, you can ignore this step.</div>
</div>
-->
<p>
To enable rack-zone awareness for a database, use a
<a href="/docs/latest/operate/rs/references/rest-api/requests/bdbs/#put-bdbs">
REST API request
</a>
:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">PUT /v1/bdbs/<database-ID>
</span></span><span class="line"><span class="cl"><span class="o">{</span> <span class="s2">"rack_aware"</span>: <span class="nb">true</span> <span class="o">}</span>
</span></span></code></pre>
</div>
<h3 id="rearrange-database-shards">
Rearrange database shards
</h3>
<p>
After you enable rack-zone awareness for an existing database, you should generate an optimized shard placement blueprint using the
<a href="/docs/latest/operate/rs/references/rest-api/">
REST API
</a>
and use it to rearrange the shards in different racks or zones.
</p>
<ol>
<li>
<p>
<a href="/docs/latest/operate/rs/references/rest-api/requests/bdbs/actions/optimize_shards_placement/#get-bdbs-actions-optimize-shards-placement">
Generate an optimized shard placement blueprint
</a>
:
</p>
<ol>
<li>
<p>
Send the following
<code>
GET
</code>
request:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">GET /v1/bdbs/<database-ID>/actions/optimize_shards_placement
</span></span></code></pre>
</div>
</li>
<li>
<p>
Copy the
<code>
cluster-state-id
</code>
from the response headers.
</p>
</li>
<li>
<p>
Copy the JSON response body, which represents the new shard placement blueprint.
</p>
</li>
</ol>
</li>
<li>
<p>
<a href="/docs/latest/operate/rs/references/rest-api/requests/bdbs/actions/optimize_shards_placement/#put-bdbs-rearrange-shards">
Rearrange the database shards
</a>
according to the new shard placement blueprint:
</p>
<ol>
<li>
<p>
In the request headers, include the
<nobr>
<code>
cluster-state-id
</code>
</nobr>
from the
<code>
optimize_shards_placement
</code>
response.
</p>
</li>
<li>
<p>
Add the following JSON in the request body and replace
<nobr>
<code>
<shard placement blueprint>
</code>
</nobr>
with the new blueprint:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl"><span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="s2">"shards_blueprint"</span>: <shard placement blueprint>
</span></span><span class="line"><span class="cl"><span class="o">}</span>
</span></span></code></pre>
</div>
</li>
<li>
<p>
Send the following
<code>
PUT
</code>
request to rearrange the shards:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">PUT /v1/bdbs/<database-ID>
</span></span></code></pre>
</div>
</li>
</ol>
</li>
</ol>
<h2 id="shard-placement-without-rack-zone-awareness">
Shard placement without rack-zone awareness
</h2>
<p>
Even if a database has rack-zone awareness turned off, the cluster still ensures that master and replica shards are placed on distinct nodes.
</p>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/clusters/configure/rack-zone-awareness/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rc/changelog/2023/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Redis Cloud changelog (2023)
</h1>
<p class="text-lg -mt-5 mb-10">
All Redis Cloud changelogs from 2023.
</p>
<p>
Select a month from the following table to see a more detailed changelog for that month:
</p>
<table>
<thead>
<tr>
<th style="text-align:left">
Month
</th>
<th style="text-align:left">
Major changes
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">
<a href="/docs/latest/operate/rc/changelog/2023/december-2023/">
December 2023
</a>
</td>
<td style="text-align:left">
Active-Active JSON support, mTLS enhancements
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/operate/rc/changelog/2023/november-2023/">
November 2023
</a>
</td>
<td style="text-align:left">
New Fixed plans, Redis 7.2 Fixed region support
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/operate/rc/changelog/2023/october-2023/">
October 2023
</a>
</td>
<td style="text-align:left">
Cost report CSV download, SAML Account linking tokens
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/operate/rc/changelog/2023/september-2023/">
September 2023
</a>
</td>
<td style="text-align:left">
RESP protocol selection
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/operate/rc/changelog/2023/august-2023/">
August 2023
</a>
</td>
<td style="text-align:left">
Redis 7.2 Opt-in for Flexible subscriptions, Triggers and functions preview
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/operate/rc/changelog/2023/july-2023/">
July 2023
</a>
</td>
<td style="text-align:left">
New ACL capabilities
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/operate/rc/changelog/2023/june-2023/">
June 2023
</a>
</td>
<td style="text-align:left">
Redis 7.2 opt-in for Fixed subscriptions
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/operate/rc/changelog/2023/may-2023/">
May 2023
</a>
</td>
<td style="text-align:left">
Cloud API Fixed plans support, Active-Active ACL roles
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/operate/rc/changelog/2023/april-2023/">
April 2023
</a>
</td>
<td style="text-align:left">
Exposed advanced capabilities when creating a new database
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/operate/rc/changelog/2023/march-2023/">
March 2023
</a>
</td>
<td style="text-align:left">
Redis 7.0 preview
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/operate/rc/changelog/2023/february-2023/">
February 2023
</a>
</td>
<td style="text-align:left">
Private Service Connect
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/operate/rc/changelog/2023/january-2023/">
January 2023
</a>
</td>
<td style="text-align:left">
Pub/sub ACLs, multiple availability zones, add users with first and last names
</td>
</tr>
</tbody>
</table>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rc/changelog/2023/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/develop/tools/insight/release-notes/v.2.48.0/.html | <section class="prose w-full py-12">
<h1>
Redis Insight v2.48.0, April 2024
</h1>
<p class="text-lg -mt-5 mb-10">
Redis Insight v2.48
</p>
<h2 id="248-april-2024">
2.48 (April 2024)
</h2>
<p>
This is the General Availability (GA) release of Redis Insight 2.48.
</p>
<h3 id="highlights">
Highlights
</h3>
<ul>
<li>
New look, equally fast.
</li>
<li>
Learn Redis faster by uploading sample data and a concise tutorial for empty databases.
</li>
<li>
Enhance the security and scalability when running Redis Insight on Docker behind a proxy by adding support for the static proxy subpath.
</li>
</ul>
<h3 id="details">
Details
</h3>
<p>
<strong>
Features and improvements
</strong>
</p>
<ul>
<li>
<a href="https://github.com/RedisInsight/RedisInsight/pull/3233">
#3233
</a>
New look, equally fast. We've refreshed our Redis Insight app to align with our new brand look.
</li>
<li>
<a href="https://github.com/RedisInsight/RedisInsight/pull/3224">
#3224
</a>
Jumpstart your Redis journey by uploading sample data with JSON and basic data structures for empty databases. To upload the sample data, navigate to the Browser screen for your empty database and initiate the upload process with just a click.
</li>
<li>
<a href="https://github.com/RedisInsight/RedisInsight/pull/2711">
#2711
</a>
Enhance the security and scalability by running Redis Insight on Docker
<a href="https://github.com/RedisInsight/RedisInsight-reverse-proxy">
behind a proxy
</a>
using the newly added support for the static proxy subpath. Use the
<code>
RIPROXYPATH
</code>
environment variable to configure the subpath proxy path.
</li>
</ul>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/develop/tools/insight/release-notes/v.2.48.0/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/commands/grouplist.html | <section class="prose w-full py-12">
<h1>
Commands
</h1>
</section>
|
https://redis.io/docs/latest/commands/pttl/.html | <section class="prose w-full py-12">
<h1 class="command-name">
PTTL
</h1>
<div class="font-semibold text-redis-ink-900">
Syntax
</div>
<pre class="command-syntax">PTTL key</pre>
<dl class="grid grid-cols-[auto,1fr] gap-2 mb-12">
<dt class="font-semibold text-redis-ink-900 m-0">
Available since:
</dt>
<dd class="m-0">
2.6.0
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
Time complexity:
</dt>
<dd class="m-0">
O(1)
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
ACL categories:
</dt>
<dd class="m-0">
<code>
@keyspace
</code>
<span class="mr-1 last:hidden">
,
</span>
<code>
@read
</code>
<span class="mr-1 last:hidden">
,
</span>
<code>
@fast
</code>
<span class="mr-1 last:hidden">
,
</span>
</dd>
</dl>
<p>
Like
<a href="/docs/latest/commands/ttl/">
<code>
TTL
</code>
</a>
this command returns the remaining time to live of a key that has an
expire set, with the sole difference that
<a href="/docs/latest/commands/ttl/">
<code>
TTL
</code>
</a>
returns the amount of remaining
time in seconds while
<code>
PTTL
</code>
returns it in milliseconds.
</p>
<p>
In Redis 2.6 or older the command returns
<code>
-1
</code>
if the key does not exist or if the key exist but has no associated expire.
</p>
<p>
Starting with Redis 2.8 the return value in case of error changed:
</p>
<ul>
<li>
The command returns
<code>
-2
</code>
if the key does not exist.
</li>
<li>
The command returns
<code>
-1
</code>
if the key exists but has no associated expire.
</li>
</ul>
<h2 id="examples">
Examples
</h2>
<div class="bg-slate-900 border-b border-slate-700 rounded-t-xl px-4 py-3 w-full flex">
<svg class="shrink-0 h-[1.0625rem] w-[1.0625rem] fill-slate-50" fill="currentColor" viewbox="0 0 20 20">
<path d="M2.5 10C2.5 5.85786 5.85786 2.5 10 2.5C14.1421 2.5 17.5 5.85786 17.5 10C17.5 14.1421 14.1421 17.5 10 17.5C5.85786 17.5 2.5 14.1421 2.5 10Z">
</path>
</svg>
<svg class="shrink-0 h-[1.0625rem] w-[1.0625rem] fill-slate-50" fill="currentColor" viewbox="0 0 20 20">
<path d="M10 2.5L18.6603 17.5L1.33975 17.5L10 2.5Z">
</path>
</svg>
<svg class="shrink-0 h-[1.0625rem] w-[1.0625rem] fill-slate-50" fill="currentColor" viewbox="0 0 20 20">
<path d="M10 2.5L12.0776 7.9322L17.886 8.22949L13.3617 11.8841L14.8738 17.5L10 14.3264L5.1262 17.5L6.63834 11.8841L2.11403 8.22949L7.92238 7.9322L10 2.5Z">
</path>
</svg>
</div>
<form class="redis-cli overflow-y-auto max-h-80">
<pre tabindex="0">redis> SET mykey "Hello"
"OK"
redis> EXPIRE mykey 1
(integer) 1
redis> PTTL mykey
(integer) 1000
</pre>
<div class="prompt" style="">
<span>
redis>
</span>
<input autocomplete="off" name="prompt" spellcheck="false" type="text"/>
</div>
</form>
<h2 id="resp2resp3-reply">
RESP2/RESP3 Reply
</h2>
<p>
One of the following:
</p>
<ul>
<li>
<a href="../../develop/reference/protocol-spec#integers">
Integer reply
</a>
: TTL in milliseconds.
</li>
<li>
<a href="../../develop/reference/protocol-spec#integers">
Integer reply
</a>
:
<code>
-1
</code>
if the key exists but has no associated expiration.
</li>
<li>
<a href="../../develop/reference/protocol-spec#integers">
Integer reply
</a>
:
<code>
-2
</code>
if the key does not exist.
</li>
</ul>
<br/>
<h2>
History
</h2>
<ul>
<li>
Starting with Redis version 2.8.0: Added the -2 reply.
</li>
</ul>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/commands/pttl/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/references/rest-api/requests/bdbs/sync_source_stats/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Database syncer source stats requests
</h1>
<p class="text-lg -mt-5 mb-10">
Syncer source statistics requests
</p>
<table>
<thead>
<tr>
<th>
Method
</th>
<th>
Path
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="#get-all-bdbs-sync_source_stats">
GET
</a>
</td>
<td>
<code>
/v1/bdbs/{bdb_uid}/sync_source_stats
</code>
</td>
<td>
Get stats for all syncer sources
</td>
</tr>
<tr>
<td>
<a href="#get-bdbs-sync_source_stats">
GET
</a>
</td>
<td>
<code>
/v1/bdbs/{bdb_uid}/sync_source_stats/{uid}
</code>
</td>
<td>
Get stats for a specific syncer instance
</td>
</tr>
</tbody>
</table>
<h2 id="get-all-bdbs-sync_source_stats">
Get all syncer source stats
</h2>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">GET /v1/bdbs/<span class="o">{</span>bdb_uid<span class="o">}</span>/sync_source_stats
</span></span></code></pre>
</div>
<p>
Get stats for all syncer sources of a local database.
</p>
<h3 id="permissions">
Permissions
</h3>
<table>
<thead>
<tr>
<th>
Permission name
</th>
<th>
Roles
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="/docs/latest/operate/rs/references/rest-api/permissions/#view_bdb_stats">
view_bdb_stats
</a>
</td>
<td>
admin
<br/>
cluster_member
<br/>
cluster_viewer
<br/>
db_member
<br/>
db_viewer
<br/>
user_manager
</td>
</tr>
</tbody>
</table>
<h3 id="get-all-request">
Request
</h3>
<h4 id="example-http-request">
Example HTTP request
</h4>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">GET /bdbs/1/sync_source_stats?interval<span class="o">=</span>5min
</span></span></code></pre>
</div>
<h4 id="headers">
Headers
</h4>
<table>
<thead>
<tr>
<th>
Key
</th>
<th>
Value
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
Host
</td>
<td>
cnm.cluster.fqdn
</td>
<td>
Domain name
</td>
</tr>
<tr>
<td>
Accept
</td>
<td>
application/json
</td>
<td>
Accepted media type
</td>
</tr>
</tbody>
</table>
<h4 id="url-parameters">
URL parameters
</h4>
<table>
<thead>
<tr>
<th>
Field
</th>
<th>
Type
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
bdb_uid
</td>
<td>
integer
</td>
<td>
The unique ID of the local database.
</td>
</tr>
</tbody>
</table>
<h4 id="query-parameters">
Query parameters
</h4>
<table>
<thead>
<tr>
<th>
Field
</th>
<th>
Type
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
interval
</td>
<td>
string
</td>
<td>
Time interval for which we want stats: 1sec/10sec/5min/15min/1hour/12hour/1week (optional)
</td>
</tr>
<tr>
<td>
stime
</td>
<td>
ISO_8601
</td>
<td>
Start time from which we want the stats. Should comply with the
<a href="https://en.wikipedia.org/wiki/ISO_8601">
ISO_8601
</a>
format (optional)
</td>
</tr>
<tr>
<td>
etime
</td>
<td>
ISO_8601
</td>
<td>
Optional end time after which we don't want the stats. Should comply with the
<a href="https://en.wikipedia.org/wiki/ISO_8601">
ISO_8601
</a>
format (optional)
</td>
</tr>
</tbody>
</table>
<h3 id="get-all-response">
Response
</h3>
<p>
Returns
<a href="/docs/latest/operate/rs/references/rest-api/objects/statistics/">
statistics
</a>
for all syncer sources.
</p>
<h4 id="example-json-body">
Example JSON body
</h4>
<div class="highlight">
<pre class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span> <span class="nt">"sync_source_stats"</span><span class="p">:</span> <span class="p">[</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"intervals"</span><span class="p">:</span> <span class="p">[</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"etime"</span><span class="p">:</span> <span class="s2">"2017-10-22T19:30:00Z"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"ingress_bytes"</span><span class="p">:</span> <span class="mi">18528</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"ingress_bytes_decompressed"</span><span class="p">:</span> <span class="mi">185992</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"interval"</span><span class="p">:</span> <span class="s2">"5min"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"local_ingress_lag_time"</span><span class="p">:</span> <span class="mf">0.244</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"stime"</span><span class="p">:</span> <span class="s2">"2017-10-22T19:25:00Z"</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"etime"</span><span class="p">:</span> <span class="s2">"2017-10-22T19:35:00Z"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"ingress_bytes"</span><span class="p">:</span> <span class="mi">18</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"ingress_bytes_decompressed"</span><span class="p">:</span> <span class="mi">192</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"interval"</span><span class="p">:</span> <span class="s2">"5min"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"local_ingress_lag_time"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"stime"</span><span class="p">:</span> <span class="s2">"2017-10-22T19:30:00Z"</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl"> <span class="p">],</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"uid"</span><span class="p">:</span> <span class="s2">"1"</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl"> <span class="p">]</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span></code></pre>
</div>
<h3 id="get-all-status-codes">
Status codes
</h3>
<table>
<thead>
<tr>
<th>
Code
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1">
200 OK
</a>
</td>
<td>
No error
</td>
</tr>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5">
404 Not Found
</a>
</td>
<td>
Database does not exist.
</td>
</tr>
</tbody>
</table>
<h2 id="get-bdbs-sync_source_stats">
Get syncer instance stats
</h2>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">GET /v1/bdbs/<span class="o">{</span>bdb_uid<span class="o">}</span>/sync_source_stats/<span class="o">{</span>int: uid<span class="o">}</span>
</span></span></code></pre>
</div>
<p>
Get stats for a specific syncer (Replica Of) instance.
</p>
<h4 id="permissions-1">
Permissions
</h4>
<table>
<thead>
<tr>
<th>
Permission name
</th>
<th>
Roles
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="/docs/latest/operate/rs/references/rest-api/permissions/#view_bdb_stats">
view_bdb_stats
</a>
</td>
<td>
admin
<br/>
cluster_member
<br/>
cluster_viewer
<br/>
db_member
<br/>
db_viewer
<br/>
user_manager
</td>
</tr>
</tbody>
</table>
<h3 id="get-request">
Request
</h3>
<h4 id="example-http-request-1">
Example HTTP request
</h4>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">GET /bdbs/1/sync_source_stats/1?interval<span class="o">=</span>5min
</span></span></code></pre>
</div>
<h4 id="headers-1">
Headers
</h4>
<table>
<thead>
<tr>
<th>
Key
</th>
<th>
Value
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
Host
</td>
<td>
cnm.cluster.fqdn
</td>
<td>
Domain name
</td>
</tr>
<tr>
<td>
Accept
</td>
<td>
application/json
</td>
<td>
Accepted media type
</td>
</tr>
</tbody>
</table>
<h4 id="url-parameters-1">
URL parameters
</h4>
<table>
<thead>
<tr>
<th>
Field
</th>
<th>
Type
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
bdb_uid
</td>
<td>
integer
</td>
<td>
The unique ID of the local database.
</td>
</tr>
<tr>
<td>
uid
</td>
<td>
integer
</td>
<td>
The sync_source uid.
</td>
</tr>
</tbody>
</table>
<h4 id="query-parameters-1">
Query parameters
</h4>
<table>
<thead>
<tr>
<th>
Field
</th>
<th>
Type
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
interval
</td>
<td>
string
</td>
<td>
Time interval for which we want stats: 1sec/10sec/5min/15min/1hour/12hour/1week (optional)
</td>
</tr>
<tr>
<td>
stime
</td>
<td>
ISO_8601
</td>
<td>
Optional start time from which we want the stats. Should comply with the
<a href="https://en.wikipedia.org/wiki/ISO_8601">
ISO_8601
</a>
format (optional)
</td>
</tr>
<tr>
<td>
etime
</td>
<td>
ISO_8601
</td>
<td>
Optional end time after which we don't want the stats. Should comply with the
<a href="https://en.wikipedia.org/wiki/ISO_8601">
ISO_8601
</a>
format (optional)
</td>
</tr>
</tbody>
</table>
<h3 id="get-response">
Response
</h3>
<p>
Returns
<a href="/docs/latest/operate/rs/references/rest-api/objects/statistics/">
statistics
</a>
for a specific syncer instance.
</p>
<h4 id="example-json-body-1">
Example JSON body
</h4>
<div class="highlight">
<pre class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"intervals"</span><span class="p">:</span> <span class="p">[</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"etime"</span><span class="p">:</span> <span class="s2">"2017-10-22T19:30:00Z"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"ingress_bytes"</span><span class="p">:</span> <span class="mi">18528</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"ingress_bytes_decompressed"</span><span class="p">:</span> <span class="mi">185992</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"interval"</span><span class="p">:</span> <span class="s2">"5min"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"local_ingress_lag_time"</span><span class="p">:</span> <span class="mf">0.244</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"stime"</span><span class="p">:</span> <span class="s2">"2017-10-22T19:25:00Z"</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"etime"</span><span class="p">:</span> <span class="s2">"2017-10-22T19:35:00Z"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"ingress_bytes"</span><span class="p">:</span> <span class="mi">18</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"ingress_bytes_decompressed"</span><span class="p">:</span> <span class="mi">192</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"interval"</span><span class="p">:</span> <span class="s2">"5min"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"local_ingress_lag_time"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"stime"</span><span class="p">:</span> <span class="s2">"2017-10-22T19:30:00Z"</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl"> <span class="p">],</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"uid"</span><span class="p">:</span> <span class="s2">"1"</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span></code></pre>
</div>
<h3 id="get-status-codes">
Status codes
</h3>
<table>
<thead>
<tr>
<th>
Code
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1">
200 OK
</a>
</td>
<td>
No error
</td>
</tr>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5">
404 Not Found
</a>
</td>
<td>
Database or sync_source do not exist.
</td>
</tr>
</tbody>
</table>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/references/rest-api/requests/bdbs/sync_source_stats/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/oss_and_stack/stack-with-enterprise/stack-quickstart/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Redis Stack quick start
</h1>
<p>
To quickly set up a database with Redis Stack features,
you can sign up for a free
<a href="https://cloud.redis.io/#/sign-up">
Redis Cloud
</a>
subscription and create a Redis Stack database.
</p>
<p>
Alternatively, you can use one of these methods:
</p>
<ul>
<li>
<a href="/docs/latest/operate/rs/installing-upgrading/quickstarts/redis-enterprise-software-quickstart/">
Redis Enterprise Software
</a>
</li>
<li>
Redis Enterprise Software in a
<a href="/docs/latest/operate/rs/installing-upgrading/quickstarts/docker-quickstart/">
Docker container
</a>
</li>
<li>
<a href="/docs/latest/operate/kubernetes/">
Other platforms
</a>
for Redis Enterprise Software
</li>
</ul>
<h2 id="set-up-a-redis-cloud-database">
Set up a Redis Cloud database
</h2>
<p>
To set up a Redis Cloud database with Redis Stack features, follow these steps:
</p>
<ol>
<li>
<p>
<a href="#create-a-subscription">
Create a new Redis Cloud subscription
</a>
.
</p>
</li>
<li>
<p>
<a href="#create-a-redis-stack-database">
Create a Redis Stack database
</a>
.
</p>
</li>
<li>
<p>
<a href="#connect-to-the-database">
Connect to the database
</a>
.
</p>
</li>
</ol>
<p>
For more details, see the Redis Cloud
<a href="/docs/latest/operate/rc/rc-quickstart/">
quick start
</a>
.
</p>
<h3 id="create-a-subscription">
Create a subscription
</h3>
<p>
To create a new subscription:
</p>
<ol>
<li>
<p>
Sign in to the Redis Cloud
<a href="http://cloud.redis.io">
admin console
</a>
or create a new account.
</p>
</li>
<li>
<p>
Select the
<strong>
New subscription
</strong>
button:
</p>
<a href="/docs/latest/images/rc/button-subscription-new.png" sdata-lightbox="/images/rc/button-subscription-new.png">
<img alt="The New subscriptions button in the admin console menu." src="/docs/latest/images/rc/button-subscription-new.png" width="150px"/>
</a>
</li>
<li>
<p>
Configure your subscription:
</p>
<ol>
<li>
Select
<strong>
Fixed plans
</strong>
.
</li>
<li>
For the cloud vendor, select
<strong>
Amazon Web Services
</strong>
(AWS),
<strong>
Google Cloud
</strong>
(GCP), or
<strong>
Microsoft Azure
</strong>
.
</li>
<li>
Select a region to deploy the subscription to.
</li>
<li>
From the dataset size list, select the Free tier (30MB).
</li>
<li>
Enter a name for the subscription.
</li>
</ol>
</li>
<li>
<p>
Select the
<strong>
Create subscription
</strong>
button:
</p>
<a href="/docs/latest/images/rc/button-subscription-create.png" sdata-lightbox="/images/rc/button-subscription-create.png">
<img alt="The Create Subscription button." src="/docs/latest/images/rc/button-subscription-create.png" width="150px"/>
</a>
</li>
</ol>
<h3 id="create-a-redis-stack-database">
Create a Redis Stack database
</h3>
<p>
After you create a subscription, follow these steps to create a Redis Stack database:
</p>
<ol>
<li>
<p>
Select the
<strong>
New database
</strong>
button:
</p>
<a href="/docs/latest/images/rc/button-database-new.png" sdata-lightbox="/images/rc/button-database-new.png">
<img alt="The New Database button creates a new database for your subscription." src="/docs/latest/images/rc/button-database-new.png" width="120px"/>
</a>
</li>
<li>
<p>
In
<strong>
General
</strong>
settings, enter a
<strong>
Database name
</strong>
.
</p>
</li>
<li>
<p>
For database
<strong>
Type
</strong>
, select
<strong>
Redis Stack
</strong>
.
</p>
</li>
<li>
<p>
Select the
<strong>
Activate database
</strong>
button:
</p>
<a href="/docs/latest/images/rc/button-database-activate.png" sdata-lightbox="/images/rc/button-database-activate.png">
<img alt="Use the Activate database button to create and activate your database." src="/docs/latest/images/rc/button-database-activate.png" width="150px"/>
</a>
</li>
</ol>
<h3 id="connect-to-the-database">
Connect to the database
</h3>
<p>
After creating the database, you can view its
<strong>
Configuration
</strong>
settings. You will need the following information to connect to your new database:
</p>
<ul>
<li>
<strong>
Public endpoint
</strong>
: The host address of the database
</li>
<li>
<strong>
Redis password
</strong>
/
<strong>
Default user password
</strong>
: The password used to authenticate with the database
</li>
</ul>
<p>
With this information, you can connect to your database with the
<a href="/docs/latest/operate/rs/references/cli-utilities/redis-cli/">
<code>
redis-cli
</code>
</a>
command-line tool, an application, or
<a href="https://redislabs.com/redisinsight/">
Redis Insight
</a>
.
</p>
<h2 id="try-redis-stack-features">
Try Redis Stack features
</h2>
<p>
To try out Redis Stack features, follow the examples provided by the corresponding guides:
</p>
<ul>
<li>
<a href="/docs/latest/develop/get-started/document-database/">
Redis Query Engine quick start
</a>
</li>
<li>
<a href="/docs/latest/develop/data-types/json/#use-redisjson">
JSON quick start
</a>
</li>
<li>
<a href="/docs/latest/develop/data-types/timeseries/quickstart/">
Time series quick start
</a>
</li>
<li>
<a href="/docs/latest/develop/data-types/probabilistic/">
Probabilistic data structures quick start
</a>
</li>
</ul>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/oss_and_stack/stack-with-enterprise/stack-quickstart/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/references/cli-utilities/rladmin/cluster/create/.html | <section class="prose w-full py-12 max-w-none">
<h1>
rladmin cluster create
</h1>
<p class="text-lg -mt-5 mb-10">
Creates a new cluster.
</p>
<p>
Creates a new cluster. The node where you run
<code>
rladmin cluster create
</code>
becomes the first node of the new cluster.
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">cluster create
</span></span><span class="line"><span class="cl"> name <cluster name>
</span></span><span class="line"><span class="cl"> username <admin email>
</span></span><span class="line"><span class="cl"> password <admin password>
</span></span><span class="line"><span class="cl"> <span class="o">[</span> node_uid <node UID> <span class="o">]</span>
</span></span><span class="line"><span class="cl"> <span class="o">[</span> rack_aware <span class="o">]</span>
</span></span><span class="line"><span class="cl"> <span class="o">[</span> rack_id <node rack ID> <span class="o">]</span>
</span></span><span class="line"><span class="cl"> <span class="o">[</span> license_file <file> <span class="o">]</span>
</span></span><span class="line"><span class="cl"> <span class="o">[</span> ephemeral_path <path> <span class="o">]</span>
</span></span><span class="line"><span class="cl"> <span class="o">[</span> persistent_path <path> <span class="o">]</span>
</span></span><span class="line"><span class="cl"> <span class="o">[</span> ccs_persistent_path <path> <span class="o">]</span>
</span></span><span class="line"><span class="cl"> <span class="o">[</span> register_dns_suffix <span class="o">]</span>
</span></span><span class="line"><span class="cl"> <span class="o">[</span> flash_enabled <span class="o">]</span>
</span></span><span class="line"><span class="cl"> <span class="o">[</span> flash_path <path> <span class="o">]</span>
</span></span><span class="line"><span class="cl"> <span class="o">[</span> addr <IP.address> <span class="o">]</span>
</span></span><span class="line"><span class="cl"> <span class="o">[</span> external_addr <IP.address.1> <span class="o">[</span><IP.address.2> ... <IP.address.N><span class="o">]</span> <span class="o">]</span>
</span></span></code></pre>
</div>
<h3 id="parameters">
Parameters
</h3>
<table>
<thead>
<tr>
<th>
Parameter
</th>
<th>
Type/Value
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
addr
</td>
<td>
IP address
</td>
<td>
The node's internal IP address (optional)
</td>
</tr>
<tr>
<td>
ccs_persistent_path
</td>
<td>
filepath (default:Β /var/opt/redislabs/persist)
</td>
<td>
Path to the location of CCS snapshots (optional)
</td>
</tr>
<tr>
<td>
ephemeral_path
</td>
<td>
filepath (default:Β /var/opt/redislabs)
</td>
<td>
Path to the ephemeral storage location (optional)
</td>
</tr>
<tr>
<td>
external_addr
</td>
<td>
list of IP addresses
</td>
<td>
A space-delimited list of the node's external IP addresses (optional)
</td>
</tr>
<tr>
<td>
flash_enabled
</td>
<td>
</td>
<td>
Enables flash storage (optional)
</td>
</tr>
<tr>
<td>
flash_path
</td>
<td>
filepath (default:Β /var/opt/redislabs/flash)
</td>
<td>
Path to the flash storage location (optional)
</td>
</tr>
<tr>
<td>
license_file
</td>
<td>
filepath
</td>
<td>
Path to the RLEC license file (optional)
</td>
</tr>
<tr>
<td>
name
</td>
<td>
string
</td>
<td>
Cluster name
</td>
</tr>
<tr>
<td>
node_uid
</td>
<td>
integer
</td>
<td>
Unique node ID (optional)
</td>
</tr>
<tr>
<td>
password
</td>
<td>
string
</td>
<td>
Admin user's password
</td>
</tr>
<tr>
<td>
persistent_path
</td>
<td>
filepath (default:Β /var/opt/redislabs/persist)
</td>
<td>
Path to the persistent storage location (optional)
</td>
</tr>
<tr>
<td>
rack_aware
</td>
<td>
</td>
<td>
Activates or deactivates rack awareness (optional)
</td>
</tr>
<tr>
<td>
rack_id
</td>
<td>
string
</td>
<td>
The rack's unique identifier (optional)
</td>
</tr>
<tr>
<td>
register_dns_suffix
</td>
<td>
</td>
<td>
Enables database mapping to both internal and external IP addresses (optional)
</td>
</tr>
<tr>
<td>
username
</td>
<td>
email address
</td>
<td>
Admin user's email address
</td>
</tr>
</tbody>
</table>
<h3 id="returns">
Returns
</h3>
<p>
Returns
<code>
ok
</code>
if the new cluster was created successfully. Otherwise, it returns an error message.
</p>
<h3 id="example">
Example
</h3>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">$ rladmin cluster create name cluster.local <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> username [email protected] <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> password admin-password
</span></span><span class="line"><span class="cl">Creating a new cluster... ok
</span></span></code></pre>
</div>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/references/cli-utilities/rladmin/cluster/create/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/7.4/references/rest-api/requests/nodes/snapshots/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Node snapshot requests
</h1>
<p class="text-lg -mt-5 mb-10">
Node snapshot requests
</p>
<table>
<thead>
<tr>
<th>
Method
</th>
<th>
Path
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="#get-snapshots">
GET
</a>
</td>
<td>
<code>
/v1/nodes/{uid}/snapshots
</code>
</td>
<td>
Get node snapshots
</td>
</tr>
<tr>
<td>
<a href="#delete-snapshot">
DELETE
</a>
</td>
<td>
<code>
/v1/nodes/{uid}/snapshots/{snapshot_name}
</code>
</td>
<td>
Delete a node snapshot
</td>
</tr>
</tbody>
</table>
<h2 id="get-snapshots">
Get node snapshots
</h2>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">GET /v1/nodes/<span class="o">{</span>int: uid<span class="o">}</span>/snapshots
</span></span></code></pre>
</div>
<p>
Get all cluster node snapshots of the specified node.
</p>
<h3 id="permissions">
Permissions
</h3>
<table>
<thead>
<tr>
<th>
Permission name
</th>
<th>
Roles
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="/docs/latest/operate/rs/7.4/references/rest-api/permissions/#view_node_info">
view_node_info
</a>
</td>
<td>
admin
<br/>
cluster_member
<br/>
cluster_viewer
<br/>
db_member
<br/>
db_viewer
</td>
</tr>
</tbody>
</table>
<h3 id="get-request">
Request
</h3>
<h4 id="example-http-request">
Example HTTP request
</h4>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">GET /nodes/1/snapshots
</span></span></code></pre>
</div>
<h4 id="headers">
Headers
</h4>
<table>
<thead>
<tr>
<th>
Key
</th>
<th>
Value
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
Host
</td>
<td>
cnm.cluster.fqdn
</td>
<td>
Domain name
</td>
</tr>
<tr>
<td>
Accept
</td>
<td>
application/json
</td>
<td>
Accepted media type
</td>
</tr>
</tbody>
</table>
<h4 id="url-parameters">
URL parameters
</h4>
<table>
<thead>
<tr>
<th>
Field
</th>
<th>
Type
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
uid
</td>
<td>
integer
</td>
<td>
The unique ID of the node requested.
</td>
</tr>
</tbody>
</table>
<h3 id="get-response">
Response
</h3>
<p>
Returns an array of node snapshot JSON objects.
</p>
<h4 id="example-json-body">
Example JSON body
</h4>
<div class="highlight">
<pre class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">[</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"created_time"</span><span class="p">:</span> <span class="s2">"2024-01-10 20:55:54"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"name"</span><span class="p">:</span> <span class="s2">"nightly_snapshot_1"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"node_uid"</span><span class="p">:</span> <span class="s2">"1"</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"created_time"</span><span class="p">:</span> <span class="s2">"2024-01-11 20:55:54"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"name"</span><span class="p">:</span> <span class="s2">"nightly_snapshot_2"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"node_uid"</span><span class="p">:</span> <span class="s2">"1"</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl"><span class="p">]</span>
</span></span></code></pre>
</div>
<h3 id="get-status-codes">
Status codes
</h3>
<table>
<thead>
<tr>
<th>
Code
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1">
200 OK
</a>
</td>
<td>
No error
</td>
</tr>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5">
404 Not Found
</a>
</td>
<td>
Node UID does not exist
</td>
</tr>
</tbody>
</table>
<h2 id="delete-snapshot">
Delete node snapshot
</h2>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">DELETE /v1/nodes/<span class="o">{</span>int: uid<span class="o">}</span>/snapshots/<span class="o">{</span>snapshot_name<span class="o">}</span>
</span></span></code></pre>
</div>
<p>
Delete a cluster node snapshot. Snapshots created by maintenance mode are not deleted.
</p>
<h3 id="permissions-1">
Permissions
</h3>
<table>
<thead>
<tr>
<th>
Permission name
</th>
<th>
Roles
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="/docs/latest/operate/rs/7.4/references/rest-api/permissions/#update_node">
update_node
</a>
</td>
<td>
admin
</td>
</tr>
</tbody>
</table>
<h3 id="delete-request">
Request
</h3>
<h4 id="example-http-request-1">
Example HTTP request
</h4>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">DELETE /nodes/1/snapshots/nightly_snapshot_19
</span></span></code></pre>
</div>
<h4 id="request-headers">
Request headers
</h4>
<table>
<thead>
<tr>
<th>
Key
</th>
<th>
Value
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
Host
</td>
<td>
cluster.fqdn
</td>
<td>
Domain name
</td>
</tr>
<tr>
<td>
Accept
</td>
<td>
application/json
</td>
<td>
Accepted media type
</td>
</tr>
</tbody>
</table>
<h4 id="url-parameters-1">
URL parameters
</h4>
<table>
<thead>
<tr>
<th>
Field
</th>
<th>
Type
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
uid
</td>
<td>
integer
</td>
<td>
The unique ID of the updated node.
</td>
</tr>
<tr>
<td>
snapshot_name
</td>
<td>
string
</td>
<td>
The unique name of the snapshot to delete.
</td>
</tr>
</tbody>
</table>
<h3 id="delete-response">
Response
</h3>
<p>
Returns a JSON object that represents the deleted node snapshot.
</p>
<h4 id="example-json-body-1">
Example JSON body
</h4>
<div class="highlight">
<pre class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"created_time"</span><span class="p">:</span> <span class="s2">"2024-01-11 20:55:54"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"name"</span><span class="p">:</span> <span class="s2">"nightly_snapshot_19"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"node_uid"</span><span class="p">:</span> <span class="s2">"1"</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span></code></pre>
</div>
<h4 id="delete-status-codes">
Status codes
</h4>
<table>
<thead>
<tr>
<th>
Code
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1">
200 OK
</a>
</td>
<td>
No error
</td>
</tr>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.4">
403 Forbidden
</a>
</td>
<td>
Node snapshot is a maintenance snapshot and cannot be deleted
</td>
</tr>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5">
404 Not Found
</a>
</td>
<td>
Node uid does not exist
</td>
</tr>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5">
404 Not Found
</a>
</td>
<td>
Snapshot name does not exist for this node uid
</td>
</tr>
</tbody>
</table>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/7.4/references/rest-api/requests/nodes/snapshots/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/commands/bf.exists.html | <section class="prose w-full py-12">
<h1 class="command-name">
BF.EXISTS
</h1>
<div class="font-semibold text-redis-ink-900">
Syntax
</div>
<pre class="command-syntax">BF.EXISTS key item</pre>
<dl class="grid grid-cols-[auto,1fr] gap-2 mb-12">
<dt class="font-semibold text-redis-ink-900 m-0">
Available in:
</dt>
<dd class="m-0">
<a href="/docs/stack">
Redis Stack
</a>
/
<a href="/docs/data-types/probabilistic">
Bloom 1.0.0
</a>
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
Time complexity:
</dt>
<dd class="m-0">
O(k), where k is the number of hash functions used by the last sub-filter
</dd>
</dl>
<p>
Determines whether a given item was added to a Bloom filter.
</p>
<p>
This command is similar to
<a href="/docs/latest/commands/bf.mexists/">
<code>
BF.MEXISTS
</code>
</a>
, except that only one item can be checked.
</p>
<h2 id="required-arguments">
Required arguments
</h2>
<details open="">
<summary>
<code>
key
</code>
</summary>
<p>
is key name for a Bloom filter.
</p>
</details>
<details open="">
<summary>
<code>
item
</code>
</summary>
<p>
is an item to check.
</p>
</details>
<h2 id="return-value">
Return value
</h2>
<p>
Returns one of these replies:
</p>
<ul>
<li>
<a href="/docs/latest/develop/reference/protocol-spec/#integers">
Integer reply
</a>
, where
<code>
1
</code>
means that, with high probability,
<code>
item
</code>
was already added to the filter, and
<code>
0
</code>
means that
<code>
key
</code>
does not exist or that
<code>
item
</code>
had not been added to the filter.
</li>
<li>
[] on error (invalid arguments, wrong key type, etc.)
</li>
</ul>
<h2 id="examples">
Examples
</h2>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">redis> BF.ADD bf item1
</span></span><span class="line"><span class="cl"><span class="o">(</span>integer<span class="o">)</span> <span class="m">1</span>
</span></span><span class="line"><span class="cl">redis> BF.EXISTS bf item1
</span></span><span class="line"><span class="cl"><span class="o">(</span>integer<span class="o">)</span> <span class="m">1</span>
</span></span><span class="line"><span class="cl">redis> BF.EXISTS bf item2
</span></span><span class="line"><span class="cl"><span class="o">(</span>integer<span class="o">)</span> <span class="m">0</span></span></span></code></pre>
</div>
<br/>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/commands/bf.exists/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/references/rest-api/objects/redis_acl/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Redis ACL object
</h1>
<p class="text-lg -mt-5 mb-10">
An object that represents a Redis access control list (ACL)
</p>
<p>
An API object that represents a Redis
<a href="/docs/latest/operate/rs/security/access-control/create-db-roles/">
access control list (ACL)
</a>
</p>
<table>
<thead>
<tr>
<th>
Name
</th>
<th>
Type/Value
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
uid
</td>
<td>
integer
</td>
<td>
Object's unique ID
</td>
</tr>
<tr>
<td>
account_id
</td>
<td>
integer
</td>
<td>
SM account ID
</td>
</tr>
<tr>
<td>
acl
</td>
<td>
string
</td>
<td>
Redis ACL's string
</td>
</tr>
<tr>
<td>
action_uid
</td>
<td>
string
</td>
<td>
Action UID. If it exists, progress can be tracked by the
<code>
GET
</code>
<code>
/actions/{uid}
</code>
API (read-only)
</td>
</tr>
<tr>
<td>
name
</td>
<td>
string
</td>
<td>
Redis ACL's name
</td>
</tr>
<tr>
<td>
min_version
</td>
<td>
string
</td>
<td>
Minimum database version that supports this ACL. Read only
</td>
</tr>
<tr>
<td>
max_version
</td>
<td>
string
</td>
<td>
Maximum database version that supports this ACL. Read only
</td>
</tr>
</tbody>
</table>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/references/rest-api/objects/redis_acl/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/7.4/references/rest-api/requests/ocsp/status/.html | <section class="prose w-full py-12 max-w-none">
<h1>
OCSP status requests
</h1>
<p class="text-lg -mt-5 mb-10">
OCSP status requests
</p>
<table>
<thead>
<tr>
<th>
Method
</th>
<th>
Path
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="#get-status">
GET
</a>
</td>
<td>
<code>
/v1/ocsp/status
</code>
</td>
<td>
Get OCSP status
</td>
</tr>
</tbody>
</table>
<h2 id="get-status">
Get OCSP status
</h2>
<pre><code>GET /v1/ocsp/status
</code></pre>
<p>
Gets the latest cached status of the proxy certificateβs OCSP response.
</p>
<h4 id="required-permissions">
Required permissions
</h4>
<table>
<thead>
<tr>
<th>
Permission name
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="/docs/latest/operate/rs/7.4/references/rest-api/permissions/#view_ocsp_status">
view_ocsp_status
</a>
</td>
</tr>
</tbody>
</table>
<h3 id="get-request">
Request
</h3>
<h4 id="example-http-request">
Example HTTP request
</h4>
<pre><code>GET /ocsp/status
</code></pre>
<h4 id="request-headers">
Request headers
</h4>
<table>
<thead>
<tr>
<th>
Key
</th>
<th>
Value
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
Host
</td>
<td>
cnm.cluster.fqdn
</td>
<td>
Domain name
</td>
</tr>
<tr>
<td>
Accept
</td>
<td>
application/json
</td>
<td>
Accepted media type
</td>
</tr>
</tbody>
</table>
<h3 id="get-response">
Response
</h3>
<p>
Returns an
<a href="/docs/latest/operate/rs/7.4/references/rest-api/objects/ocsp_status/">
OCSP status object
</a>
.
</p>
<h4 id="example-json-body">
Example JSON body
</h4>
<div class="highlight">
<pre class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"responder_url"</span><span class="p">:</span> <span class="s2">"http://responder.ocsp.url.com"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"cert_status"</span><span class="p">:</span> <span class="s2">"REVOKED"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"produced_at"</span><span class="p">:</span> <span class="s2">"Wed, 22 Dec 2021 12:50:11 GMT"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"this_update"</span><span class="p">:</span> <span class="s2">"Wed, 22 Dec 2021 12:50:11 GMT"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"next_update"</span><span class="p">:</span> <span class="s2">"Wed, 22 Dec 2021 14:50:00 GMT"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"revocation_time"</span><span class="p">:</span> <span class="s2">"Wed, 22 Dec 2021 12:50:04 GMT"</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span></code></pre>
</div>
<h3 id="get-error-codes">
Error codes
</h3>
<p>
When errors occur, the server returns a JSON object with
<code>
error_code
</code>
and
<code>
message
</code>
fields that provide additional information. The following are possible
<code>
error_code
</code>
values:
</p>
<table>
<thead>
<tr>
<th>
Code
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
ocsp_unsupported_by_capability
</td>
<td>
Not all nodes support OCSP capability
</td>
</tr>
<tr>
<td>
invalid_ocsp_response
</td>
<td>
The server returned a response that is not OCSP-compatible
</td>
</tr>
</tbody>
</table>
<h3 id="get-status-codes">
Status codes
</h3>
<table>
<thead>
<tr>
<th>
Code
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1">
200 OK
</a>
</td>
<td>
Success
</td>
</tr>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.7">
406 Not Acceptable
</a>
</td>
<td>
Feature not supported in all nodes
</td>
</tr>
</tbody>
</table>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/7.4/references/rest-api/requests/ocsp/status/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/7.4/references/rest-api/objects/module/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Module object
</h1>
<p class="text-lg -mt-5 mb-10">
An object that represents a Redis module
</p>
<p>
Represents a
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/">
Redis module
</a>
.
</p>
<table>
<thead>
<tr>
<th>
Name
</th>
<th>
Type/Value
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
uid
</td>
<td>
string
</td>
<td>
Cluster unique ID of module
</td>
</tr>
<tr>
<td>
architecture
</td>
<td>
string
</td>
<td>
Architecture used to compile the module
</td>
</tr>
<tr>
<td>
author
</td>
<td>
string
</td>
<td>
Module creator
</td>
</tr>
<tr>
<td>
capabilities
</td>
<td>
array of strings
</td>
<td>
List of capabilities supported by this module
</td>
</tr>
<tr>
<td>
capability_name
</td>
<td>
string
</td>
<td>
Short description of module functionality
</td>
</tr>
<tr>
<td>
command_line_args
</td>
<td>
string
</td>
<td>
Command line arguments passed to the module
</td>
</tr>
<tr>
<td>
config_command
</td>
<td>
string
</td>
<td>
Name of command to configure module arguments at runtime
</td>
</tr>
<tr>
<td>
dependencies
</td>
<td>
object dependencies
</td>
<td>
Module dependencies
</td>
</tr>
<tr>
<td>
description
</td>
<td>
string
</td>
<td>
Short description of the module
</td>
</tr>
<tr>
<td>
display_name
</td>
<td>
string
</td>
<td>
Name of module for display purposes
</td>
</tr>
<tr>
<td>
email
</td>
<td>
string
</td>
<td>
Author's email address
</td>
</tr>
<tr>
<td>
homepage
</td>
<td>
string
</td>
<td>
Module's homepage
</td>
</tr>
<tr>
<td>
is_bundled
</td>
<td>
boolean
</td>
<td>
Whether module came bundled with a version of Redis Enterprise
</td>
</tr>
<tr>
<td>
license
</td>
<td>
string
</td>
<td>
Module is distributed under this license
</td>
</tr>
<tr>
<td>
min_redis_pack_version
</td>
<td>
string
</td>
<td>
Minimum Redis Enterprise Software cluster version required by this module
</td>
</tr>
<tr>
<td>
min_redis_version
</td>
<td>
string
</td>
<td>
Minimum Redis database version required by this module
</td>
</tr>
<tr>
<td>
module_file
</td>
<td>
string
</td>
<td>
Module filename
</td>
</tr>
<tr>
<td>
module_name
</td>
<td>
<code>
search
</code>
<br/>
<code>
ReJSON
</code>
<br/>
<code>
graph
</code>
<br/>
<code>
timeseries
</code>
<br/>
<code>
bf
</code>
</td>
<td>
Module's name
<br/>
</td>
</tr>
<tr>
<td>
os
</td>
<td>
string
</td>
<td>
Operating system used to compile the module
</td>
</tr>
<tr>
<td>
os_list
</td>
<td>
array of strings
</td>
<td>
List of supported operating systems
</td>
</tr>
<tr>
<td>
semantic_version
</td>
<td>
string
</td>
<td>
Module's semantic version
</td>
</tr>
<tr>
<td>
sha256
</td>
<td>
string
</td>
<td>
SHA256 of module binary
</td>
</tr>
<tr>
<td>
version
</td>
<td>
integer
</td>
<td>
Module's version
</td>
</tr>
</tbody>
</table>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/7.4/references/rest-api/objects/module/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/commands/pubsub/.html | <section class="prose w-full py-12">
<h1 class="command-name">
PUBSUB
</h1>
<div class="font-semibold text-redis-ink-900">
Syntax
</div>
<pre class="command-syntax">PUBSUB</pre>
<dl class="grid grid-cols-[auto,1fr] gap-2 mb-12">
<dt class="font-semibold text-redis-ink-900 m-0">
Available since:
</dt>
<dd class="m-0">
2.8.0
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
Time complexity:
</dt>
<dd class="m-0">
Depends on subcommand.
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
ACL categories:
</dt>
<dd class="m-0">
<code>
@slow
</code>
<span class="mr-1 last:hidden">
,
</span>
</dd>
</dl>
<p>
This is a container command for Pub/Sub introspection commands.
</p>
<p>
To see the list of available commands you can call
<a href="/docs/latest/commands/pubsub-help/">
<code>
PUBSUB HELP
</code>
</a>
.
</p>
<br/>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/commands/pubsub/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/oss_and_stack/stack-with-enterprise/gears-v1/jvm/classes/gearsbuilder/.html | <section class="prose w-full py-12 max-w-none">
<h1>
GearsBuilder
</h1>
<p class="text-lg -mt-5 mb-10">
Creates a RedisGears pipeline of operations to transform data.
</p>
<p>
The
<code>
GearsBuilder
</code>
class allows you to create a pipeline of RedisGears functions that transform data.
</p>
<p>
It requires a reader to supply data to the pipe.
</p>
<p>
To create a
<code>
GearsBuilder
</code>
object, follow this example code:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-java" data-lang="java"><span class="line"><span class="cl"><span class="n">BaseReader</span> <span class="n">reader</span> <span class="o">=</span> <span class="o">...;</span> <span class="c1">// Initialize the reader
</span></span></span><span class="line"><span class="cl"><span class="c1"></span><span class="n">builder</span> <span class="o">=</span> <span class="n">GearsBuilder</span><span class="o">.</span><span class="na">CreateGearsBuilder</span><span class="o">(</span><span class="n">reader</span><span class="o">);</span>
</span></span></code></pre>
</div>
<h2 id="functions">
Functions
</h2>
<table>
<thead>
<tr>
<th style="text-align:left">
Function
</th>
<th style="text-align:left">
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/gears-v1/jvm/classes/gearsbuilder/accumulate/">
accumulate
</a>
</td>
<td style="text-align:left">
Reduces many records in the pipe to a single record.
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/gears-v1/jvm/classes/gearsbuilder/accumulateby/">
accumulateBy
</a>
</td>
<td style="text-align:left">
Groups records and reduces each group to a single record per group.
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/gears-v1/jvm/classes/gearsbuilder/asyncfilter/">
asyncFilter
</a>
</td>
<td style="text-align:left">
Asynchronously filters out records in the pipe based on a given condition.
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/gears-v1/jvm/classes/gearsbuilder/asyncforeach/">
asyncForeach
</a>
</td>
<td style="text-align:left">
For each record in the pipe, asynchronously runs some operations.
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/gears-v1/jvm/classes/gearsbuilder/asyncmap/">
asyncMap
</a>
</td>
<td style="text-align:left">
Asynchronously maps records one-to-one.
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/gears-v1/jvm/classes/gearsbuilder/callnext/">
callNext
</a>
</td>
<td style="text-align:left">
Calls the next execution that overrides the command or the original command itself. A more flexible version of callNextArray.
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/gears-v1/jvm/classes/gearsbuilder/callnextarray/">
callNextArray
</a>
</td>
<td style="text-align:left">
Calls the next execution that overrides the command or the original command itself.
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/gears-v1/jvm/classes/gearsbuilder/collect/">
collect
</a>
</td>
<td style="text-align:left">
Collects all records to the origin shard.
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/gears-v1/jvm/classes/gearsbuilder/config-get/">
configGet
</a>
</td>
<td style="text-align:left">
Gets the value of a RedisGears configuration setting.
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/gears-v1/jvm/classes/gearsbuilder/count/">
count
</a>
</td>
<td style="text-align:left">
Counts the number of records in the pipe.
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/gears-v1/jvm/classes/gearsbuilder/creategearsbuilder/">
CreateGearsBuilder
</a>
</td>
<td style="text-align:left">
Creates a new GearsBuilder object.
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/gears-v1/jvm/classes/gearsbuilder/execute/">
execute
</a>
</td>
<td style="text-align:left">
Runs a Redis command. A more flexible version of executeArray.
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/gears-v1/jvm/classes/gearsbuilder/executearray/">
executeArray
</a>
</td>
<td style="text-align:left">
Runs a Redis command.
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/gears-v1/jvm/classes/gearsbuilder/filter/">
filter
</a>
</td>
<td style="text-align:left">
Filters out records in the pipe based on a given condition.
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/gears-v1/jvm/classes/gearsbuilder/flatmap/">
flatMap
</a>
</td>
<td style="text-align:left">
Maps a single input record to one or more output records.
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/gears-v1/jvm/classes/gearsbuilder/foreach/">
foreach
</a>
</td>
<td style="text-align:left">
For each record in the pipe, runs some operations.
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/gears-v1/jvm/classes/gearsbuilder/hashtag/">
hashtag
</a>
</td>
<td style="text-align:left">
Returns a string that maps to the current shard.
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/gears-v1/jvm/classes/gearsbuilder/localaccumulateby/">
localAccumulateBy
</a>
</td>
<td style="text-align:left">
Groups records and reduces each group to a single record per group locally on each shard.
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/gears-v1/jvm/classes/gearsbuilder/log/">
log
</a>
</td>
<td style="text-align:left">
Writes a log message to the Redis log file.
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/gears-v1/jvm/classes/gearsbuilder/map/">
map
</a>
</td>
<td style="text-align:left">
Maps records one-to-one.
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/gears-v1/jvm/classes/gearsbuilder/register/">
register
</a>
</td>
<td style="text-align:left">
Registers the pipeline of functions to run when certain events occur.
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/gears-v1/jvm/classes/gearsbuilder/repartition/">
repartition
</a>
</td>
<td style="text-align:left">
Moves records between shards according to the extracted data.
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/gears-v1/jvm/classes/gearsbuilder/run/">
run
</a>
</td>
<td style="text-align:left">
Runs the pipeline of functions immediately.
</td>
</tr>
</tbody>
</table>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/oss_and_stack/stack-with-enterprise/gears-v1/jvm/classes/gearsbuilder/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/develop/interact/search-and-query/advanced-concepts/dialects/.html | <section class="prose w-full py-12">
<h1>
Query dialects
</h1>
<p class="text-lg -mt-5 mb-10">
Learn how to use query dialects
</p>
<p>
Redis Stack currently supports four query dialects for use with the
<a href="/docs/latest/commands/ft.search/">
<code>
FT.SEARCH
</code>
</a>
,
<a href="/docs/latest/commands/ft.aggregate/">
<code>
FT.AGGREGATE
</code>
</a>
, and other Redis Query Engine commands.
Dialects provide for enhancing the query API incrementally, introducing innovative behaviors and new features that support new use cases in a way that does not break the API for existing applications.
</p>
<h2 id="dialect-1">
<code>
DIALECT 1
</code>
</h2>
<p>
Dialect version 1 was the default query syntax dialect from the first release of search and query until dialect version 2 was introduced with version
<a href="https://github.com/RediSearch/RediSearch/releases/tag/v2.4.3">
2.4
</a>
.
This dialect is also the default dialect. See below for information about changing the default dialect.
</p>
<h2 id="dialect-2">
<code>
DIALECT 2
</code>
</h2>
<p>
Dialect version 2 was introduced in the
<a href="https://github.com/RediSearch/RediSearch/releases/tag/v2.4.3">
2.4
</a>
release to address query parser inconsistencies found in previous versions of Redis Stack. Dialect version 1 remains the default dialect. To use dialect version 2, append
<code>
DIALECT 2
</code>
to your query command.
Support for vector search also was introduced in the 2.4 release and requires
<code>
DIALECT 2
</code>
. See
<a href="/docs/latest/develop/interact/search-and-query/query/vector-search/">
here
</a>
for more details.
<code>
FT.SEARCH ... DIALECT 2
</code>
</p>
<p>
It was determined that under certain conditions some query parsing rules did not behave as originally intended.
Particularly, some queries containing the operators below could return unexpected results.
</p>
<ol>
<li>
AND, multi-word phrases that imply intersection
</li>
<li>
<code>
"..."
</code>
(exact),
<code>
~
</code>
(optional),
<code>
-
</code>
(negation), and
<code>
%
</code>
(fuzzy)
</li>
<li>
OR, words separated by the
<code>
|
</code>
(pipe) character that imply union
</li>
<li>
wildcard characters
</li>
</ol>
<p>
Existing queries that used dialect 1 may behave differently using dialect 2 if they fall into any of the following categories:
</p>
<ol>
<li>
<p>
Your query has a field modifier followed by multiple words. Consider the sample query:
</p>
<p>
<code>
@name:James Brown
</code>
</p>
<p>
Here, the field modifier
<code>
@name
</code>
is followed by two words,
<code>
James
</code>
and
<code>
Brown
</code>
.
</p>
<p>
In
<code>
DIALECT 1
</code>
, this query would be interpreted as find
<code>
James Brown
</code>
in the
<code>
@name
</code>
field.
In
<code>
DIALECT 2
</code>
, this query would be interpreted as find
<code>
James
</code>
in the
<code>
@name
</code>
field, and
<code>
Brown
</code>
in any text field. In other words, it would be interpreted as
<code>
(@name:James) Brown
</code>
.
In
<code>
DIALECT 2
</code>
, you could achieve the dialect 1 behavior by updating your query to
<code>
@name:(James Brown)
</code>
.
</p>
</li>
<li>
<p>
Your query uses
<code>
"..."
</code>
,
<code>
~
</code>
,
<code>
-
</code>
, and/or
<code>
%
</code>
. Consider a simple query with negation:
</p>
<p>
<code>
-hello world
</code>
</p>
<p>
In
<code>
DIALECT 1
</code>
, this query is interpreted as find values in any field that do not contain
<code>
hello
</code>
and do not contain
<code>
world
</code>
; the equivalent of
<code>
-(hello world)
</code>
or
<code>
-hello -world
</code>
.
In
<code>
DIALECT 2
</code>
, this query is interpreted as
<code>
-hello
</code>
and
<code>
world
</code>
(only
<code>
hello
</code>
is negated).
In
<code>
DIALECT 2
</code>
, you could achieve the dialect 1 behavior by updating your query to
<code>
-(hello world)
</code>
.
</p>
</li>
<li>
<p>
Your query used
<code>
|
</code>
. Consider the simple query:
</p>
<p>
<code>
hello world | "goodbye" moon
</code>
</p>
<p>
In
<code>
DIALECT 1
</code>
, this query is interpreted as searching for
<code>
(hello world | "goodbye") moon
</code>
.
In
<code>
DIALECT 2
</code>
, this query is interpreted as searching for either
<code>
hello world
</code>
<code>
"goodbye" moon
</code>
.
</p>
</li>
<li>
<p>
Your query uses a wildcard pattern. Consider the simple query:
</p>
<p>
<code>
"w'foo*bar?'"
</code>
</p>
<p>
As shown above, you must use double quotes to contain the
<code>
w
</code>
pattern.
</p>
</li>
</ol>
<p>
With
<code>
DIALECT 2
</code>
you can use un-escaped spaces in tag queries, even with stopwords.
</p>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Note:
</div>
<code>
DIALECT 2
</code>
is required with vector searches.
</div>
</div>
<p>
<code>
DIALECT 2
</code>
functionality was enhanced in the 2.10 release.
It introduces support for new comparison operators for
<code>
NUMERIC
</code>
fields:
</p>
<ul>
<li>
<p>
<code>
==
</code>
(equal).
</p>
<p>
<code>
FT.SEARCH idx "@numeric==3456" DIALECT 2
</code>
</p>
<p>
and
</p>
<p>
<code>
FT.SEARCH idx "@numeric:[3456]" DIALECT 2
</code>
</p>
</li>
<li>
<p>
<code>
!=
</code>
(not equal).
</p>
<p>
<code>
FT.SEARCH idx "@numeric!=3456" DIALECT 2
</code>
</p>
</li>
<li>
<p>
<code>
>
</code>
(greater than).
</p>
<p>
<code>
FT.SEARCH idx "@numeric>3456" DIALECT 2
</code>
</p>
</li>
<li>
<p>
<code>
>=
</code>
(greater than or equal).
</p>
<p>
<code>
FT.SEARCH idx "@numeric>=3456" DIALECT 2
</code>
</p>
</li>
<li>
<p>
<code>
<
</code>
(less than).
</p>
<p>
<code>
FT.SEARCH idx "@numeric<3456" DIALECT 2
</code>
</p>
</li>
<li>
<p>
<code>
<=
</code>
(less than or equal).
</p>
<p>
<code>
FT.SEARCH idx "@numeric<=3456" DIALECT 2
</code>
</p>
</li>
</ul>
<p>
The Dialect version 2 enhancements also introduce simplified syntax for logical operations:
</p>
<ul>
<li>
<p>
<code>
|
</code>
(or).
</p>
<p>
<code>
FT.SEARCH idx "@tag:{3d3586fe-0416-4572-8ce1 | 3d3586fe-0416-6758-4ri8}" DIALECT 2
</code>
</p>
<p>
which is equivalent to
</p>
<p>
<code>
FT.SEARCH idx "(@tag:{3d3586fe-0416-4572-8ce1} | @tag{3d3586fe-0416-6758-4ri8})" DIALECT 2
</code>
</p>
</li>
<li>
<p>
<code>
<space>
</code>
(and).
</p>
<p>
<code>
FT.SEARCH idx "(@tag:{3d3586fe-0416-4572-8ce1} @tag{3d3586fe-0416-6758-4ri8})" DIALECT 2
</code>
</p>
</li>
<li>
<p>
<code>
-
</code>
(negation).
</p>
<p>
<code>
FT.SEARCH idx "(@tag:{3d3586fe-0416-4572-8ce1} -@tag{3d3586fe-0416-6758-4ri8})" DIALECT 2
</code>
</p>
</li>
<li>
<p>
<code>
~
</code>
(optional/proximity).
</p>
<p>
<code>
FT.SEARCH idx "(@tag:{3d3586fe-0416-4572-8ce1} ~@tag{3d3586fe-0416-6758-4ri8})" DIALECT 2
</code>
</p>
</li>
</ul>
<h2 id="dialect-3">
<code>
DIALECT 3
</code>
</h2>
<p>
Dialect version 3 was introduced in the
<a href="https://github.com/RediSearch/RediSearch/releases/tag/v2.6.3">
2.6
</a>
release. This version introduced support for multi-value indexing and querying of attributes for any attribute type (
<a href="/docs/latest/develop/interact/search-and-query/indexing/#index-json-arrays-as-text">
TEXT
</a>
,
<a href="/docs/latest/develop/interact/search-and-query/indexing/#index-json-arrays-as-tag">
TAG
</a>
,
<a href="/docs/latest/develop/interact/search-and-query/indexing/#index-json-arrays-as-numeric">
NUMERIC
</a>
,
<a href="/docs/latest/develop/interact/search-and-query/indexing/#index-json-arrays-as-geo">
GEO
</a>
and
<a href="/docs/latest/develop/interact/search-and-query/indexing/#index-json-arrays-as-vector">
VECTOR
</a>
) defined by a
<a href="/docs/latest/develop/data-types/json/path/">
JSONPath
</a>
leading to an array or multiple scalar values. Support for
<a href="/docs/latest/develop/interact/search-and-query/query/geo-spatial/">
GEOSHAPE
</a>
queries was also introduced in this dialect.
</p>
<p>
The primary difference between dialects version 2 and version 3 is that JSON is returned rather than scalars for multi-value attributes. Apart from specifying
<code>
DIALECT 3
</code>
at the end of a
<a href="/docs/latest/commands/ft.search/">
<code>
FT.SEARCH
</code>
</a>
command, there are no other syntactic changes. Dialect version 1 remains the default dialect. To use dialect version 3, append
<code>
DIALECT 3
</code>
to your query command.
</p>
<p>
<code>
FT.SEARCH ... DIALECT 3
</code>
</p>
<p>
<strong>
Example
</strong>
</p>
<p>
Sample JSON:
</p>
<pre tabindex="0"><code>{
"id": 123,
"underlyings": [
{
"currency": "USD",
"spot": 99,
"underlier": "AAPL UW"
},
{
"currency": "USD",
"spot": 100,
"underlier": "NFLX UW"
}
]
}
</code></pre>
<p>
Create an index:
</p>
<pre tabindex="0"><code>FT.CREATE js_idx ON JSON PREFIX 1 js: SCHEMA $.underlyings[*].underlier AS und TAG
</code></pre>
<p>
Now search, with and without
<code>
DIALECT 3
</code>
.
</p>
<ul>
<li>
<p>
With dialect 1 (default):
</p>
<pre tabindex="0"><code>ft.search js_idx * return 1 und
1) (integer) 1
2) "js:1"
3) 1) "und"
2) "AAPL UW"
</code></pre>
<p>
Only the first element of the expected two elements is returned.
</p>
</li>
<li>
<p>
With dialect 3:
</p>
<pre tabindex="0"><code>ft.search js_idx * return 1 und DIALECT 3
1) (integer) 1
2) "js:1"
3) 1) "und"
2) "[\"AAPL UW\",\"NFLX UW\"]"
</code></pre>
<p>
Both elements are returned.
</p>
</li>
</ul>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Note:
</div>
DIALECT 3 is required for shape-based (
<code>
POINT
</code>
or
<code>
POLYGON
</code>
) geospatial queries.
</div>
</div>
<h2 id="dialect-4">
<code>
DIALECT 4
</code>
</h2>
<p>
Dialect version 4 was introduced in the
<a href="https://github.com/RediSearch/RediSearch/releases/tag/v2.8.4">
2.8
</a>
release. It introduces performance optimizations for sorting operations on
<a href="/docs/latest/commands/ft.search/">
<code>
FT.SEARCH
</code>
</a>
and
<a href="/docs/latest/commands/ft.aggregate/">
<code>
FT.AGGREGATE
</code>
</a>
. Apart from specifying
<code>
DIALECT 4
</code>
at the end of a
<a href="/docs/latest/commands/ft.search/">
<code>
FT.SEARCH
</code>
</a>
command, there are no other syntactic changes. Dialect version 1 remains the default dialect. To use dialect version 4, append
<code>
DIALECT 4
</code>
to your query command.
</p>
<p>
<code>
FT.SEARCH ... DIALECT 4
</code>
</p>
<p>
Dialect version 4 will improve performance in four different scenarios:
</p>
<ol>
<li>
<strong>
Skip sorter
</strong>
- applied when there is no sorting to be done. The query can return once it reaches the
<code>
LIMIT
</code>
of requested results.
</li>
<li>
<strong>
Partial range
</strong>
- applied when there is a
<code>
SORTBY
</code>
on a numeric field, either with no filter or with a filter by the same numeric field. Such queries will iterate on a range large enough to satisfy the
<code>
LIMIT
</code>
of requested results.
</li>
<li>
<strong>
Hybrid
</strong>
- applied when there is a
<code>
SORTBY
</code>
on a numeric field in addition to another non-numeric filter. It could be the case that some results will get filtered, leaving too small a range to satisfy any specified
<code>
LIMIT
</code>
. In such cases, the iterator then is re-wound and additional iterations occur to collect result up to the requested
<code>
LIMIT
</code>
.
</li>
<li>
<strong>
No optimization
</strong>
- If there is a sort by score or by a non-numeric field, there is no other option but to retrieve all results and compare their values to the search parameters.
</li>
</ol>
<h2 id="use-ftexplaincli-to-compare-dialects">
Use
<code>
FT.EXPLAINCLI
</code>
to compare dialects
</h2>
<p>
The
<a href="/docs/latest/commands/ft.explaincli/">
<code>
FT.EXPLAINCLI
</code>
</a>
command is a powerful tool that provides a window into the inner workings of your queries. It's like a roadmap that details your query's journey from start to finish.
</p>
<p>
When you run
<a href="/docs/latest/commands/ft.explaincli/">
<code>
FT.EXPLAINCLI
</code>
</a>
, it returns an array representing the execution plan of a complex query. This plan is a step-by-step guide of how Redis interprets your query and how it plans to fetch results. It's a behind-the-scenes look at the process, giving you insights into how the search engine works.
</p>
<p>
The
<a href="/docs/latest/commands/ft.explaincli/">
<code>
FT.EXPLAINCLI
</code>
</a>
accepts a
<code>
DIALECT
</code>
argument, allowing you to execute the query using different dialect versions, allowing you to compare the resulting query plans.
</p>
<p>
To use
<a href="/docs/latest/commands/ft.explaincli/">
<code>
FT.EXPLAINCLI
</code>
</a>
, you need to provide an index and a query predicate. The index is the name of the index you created using
<a href="/docs/latest/commands/ft.create/">
<code>
FT.CREATE
</code>
</a>
, and the query predicate is the same as if you were sending it to
<a href="/docs/latest/commands/ft.search/">
<code>
FT.SEARCH
</code>
</a>
or
<a href="/docs/latest/commands/ft.aggregate/">
<code>
FT.AGGREGATE
</code>
</a>
.
</p>
<p>
Here's an example of how to use
<a href="/docs/latest/commands/ft.explaincli/">
<code>
FT.EXPLAINCLI
</code>
</a>
to understand differences in dialect versions 1 and 2.
</p>
<p>
Negation of the intersection between tokens
<code>
hello
</code>
and
<code>
world
</code>
:
</p>
<pre tabindex="0"><code class="language-FT.EXPLAINCLI" data-lang="FT.EXPLAINCLI">1) NOT {
2) INTERSECT {
3) hello
4) world
5) }
6) }
7)
</code></pre>
<p>
Intersection of the negation of the token
<code>
hello
</code>
together with token
<code>
world
</code>
:
</p>
<pre tabindex="0"><code>FT.EXPLAINCLI idx:dialects "-hello world" DIALECT 2
1) INTERSECT {
2) NOT {
3) hello
4) }
5) UNION {
6) world
7) +world(expanded)
8) }
9) }
10)
</code></pre>
<p>
Same result as
<code>
DIALECT 1
</code>
:
</p>
<pre tabindex="0"><code>FT.EXPLAINCLI idx:dialects "-(hello world)" DIALECT 2
1) NOT {
2) INTERSECT {
3) hello
4) world
5) }
6) }
7)
</code></pre>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Note:
</div>
<a href="/docs/latest/commands/ft.explain/">
<code>
FT.EXPLAIN
</code>
</a>
doesn't execute the query. It only explains the plan. It's a way to understand how your query is interpreted by the query engine, which can be invaluable when you're trying to optimize your searches.
</div>
</div>
<h2 id="change-the-default-dialect">
Change the default dialect
</h2>
<p>
The default dialect is
<code>
DIALECT 1
</code>
. If you wish to change that, you can do so by using the
<code>
DEFAULT_DIALECT
</code>
parameter when loading the RediSearch module:
</p>
<pre tabindex="0"><code>$ redis-server --loadmodule ./redisearch.so DEFAULT_DIALECT 2
</code></pre>
<p>
You can also change the query dialect on an already running server using the
<code>
FT.CONFIG
</code>
command:
</p>
<pre tabindex="0"><code>FT.CONFIG SET DEFAULT_DIALECT 2
</code></pre>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/develop/interact/search-and-query/advanced-concepts/dialects/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/7.4/security/encryption/pem-encryption/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Encrypt private keys
</h1>
<p class="text-lg -mt-5 mb-10">
Enable PEM encryption to encrypt all private keys on disk.
</p>
<p>
Enable PEM encryption to automatically encrypt all private keys on disk. Public keys (
<code>
.cert
</code>
files) are not encrypted.
</p>
<p>
When certificates are rotated, the encrypted private keys are also rotated.
</p>
<h2 id="enable-pem-encryption">
Enable PEM encryption
</h2>
<p>
To enable PEM encryption and encrypt private keys on the disk, use
<a href="/docs/latest/operate/rs/7.4/references/cli-utilities/rladmin/">
<code>
rladmin
</code>
</a>
or the
<a href="/docs/latest/operate/rs/7.4/references/rest-api/">
REST API
</a>
.
</p>
<ul>
<li>
<p>
<a href="/docs/latest/operate/rs/7.4/references/cli-utilities/rladmin/cluster/config/">
<code>
rladmin cluster config
</code>
</a>
:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">rladmin cluster config encrypt_pkeys enabled
</span></span></code></pre>
</div>
</li>
<li>
<p>
<a href="/docs/latest/operate/rs/7.4/references/rest-api/requests/cluster/#put-cluster">
Update cluster settings
</a>
REST API request:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">PUT /v1/cluster
</span></span><span class="line"><span class="cl"><span class="o">{</span> <span class="s2">"encrypt_pkeys"</span>: <span class="nb">true</span> <span class="o">}</span>
</span></span></code></pre>
</div>
</li>
</ul>
<h2 id="deactivate-pem-encryption">
Deactivate PEM encryption
</h2>
<p>
To deactivate PEM encryption and decrypt private keys on the disk, use
<a href="/docs/latest/operate/rs/7.4/references/cli-utilities/rladmin/">
<code>
rladmin
</code>
</a>
or the
<a href="/docs/latest/operate/rs/7.4/references/rest-api/">
REST API
</a>
.
</p>
<ul>
<li>
<p>
<a href="/docs/latest/operate/rs/7.4/references/cli-utilities/rladmin/cluster/config/">
<code>
rladmin cluster config
</code>
</a>
:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">rladmin cluster config encrypt_pkeys disabled
</span></span></code></pre>
</div>
</li>
<li>
<p>
<a href="/docs/latest/operate/rs/7.4/references/rest-api/requests/cluster/#put-cluster">
Update cluster settings
</a>
REST API request:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">PUT /v1/cluster
</span></span><span class="line"><span class="cl"><span class="o">{</span> <span class="s2">"encrypt_pkeys"</span>: <span class="nb">false</span> <span class="o">}</span>
</span></span></code></pre>
</div>
</li>
</ul>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/7.4/security/encryption/pem-encryption/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rc/changelog/march-2024/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Redis Cloud changelog (March 2024)
</h1>
<p class="text-lg -mt-5 mb-10">
New features, enhancements, and other changes added to Redis Cloud during March 2024.
</p>
<h2 id="new-features">
New Features
</h2>
<h3 id="fixed-subscriptions-through-google-cloud-marketplace">
Fixed subscriptions through Google Cloud Marketplace
</h3>
<p>
You can now use your
<a href="/docs/latest/operate/rc/cloud-integrations/gcp-marketplace/">
Google Cloud Marketplace
</a>
account to pay for your Fixed subscriptions as well as your Flexible subscriptions.
</p>
<h3 id="active-passive-with-tls">
Active-Passive with TLS
</h3>
<p>
<a href="/docs/latest/operate/rc/databases/migrate-databases/#sync-using-active-passive">
Active-Passive
</a>
now supports source databases that require connections over TLS. See
<a href="/docs/latest/operate/rc/databases/migrate-databases/">
Migrate data
</a>
for more information.
</p>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rc/changelog/march-2024/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/databases/active-active/develop/data-types/sorted-sets/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Sorted sets in Active-Active databases
</h1>
<p class="text-lg -mt-5 mb-10">
Information about using sorted sets with an Active-Active database.
</p>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Note:
</div>
<a href="/docs/latest/commands/geoadd/">
Redis Geospatial (Geo)
</a>
is based on Sorted Sets, so the same Active-Active database development instructions apply to Geo.
</div>
</div>
<p>
Similar to Redis Sets, Redis Sorted Sets are non-repeating collections
of Strings. The difference between the two is that every member of a
Sorted Set is associated with a score used to order the Sorted Set from
lowest to highest. While members are unique, they may have the same
score.
</p>
<p>
With Sorted Sets, you can quickly add, remove or update elements as
well as get ranges by score or by rank (position). Sorted Sets in Active-Active databases
behave the same and maintain additional metadata to handle concurrent
conflicting writes. Conflict resolution is done in two
phases:
</p>
<ol>
<li>
First, the database resolves conflict at the set level using "OR
Set" (Observed-Remove Set). With OR-Set behavior, writes across
multiple Active-Active database instances are typically unioned except in cases of
conflicts. Conflicting writes can happen when an Active-Active database instance
deletes an element while the other adds or updates the same element.
In this case, an observed Remove rule is followed, and only
instances it has already seen are removed. In all other cases, the
Add / Update element wins.
</li>
<li>
Second, the database resolves conflict at the score level. In this
case, the score is treated as a counter and applies the same
conflict resolution as regular counters.
</li>
</ol>
<p>
See the following examples to get familiar with Sorted Sets'
behavior in Active-Active database:
</p>
<p>
Example of Simple Sorted Set with No
Conflict:
</p>
<table>
<thead>
<tr>
<th style="text-align:right">
<strong>
Time
</strong>
</th>
<th style="text-align:center">
<strong>
CRDB Instance 1
</strong>
</th>
<th style="text-align:center">
<strong>
CRDB Instance 2
</strong>
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:right">
t1
</td>
<td style="text-align:center">
ZADD Z 1.1 x
</td>
<td style="text-align:center">
</td>
</tr>
<tr>
<td style="text-align:right">
t2
</td>
<td style="text-align:center">
β Sync β
</td>
<td style="text-align:center">
β Sync β
</td>
</tr>
<tr>
<td style="text-align:right">
t3
</td>
<td style="text-align:center">
</td>
<td style="text-align:center">
ZADD Z 1.2 y
</td>
</tr>
<tr>
<td style="text-align:right">
t4
</td>
<td style="text-align:center">
β Sync β
</td>
<td style="text-align:center">
β Sync β
</td>
</tr>
<tr>
<td style="text-align:right">
t5
</td>
<td style="text-align:center">
ZRANGE Z 0 -1 => x y
</td>
<td style="text-align:center">
ZRANGE Z 0 -1 => x y
</td>
</tr>
</tbody>
</table>
<p>
<strong>
Explanation
</strong>
:
When adding two different elements to a Sorted Set from different
replicas (in this example, x with score 1.1 was added by Instance 1 to
Sorted Set Z, and y with score 1.2 was added by Instance 2 to Sorted Set
Z) in a non-concurrent manner (i.e. each operation happened separately
and after both instances were in sync), the end result is a Sorted
Set including both elements in each Active-Active database instance.
Example of Sorted Set and Concurrent
Add:
</p>
<table>
<thead>
<tr>
<th style="text-align:right">
<strong>
Time
</strong>
</th>
<th style="text-align:center">
<strong>
CRDB Instance 1
</strong>
</th>
<th style="text-align:center">
<strong>
CRDB Instance 2
</strong>
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:right">
t1
</td>
<td style="text-align:center">
ZADD Z 1.1 x
</td>
<td style="text-align:center">
</td>
</tr>
<tr>
<td style="text-align:right">
t2
</td>
<td style="text-align:center">
</td>
<td style="text-align:center">
ZADD Z 2.1 x
</td>
</tr>
<tr>
<td style="text-align:right">
t3
</td>
<td style="text-align:center">
ZSCORE Z x => 1.1
</td>
<td style="text-align:center">
ZSCORE Z x => 2.1
</td>
</tr>
<tr>
<td style="text-align:right">
t4
</td>
<td style="text-align:center">
β Sync β
</td>
<td style="text-align:center">
β Sync β
</td>
</tr>
<tr>
<td style="text-align:right">
t5
</td>
<td style="text-align:center">
ZSCORE Z x => 2.1
</td>
<td style="text-align:center">
ZSCORE Z x => 2.1
</td>
</tr>
</tbody>
</table>
<p>
<strong>
Explanation
</strong>
:
When concurrently adding an element x to a Sorted Set Z by two different
Active-Active database instances (Instance 1 added score 1.1 and Instance 2 added score
2.1), the Active-Active database implements Last Write Win (LWW) to determine the score of
x. In this scenario, Instance 2 performed the ZADD operation at time
t2>t1 and therefore the Active-Active database sets the score 2.1 to
x.
</p>
<p>
Example of Sorted Set with Concurrent Add Happening at the Exact Same
Time:
</p>
<table>
<thead>
<tr>
<th style="text-align:right">
<strong>
Time
</strong>
</th>
<th style="text-align:center">
<strong>
CRDB Instance 1
</strong>
</th>
<th style="text-align:center">
<strong>
CRDB Instance 2
</strong>
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:right">
t1
</td>
<td style="text-align:center">
ZADD Z 1.1 x
</td>
<td style="text-align:center">
ZADD Z 2.1 x
</td>
</tr>
<tr>
<td style="text-align:right">
t2
</td>
<td style="text-align:center">
ZSCORE Z x => 1.1
</td>
<td style="text-align:center">
ZSCORE Z x => 2.1
</td>
</tr>
<tr>
<td style="text-align:right">
t3
</td>
<td style="text-align:center">
β Sync β
</td>
<td style="text-align:center">
β Sync β
</td>
</tr>
<tr>
<td style="text-align:right">
t4
</td>
<td style="text-align:center">
ZSCORE Z x => 1.1
</td>
<td style="text-align:center">
ZSCORE Z x => 1.1
</td>
</tr>
</tbody>
</table>
<p>
<strong>
Explanation
</strong>
:
The example above shows a relatively rare situation, in which two Active-Active database
instances concurrently added the same element x to a Sorted Set at the
same exact time but with a different score, i.e. Instance 1 added x with
a 1.1 score and Instance 2 added x with a 2.1 score. After syncing, the
Active-Active database realized that both operations happened at the same time and
resolved the conflict by arbitrarily (but consistently across all Active-Active database
instances) giving precedence to Instance 1.
Example of Sorted Set with Concurrent Counter
Increment:
</p>
<table>
<thead>
<tr>
<th style="text-align:right">
<strong>
Time
</strong>
</th>
<th style="text-align:center">
<strong>
CRDB Instance 1
</strong>
</th>
<th style="text-align:center">
<strong>
CRDB Instance 2
</strong>
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:right">
t1
</td>
<td style="text-align:center">
ZADD Z 1.1 x
</td>
<td style="text-align:center">
</td>
</tr>
<tr>
<td style="text-align:right">
t2
</td>
<td style="text-align:center">
β Sync β
</td>
<td style="text-align:center">
β Sync β
</td>
</tr>
<tr>
<td style="text-align:right">
t3
</td>
<td style="text-align:center">
ZINCRBY Z 1.0 x
</td>
<td style="text-align:center">
ZINCRBY Z 1.0 x
</td>
</tr>
<tr>
<td style="text-align:right">
t4
</td>
<td style="text-align:center">
β Sync β
</td>
<td style="text-align:center">
β Sync β
</td>
</tr>
<tr>
<td style="text-align:right">
t5
</td>
<td style="text-align:center">
ZSCORE Z x => 3.1
</td>
<td style="text-align:center">
ZSCORE Z x => 3.1
</td>
</tr>
</tbody>
</table>
<p>
<strong>
Explanation
</strong>
:
The result is the sum of all
ZINCRBY
operations performed by all Active-Active database instances.
</p>
<p>
Example of Removing an Element from a Sorted
Set:
</p>
<table>
<thead>
<tr>
<th style="text-align:right">
<strong>
Time
</strong>
</th>
<th style="text-align:center">
<strong>
CRDB Instance 1
</strong>
</th>
<th style="text-align:center">
<strong>
CRDB Instance 2
</strong>
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:right">
t1
</td>
<td style="text-align:center">
ZADD Z 4.1 x
</td>
<td style="text-align:center">
</td>
</tr>
<tr>
<td style="text-align:right">
t2
</td>
<td style="text-align:center">
β Sync β
</td>
<td style="text-align:center">
β Sync β
</td>
</tr>
<tr>
<td style="text-align:right">
t3
</td>
<td style="text-align:center">
ZSCORE Z x => 4.1
</td>
<td style="text-align:center">
ZSCORE Z x => 4.1
</td>
</tr>
<tr>
<td style="text-align:right">
t4
</td>
<td style="text-align:center">
ZREM Z x
</td>
<td style="text-align:center">
ZINCRBY Z 2.0 x
</td>
</tr>
<tr>
<td style="text-align:right">
t5
</td>
<td style="text-align:center">
ZSCORE Z x => nill
</td>
<td style="text-align:center">
ZSCORE Z x => 6.1
</td>
</tr>
<tr>
<td style="text-align:right">
t6
</td>
<td style="text-align:center">
β Sync β
</td>
<td style="text-align:center">
β Sync β
</td>
</tr>
<tr>
<td style="text-align:right">
t7
</td>
<td style="text-align:center">
ZSCORE Z x => 2.0
</td>
<td style="text-align:center">
ZSCORE Z x => 2.0
</td>
</tr>
</tbody>
</table>
<p>
<strong>
Explanation
</strong>
:
At t4 - t5, concurrent ZREM and ZINCRBY operations ran on Instance 1
and Instance 2 respectively. Before the instances were in sync, the ZREM
operation could only delete what had been seen by Instance 1, so
Instance 2 was not affected. Therefore, the ZSCORE operation shows the
local effect on x. At t7, after both instances were in-sync, the Active-Active database
resolved the conflict by subtracting 4.1 (the value of element x in
Instance 1) from 6.1 (the value of element x in Instance 2).
</p>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/databases/active-active/develop/data-types/sorted-sets/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/installing-upgrading/configuring/change-location-socket-files/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Change socket file locations
</h1>
<p class="text-lg -mt-5 mb-10">
Change socket file locations.
</p>
<h2 id="default-socket-file-locations">
Default socket file locations
</h2>
<p>
There are two default locations for the socket files in Redis Enterprise Software:
</p>
<ul>
<li>
<p>
<code>
/tmp
</code>
- In clean installations of Redis Enterprise Software version earlier than 5.2.2
</p>
</li>
<li>
<p>
<code>
/var/opt/redislabs/run
</code>
- In clean installations of Redis Enterprise Software version 5.2.2 and later
</p>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Note:
</div>
The default location was changed in case you run any maintenance procedures that delete the
<code>
/tmp
</code>
directory.
</div>
</div>
</li>
</ul>
<p>
When you upgrade Redis Enterprise Software from an earlier version to 5.2.2 or later, the socket files
are not moved to the new location by default. You need to either specify a custom location
for the socket files during
<a href="/docs/latest/operate/rs/installing-upgrading/">
installation
</a>
or use the
<a href="#change-socket-file-locations">
following procedure
</a>
after installation.
</p>
<h2 id="change-socket-file-locations">
Change socket file locations
</h2>
<p>
To change the location of the socket files:
</p>
<ol>
<li>
<p>
On each node in the cluster, run:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">sudo rlutil create_socket_path <span class="nv">socket_path</span><span class="o">=</span>/var/opt/redislabs/run
</span></span></code></pre>
</div>
</li>
<li>
<p>
Identify the node with the
<code>
master
</code>
role by running the following command on any node in the cluster:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">rladmin status nodes
</span></span></code></pre>
</div>
</li>
<li>
<p>
On the master node, change the socket file location:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">sudo rlutil set_socket_path <span class="nv">socket_path</span><span class="o">=</span>/var/opt/redislabs/run
</span></span></code></pre>
</div>
</li>
<li>
<p>
To update the socket file location for all other nodes, restart Redis Enterprise Software on each node in the cluster, one at a time:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">sudo service rlec_supervisor restart
</span></span></code></pre>
</div>
</li>
<li>
<p>
Restart each database in the cluster to update the socket file location:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">rladmin restart db <db name>
</span></span></code></pre>
</div>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Warning:
</div>
Restarting databases can cause interruptions in data traffic.
</div>
</div>
</li>
</ol>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/installing-upgrading/configuring/change-location-socket-files/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/7.4/security/access-control/manage-passwords/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Set password policies
</h1>
<p class="text-lg -mt-5 mb-10">
Set password policies.
</p>
<p>
Redis Enterprise Software provides several ways to manage the passwords of local accounts, including:
</p>
<ul>
<li>
<p>
<a href="/docs/latest/operate/rs/7.4/security/access-control/manage-passwords/password-complexity-rules/">
Password complexity rules
</a>
</p>
</li>
<li>
<p>
<a href="/docs/latest/operate/rs/7.4/security/access-control/manage-passwords/password-expiration/">
Password expiration
</a>
</p>
</li>
<li>
<p>
<a href="/docs/latest/operate/rs/7.4/security/access-control/manage-passwords/rotate-passwords/">
Password rotation
</a>
</p>
</li>
</ul>
<p>
You can also manage a user's ability to
<a href="/docs/latest/operate/rs/7.4/security/access-control/manage-users/login-lockout/#user-login-lockout">
sign in
</a>
and control
<a href="/docs/latest/operate/rs/7.4/security/access-control/manage-users/login-lockout/#session-timeout">
session timeout
</a>
.
</p>
<p>
To enforce more advanced password policies, we recommend using
<a href="/docs/latest/operate/rs/7.4/security/access-control/ldap/">
LDAP integration
</a>
with an external identity provider, such as Active Directory.
</p>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Note:
</div>
Redis Enterprise Software stores all user passwords using the SHA-256 cryptographic hash function.
</div>
</div>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/7.4/security/access-control/manage-passwords/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/commands/bf.insert.html | <section class="prose w-full py-12">
<h1 class="command-name">
BF.INSERT
</h1>
<div class="font-semibold text-redis-ink-900">
Syntax
</div>
<pre class="command-syntax">BF.INSERT key [CAPACITYΒ capacity] [ERRORΒ error]
[EXPANSIONΒ expansion] [NOCREATE] [NONSCALING] ITEMS item [item
...]</pre>
<dl class="grid grid-cols-[auto,1fr] gap-2 mb-12">
<dt class="font-semibold text-redis-ink-900 m-0">
Available in:
</dt>
<dd class="m-0">
<a href="/docs/stack">
Redis Stack
</a>
/
<a href="/docs/data-types/probabilistic">
Bloom 1.0.0
</a>
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
Time complexity:
</dt>
<dd class="m-0">
O(k * n), where k is the number of hash functions and n is the number of items
</dd>
</dl>
<p>
Creates a new Bloom filter if the
<code>
key
</code>
does not exist using the specified error rate, capacity, and expansion, then adds all specified items to the Bloom Filter.
</p>
<p>
This command is similar to
<a href="/docs/latest/commands/bf.madd/">
<code>
BF.MADD
</code>
</a>
, except that the error rate, capacity, and expansion can be specified. It is a sugarcoated combination of
<a href="/docs/latest/commands/bf.reserve/">
<code>
BF.RESERVE
</code>
</a>
and
<a href="/docs/latest/commands/bf.madd/">
<code>
BF.MADD
</code>
</a>
.
</p>
<h2 id="required-arguments">
Required arguments
</h2>
<details open="">
<summary>
<code>
key
</code>
</summary>
<p>
is key name for a Bloom filter to add items to.
</p>
<p>
If
<code>
key
</code>
does not exist, a new Bloom filter is created.
</p>
</details>
<details open="">
<summary>
<code>
ITEMS item...
</code>
</summary>
<p>
One or more items to add.
</p>
</details>
<h2 id="optional-arguments">
Optional arguments
</h2>
<details open="">
<summary>
<code>
NOCREATE
</code>
</summary>
<p>
Indicates that the filter should not be created if it does not already exist.
If the filter does not yet exist, an error is returned rather than creating it automatically.
This may be used where a strict separation between filter creation and filter addition is desired.
It is an error to specify
<code>
NOCREATE
</code>
together with either
<code>
CAPACITY
</code>
or
<code>
ERROR
</code>
.
</p>
</details>
<details open="">
<summary>
<code>
CAPACITY capacity
</code>
</summary>
<p>
Specifies the desired
<code>
capacity
</code>
for the filter to be created.
This parameter is ignored if the filter already exists.
If the filter is automatically created and this parameter is absent, then the module-level
<code>
capacity
</code>
is used.
See
<a href="/docs/latest/commands/bf.reserve/">
<code>
BF.RESERVE
</code>
</a>
for more information about the impact of this value.
</p>
</details>
<details open="">
<summary>
<code>
ERROR error
</code>
</summary>
<p>
Specifies the
<code>
error
</code>
ratio of the newly created filter if it does not yet exist.
If the filter is automatically created and
<code>
error
</code>
is not specified then the module-level error rate is used.
See
<a href="/docs/latest/commands/bf.reserve/">
<code>
BF.RESERVE
</code>
</a>
for more information about the format of this value.
</p>
</details>
<details open="">
<summary>
<code>
NONSCALING
</code>
</summary>
<p>
Prevents the filter from creating additional sub-filters if initial capacity is reached.
Non-scaling filters require slightly less memory than their scaling counterparts. The filter returns an error when
<code>
capacity
</code>
is reached.
</p>
</details>
<details open="">
<summary>
<code>
EXPANSION expansion
</code>
</summary>
<p>
When
<code>
capacity
</code>
is reached, an additional sub-filter is created.
The size of the new sub-filter is the size of the last sub-filter multiplied by
<code>
expansion
</code>
, specified as a positive integer.
</p>
<p>
If the number of elements to be stored in the filter is unknown, use an
<code>
expansion
</code>
of
<code>
2
</code>
or more to reduce the number of sub-filters.
Otherwise, use an
<code>
expansion
</code>
of
<code>
1
</code>
to reduce memory consumption. The default value is
<code>
2
</code>
.
</p>
</details>
<h2 id="return-value">
Return value
</h2>
<p>
Returns one of these replies:
</p>
<ul>
<li>
<a href="/docs/latest/develop/reference/protocol-spec/#arrays">
Array reply
</a>
where each element is one of these options:
<ul>
<li>
<a href="/docs/latest/develop/reference/protocol-spec/#integers">
Integer reply
</a>
, where
<code>
1
</code>
denotes that the item has been added successfully, and
<code>
0
</code>
means that such item had already added to the filter (which could be wrong)
</li>
<li>
[] when the item cannot be added because the filter is full
</li>
</ul>
</li>
<li>
[], for example, when the number of arguments or key type is wrong, and also when
<code>
NOCREATE
</code>
is specified and
<code>
key
</code>
does not exist.
</li>
</ul>
<h2 id="examples">
Examples
</h2>
<p>
Add three items to a filter, then create the filter with default parameters if it does not already exist.
</p>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">BF.INSERT filter ITEMS foo bar baz</span></span></code></pre>
</div>
<p>
Add one item to a filter, then create the filter with a capacity of 10000 if it does not already exist.
</p>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">BF.INSERT filter CAPACITY <span class="m">10000</span> ITEMS hello</span></span></code></pre>
</div>
<p>
Add two items to a filter, then return error if the filter does not already exist.
</p>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">BF.INSERT filter NOCREATE ITEMS foo bar</span></span></code></pre>
</div>
<br/>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/commands/bf.insert/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/references/cli-utilities/rladmin/node/recovery-path/.html | <section class="prose w-full py-12 max-w-none">
<h1>
rladmin node recovery_path set
</h1>
<p class="text-lg -mt-5 mb-10">
Sets a node's local recovery path.
</p>
<p>
Sets the node's local recovery path, which specifies the directory where
<a href="/docs/latest/operate/rs/databases/configure/database-persistence/">
persistence files
</a>
are stored. You can use these persistence files to
<a href="/docs/latest/operate/rs/databases/recover/">
recover a failed database
</a>
.
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">rladmin node <ID> recovery_path <span class="nb">set</span> <path>
</span></span></code></pre>
</div>
<h3 id="parameters">
Parameters
</h3>
<table>
<thead>
<tr>
<th>
Parameter
</th>
<th>
Type/Value
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
node
</td>
<td>
integer
</td>
<td>
Sets the recovery path for the specified node
</td>
</tr>
<tr>
<td>
path
</td>
<td>
filepath
</td>
<td>
Path to the folder where persistence files are stored
</td>
</tr>
</tbody>
</table>
<h3 id="returns">
Returns
</h3>
<p>
Returns
<code>
Updated successfully
</code>
if the recovery path was set. Otherwise, it returns an error.
</p>
<h3 id="example">
Example
</h3>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">$ rladmin node <span class="m">2</span> recovery_path <span class="nb">set</span> /var/opt/redislabs/persist/redis
</span></span><span class="line"><span class="cl">Updated successfully.
</span></span></code></pre>
</div>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/references/cli-utilities/rladmin/node/recovery-path/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/oss_and_stack/stack-with-enterprise/deprecated-features/triggers-and-functions/concepts/binary_data/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Binary data
</h1>
<p class="text-lg -mt-5 mb-10">
Working with binary data
</p>
<div class="banner-article rounded-md">
<p>
The Redis Stack triggers and functions feature preview has ended and it will not be promoted to GA.
</p>
</div>
<p>
By default, triggers and functions will decode all data as a string and will raise error on failures. Though useful for most users, sometimes there is a need to work with binary data. In order to do so, the library developer has to consider the following:
</p>
<ol>
<li>
Binary function arguments
</li>
<li>
Binary command results
</li>
<li>
Binary key names on
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/deprecated-features/triggers-and-functions/concepts/triggers/keyspace_triggers/">
keyspace triggers
</a>
</li>
<li>
Binary data on
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/deprecated-features/triggers-and-functions/concepts/triggers/stream_triggers/">
stream triggers
</a>
</li>
</ol>
<h3 id="binary-function-arguments">
Binary function arguments
</h3>
<p>
It is possible to instruct triggers and functions not to decode function arguments as
<code>
JS
</code>
<code>
Strings
</code>
using the
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/deprecated-features/triggers-and-functions/concepts/function_flags/">
redis.functionFlags.RAW_ARGUMENTS
</a>
function flag. In this case, the function arguments will be given as
<code>
JS
</code>
<code>
ArrayBuffer
</code>
. Example:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-js" data-lang="js"><span class="line"><span class="cl"><span class="err">#</span><span class="o">!</span><span class="nx">js</span> <span class="nx">api_version</span><span class="o">=</span><span class="mf">1.0</span> <span class="nx">name</span><span class="o">=</span><span class="nx">lib</span>
</span></span><span class="line"><span class="cl"><span class="nx">redis</span><span class="p">.</span><span class="nx">registerFunction</span><span class="p">(</span><span class="s2">"my_set"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="p">(</span><span class="nx">c</span><span class="p">,</span> <span class="nx">key</span><span class="p">,</span> <span class="nx">val</span><span class="p">)</span> <span class="p">=></span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="nx">c</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="s2">"set"</span><span class="p">,</span> <span class="nx">key</span><span class="p">,</span> <span class="nx">val</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">flags</span><span class="o">:</span> <span class="p">[</span><span class="nx">redis</span><span class="p">.</span><span class="nx">functionFlags</span><span class="p">.</span><span class="nx">RAW_ARGUMENTS</span><span class="p">]</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span></code></pre>
</div>
<p>
The above example will allow us to set
<code>
key
</code>
and
<code>
val
</code>
even if those are binary data. Run example:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">127.0.0.1:6379> TFCALL lib.my_set <span class="m">1</span> <span class="s2">"\xaa"</span> <span class="s2">"\xaa"</span>
</span></span><span class="line"><span class="cl"><span class="s2">"OK"</span>
</span></span><span class="line"><span class="cl">127.0.0.1:6379> get <span class="s2">"\xaa"</span>
</span></span><span class="line"><span class="cl"><span class="s2">"\xaa"</span>
</span></span></code></pre>
</div>
<p>
Notice that the
<code>
call
</code>
function also accepts
<code>
JS
</code>
<code>
ArrayBuffer
</code>
arguments.
</p>
<h3 id="binary-command-results">
Binary command results
</h3>
<p>
Getting function arguments as binary data is not enough. We might want to read binary data from a Redis key. In order to do this we can use the
<code>
callRaw
</code>
function, which will not decode the result as a
<code>
JS
</code>
<code>
String
</code>
and instead will return the result as a
<code>
JS
</code>
<code>
ArrayBuffer
</code>
. Example:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-js" data-lang="js"><span class="line"><span class="cl"><span class="err">#</span><span class="o">!</span><span class="nx">js</span> <span class="nx">api_version</span><span class="o">=</span><span class="mf">1.0</span> <span class="nx">name</span><span class="o">=</span><span class="nx">lib</span>
</span></span><span class="line"><span class="cl"><span class="nx">redis</span><span class="p">.</span><span class="nx">registerFunction</span><span class="p">(</span><span class="s2">"my_get"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="p">(</span><span class="nx">c</span><span class="p">,</span> <span class="nx">key</span><span class="p">)</span> <span class="p">=></span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="nx">c</span><span class="p">.</span><span class="nx">callRaw</span><span class="p">(</span><span class="s2">"get"</span><span class="p">,</span> <span class="nx">key</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">flags</span><span class="o">:</span> <span class="p">[</span><span class="nx">redis</span><span class="p">.</span><span class="nx">functionFalgs</span><span class="p">.</span><span class="nx">RAW_ARGUMENTS</span><span class="p">]</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span></code></pre>
</div>
<p>
The above example will be able to fetch binary data and return it to the user. For example:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">27.0.0.1:6379> <span class="nb">set</span> <span class="s2">"\xaa"</span> <span class="s2">"\xaa"</span>
</span></span><span class="line"><span class="cl">OK
</span></span><span class="line"><span class="cl">127.0.0.1:6379> TFCALL lib.my_get <span class="m">1</span> <span class="s2">"\xaa"</span>
</span></span><span class="line"><span class="cl"><span class="s2">"\xaa"</span>
</span></span></code></pre>
</div>
<p>
Notice that a
<code>
JS
</code>
<code>
ArrayBuffer
</code>
can be returned by a function, it will be returned to the client as
<code>
bulk string
</code>
.
</p>
<h3 id="binary-keys-names-on-database-triggers">
Binary keys names on database triggers
</h3>
<p>
On
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/deprecated-features/triggers-and-functions/concepts/triggers/keyspace_triggers/">
keyspace triggers
</a>
, if the key name that triggered the event is binary, the
<code>
data.key
</code>
field will be NULL. The
<code>
data.key_raw
</code>
field is always provided as a
<code>
JS
</code>
<code>
ArrayBuffer
</code>
and can be used as in the following example:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-js" data-lang="js"><span class="line"><span class="cl"><span class="err">#</span><span class="o">!</span><span class="nx">js</span> <span class="nx">api_version</span><span class="o">=</span><span class="mf">1.0</span> <span class="nx">name</span><span class="o">=</span><span class="nx">lib</span>
</span></span><span class="line"><span class="cl"><span class="cm">/* The following is just an example, in general it is discourage to use globals. */</span>
</span></span><span class="line"><span class="cl"><span class="kd">var</span> <span class="nx">n_notifications</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="kd">var</span> <span class="nx">last_key</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="kd">var</span> <span class="nx">last_key_raw</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="nx">redis</span><span class="p">.</span><span class="nx">registerKeySpaceTrigger</span><span class="p">(</span><span class="s2">"consumer"</span><span class="p">,</span> <span class="s2">""</span><span class="p">,</span> <span class="kd">function</span><span class="p">(</span><span class="nx">client</span><span class="p">,</span> <span class="nx">data</span><span class="p">)</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="p">(</span><span class="nx">data</span><span class="p">.</span><span class="nx">event</span> <span class="o">==</span> <span class="s2">"set"</span><span class="p">)</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">n_notifications</span> <span class="o">+=</span> <span class="mi">1</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"> <span class="nx">last_data</span> <span class="o">=</span> <span class="nx">data</span><span class="p">.</span><span class="nx">key</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"> <span class="nx">last_key_raw</span> <span class="o">=</span> <span class="nx">data</span><span class="p">.</span><span class="nx">key_raw</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl"><span class="p">});</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="nx">redis</span><span class="p">.</span><span class="nx">registerFunction</span><span class="p">(</span><span class="s2">"notifications_stats"</span><span class="p">,</span> <span class="kr">async</span> <span class="kd">function</span><span class="p">(){</span>
</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="p">[</span>
</span></span><span class="line"><span class="cl"> <span class="nx">n_notifications</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">last_key</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">last_key_raw</span>
</span></span><span class="line"><span class="cl"> <span class="p">];</span>
</span></span><span class="line"><span class="cl"><span class="p">});</span>
</span></span></code></pre>
</div>
<p>
Run example:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">127.0.0.1:6379> <span class="nb">set</span> <span class="s2">"\xaa"</span> <span class="s2">"\xaa"</span>
</span></span><span class="line"><span class="cl">OK
</span></span><span class="line"><span class="cl">127.0.0.1:6379> TFCALL lib.notifications_stats <span class="m">0</span>
</span></span><span class="line"><span class="cl">1<span class="o">)</span> <span class="o">(</span>integer<span class="o">)</span> <span class="m">1</span>
</span></span><span class="line"><span class="cl">2<span class="o">)</span> <span class="o">(</span>nil<span class="o">)</span>
</span></span><span class="line"><span class="cl">3<span class="o">)</span> <span class="s2">"\xaa"</span>
</span></span></code></pre>
</div>
<p>
For more information see
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/deprecated-features/triggers-and-functions/concepts/triggers/keyspace_triggers/">
keyspace triggers
</a>
.
</p>
<h3 id="binary-data-on-stream-consumers">
Binary data on stream consumers
</h3>
<p>
On
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/deprecated-features/triggers-and-functions/concepts/triggers/stream_triggers/">
stream triggers
</a>
, if the key name is binary. The
<code>
data.stream_name
</code>
field will be NULL. The
<code>
data.stream_name_raw
</code>
field is always provided as a
<code>
JS
</code>
<code>
ArrayBuffer
</code>
and can be used in this case. In addition, if the content of the steam is binary, it will also appear as
<code>
null
</code>
under
<code>
data.record
</code>
. In this case, it is possible to use
<code>
data.record
</code>
(which always exists) and contains the data as a
<code>
JS
</code>
<code>
ArrayBuffer
</code>
. Example:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-js" data-lang="js"><span class="line"><span class="cl"><span class="err">#</span><span class="o">!</span><span class="nx">js</span> <span class="nx">api_version</span><span class="o">=</span><span class="mf">1.0</span> <span class="nx">name</span><span class="o">=</span><span class="nx">lib</span>
</span></span><span class="line"><span class="cl"><span class="cm">/* The following is just an example, in general it is discourage to use globals. */</span>
</span></span><span class="line"><span class="cl"><span class="kd">var</span> <span class="nx">last_key</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="kd">var</span> <span class="nx">last_key_raw</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="kd">var</span> <span class="nx">last_data</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="kd">var</span> <span class="nx">last_data_raw</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="nx">redis</span><span class="p">.</span><span class="nx">registerFunction</span><span class="p">(</span><span class="s2">"stats"</span><span class="p">,</span> <span class="kd">function</span><span class="p">(){</span>
</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="p">[</span>
</span></span><span class="line"><span class="cl"> <span class="nx">last_key</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">last_key_raw</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">last_data</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">last_data_raw</span>
</span></span><span class="line"><span class="cl"> <span class="p">];</span>
</span></span><span class="line"><span class="cl"><span class="p">})</span>
</span></span><span class="line"><span class="cl"><span class="nx">redis</span><span class="p">.</span><span class="nx">registerStreamTrigger</span><span class="p">(</span><span class="s2">"consumer"</span><span class="p">,</span> <span class="k">new</span> <span class="nx">Uint8Array</span><span class="p">([</span><span class="mi">255</span><span class="p">]).</span><span class="nx">buffer</span><span class="p">,</span> <span class="kd">function</span><span class="p">(</span><span class="nx">c</span><span class="p">,</span> <span class="nx">data</span><span class="p">){</span>
</span></span><span class="line"><span class="cl"> <span class="nx">last_key</span> <span class="o">=</span> <span class="nx">data</span><span class="p">.</span><span class="nx">stream_name</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"> <span class="nx">last_key_raw</span> <span class="o">=</span> <span class="nx">data</span><span class="p">.</span><span class="nx">stream_name_raw</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"> <span class="nx">last_data</span> <span class="o">=</span> <span class="nx">data</span><span class="p">.</span><span class="nx">record</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"> <span class="nx">last_data_raw</span> <span class="o">=</span> <span class="nx">data</span><span class="p">.</span><span class="nx">record_raw</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="p">})</span>
</span></span></code></pre>
</div>
<p>
Run Example:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">127.0.0.1:6379> xadd <span class="s2">"\xff\xff"</span> * <span class="s2">"\xaa"</span> <span class="s2">"\xaa"</span>
</span></span><span class="line"><span class="cl"><span class="s2">"1659515146671-0"</span>
</span></span><span class="line"><span class="cl">127.0.0.1:6379> TFCALL foo.stats <span class="m">0</span>
</span></span><span class="line"><span class="cl">1<span class="o">)</span> <span class="o">(</span>nil<span class="o">)</span>
</span></span><span class="line"><span class="cl">2<span class="o">)</span> <span class="s2">"\xff\xff"</span>
</span></span><span class="line"><span class="cl">3<span class="o">)</span> 1<span class="o">)</span> 1<span class="o">)</span> <span class="o">(</span>nil<span class="o">)</span>
</span></span><span class="line"><span class="cl"> 2<span class="o">)</span> <span class="o">(</span>nil<span class="o">)</span>
</span></span><span class="line"><span class="cl">4<span class="o">)</span> 1<span class="o">)</span> 1<span class="o">)</span> <span class="s2">"\xaa"</span>
</span></span><span class="line"><span class="cl"> 2<span class="o">)</span> <span class="s2">"\xaa"</span>
</span></span></code></pre>
</div>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/oss_and_stack/stack-with-enterprise/deprecated-features/triggers-and-functions/concepts/binary_data/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/7.4/references/rest-api/requests/nodes/status/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Node status requests
</h1>
<p class="text-lg -mt-5 mb-10">
Requests that return a node's hostname and role.
</p>
<table>
<thead>
<tr>
<th>
Method
</th>
<th>
Path
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="#get-all-nodes-status">
GET
</a>
</td>
<td>
<code>
/v1/nodes/status
</code>
</td>
<td>
Get the status of all nodes
</td>
</tr>
<tr>
<td>
<a href="#get-node-status">
GET
</a>
</td>
<td>
<code>
/v1/nodes/{uid}/status
</code>
</td>
<td>
Get a node's status
</td>
</tr>
</tbody>
</table>
<h2 id="get-all-nodes-status">
Get all node statuses
</h2>
<pre><code>GET /v1/nodes/status
</code></pre>
<p>
Gets the status of all nodes. Includes each node's hostname and role in the cluster:
</p>
<ul>
<li>
<p>
Primary nodes return
<code>
"role": "master"
</code>
</p>
</li>
<li>
<p>
Replica nodes return
<code>
"role": "slave"
</code>
</p>
</li>
</ul>
<h4 id="required-permissions">
Required permissions
</h4>
<table>
<thead>
<tr>
<th>
Permission name
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="/docs/latest/operate/rs/7.4/references/rest-api/permissions/#view_node_info">
view_node_info
</a>
</td>
</tr>
</tbody>
</table>
<h3 id="get-all-request">
Request
</h3>
<h4 id="example-http-request">
Example HTTP request
</h4>
<pre><code>GET /nodes/status
</code></pre>
<h4 id="request-headers">
Request headers
</h4>
<table>
<thead>
<tr>
<th>
Key
</th>
<th>
Value
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
Host
</td>
<td>
cnm.cluster.fqdn
</td>
<td>
Domain name
</td>
</tr>
<tr>
<td>
Accept
</td>
<td>
application/json
</td>
<td>
Accepted media type
</td>
</tr>
</tbody>
</table>
<h3 id="get-all-response">
Response
</h3>
<p>
For each node in the cluster, returns a JSON object that contains each node's hostname, role, and other status details.
</p>
<p>
If a maintenance snapshot exists due to an in-progress or improperly stopped
<a href="/docs/latest/operate/rs/7.4/clusters/maintenance-mode/">
node maintenance
</a>
process, the response includes a
<code>
maintenance_snapshot
</code>
field.
</p>
<h4 id="example-json-body">
Example JSON body
</h4>
<div class="highlight">
<pre class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"1"</span><span class="p">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"cores"</span><span class="p">:</span> <span class="mi">8</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"free_provisional_ram"</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"free_ram"</span><span class="p">:</span> <span class="mi">3499368448</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"hostname"</span><span class="p">:</span> <span class="s2">"3d99db1fdf4b"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"maintenance_snapshot"</span><span class="p">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"created_time"</span><span class="p">:</span> <span class="s2">"2024-09-06 20:47:23"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"name"</span><span class="p">:</span> <span class="s2">"maintenance_mode_2024-09-06_20-47-23"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"node_uid"</span><span class="p">:</span> <span class="s2">"1"</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"master_shards"</span><span class="p">:</span> <span class="p">[],</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"node_overbooking_depth"</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"node_status"</span><span class="p">:</span> <span class="s2">"active"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"role"</span><span class="p">:</span> <span class="s2">"master"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"slave_shards"</span><span class="p">:</span> <span class="p">[],</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"software_version"</span><span class="p">:</span> <span class="s2">"7.4.6-22"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"software_version_sha"</span><span class="p">:</span> <span class="s2">"6c37b1483b5fb6110c8055c1526aa58eec1d29d3519e92310859101419248831"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"total_memory"</span><span class="p">:</span> <span class="mi">6219673600</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"total_provisional_ram"</span><span class="p">:</span> <span class="mi">0</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"2"</span><span class="p">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"hostname"</span><span class="p">:</span> <span class="s2">"fc7a3d332458"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"role"</span><span class="p">:</span> <span class="s2">"slave"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="c1">// additional fields
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"3"</span><span class="p">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"hostname"</span><span class="p">:</span> <span class="s2">"b87cc06c830f"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"role"</span><span class="p">:</span> <span class="s2">"slave"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="c1">// additional fields
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="p">}</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span></code></pre>
</div>
<h3 id="get-all-status-codes">
Status codes
</h3>
<table>
<thead>
<tr>
<th>
Code
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1">
200 OK
</a>
</td>
<td>
No error
</td>
</tr>
</tbody>
</table>
<h2 id="get-node-status">
Get node status
</h2>
<pre><code>GET /v1/nodes/{int: uid}/status
</code></pre>
<p>
Gets the status of a node. Includes the node's hostname and role in the cluster:
</p>
<ul>
<li>
<p>
Primary nodes return
<code>
"role": "master"
</code>
</p>
</li>
<li>
<p>
Replica nodes return
<code>
"role": "slave"
</code>
</p>
</li>
</ul>
<h4 id="required-permissions-1">
Required permissions
</h4>
<table>
<thead>
<tr>
<th>
Permission name
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="/docs/latest/operate/rs/7.4/references/rest-api/permissions/#view_node_info">
view_node_info
</a>
</td>
</tr>
</tbody>
</table>
<h3 id="get-request">
Request
</h3>
<h4 id="example-http-request-1">
Example HTTP request
</h4>
<pre><code>GET /nodes/1/status
</code></pre>
<h4 id="request-headers-1">
Request headers
</h4>
<table>
<thead>
<tr>
<th>
Key
</th>
<th>
Value
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
Host
</td>
<td>
cnm.cluster.fqdn
</td>
<td>
Domain name
</td>
</tr>
<tr>
<td>
Accept
</td>
<td>
application/json
</td>
<td>
Accepted media type
</td>
</tr>
</tbody>
</table>
<h4 id="url-parameters">
URL parameters
</h4>
<table>
<thead>
<tr>
<th>
Field
</th>
<th>
Type
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
uid
</td>
<td>
integer
</td>
<td>
The node's unique ID.
</td>
</tr>
</tbody>
</table>
<h3 id="get-response">
Response
</h3>
<p>
Returns a JSON object that contains the node's hostname, role, and other status details.
</p>
<p>
If a maintenance snapshot exists due to an in-progress or improperly stopped
<a href="/docs/latest/operate/rs/7.4/clusters/maintenance-mode/">
node maintenance
</a>
process, the response includes a
<code>
maintenance_snapshot
</code>
field.
</p>
<h4 id="example-json-body-1">
Example JSON body
</h4>
<div class="highlight">
<pre class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"cores"</span><span class="p">:</span> <span class="mi">8</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"free_provisional_ram"</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"free_ram"</span><span class="p">:</span> <span class="mi">3504422912</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"hostname"</span><span class="p">:</span> <span class="s2">"3d99db1fdf4b"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"maintenance_snapshot"</span><span class="p">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"created_time"</span><span class="p">:</span> <span class="s2">"2024-09-06 20:47:23"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"name"</span><span class="p">:</span> <span class="s2">"maintenance_mode_2024-09-06_20-47-23"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"node_uid"</span><span class="p">:</span> <span class="s2">"1"</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"master_shards"</span><span class="p">:</span> <span class="p">[],</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"node_overbooking_depth"</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"node_status"</span><span class="p">:</span> <span class="s2">"active"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"role"</span><span class="p">:</span> <span class="s2">"master"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"slave_shards"</span><span class="p">:</span> <span class="p">[],</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"software_version"</span><span class="p">:</span> <span class="s2">"7.4.6-22"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"software_version_sha"</span><span class="p">:</span> <span class="s2">"6c37b1483b5fb6110c8055c1526aa58eec1d29d3519e92310859101419248831"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"total_memory"</span><span class="p">:</span> <span class="mi">6219673600</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"total_provisional_ram"</span><span class="p">:</span> <span class="mi">0</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span></code></pre>
</div>
<h3 id="get-status-codes">
Status codes
</h3>
<table>
<thead>
<tr>
<th>
Code
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1">
200 OK
</a>
</td>
<td>
No error
</td>
</tr>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5">
404 Not Found
</a>
</td>
<td>
Node UID does not exist
</td>
</tr>
</tbody>
</table>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/7.4/references/rest-api/requests/nodes/status/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/7.4/installing-upgrading/install/plan-deployment/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Plan Redis Enterprise Software deployment
</h1>
<p class="text-lg -mt-5 mb-10">
Plan a deployment of Redis Enterprise Software.
</p>
<p>
Before installing Redis Enterprise Software, you need to:
</p>
<ul>
<li>
<p>
Set up your hardware. See
<a href="/docs/latest/operate/rs/7.4/installing-upgrading/install/plan-deployment/hardware-requirements/">
Hardware requirements
</a>
and
<a href="/docs/latest/operate/rs/7.4/installing-upgrading/install/plan-deployment/persistent-ephemeral-storage/">
Persistent and ephemeral node storage
</a>
for more information.
</p>
</li>
<li>
<p>
Choose your
<a href="/docs/latest/operate/rs/7.4/installing-upgrading/install/plan-deployment/supported-platforms/">
deployment platform
</a>
.
</p>
<p>
Redis Enterprise Software supports a variety of platforms, including:
</p>
<ul>
<li>
Multiple Linux distributions (Ubuntu, Red Hat Enterprise Linux (RHEL), IBM CentOS, Oracle Linux)
</li>
<li>
<a href="/docs/latest/operate/rs/7.4/installing-upgrading/install/plan-deployment/configuring-aws-instances/">
Amazon AWS AMI
</a>
</li>
<li>
<a href="/docs/latest/operate/rs/7.4/installing-upgrading/quickstarts/docker-quickstart/">
Docker container
</a>
(for development and testing only)
</li>
<li>
<a href="/docs/latest/operate/kubernetes/">
Kubernetes
</a>
</li>
</ul>
<p>
For more details, see
<a href="/docs/latest/operate/rs/7.4/installing-upgrading/install/plan-deployment/supported-platforms/">
Supported platforms
</a>
.
</p>
</li>
<li>
<p>
Open appropriate
<a href="/docs/latest/operate/rs/7.4/networking/port-configurations/">
network ports
</a>
in the firewall to allow connections to the nodes.
</p>
</li>
<li>
<p>
Configure
<a href="/docs/latest/operate/rs/7.4/networking/cluster-dns/">
cluster DNS
</a>
so that cluster nodes can reach each other by DNS names.
</p>
</li>
<li>
<p>
By default, the installation process requires an internet connection to install dependencies and synchronize the operating system clock. To learn more, see
<a href="/docs/latest/operate/rs/7.4/installing-upgrading/install/offline-installation/">
Offline installation
</a>
.
</p>
</li>
</ul>
<h2 id="next-steps">
Next steps
</h2>
<p>
After you finish planning your deployment, you can:
</p>
<ul>
<li>
<p>
<a href="/docs/latest/operate/rs/7.4/installing-upgrading/install/prepare-install/download-install-package/">
Download an installation package
</a>
.
</p>
</li>
<li>
<p>
<a href="/docs/latest/operate/rs/7.4/installing-upgrading/install/prepare-install/">
Prepare to install
</a>
Redis Enterprise Software.
</p>
</li>
<li>
<p>
<a href="/docs/latest/operate/rs/7.4/installing-upgrading/install/manage-installation-questions/">
View installation questions
</a>
and prepare answers before installation.
</p>
</li>
</ul>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/7.4/installing-upgrading/install/plan-deployment/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redistimeseries/redistimeseries-1.4-release-notes/.html | <section class="prose w-full py-12 max-w-none">
<h1>
RedisTimeSeries 1.4 release notes
</h1>
<p class="text-lg -mt-5 mb-10">
Added ability to backfill time series.
</p>
<h2 id="requirements">
Requirements
</h2>
<p>
RedisTimeSeries v1.4.14 requires:
</p>
<ul>
<li>
Minimum Redis compatibility version (database): 5.0.0
</li>
<li>
Minimum Redis Enterprise Software version (cluster): 6.0.12
</li>
</ul>
<h2 id="v1414-february-2022">
v1.4.14 (February 2022)
</h2>
<p>
This is a maintenance release for RedisTimeSeries 1.4.
</p>
<p>
Update urgency:
<code>
MODERATE
</code>
: Program an upgrade of the server, but it's not urgent.
</p>
<p>
Bug fixes:
</p>
<ul>
<li>
<a href="https://github.com/RedisTimeSeries/RedisTimeSeries/pull/891">
#891
</a>
,
<a href="https://github.com/RedisTimeSeries/RedisTimeSeries/pull/892">
#892
</a>
Fixed memory leak in parseCreateArgs when parsing error occurs (MOD-1958)
</li>
</ul>
<h2 id="v1413-november-2021">
v1.4.13 (November 2021)
</h2>
<p>
This is a maintenance release for RedisTimeSeries 1.4.
</p>
<p>
Update urgency:
<code>
MODERATE
</code>
: Program an upgrade of the server, but it's not urgent.
</p>
<p>
Bug fixes:
</p>
<ul>
<li>
<a href="https://github.com/RedisTimeSeries/RedisTimeSeries/pull/881">
#881
</a>
Replicate only successful insertion of
<code>
TS.MADD
</code>
</li>
</ul>
<h2 id="v1411-november-2021">
v1.4.11 (November 2021)
</h2>
<p>
This is a maintenance release for RedisTimeSeries 1.4.
</p>
<p>
Update urgency:
<code>
MODERATE
</code>
: Program an upgrade of the server, but it's not urgent.
</p>
<p>
Bug fixes:
</p>
<ul>
<li>
<a href="https://github.com/RedisTimeSeries/RedisTimeSeries/pull/862">
#862
</a>
Index dictionary should be freed on removing the last element
</li>
</ul>
<h2 id="v1410-july-2021">
v1.4.10 (July 2021)
</h2>
<p>
This is a maintenance release for RedisTimeSeries 1.4.
</p>
<p>
Update urgency:
<code>
HIGH
</code>
: There is a critical bug that may affect a subset of users. Upgrade!
</p>
<p>
Bug fixes:
</p>
<ul>
<li>
<a href="https://github.com/RedisTimeSeries/RedisTimeSeries/issues/760">
#760
</a>
Avoid closing the same key twice, causing server crash on
<a href="/docs/latest/commands/rename/">
<code>
RENAME
</code>
</a>
of other keys
</li>
</ul>
<h2 id="v149-may-2021">
v1.4.9 (May 2021)
</h2>
<p>
This is a maintenance release for version 1.4.
</p>
<p>
Update urgency: Medium
</p>
<p>
Headlines:
</p>
<ul>
<li>
This release improves overall stability and provides fixes for issues found after the previous release.
</li>
</ul>
<p>
Bug fixes:
</p>
<ul>
<li>
#
<a href="https://github.com/RedisTimeSeries/RedisTimeSeries/issues/712">
#712
</a>
Missing keytype check on TS.INCRBY/DECRBY causes shards to crash
</li>
<li>
#
<a href="https://github.com/RedisTimeSeries/RedisTimeSeries/issues/719">
#719
</a>
Support for renaming time series keys
</li>
</ul>
<h2 id="v148-march-2021">
v1.4.8 (March 2021)
</h2>
<p>
This is a maintenance release for version 1.4.
</p>
<p>
Headlines:
</p>
<ul>
<li>
This release improves overall stability and provides fixes for issues found after the previous release.
</li>
</ul>
<p>
Bug fixes:
</p>
<ul>
<li>
<a href="https://github.com/RedisTimeSeries/RedisTimeSeries/issues/612">
#612
</a>
Crash on
<code>
MGET
</code>
/
<code>
MRANGE
</code>
</li>
<li>
<a href="https://github.com/RedisTimeSeries/RedisTimeSeries/pull/606">
#606
</a>
Memory leak when key loaded from RDB
</li>
<li>
<a href="https://github.com/RedisTimeSeries/RedisTimeSeries/pull/624">
#624
</a>
Uninitialised memory access on log
</li>
</ul>
<h2 id="v147-december-2020">
v1.4.7 (December 2020)
</h2>
<p>
This is a maintenance release for version 1.4.
</p>
<p>
Headlines:
</p>
<ul>
<li>
This release improves overall stability, and provides fixes for issues found after the previous release.
</li>
</ul>
<p>
Bug fixes:
</p>
<ul>
<li>
<a href="https://github.com/RedisTimeSeries/RedisTimeSeries/pull/581">
#581
</a>
Misaligned allocators usage might crash Redis.
</li>
<li>
<a href="https://github.com/RedisTimeSeries/RedisTimeSeries/pull/588">
#588
</a>
<code>
ON_DUPLICATE
</code>
min/max rules not working for negative value.
</li>
</ul>
<h2 id="v146-november-2020">
v1.4.6 (November 2020)
</h2>
<p>
This is a maintenance release for version 1.4.
</p>
<p>
Headlines:
</p>
<p>
This release improves overall stability and provides fixes for issues found after the previous release.
</p>
<p>
Minor enhancements:
</p>
<ul>
<li>
<a href="https://github.com/RedisTimeSeries/RedisTimeSeries/pull/565">
#565
</a>
duplicate policy: add
<code>
SUM
</code>
option: If a previous sample exists, add the new sample to it so that the updated value is equal to (previous + new).
If no previous sample exists, set the updated value equal to the new value. (PR
<a href="https://github.com/RedisTimeSeries/RedisTimeSeries/pull/565">
#565
</a>
</li>
<li>
<a href="https://github.com/RedisTimeSeries/RedisTimeSeries/pull/559">
#559
</a>
Compressed chunk will be be the default global option
</li>
<li>
<a href="https://github.com/RedisTimeSeries/RedisTimeSeries/pull/559">
#559
</a>
Added
<code>
chunkType
</code>
to
<code>
TS.INFO
</code>
</li>
</ul>
<p>
Bug fixes:
</p>
<ul>
<li>
<a href="https://github.com/RedisTimeSeries/RedisTimeSeries/pull/528">
#528
</a>
Out of order insert might crash Redis if there's an update to an empty downsampled key
</li>
<li>
<a href="https://github.com/RedisTimeSeries/RedisTimeSeries/pull/561">
#561
</a>
<code>
TS.MRANGE
</code>
command might crash if there's an expired key that was deleted in the result set
</li>
</ul>
<h2 id="v14-ga-september-2020">
v1.4 GA (September 2020)
</h2>
<p>
This is the General Availability release for RedisTimeSeries 1.4.
</p>
<p>
Highlights:
</p>
<p>
<strong>
Ability to backfill time series!
</strong>
You can now add samples to a time series where the time of the sample is older than the newest sample in the series. This enables:
</p>
<ul>
<li>
Adding out of order of samples to time series.
</li>
<li>
Batch loading of historical samples into an existing series.
</li>
<li>
Updating existing samples (for example for compliance reasons).
</li>
</ul>
<p>
This has been the most requested feature for RedisTimeSeries. We look forward to your feedback so we can move to a general availability release soon.
</p>
<p>
Details:
</p>
<ul>
<li>
Added functionality:
<ul>
<li>
<a href="https://github.com/RedisTimeSeries/RedisTimeSeries/pull/254">
#254
</a>
TS.REVRANGE and TS.MREVRANGE commands allow for querying in descending order of Timestamps.
</li>
<li>
<a href="https://github.com/RedisTimeSeries/RedisTimeSeries/pull/503">
#503
</a>
- RDB saves the whole chunk instead of individual samples giving a speed and space improvement when saving or loading an RDB file
</li>
<li>
<a href="https://github.com/RedisTimeSeries/RedisTimeSeries/pull/502">
#502
</a>
- The ability to set, at creation time, the data section size of each chunk using flag
<code>
CHUNK_SIZE
</code>
. TS.INFO uses
<code>
chunkSize
</code>
instead of
<code>
maxSamplesPerChunk
</code>
.
</li>
<li>
<a href="https://github.com/RedisTimeSeries/RedisTimeSeries/pull/437">
#437
</a>
Allow backfilling of samples and updating of existing samples
<ul>
<li>
Works with
<a href="https://redislabs.com/blog/redistimeseries-version-1-2-is-here/">
compressed
</a>
and uncompressed series.
</li>
<li>
This comes with a performance hit when a sample is written out-of-order. We will publish numbers once we are generally available, but are still considering optimisations.
</li>
</ul>
</li>
<li>
<a href="https://github.com/RedisTimeSeries/RedisTimeSeries/pull/521">
#521
</a>
<code>
DUPLICATE_POLICY
</code>
allows to configure on module, series and sample level how to handle duplicate samples. A duplicate sample is a sample for which the series holds already a sample on the same timestamp. Note that the default behaviour is equal to v1.2:
<code>
BLOCK
</code>
</li>
</ul>
</li>
</ul>
<p>
Notes:
The version inside Redis will be 10405 or 1.4.5 in semantic versioning. Since the version of a module in Redis is numeric, we could not add an GA flag.
</p>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redistimeseries/redistimeseries-1.4-release-notes/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/integrate/redis-data-integration/reference/cli/redis-di-set-secret/.html | <section class="prose w-full py-12">
<h1>
redis-di set-secret
</h1>
<p class="text-lg -mt-5 mb-10">
Creates a secret of a specified key
</p>
<h2 id="usage">
Usage
</h2>
<pre tabindex="0"><code>Usage: redis-di set-secret [OPTIONS] {RDI_REDIS_USERNAME|RDI_REDIS_PASSWORD|RD
I_REDIS_CACERT|RDI_REDIS_CERT|RDI_REDIS_KEY|RDI_RED
IS_KEY_PASSPHRASE|SOURCE_DB_USERNAME|SOURCE_DB_PASS
WORD|SOURCE_DB_CACERT|SOURCE_DB_CERT|SOURCE_DB_KEY|
SOURCE_DB_KEY_PASSWORD|TARGET_DB_USERNAME|TARGET_DB
_PASSWORD|TARGET_DB_CACERT|TARGET_DB_CERT|TARGET_DB
_KEY|TARGET_DB_KEY_PASSWORD} [VALUE]
</code></pre>
<h2 id="options">
Options
</h2>
<ul>
<li>
<p>
<code>
log_level
</code>
:
</p>
<ul>
<li>
Type: Choice(['DEBUG', 'INFO', 'WARN', 'ERROR', 'CRITICAL'])
</li>
<li>
Default:
<code>
info
</code>
</li>
<li>
Usage:
<code>
--log-level -l
</code>
</li>
</ul>
</li>
<li>
<p>
<code>
key
</code>
(REQUIRED):
</p>
<ul>
<li>
Type: Choice(['RDI_REDIS_USERNAME', 'RDI_REDIS_PASSWORD', 'RDI_REDIS_CACERT', 'RDI_REDIS_CERT', 'RDI_REDIS_KEY', 'RDI_REDIS_KEY_PASSPHRASE', 'SOURCE_DB_USERNAME', 'SOURCE_DB_PASSWORD', 'SOURCE_DB_CACERT', 'SOURCE_DB_CERT', 'SOURCE_DB_KEY', 'SOURCE_DB_KEY_PASSWORD', 'TARGET_DB_USERNAME', 'TARGET_DB_PASSWORD', 'TARGET_DB_CACERT', 'TARGET_DB_CERT', 'TARGET_DB_KEY', 'TARGET_DB_KEY_PASSWORD'])
</li>
<li>
Default:
<code>
none
</code>
</li>
<li>
Usage:
<code>
key
</code>
</li>
</ul>
</li>
<li>
<p>
<code>
value
</code>
:
</p>
<ul>
<li>
Type: STRING
</li>
<li>
Default:
<code>
none
</code>
</li>
<li>
Usage:
<code>
value
</code>
</li>
</ul>
</li>
<li>
<p>
<code>
help
</code>
:
</p>
<ul>
<li>
Type: BOOL
</li>
<li>
Default:
<code>
false
</code>
</li>
<li>
Usage:
<code>
--help
</code>
</li>
</ul>
<p>
Show this message and exit.
</p>
</li>
</ul>
<h2 id="cli-help">
CLI help
</h2>
<pre tabindex="0"><code>Usage: redis-di set-secret [OPTIONS] {RDI_REDIS_USERNAME|RDI_REDIS_PASSWORD|RD
I_REDIS_CACERT|RDI_REDIS_CERT|RDI_REDIS_KEY|RDI_RED
IS_KEY_PASSPHRASE|SOURCE_DB_USERNAME|SOURCE_DB_PASS
WORD|SOURCE_DB_CACERT|SOURCE_DB_CERT|SOURCE_DB_KEY|
SOURCE_DB_KEY_PASSWORD|TARGET_DB_USERNAME|TARGET_DB
_PASSWORD|TARGET_DB_CACERT|TARGET_DB_CERT|TARGET_DB
_KEY|TARGET_DB_KEY_PASSWORD} [VALUE]
Creates a secret of a specified key
Options:
-l, --log-level [DEBUG|INFO|WARN|ERROR|CRITICAL]
[default: INFO]
--help Show this message and exit.
</code></pre>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/integrate/redis-data-integration/reference/cli/redis-di-set-secret/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/commands/tdigest.merge.html | <section class="prose w-full py-12">
<h1 class="command-name">
TDIGEST.MERGE
</h1>
<div class="font-semibold text-redis-ink-900">
Syntax
</div>
<pre class="command-syntax">TDIGEST.MERGE destination-key numkeys source-key [source-key ...]
[COMPRESSION compression] [OVERRIDE]</pre>
<dl class="grid grid-cols-[auto,1fr] gap-2 mb-12">
<dt class="font-semibold text-redis-ink-900 m-0">
Available in:
</dt>
<dd class="m-0">
<a href="/docs/stack">
Redis Stack
</a>
/
<a href="/docs/data-types/probabilistic">
Bloom 2.4.0
</a>
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
Time complexity:
</dt>
<dd class="m-0">
O(N*K), where N is the number of centroids and K being the number of input sketches
</dd>
</dl>
<p>
Merges multiple t-digest sketches into a single sketch.
</p>
<h2 id="required-arguments">
Required arguments
</h2>
<details open="">
<summary>
<code>
destination-key
</code>
</summary>
<p>
is key name for a t-digest sketch to merge observation values to.
</p>
<p>
If
<code>
destination-key
</code>
does not exist - a new sketch is created.
</p>
<p>
If
<code>
destination-key
</code>
is an existing sketch, its values are merged with the values of the source keys. To override the destination key contents use
<code>
OVERRIDE
</code>
.
</p>
</details>
<details open="">
<summary>
<code>
numkeys
</code>
</summary>
Number of sketches to merge observation values from (1 or more).
</details>
<details open="">
<summary>
<code>
source-key
</code>
</summary>
each is a key name for a t-digest sketch to merge observation values from.
</details>
<h2 id="optional-arguments">
Optional arguments
</h2>
<details open="">
<summary>
<code>
COMPRESSION compression
</code>
</summary>
<p>
is a controllable tradeoff between accuracy and memory consumption. 100 is a common value for normal uses. 1000 is more accurate. If no value is passed by default the compression will be 100. For more information on scaling of accuracy versus the compression parameter see
<a href="https://www.sciencedirect.com/science/article/pii/S2665963820300403">
<em>
The t-digest: Efficient estimates of distributions
</em>
</a>
.
</p>
<p>
When
<code>
COMPRESSION
</code>
is not specified:
</p>
<ul>
<li>
If
<code>
destination-key
</code>
does not exist or if
<code>
OVERRIDE
</code>
is specified, the compression is set to the maximal value among all source sketches.
</li>
<li>
If
<code>
destination-key
</code>
already exists and
<code>
OVERRIDE
</code>
is not specified, its compression is not changed.
</li>
</ul>
</details>
<details open="">
<summary>
<code>
OVERRIDE
</code>
</summary>
When specified, if `destination-key` already exists, it is overwritten.
</details>
<h2 id="return-value">
Return value
</h2>
<p>
OK on success, error otherwise.
</p>
<h2 id="examples">
Examples
</h2>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">redis> TDIGEST.CREATE s1
</span></span><span class="line"><span class="cl">OK
</span></span><span class="line"><span class="cl">redis> TDIGEST.CREATE s2
</span></span><span class="line"><span class="cl">OK
</span></span><span class="line"><span class="cl">redis> TDIGEST.ADD s1 10.0 20.0
</span></span><span class="line"><span class="cl">OK
</span></span><span class="line"><span class="cl">redis> TDIGEST.ADD s2 30.0 40.0
</span></span><span class="line"><span class="cl">OK
</span></span><span class="line"><span class="cl">redis> TDIGEST.MERGE sM <span class="m">2</span> s1 s2
</span></span><span class="line"><span class="cl">OK
</span></span><span class="line"><span class="cl">redis> TDIGEST.BYRANK sM <span class="m">0</span> <span class="m">1</span> <span class="m">2</span> <span class="m">3</span> <span class="m">4</span>
</span></span><span class="line"><span class="cl">1<span class="o">)</span> <span class="s2">"10"</span>
</span></span><span class="line"><span class="cl">2<span class="o">)</span> <span class="s2">"20"</span>
</span></span><span class="line"><span class="cl">3<span class="o">)</span> <span class="s2">"30"</span>
</span></span><span class="line"><span class="cl">4<span class="o">)</span> <span class="s2">"40"</span>
</span></span><span class="line"><span class="cl">5<span class="o">)</span> <span class="s2">"inf"</span></span></span></code></pre>
</div>
<br/>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/commands/tdigest.merge/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rc/databases/create-database/create-pro-database-existing/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Create a Pro database in an existing subscription
</h1>
<p class="text-lg -mt-5 mb-10">
Shows how to create a Pro database in an existing subscription
</p>
<p>
Before creating a Redis Cloud database, you need to
<a href="/docs/latest/operate/rc/rc-quickstart/">
create an account
</a>
.
</p>
<p>
To create a database in your Redis Cloud account:
</p>
<ol>
<li>
<p>
Sign in to the
<a href="https://cloud.redis.io">
Redis Cloud console
</a>
.
</p>
</li>
<li>
<p>
Select the
<strong>
New database
</strong>
button.
</p>
<a href="/docs/latest/images/rc/button-database-new.png" sdata-lightbox="/images/rc/button-database-new.png">
<img alt="The New Database button creates a new database." src="/docs/latest/images/rc/button-database-new.png" width="120px"/>
</a>
<p>
This displays the
<strong>
Create database
</strong>
screen.
</p>
</li>
<li>
<p>
Select your Redis use case. There are four pre-defined use cases:
</p>
<a href="/docs/latest/images/rc/create-database-redis-use-cases.png" sdata-lightbox="/images/rc/create-database-redis-use-cases.png">
<img alt="The Redis Use case panel" src="/docs/latest/images/rc/create-database-redis-use-cases.png"/>
</a>
<ul>
<li>
<strong>
Cache
</strong>
: Stores short-term or volatile data. Can be used for session management, semantic cache, session store, and other uses where data is short-lived.
</li>
<li>
<strong>
Database
</strong>
: Stores durable and consistent data. Can be used for document databases, feature storage, gaming leaderboards, durable caches, and other uses where your data needs to be highly available and persistent.
</li>
<li>
<strong>
Vector search
</strong>
: Manages and manipulates vector data. Can be used for Generative AI, recommendation systems, visual search, and other uses where you can search and query your data.
</li>
<li>
<strong>
Custom
</strong>
: If your Redis use case doesn't match any of the other use cases, you can choose this option to customize all of your settings.
</li>
</ul>
<p>
Select the use case that best matches your Redis use case. You can always change the settings later.
</p>
</li>
</ol>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Note:
</div>
See
<a href="#use-case-settings">
Use case settings
</a>
to view the default settings for each use case.
</div>
</div>
<ol start="4">
<li>
<p>
Select the type of
<a href="/docs/latest/operate/rc/subscriptions/">
subscription
</a>
you need. For this guide, select
<strong>
Pro
</strong>
, select
<strong>
Existing subscription
</strong>
, and then select your existing pro subscription from the list.
</p>
<a href="/docs/latest/images/rc/create-database-subscription-pro-existing.png" sdata-lightbox="/images/rc/create-database-subscription-pro-existing.png">
<img alt="The Subscription selection panel with Pro selected and an existing subscription selected." src="/docs/latest/images/rc/create-database-subscription-pro-existing.png"/>
</a>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Note:
</div>
<p>
This guide shows how to create a Pro database in an existing subscription.
</p>
<ul>
<li>
If you don't yet have a Pro subscription, see
<a href="/docs/latest/operate/rc/databases/create-database/create-pro-database-new/">
Create a Pro database with a new subscription
</a>
.
</li>
<li>
If you'd rather create an Essentials database, see
<a href="/docs/latest/operate/rc/databases/create-database/create-essentials-database/">
Create an Essentials database
</a>
.
</li>
</ul>
</div>
</div>
</li>
</ol>
<p>
After you select
<strong>
Pro
</strong>
and select your existing subscription from the list, select
<strong>
Continue
</strong>
to go to the
<strong>
New database
</strong>
page.
</p>
<p>
The
<strong>
New database
</strong>
page is divided into sections, each dedicated to a specific category of settings. The following sections provide more details.
</p>
<p>
When you've configured your new database, click the
<strong>
Activate database
</strong>
button to create and activate it.
</p>
<a href="/docs/latest/images/rc/button-database-activate.png" sdata-lightbox="/images/rc/button-database-activate.png">
<img alt="Use the Activate database button to create and activate your database." src="/docs/latest/images/rc/button-database-activate.png" width="150px"/>
</a>
<h2 id="general-section">
General section
</h2>
<p>
The
<strong>
General
</strong>
section defines basic properties about your database.
</p>
<a href="/docs/latest/images/rc/database-new-flexible.png" sdata-lightbox="/images/rc/database-new-flexible.png">
<img alt="The general section of the New Database screen." src="/docs/latest/images/rc/database-new-flexible.png"/>
</a>
<p>
The available settings vary according to your subscription plan:
</p>
<table>
<thead>
<tr>
<th style="text-align:left">
Setting name
</th>
<th style="text-align:left">
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">
<strong>
Subscription
</strong>
</td>
<td style="text-align:left">
Read-only description of your Pro subscription, including cloud provider and region
</td>
</tr>
<tr>
<td style="text-align:left">
<strong>
Active-Active Redis
</strong>
</td>
<td style="text-align:left">
Checked when the subscription supports Active-Active databases
</td>
</tr>
<tr>
<td style="text-align:left">
<strong>
Auto Tiering
</strong>
</td>
<td style="text-align:left">
Checked when the subscription supports Auto Tiering
</td>
</tr>
<tr>
<td style="text-align:left">
<strong>
Database name
</strong>
</td>
<td style="text-align:left">
A name for your database (
<em>
required
</em>
)
</td>
</tr>
<tr>
<td style="text-align:left">
<strong>
Database port
</strong>
</td>
<td style="text-align:left">
Automatically or manually assigns a database port (range: 10000-19999). You cannot assign a port that is reserved or already in use.
</td>
</tr>
<tr>
<td style="text-align:left">
<strong>
Type
</strong>
</td>
<td style="text-align:left">
Controls advanced database capabilities and protocol. Supported values include
<em>
Redis
</em>
and
<em>
Memcached
</em>
</td>
</tr>
<tr>
<td style="text-align:left">
<strong>
Advanced capabilities
</strong>
</td>
<td style="text-align:left">
Advanced data types used by the database. Choose from
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/search/">
Search and query
</a>
,
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/json/">
JSON
</a>
,
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/timeseries/">
Time series
</a>
, or
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/bloom/">
Probabilistic
</a>
.
<br/>
Databases with Search and query have specific sizing requirements, see
<a href="/docs/latest/operate/rc/databases/configuration/advanced-capabilities/#search-and-query-sizing">
Search and query sizing
</a>
for more information.
</td>
</tr>
<tr>
<td style="text-align:left">
<strong>
Query performance factor
</strong>
</td>
<td style="text-align:left">
<em>
(Search and query databases only)
</em>
Adds additional compute power to process your query and vector search workloads and boost your queries per second. See
<a href="/docs/latest/operate/rc/databases/configuration/advanced-capabilities/#search-and-query-sizing">
Search and query sizing
</a>
for more information.
</td>
</tr>
<tr>
<td style="text-align:left">
<strong>
Supported Protocol(s)
</strong>
</td>
<td style="text-align:left">
Choose between RESP2 and RESP3
<em>
(Redis 7.2 only)
</em>
. See
<a href="/docs/latest/develop/reference/protocol-spec/#resp-versions">
Redis serialization protocol
</a>
for details
</td>
</tr>
</tbody>
</table>
<h2 id="scalability-section">
Scalability section
</h2>
<p>
The
<strong>
Scalability
</strong>
section lets you manage the maximum size, throughput, and hashing policy for a database.
</p>
<a href="/docs/latest/images/rc/database-new-flexible-scalability.png" sdata-lightbox="/images/rc/database-new-flexible-scalability.png">
<img alt="Use the Scalability section to control the size, throughput, and hashing policy for a database." src="/docs/latest/images/rc/database-new-flexible-scalability.png"/>
</a>
<table>
<thead>
<tr>
<th style="text-align:left">
Setting name
</th>
<th style="text-align:left">
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">
<strong>
Dataset size
</strong>
</td>
<td style="text-align:left">
Maximum size (in GB) for your dataset. See
<a href="/docs/latest/operate/rc/databases/configuration/clustering/#dataset-size">
Dataset size
</a>
for sizing considerations.
<br/>
Databases with Search and query have specific size requirements, see
<a href="/docs/latest/operate/rc/databases/configuration/advanced-capabilities/#search-and-query-sizing">
Search and query sizing
</a>
for more information.
</td>
</tr>
<tr>
<td style="text-align:left">
<strong>
Throughput
</strong>
</td>
<td style="text-align:left">
Defines throughput in terms of maximum operations per second for the database. See
<a href="/docs/latest/operate/rc/databases/configuration/clustering/#throughput">
Throughput
</a>
for more info.
<br/>
Databases with Search and query have specific throughput requirements, see
<a href="/docs/latest/operate/rc/databases/configuration/advanced-capabilities/#search-and-query-sizing">
Search and query sizing
</a>
for more information.
</td>
</tr>
<tr>
<td style="text-align:left">
<strong>
High availability
</strong>
</td>
<td style="text-align:left">
Replicates your data across multiple nodes, as allowed by your subscription plan. See
<a href="/docs/latest/operate/rc/databases/configuration/high-availability/">
High availability
</a>
for more info
</td>
</tr>
<tr>
<td style="text-align:left">
<strong>
Hashing policy
</strong>
</td>
<td style="text-align:left">
Defines the
<a href="/docs/latest/operate/rc/databases/configuration/clustering/#manage-the-hashing-policy">
hashing policy
</a>
.
</td>
</tr>
<tr>
<td style="text-align:left">
<strong>
OSS Cluster API
</strong>
</td>
<td style="text-align:left">
Enables the
<a href="/docs/latest/operate/rc/databases/configuration/clustering/#oss-cluster-api">
Cluster API
</a>
for a database
<br/>
<br/>
When this option is enabled, you cannot define a custom hashing policy.
</td>
</tr>
</tbody>
</table>
<p>
To learn more about these settings and when to use them, see
<a href="/docs/latest/operate/rc/databases/configuration/clustering/">
Database clustering
</a>
.
</p>
<h2 id="durability-section">
Durability section
</h2>
<p>
The
<strong>
Durability
</strong>
section helps you keep your database (and your data) available when problems occur.
</p>
<a href="/docs/latest/images/rc/database-new-flexible-durability.png" sdata-lightbox="/images/rc/database-new-flexible-durability.png">
<img alt="Use the Durability settings to keep your database (and data) available when problems occur." src="/docs/latest/images/rc/database-new-flexible-durability.png"/>
</a>
<table>
<thead>
<tr>
<th style="text-align:left">
Setting name
</th>
<th style="text-align:left">
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">
<strong>
Data persistence
</strong>
</td>
<td style="text-align:left">
Defines whether (and how) data is saved to disk;
<a href="/docs/latest/operate/rc/databases/configuration/data-persistence/">
available options
</a>
depending on your plan type
</td>
</tr>
<tr>
<td style="text-align:left">
<strong>
Data eviction policy
</strong>
</td>
<td style="text-align:left">
Configures which
<a href="/docs/latest/operate/rc/databases/configuration/data-eviction-policies/">
policy
</a>
is applied when your database reaches its memory limit
</td>
</tr>
<tr>
<td style="text-align:left">
<strong>
Remote backup
</strong>
</td>
<td style="text-align:left">
When enabled, identifies a location and interval for
<a href="/docs/latest/operate/rc/databases/back-up-data/">
data backups
</a>
</td>
</tr>
<tr>
<td style="text-align:left">
<strong>
Active-Passive Redis
</strong>
</td>
<td style="text-align:left">
When enabled, identifies a path to the linked database. See
<a href="/docs/latest/operate/rc/databases/migrate-databases/">
Migrate data
</a>
for more information.
</td>
</tr>
</tbody>
</table>
<h2 id="tags-section">
Tags section
</h2>
<p>
The
<strong>
Tags
</strong>
section lets you add
<a href="/docs/latest/operate/rc/databases/tag-database/">
tags
</a>
to the database.
</p>
<a href="/docs/latest/images/rc/database-new-tags.png" sdata-lightbox="/images/rc/database-new-tags.png">
<img alt="Use the Tag settings to add tags to the database." src="/docs/latest/images/rc/database-new-tags.png"/>
</a>
<p>
Select
<strong>
Add tag
</strong>
to add a tag.
</p>
<a href="/docs/latest/images/rc/tags-button-add-tag.png" sdata-lightbox="/images/rc/tags-button-add-tag.png">
<img alt="The Add tag button." src="/docs/latest/images/rc/tags-button-add-tag.png" width="100px"/>
</a>
<p>
You can select the tag's
<strong>
Key
</strong>
and
<strong>
Value
</strong>
from the suggestions, or you can enter your own.
</p>
<a href="/docs/latest/images/rc/tags-new-tag.png" sdata-lightbox="/images/rc/tags-new-tag.png">
<img alt="The New tag fields." src="/docs/latest/images/rc/tags-new-tag.png"/>
</a>
<p>
A valid tag must follow these guidelines:
</p>
<ul>
<li>
Tag keys must be between 1 and 64 characters long, and values must be at least 1 character long.
</li>
<li>
Tags can only have lowercase letters, numbers, spaces, and these special characters:
<code>
-
</code>
,
<code>
_
</code>
,
<code>
.
</code>
,
<code>
+
</code>
,
<code>
@
</code>
, and
<code>
:
</code>
.
</li>
</ul>
<p>
After you add your first tag, you can:
</p>
<ul>
<li>
<p>
Select the
<strong>
Key
</strong>
or
<strong>
Value
</strong>
field of an existing tag and enter new text to edit it.
</p>
</li>
<li>
<p>
Select
<strong>
Delete
</strong>
next to a tag to delete it.
</p>
<a href="/docs/latest/images/rc/tags-icon-delete.png" sdata-lightbox="/images/rc/tags-icon-delete.png">
<img alt="Delete button." src="/docs/latest/images/rc/tags-icon-delete.png"/>
</a>
</li>
<li>
<p>
Select
<strong>
Add additional tag
</strong>
to add another tag.
</p>
<a href="/docs/latest/images/rc/tags-button-add-additional-tag.png" sdata-lightbox="/images/rc/tags-button-add-additional-tag.png">
<img alt="The Add additional tag button." src="/docs/latest/images/rc/tags-button-add-additional-tag.png" width="200px"/>
</a>
</li>
</ul>
<h2 id="security-section">
Security section
</h2>
<p>
The
<strong>
Security
</strong>
section helps you control access to your database.
</p>
<a href="/docs/latest/images/rc/database-new-flexible-security.png" sdata-lightbox="/images/rc/database-new-flexible-security.png">
<img alt="Use the Security settings to control access to your database." src="/docs/latest/images/rc/database-new-flexible-security.png"/>
</a>
<table>
<thead>
<tr>
<th style="text-align:left">
Setting name
</th>
<th style="text-align:left">
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">
<strong>
Default user
</strong>
</td>
<td style="text-align:left">
When enabled, permits access using a simple password
</td>
</tr>
<tr>
<td style="text-align:left">
<strong>
Redis password
</strong>
</td>
<td style="text-align:left">
Password assigned to the database when created
</td>
</tr>
<tr>
<td style="text-align:left">
<strong>
CIDR allow list
</strong>
</td>
<td style="text-align:left">
<a href="/docs/latest/operate/rc/security/cidr-whitelist/">
Allow list
</a>
of IP addresses/security groups permitted to access the database
</td>
</tr>
<tr>
<td style="text-align:left">
<strong>
Transport layer security (TLS)
</strong>
</td>
<td style="text-align:left">
Enables
<a href="/docs/latest/operate/rc/security/database-security/tls-ssl/">
transport layer security
</a>
(TLS) encryption for database access
</td>
</tr>
</tbody>
</table>
<h2 id="alerts-section">
Alerts section
</h2>
<p>
The
<strong>
Alerts
</strong>
section defines notification emails sent to your account and the conditions that trigger them.
</p>
<a href="/docs/latest/images/rc/database-new-flexible-alerts.png" sdata-lightbox="/images/rc/database-new-flexible-alerts.png">
<img alt="The Alerts section defines the notification emails and their triggering conditions." src="/docs/latest/images/rc/database-new-flexible-alerts.png"/>
</a>
<p>
The available alerts vary according to the subscription type.
</p>
<table>
<thead>
<tr>
<th style="text-align:left">
Setting name
</th>
<th style="text-align:left">
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">
<strong>
Dataset size has reached
</strong>
</td>
<td style="text-align:left">
When enabled, sends an an email when the database reaches the defined memory limit
</td>
</tr>
<tr>
<td style="text-align:left">
<strong>
Latency is higher than
</strong>
</td>
<td style="text-align:left">
When enabled, sends an an email when the latency exceeds the defined limit
</td>
</tr>
<tr>
<td style="text-align:left">
<strong>
Replica Of - database unable to sync with source
</strong>
</td>
<td style="text-align:left">
When enabled, sends email when the replica database cannot sync with the primary (source) database
</td>
</tr>
<tr>
<td style="text-align:left">
<strong>
Replica Of - sync lag is higher than
</strong>
</td>
<td style="text-align:left">
When enabled, sends email when the sync lag exceeds the defined threshold
</td>
</tr>
<tr>
<td style="text-align:left">
<strong>
Throughput is higher than
</strong>
</td>
<td style="text-align:left">
When enabled, sends an email when the operations per second exceed the defined threshold
</td>
</tr>
<tr>
<td style="text-align:left">
<strong>
Throughput is lower than
</strong>
</td>
<td style="text-align:left">
When enabled, sends an email when the operations per second falls below the defined threshold
</td>
</tr>
</tbody>
</table>
<h2 id="use-case-settings">
Use case settings
</h2>
<p>
The following table shows the default use case settings for a Pro database.
</p>
<table>
<thead>
<tr>
<th>
<strong>
Type
</strong>
</th>
<th>
High Availability
</th>
<th>
Data Persistence
</th>
<th>
Eviction Policy
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<strong>
Cache
</strong>
</td>
<td>
Single-zone
</td>
<td>
None
</td>
<td>
<code>
volatile-lru
</code>
</td>
</tr>
<tr>
<td>
<strong>
Database
</strong>
</td>
<td>
Multi-zone
</td>
<td>
Append-only file every 1 sec
</td>
<td>
None
</td>
</tr>
<tr>
<td>
<strong>
Vector Search
</strong>
</td>
<td>
Multi-zone
</td>
<td>
Append-only file every 1 sec
</td>
<td>
None
</td>
</tr>
<tr>
<td>
<strong>
Custom
</strong>
</td>
<td>
Single-zone
</td>
<td>
Append-only file every 1 sec
</td>
<td>
None
</td>
</tr>
</tbody>
</table>
<h2 id="billing-unit-types">
Billing Unit types
</h2>
<p>
The Redis Billing Unit types associated with your Pro subscription depend on your database memory size and throughput requirements.
</p>
<table>
<thead>
<tr>
<th style="text-align:left">
Billing unit type
</th>
<th style="text-align:left">
Capacity (Memory/Throughput)
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">
Nano
<sup>
<a href="#table-note-1">
1
</a>
</sup>
</td>
<td style="text-align:left">
500MB / 500 ops/sec
</td>
</tr>
<tr>
<td style="text-align:left">
Micro
</td>
<td style="text-align:left">
1GB / 1K ops/sec
</td>
</tr>
<tr>
<td style="text-align:left">
High-throughput
</td>
<td style="text-align:left">
2.5GB / 25K ops/sec
</td>
</tr>
<tr>
<td style="text-align:left">
Small
</td>
<td style="text-align:left">
12.5GB / 12.5K ops/sec
</td>
</tr>
<tr>
<td style="text-align:left">
Large
</td>
<td style="text-align:left">
25GB / 25K ops/sec
</td>
</tr>
<tr>
<td style="text-align:left">
Very large
<sup>
<a href="#table-note-2">
2
</a>
</sup>
</td>
<td style="text-align:left">
50GB / 5K ops/sec
</td>
</tr>
<tr>
<td style="text-align:left">
XLarge
<sup>
<a href="#table-note-3">
3
</a>
</sup>
</td>
<td style="text-align:left">
50GB / 10K ops/sec
</td>
</tr>
</tbody>
</table>
<ol>
<li>
<p>
<a name="table-note-1" style="display: block; height: 80px; margin-top: -80px;">
</a>
Not available for databases hosted on external AWS accounts.
</p>
</li>
<li>
<p>
<a name="table-note-2" style="display: block; height: 80px; margin-top: -80px;">
</a>
Used for databases with Auto Tiering before Redis 7.2.
</p>
</li>
<li>
<p>
<a name="table-note-3" style="display: block; height: 80px; margin-top: -80px;">
</a>
Used for hosted databases with Auto Tiering for Redis 7.2 and later.
</p>
</li>
</ol>
<p>
Prices vary according to the cloud provider and region. Minimum prices apply. To learn more, see
<a href="https://redis.com/redis-enterprise-cloud/pricing/">
Cloud pricing
</a>
.
</p>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rc/databases/create-database/create-pro-database-existing/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/commands/bzmpop/.html | <section class="prose w-full py-12">
<h1 class="command-name">
BZMPOP
</h1>
<div class="font-semibold text-redis-ink-900">
Syntax
</div>
<pre class="command-syntax">BZMPOP timeout numkeys key [key ...] <MIN | MAX> [COUNTΒ count]</pre>
<dl class="grid grid-cols-[auto,1fr] gap-2 mb-12">
<dt class="font-semibold text-redis-ink-900 m-0">
Available since:
</dt>
<dd class="m-0">
7.0.0
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
Time complexity:
</dt>
<dd class="m-0">
O(K) + O(M*log(N)) where K is the number of provided keys, N being the number of elements in the sorted set, and M being the number of elements popped.
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
ACL categories:
</dt>
<dd class="m-0">
<code>
@write
</code>
<span class="mr-1 last:hidden">
,
</span>
<code>
@sortedset
</code>
<span class="mr-1 last:hidden">
,
</span>
<code>
@slow
</code>
<span class="mr-1 last:hidden">
,
</span>
<code>
@blocking
</code>
<span class="mr-1 last:hidden">
,
</span>
</dd>
</dl>
<p>
<code>
BZMPOP
</code>
is the blocking variant of
<a href="/docs/latest/commands/zmpop/">
<code>
ZMPOP
</code>
</a>
.
</p>
<p>
When any of the sorted sets contains elements, this command behaves exactly like
<a href="/docs/latest/commands/zmpop/">
<code>
ZMPOP
</code>
</a>
.
When used inside a
<a href="/docs/latest/commands/multi/">
<code>
MULTI
</code>
</a>
/
<a href="/docs/latest/commands/exec/">
<code>
EXEC
</code>
</a>
block, this command behaves exactly like
<a href="/docs/latest/commands/zmpop/">
<code>
ZMPOP
</code>
</a>
.
When all sorted sets are empty, Redis will block the connection until another client adds members to one of the keys or until the
<code>
timeout
</code>
(a double value specifying the maximum number of seconds to block) elapses.
A
<code>
timeout
</code>
of zero can be used to block indefinitely.
</p>
<p>
See
<a href="/docs/latest/commands/zmpop/">
<code>
ZMPOP
</code>
</a>
for more information.
</p>
<h2 id="resp2-reply">
RESP2 Reply
</h2>
<p>
One of the following:
</p>
<ul>
<li>
<a href="../../develop/reference/protocol-spec#bulk-strings">
Nil reply
</a>
: when no element could be popped.
</li>
<li>
<a href="../../develop/reference/protocol-spec#arrays">
Array reply
</a>
: a two-element array with the first element being the name of the key from which elements were popped, and the second element is an array of the popped elements. Every entry in the elements array is also an array that contains the member and its score.
</li>
</ul>
<h2 id="resp3-reply">
RESP3 Reply
</h2>
<p>
One of the following:
</p>
<ul>
<li>
<a href="../../develop/reference/protocol-spec#nulls">
Null reply
</a>
: when no element could be popped.
</li>
<li>
<a href="../../develop/reference/protocol-spec#arrays">
Array reply
</a>
: a two-element array with the first element being the name of the key from which elements were popped, and the second element is an array of the popped elements. Every entry in the elements array is also an array that contains the member and its score.
</li>
</ul>
<br/>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/commands/bzmpop/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/commands/multi/.html | <section class="prose w-full py-12">
<h1 class="command-name">
MULTI
</h1>
<div class="font-semibold text-redis-ink-900">
Syntax
</div>
<pre class="command-syntax">MULTI</pre>
<dl class="grid grid-cols-[auto,1fr] gap-2 mb-12">
<dt class="font-semibold text-redis-ink-900 m-0">
Available since:
</dt>
<dd class="m-0">
1.2.0
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
Time complexity:
</dt>
<dd class="m-0">
O(1)
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
ACL categories:
</dt>
<dd class="m-0">
<code>
@fast
</code>
<span class="mr-1 last:hidden">
,
</span>
<code>
@transaction
</code>
<span class="mr-1 last:hidden">
,
</span>
</dd>
</dl>
<p>
Marks the start of a
<a href="/develop/interact/transactions">
transaction
</a>
block.
Subsequent commands will be queued for atomic execution using
<a href="/docs/latest/commands/exec/">
<code>
EXEC
</code>
</a>
.
</p>
<h2 id="resp2resp3-reply">
RESP2/RESP3 Reply
</h2>
<a href="../../develop/reference/protocol-spec#simple-strings">
Simple string reply
</a>
:
<code>
OK
</code>
.
<br/>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/commands/multi/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/commands/cluster-getkeysinslot/.html | <section class="prose w-full py-12">
<h1 class="command-name">
CLUSTER GETKEYSINSLOT
</h1>
<div class="font-semibold text-redis-ink-900">
Syntax
</div>
<pre class="command-syntax">CLUSTER GETKEYSINSLOT slot count</pre>
<dl class="grid grid-cols-[auto,1fr] gap-2 mb-12">
<dt class="font-semibold text-redis-ink-900 m-0">
Available since:
</dt>
<dd class="m-0">
3.0.0
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
Time complexity:
</dt>
<dd class="m-0">
O(N) where N is the number of requested keys
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
ACL categories:
</dt>
<dd class="m-0">
<code>
@slow
</code>
<span class="mr-1 last:hidden">
,
</span>
</dd>
</dl>
<p>
The command returns an array of keys names stored in the contacted node and
hashing to the specified hash slot. The maximum number of keys to return
is specified via the
<code>
count
</code>
argument, so that it is possible for the user
of this API to batch-processing keys.
</p>
<p>
The main usage of this command is during rehashing of cluster slots from one
node to another. The way the rehashing is performed is exposed in the Redis
Cluster specification, or in a more simple to digest form, as an appendix
of the
<a href="/docs/latest/commands/cluster-setslot/">
<code>
CLUSTER SETSLOT
</code>
</a>
command documentation.
</p>
<pre tabindex="0"><code>> CLUSTER GETKEYSINSLOT 7000 3
1) "key_39015"
2) "key_89793"
3) "key_92937"
</code></pre>
<h2 id="resp2resp3-reply">
RESP2/RESP3 Reply
</h2>
<a href="../../develop/reference/protocol-spec#arrays">
Array reply
</a>
: an array with up to count elements.
<br/>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/commands/cluster-getkeysinslot/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/commands/topk.list.html | <section class="prose w-full py-12">
<h1 class="command-name">
TOPK.LIST
</h1>
<div class="font-semibold text-redis-ink-900">
Syntax
</div>
<pre class="command-syntax">TOPK.LIST key [WITHCOUNT]</pre>
<dl class="grid grid-cols-[auto,1fr] gap-2 mb-12">
<dt class="font-semibold text-redis-ink-900 m-0">
Available in:
</dt>
<dd class="m-0">
<a href="/docs/stack">
Redis Stack
</a>
/
<a href="/docs/data-types/probabilistic">
Bloom 2.0.0
</a>
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
Time complexity:
</dt>
<dd class="m-0">
O(k*log(k)) where k is the value of top-k
</dd>
</dl>
<p>
Return full list of items in Top K list.
</p>
<h3 id="parameters">
Parameters
</h3>
<ul>
<li>
<strong>
key
</strong>
: Name of sketch where item is counted.
</li>
<li>
<strong>
WITHCOUNT
</strong>
: Count of each element is returned.
</li>
</ul>
<h2 id="return">
Return
</h2>
<p>
k (or less) items in Top K list.
</p>
<p>
The list is sorted by decreased count estimation.
</p>
<p>
<a href="/docs/latest/develop/reference/protocol-spec/#arrays">
Array reply
</a>
of
<a href="/docs/latest/develop/reference/protocol-spec/#simple-strings">
Simple string reply
</a>
- the names of items in the TopK list.
If
<code>
WITHCOUNT
</code>
is requested,
<a href="/docs/latest/develop/reference/protocol-spec/#arrays">
Array reply
</a>
of
<a href="/docs/latest/develop/reference/protocol-spec/#simple-strings">
Simple string reply
</a>
and
<a href="/docs/latest/develop/reference/protocol-spec/#integers">
Integer reply
</a>
pairs of the names of items in the TopK list and their count.
</p>
<h2 id="examples">
Examples
</h2>
<pre tabindex="0"><code>TOPK.LIST topk
1) foo
2) 42
3) bar
</code></pre>
<pre tabindex="0"><code>TOPK.LIST topk WITHCOUNT
1) foo
2) (integer) 12
3) 42
4) (integer) 7
5) bar
6) (integer) 2
</code></pre>
<br/>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/commands/topk.list/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/commands/ft.sugget/.html | <section class="prose w-full py-12">
<h1 class="command-name">
FT.SUGGET
</h1>
<div class="font-semibold text-redis-ink-900">
Syntax
</div>
<pre class="command-syntax">FT.SUGGET key prefix
[FUZZY]
[WITHSCORES]
[WITHPAYLOADS]
[MAX max]
</pre>
<dl class="grid grid-cols-[auto,1fr] gap-2 mb-12">
<dt class="font-semibold text-redis-ink-900 m-0">
Available in:
</dt>
<dd class="m-0">
<a href="/docs/stack">
Redis Stack
</a>
/
<a href="/docs/interact/search-and-query">
Search 1.0.0
</a>
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
Time complexity:
</dt>
<dd class="m-0">
O(1)
</dd>
</dl>
<p>
Get completion suggestions for a prefix
</p>
<h2 id="required-arguments">
Required arguments
</h2>
<details open="">
<summary>
<code>
key
</code>
</summary>
<p>
is suggestion dictionary key.
</p>
</details>
<details open="">
<summary>
<code>
prefix
</code>
</summary>
<p>
is prefix to complete on.
</p>
</details>
<h2 id="optional-arguments">
Optional arguments
</h2>
<details open="">
<summary>
<code>
FUZZY
</code>
</summary>
<p>
performs a fuzzy prefix search, including prefixes at Levenshtein distance of 1 from the prefix sent.
</p>
</details>
<details open="">
<summary>
<code>
MAX num
</code>
</summary>
<p>
limits the results to a maximum of
<code>
num
</code>
(default: 5).
</p>
</details>
<details open="">
<summary>
<code>
WITHSCORES
</code>
</summary>
<p>
also returns the score of each suggestion. This can be used to merge results from multiple instances.
</p>
</details>
<details open="">
<summary>
<code>
WITHPAYLOADS
</code>
</summary>
<p>
returns optional payloads saved along with the suggestions. If no payload is present for an entry, it returns a null reply.
</p>
</details>
<h2 id="return">
Return
</h2>
<p>
FT.SUGGET returns an array reply, which is a list of the top suggestions matching the prefix, optionally with score after each entry.
</p>
<h2 id="example">
Example
</h2>
<details open="">
<summary>
<b>
Get completion suggestions for a prefix
</b>
</summary>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">127.0.0.1:6379> FT.SUGGET sug hell FUZZY MAX <span class="m">3</span> WITHSCORES
</span></span><span class="line"><span class="cl">1<span class="o">)</span> <span class="s2">"hell"</span>
</span></span><span class="line"><span class="cl">2<span class="o">)</span> <span class="s2">"2147483648"</span>
</span></span><span class="line"><span class="cl">3<span class="o">)</span> <span class="s2">"hello"</span>
</span></span><span class="line"><span class="cl">4<span class="o">)</span> <span class="s2">"0.70710676908493042"</span></span></span></code></pre>
</div>
</details>
<h2 id="see-also">
See also
</h2>
<p>
<a href="/docs/latest/commands/ft.sugadd/">
<code>
FT.SUGADD
</code>
</a>
|
<a href="/docs/latest/commands/ft.sugdel/">
<code>
FT.SUGDEL
</code>
</a>
|
<a href="/docs/latest/commands/ft.suglen/">
<code>
FT.SUGLEN
</code>
</a>
</p>
<h2 id="related-topics">
Related topics
</h2>
<p>
<a href="/docs/latest/develop/interact/search-and-query/">
RediSearch
</a>
</p>
<br/>
<h2>
History
</h2>
<ul>
<li>
Starting with Redis version 2.0.0: Deprecated
<code>
WITHPAYLOADS
</code>
argument
</li>
</ul>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/commands/ft.sugget/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/databases/active-active/develop/hyperloglog-active-active.md.html | <section class="prose w-full py-12 max-w-none">
<h1>
HyperLogLog in Active-Active databases
</h1>
<p class="text-lg -mt-5 mb-10">
Information about using hyperloglog with an Active-Active database.
</p>
<p>
<strong>
HyperLogLog
</strong>
is an algorithm that addresses the
<a href="https://en.wikipedia.org/wiki/Count-distinct_problem">
count-distinct problem
</a>
.
To do this it approximates the numbers of items in a
<a href="https://en.wikipedia.org/wiki/Multiset">
set
</a>
.
Determining the
<em>
exact
</em>
cardinality of a set requires memory according to the cardinality of the set.
Because it estimates the cardinality by probability, the HyperLogLog algorithm can run with more reasonable memory requirements.
</p>
<h2 id="hyperloglog-in-redis">
HyperLogLog in Redis
</h2>
<p>
Redis Community Edition implements
<a href="https://redislabs.com/redis-best-practices/counting/hyperloglog/">
HyperLogLog
</a>
(HLL) as a native data structure.
It supports adding elements (
<a href="/docs/latest/commands/pfadd/">
PFADD
</a>
to an HLL, counting elements (
<a href="/docs/latest/commands/pfcount/">
PFCOUNT
</a>
of HLLs, and merging of (
<a href="/docs/latest/commands/pfmerge/">
PFMERGE
</a>
HLLs.
</p>
<p>
Here is an example of a simple write case:
</p>
<table>
<thead>
<tr>
<th>
Time
</th>
<th>
Replica 1
</th>
<th>
Replica 2
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
t1
</td>
<td>
PFADD hll x
</td>
<td>
</td>
</tr>
<tr>
<td>
t2
</td>
<td>
--- sync ---
</td>
<td>
</td>
</tr>
<tr>
<td>
t3
</td>
<td>
</td>
<td>
PFADD hll y
</td>
</tr>
<tr>
<td>
t4
</td>
<td>
--- sync ---
</td>
<td>
</td>
</tr>
<tr>
<td>
t5
</td>
<td>
PFCOUNT hll --> 2
</td>
<td>
PFCOUNT hll --> 2
</td>
</tr>
</tbody>
</table>
<p>
Here is an example of a concurrent add case:
</p>
<table>
<thead>
<tr>
<th>
Time
</th>
<th>
Replica 1
</th>
<th>
Replica 2
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
t1
</td>
<td>
PFADD hll x
</td>
<td>
PFADD hll y
</td>
</tr>
<tr>
<td>
t2
</td>
<td>
PFCOUNT hll --> 1
</td>
<td>
PFCOUNT hll --> 1
</td>
</tr>
<tr>
<td>
t3
</td>
<td>
--- sync ---
</td>
<td>
</td>
</tr>
<tr>
<td>
t4
</td>
<td>
PFCOUNT hll --> 2
</td>
<td>
PFCOUNT hll --> 2
</td>
</tr>
</tbody>
</table>
<h2 id="the-del-wins-approach">
The DEL-wins approach
</h2>
<p>
Other collections in the Redis-CRDT implementation use the observed remove method to resolve conflicts.
The CRDT-HLL uses the DEL-wins method.
If a DEL request is received at the same time as any other request (ADD/MERGE/EXPIRE) on the HLL-key
the replicas consistently converge to delete key.
In the observed remove method used by other collections (sets, lists, sorted-sets and hashes),
only the replica that received the DEL request removes the elements, but elements added concurrently in other replicas exist in the consistently converged collection.
We chose to use the DEL-wins method for the CRDT-HLL to maintain the original time and space complexity of the HLL in Redis Community Edition.
</p>
<p>
Here is an example of a DEL-wins case:
</p>
<table>
<thead>
<tr>
<th>
HLL
</th>
<th>
</th>
<th>
</th>
<th>
|
</th>
<th>
Set
</th>
<th>
</th>
<th>
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
|
</td>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
Time
</td>
<td>
Replica 1
</td>
<td>
Replica 2
</td>
<td>
|
</td>
<td>
Time
</td>
<td>
Replica 1
</td>
<td>
Replica 2
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
|
</td>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
t1
</td>
<td>
PFADD h e1
</td>
<td>
</td>
<td>
|
</td>
<td>
t1
</td>
<td>
SADD s e1
</td>
<td>
</td>
</tr>
<tr>
<td>
t2
</td>
<td>
--- sync ---
</td>
<td>
</td>
<td>
|
</td>
<td>
t2
</td>
<td>
--- sync ---
</td>
<td>
</td>
</tr>
<tr>
<td>
t3
</td>
<td>
PFCOUNT h --> 1
</td>
<td>
PFCOUNT h --> 1
</td>
<td>
|
</td>
<td>
t3
</td>
<td>
SCARD s --> 1
</td>
<td>
SCARD s --> 1
</td>
</tr>
<tr>
<td>
t4
</td>
<td>
PFADD h e2
</td>
<td>
Del h
</td>
<td>
|
</td>
<td>
t4
</td>
<td>
SADD s e2
</td>
<td>
Del S
</td>
</tr>
<tr>
<td>
t5
</td>
<td>
PFCOUNT h --> 2
</td>
<td>
PFCOUNT h --> 0
</td>
<td>
|
</td>
<td>
t5
</td>
<td>
SCARD s --> 2
</td>
<td>
SCARD s --> 0
</td>
</tr>
<tr>
<td>
t6
</td>
<td>
--- sync ---
</td>
<td>
</td>
<td>
|
</td>
<td>
t6
</td>
<td>
--- sync ---
</td>
<td>
</td>
</tr>
<tr>
<td>
t7
</td>
<td>
PFCOUNT h --> 0
</td>
<td>
PFCOUNT h --> 0
</td>
<td>
|
</td>
<td>
t7
</td>
<td>
SCARD s --> 1
</td>
<td>
SCARD s --> 1
</td>
</tr>
<tr>
<td>
t8
</td>
<td>
Exists h --> 0
</td>
<td>
Exists h --> 0
</td>
<td>
|
</td>
<td>
t8
</td>
<td>
Exists s --> 1
</td>
<td>
Exists s --> 1
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
|
</td>
<td>
t9
</td>
<td>
SMEMBERS s --> {e2}
</td>
<td>
SMEMBERS s --> {e2}
</td>
</tr>
</tbody>
</table>
<h2 id="hll-in-active-active-databases-versus-hll-in-redis-community-edition">
HLL in Active-Active databases versus HLL in Redis Community Edition
</h2>
<p>
In Active-Active databases, we implemented HLL within the CRDT on the basis of the Redis implementation with a few exceptions:
</p>
<ul>
<li>
Redis keeps the HLL data structure as an encoded string object
such that you can potentially run any string request can on a key that contains an HLL. In CRDT, only get and set are supported for HLL.
</li>
<li>
In CRDT, if you do SET on a key that contains a value encoded as an HLL, then the value will remain an HLL. If the value is not encoded as HLL, then it will be a register.
</li>
</ul>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/databases/active-active/develop/data-types/hyperloglog/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/commands/ft.syndump/.html | <section class="prose w-full py-12">
<h1 class="command-name">
FT.SYNDUMP
</h1>
<div class="font-semibold text-redis-ink-900">
Syntax
</div>
<pre class="command-syntax">FT.SYNDUMP index
</pre>
<dl class="grid grid-cols-[auto,1fr] gap-2 mb-12">
<dt class="font-semibold text-redis-ink-900 m-0">
Available in:
</dt>
<dd class="m-0">
<a href="/docs/stack">
Redis Stack
</a>
/
<a href="/docs/interact/search-and-query">
Search 1.2.0
</a>
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
Time complexity:
</dt>
<dd class="m-0">
O(1)
</dd>
</dl>
<p>
Dump the contents of a synonym group
</p>
<p>
<a href="#examples">
Examples
</a>
</p>
<h2 id="required-arguments">
Required arguments
</h2>
<details open="">
<summary>
<code>
index
</code>
</summary>
<p>
is index name.
</p>
</details>
<p>
Use FT.SYNDUMP to dump the synonyms data structure. This command returns a list of synonym terms and their synonym group ids.
</p>
<h2 id="return">
Return
</h2>
<p>
FT.SYNDUMP returns an array reply, with a pair of
<code>
term
</code>
and an array of synonym groups.
</p>
<h2 id="examples">
Examples
</h2>
<details open="">
<summary>
<b>
Return the contents of a synonym group
</b>
</summary>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">127.0.0.1:6379> FT.SYNDUMP idx
</span></span><span class="line"><span class="cl">1<span class="o">)</span> <span class="s2">"shalom"</span>
</span></span><span class="line"><span class="cl">2<span class="o">)</span> 1<span class="o">)</span> <span class="s2">"synonym1"</span>
</span></span><span class="line"><span class="cl"> 2<span class="o">)</span> <span class="s2">"synonym2"</span>
</span></span><span class="line"><span class="cl">3<span class="o">)</span> <span class="s2">"hi"</span>
</span></span><span class="line"><span class="cl">4<span class="o">)</span> 1<span class="o">)</span> <span class="s2">"synonym1"</span>
</span></span><span class="line"><span class="cl">5<span class="o">)</span> <span class="s2">"hello"</span>
</span></span><span class="line"><span class="cl">6<span class="o">)</span> 1<span class="o">)</span> <span class="s2">"synonym1"</span></span></span></code></pre>
</div>
</details>
<h2 id="see-also">
See also
</h2>
<p>
<a href="/docs/latest/commands/ft.synupdate/">
<code>
FT.SYNUPDATE
</code>
</a>
</p>
<h2 id="related-topics">
Related topics
</h2>
<p>
<a href="/docs/latest/develop/interact/search-and-query/">
RediSearch
</a>
</p>
<br/>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/commands/ft.syndump/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/oss_and_stack/stack-with-enterprise/deprecated-features/graph/commands/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Graph commands
</h1>
<p class="text-lg -mt-5 mb-10">
Lists graph commands and provides links to the command reference pages.
</p>
<div class="banner-article rounded-md">
<p>
Redis, Inc. has announced the end of life of RedisGraph. We will carry out the process gradually and in accordance with our commitment to our customers. See
<a href="https://redis.io/blog/redisgraph-eol/">
details
</a>
.
</p>
</div>
<p>
The following table lists graph commands. See the command links for more information about each command's syntax, arguments, and examples.
</p>
<table>
<thead>
<tr>
<th style="text-align:left">
Command
</th>
<th style="text-align:left">
Redis Enterprise Software
</th>
<th style="text-align:left">
Redis Cloud
<br/>
Flexible & Annual
</th>
<th style="text-align:left">
Redis Cloud
<br/>
Free & Fixed
</th>
<th style="text-align:left">
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">
<a href="https://github.com/RedisGraph/RedisGraph/blob/master/docs/commands/graph.config-get.md">
GRAPH.CONFIG GET
</a>
</td>
<td style="text-align:left">
<span title="Not supported">
<nobr>
β Not supported
</nobr>
</span>
</td>
<td style="text-align:left">
<span title="Not supported">
<nobr>
β οΈ Not supported
</nobr>
</span>
<nobr>
<sup>
<a href="#table-note-2">
2
</a>
</sup>
</nobr>
</td>
<td style="text-align:left">
<span title="Not supported">
<nobr>
β Not supported
</nobr>
</span>
</td>
<td style="text-align:left">
Returns the current value of a
<a href="https://github.com/RedisGraph/RedisGraph/blob/master/docs/docs/configuration.md#redisgraph-configuration-parameters">
RedisGraph configuration parameter
</a>
.
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="https://github.com/RedisGraph/RedisGraph/blob/master/docs/commands/graph.config-set.md">
GRAPH.CONFIG SET
</a>
</td>
<td style="text-align:left">
<span title="Not supported">
<nobr>
β οΈ Not supported
</nobr>
</span>
<nobr>
<sup>
<a href="#table-note-1">
1
</a>
</sup>
</nobr>
</td>
<td style="text-align:left">
<span title="Not supported">
<nobr>
β οΈ Not supported
</nobr>
</span>
<nobr>
<sup>
<a href="#table-note-2">
2
</a>
</sup>
</nobr>
</td>
<td style="text-align:left">
<span title="Not supported">
<nobr>
β Not supported
</nobr>
</span>
</td>
<td style="text-align:left">
Changes the value of a
<a href="https://github.com/RedisGraph/RedisGraph/blob/master/docs/docs/configuration.md#redisgraph-configuration-parameters">
RedisGraph configuration parameter
</a>
.
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="https://github.com/RedisGraph/RedisGraph/blob/master/docs/commands/graph.delete.md">
GRAPH.DELETE
</a>
</td>
<td style="text-align:left">
<span title="Supported">
β
Supported
</span>
</td>
<td style="text-align:left">
<span title="Supported">
β
Supported
</span>
</td>
<td style="text-align:left">
<span title="Supported">
β
Supported
</span>
</td>
<td style="text-align:left">
Removes the graph and its entities.
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="https://github.com/RedisGraph/RedisGraph/blob/master/docs/commands/graph.explain.md">
GRAPH.EXPLAIN
</a>
</td>
<td style="text-align:left">
<span title="Supported">
β
Supported
</span>
</td>
<td style="text-align:left">
<span title="Supported">
β
Supported
</span>
</td>
<td style="text-align:left">
<span title="Supported">
β
Supported
</span>
</td>
<td style="text-align:left">
Displays the query execution plan but does not run the query.
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="https://github.com/RedisGraph/RedisGraph/blob/master/docs/commands/graph.list.md">
GRAPH.LIST
</a>
</td>
<td style="text-align:left">
<span title="Supported">
β
Supported
</span>
</td>
<td style="text-align:left">
<span title="Supported">
β
Supported
</span>
</td>
<td style="text-align:left">
<span title="Supported">
β
Supported
</span>
</td>
<td style="text-align:left">
Lists all graph keys.
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="https://github.com/RedisGraph/RedisGraph/blob/master/docs/commands/graph.profile.md">
GRAPH.PROFILE
</a>
</td>
<td style="text-align:left">
<span title="Supported">
β
Supported
</span>
</td>
<td style="text-align:left">
<span title="Supported">
β
Supported
</span>
</td>
<td style="text-align:left">
<span title="Supported">
β
Supported
</span>
</td>
<td style="text-align:left">
Runs a query and displays the execution plan with metrics for each operation.
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="https://github.com/RedisGraph/RedisGraph/blob/master/docs/commands/graph.query.md">
GRAPH.QUERY
</a>
</td>
<td style="text-align:left">
<span title="Supported">
β
Supported
</span>
</td>
<td style="text-align:left">
<span title="Supported">
β
Supported
</span>
</td>
<td style="text-align:left">
<span title="Supported">
β
Supported
</span>
</td>
<td style="text-align:left">
Runs a query against a graph. Supports a variety of
<a href="https://github.com/RedisGraph/RedisGraph/blob/master/docs/commands/graph.query.md#query-structure">
clauses
</a>
and
<a href="https://github.com/RedisGraph/RedisGraph/blob/master/docs/commands/graph.query.md#functions">
functions
</a>
.
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="https://github.com/RedisGraph/RedisGraph/blob/master/docs/commands/graph.ro_query.md">
GRAPH.RO_QUERY
</a>
</td>
<td style="text-align:left">
<span title="Supported">
β
Supported
</span>
</td>
<td style="text-align:left">
<span title="Supported">
β
Supported
</span>
</td>
<td style="text-align:left">
<span title="Supported">
β
Supported
</span>
</td>
<td style="text-align:left">
Runs a read-only query against a graph.
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="https://github.com/RedisGraph/RedisGraph/blob/master/docs/commands/graph.slowlog.md">
GRAPH.SLOWLOG
</a>
</td>
<td style="text-align:left">
<span title="Supported">
β
Supported
</span>
</td>
<td style="text-align:left">
<span title="Supported">
β
Supported
</span>
</td>
<td style="text-align:left">
<span title="Supported">
β
Supported
</span>
</td>
<td style="text-align:left">
Returns the slowest 10 queries run against a specific graph.
</td>
</tr>
</tbody>
</table>
<ol>
<li>
<p>
<a name="table-note-1" style="display: block; height: 80px; margin-top: -80px;">
</a>
Use
<a href="/docs/latest/operate/rs/references/cli-utilities/rladmin/">
<code>
rladmin
</code>
</a>
or the
<a href="/docs/latest/operate/rs/references/rest-api/">
REST API
</a>
to change RedisGraph configuration for Redis Enterprise Software. See
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/deprecated-features/graph/config/">
RedisGraph configuration compatibility with Redis Enterprise
</a>
for more information and examples.
</p>
</li>
<li>
<p>
<a name="table-note-2" style="display: block; height: 80px; margin-top: -80px;">
</a>
<a href="https://redis.com/company/support/">
Contact support
</a>
to view the current RedisGraph configuration values or request configuration changes for Flexible or Annual Redis Cloud subscriptions.
</p>
</li>
</ol>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/oss_and_stack/stack-with-enterprise/deprecated-features/graph/commands/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/references/rest-api/objects/bootstrap/limits/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Limits object
</h1>
<p class="text-lg -mt-5 mb-10">
Documents the limits object used with Redis Enterprise Software REST API calls.
</p>
<table>
<thead>
<tr>
<th>
Name
</th>
<th>
Type/Value
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
max_listeners
</td>
<td>
integer (default:Β 100)
</td>
<td>
Max allowed listeners on node
</td>
</tr>
<tr>
<td>
max_redis_servers
</td>
<td>
integer (default:Β 100)
</td>
<td>
Max allowed Redis servers on node
</td>
</tr>
</tbody>
</table>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/references/rest-api/objects/bootstrap/limits/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/commands/zrange/.html | <section class="prose w-full py-12">
<h1 class="command-name">
ZRANGE
</h1>
<div class="font-semibold text-redis-ink-900">
Syntax
</div>
<pre class="command-syntax">ZRANGE key start stop [BYSCORE | BYLEX] [REV] [LIMITΒ offset count]
[WITHSCORES]</pre>
<dl class="grid grid-cols-[auto,1fr] gap-2 mb-12">
<dt class="font-semibold text-redis-ink-900 m-0">
Available since:
</dt>
<dd class="m-0">
1.2.0
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
Time complexity:
</dt>
<dd class="m-0">
O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements returned.
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
ACL categories:
</dt>
<dd class="m-0">
<code>
@read
</code>
<span class="mr-1 last:hidden">
,
</span>
<code>
@sortedset
</code>
<span class="mr-1 last:hidden">
,
</span>
<code>
@slow
</code>
<span class="mr-1 last:hidden">
,
</span>
</dd>
</dl>
<p>
Returns the specified range of elements in the sorted set stored at
<code>
<key>
</code>
.
</p>
<p>
<code>
ZRANGE
</code>
can perform different types of range queries: by index (rank), by the score, or by lexicographical order.
</p>
<p>
Starting with Redis 6.2.0, this command can replace the following commands:
<a href="/docs/latest/commands/zrevrange/">
<code>
ZREVRANGE
</code>
</a>
,
<a href="/docs/latest/commands/zrangebyscore/">
<code>
ZRANGEBYSCORE
</code>
</a>
,
<a href="/docs/latest/commands/zrevrangebyscore/">
<code>
ZREVRANGEBYSCORE
</code>
</a>
,
<a href="/docs/latest/commands/zrangebylex/">
<code>
ZRANGEBYLEX
</code>
</a>
and
<a href="/docs/latest/commands/zrevrangebylex/">
<code>
ZREVRANGEBYLEX
</code>
</a>
.
</p>
<h2 id="common-behavior-and-options">
Common behavior and options
</h2>
<p>
The order of elements is from the lowest to the highest score. Elements with the same score are ordered lexicographically.
</p>
<p>
The optional
<code>
REV
</code>
argument reverses the ordering, so elements are ordered from highest to lowest score, and score ties are resolved by reverse lexicographical ordering.
</p>
<p>
The optional
<code>
LIMIT
</code>
argument can be used to obtain a sub-range from the matching elements (similar to
<em>
SELECT LIMIT offset, count
</em>
in SQL).
A negative
<code>
<count>
</code>
returns all elements from the
<code>
<offset>
</code>
. Keep in mind that if
<code>
<offset>
</code>
is large, the sorted set needs to be traversed for
<code>
<offset>
</code>
elements before getting to the elements to return, which can add up to O(N) time complexity.
</p>
<p>
The optional
<code>
WITHSCORES
</code>
argument supplements the command's reply with the scores of elements returned. The returned list contains
<code>
value1,score1,...,valueN,scoreN
</code>
instead of
<code>
value1,...,valueN
</code>
. Client libraries are free to return a more appropriate data type (suggestion: an array with (value, score) arrays/tuples).
</p>
<h2 id="index-ranges">
Index ranges
</h2>
<p>
By default, the command performs an index range query. The
<code>
<start>
</code>
and
<code>
<stop>
</code>
arguments represent zero-based indexes, where
<code>
0
</code>
is the first element,
<code>
1
</code>
is the next element, and so on. These arguments specify an
<strong>
inclusive range
</strong>
, so for example,
<code>
ZRANGE myzset 0 1
</code>
will return both the first and the second element of the sorted set.
</p>
<p>
The indexes can also be negative numbers indicating offsets from the end of the sorted set, with
<code>
-1
</code>
being the last element of the sorted set,
<code>
-2
</code>
the penultimate element, and so on.
</p>
<p>
Out of range indexes do not produce an error.
</p>
<p>
If
<code>
<start>
</code>
is greater than either the end index of the sorted set or
<code>
<stop>
</code>
, an empty list is returned.
</p>
<p>
If
<code>
<stop>
</code>
is greater than the end index of the sorted set, Redis will use the last element of the sorted set.
</p>
<h2 id="score-ranges">
Score ranges
</h2>
<p>
When the
<code>
BYSCORE
</code>
option is provided, the command behaves like
<a href="/docs/latest/commands/zrangebyscore/">
<code>
ZRANGEBYSCORE
</code>
</a>
and returns the range of elements from the sorted set having scores equal or between
<code>
<start>
</code>
and
<code>
<stop>
</code>
.
</p>
<p>
<code>
<start>
</code>
and
<code>
<stop>
</code>
can be
<code>
-inf
</code>
and
<code>
+inf
</code>
, denoting the negative and positive infinities, respectively. This means that you are not required to know the highest or lowest score in the sorted set to get all elements from or up to a certain score.
</p>
<p>
By default, the score intervals specified by
<code>
<start>
</code>
and
<code>
<stop>
</code>
are closed (inclusive).
It is possible to specify an open interval (exclusive) by prefixing the score
with the character
<code>
(
</code>
.
</p>
<p>
For example:
</p>
<pre tabindex="0"><code>ZRANGE zset (1 5 BYSCORE
</code></pre>
<p>
Will return all elements with
<code>
1 < score <= 5
</code>
while:
</p>
<pre tabindex="0"><code>ZRANGE zset (5 (10 BYSCORE
</code></pre>
<p>
Will return all the elements with
<code>
5 < score < 10
</code>
(5 and 10 excluded).
</p>
<h2 id="reverse-ranges">
Reverse ranges
</h2>
<p>
Using the
<code>
REV
</code>
option reverses the sorted set, with index 0 as the element with the highest score.
</p>
<p>
By default,
<code>
<start>
</code>
must be less than or equal to
<code>
<stop>
</code>
to return anything.
However, if the
<code>
BYSCORE
</code>
, or
<code>
BYLEX
</code>
options are selected, the
<code>
<start>
</code>
is the highest score to consider, and
<code>
<stop>
</code>
is the lowest score to consider, therefore
<code>
<start>
</code>
must be greater than or equal to
<code>
<stop>
</code>
in order to return anything.
</p>
<p>
For example:
</p>
<pre tabindex="0"><code>ZRANGE zset 5 10 REV
</code></pre>
<p>
Will return the elements between index 5 and 10 in the reversed index.
</p>
<pre tabindex="0"><code>ZRANGE zset 10 5 REV BYSCORE
</code></pre>
<p>
Will return all elements with scores less than 10 and greater than 5.
</p>
<h2 id="lexicographical-ranges">
Lexicographical ranges
</h2>
<p>
When the
<code>
BYLEX
</code>
option is used, the command behaves like
<a href="/docs/latest/commands/zrangebylex/">
<code>
ZRANGEBYLEX
</code>
</a>
and returns the range of elements from the sorted set between the
<code>
<start>
</code>
and
<code>
<stop>
</code>
lexicographical closed range intervals.
</p>
<p>
Note that lexicographical ordering relies on all elements having the same score. The reply is unspecified when the elements have different scores.
</p>
<p>
Valid
<code>
<start>
</code>
and
<code>
<stop>
</code>
must start with
<code>
(
</code>
or
<code>
[
</code>
, in order to specify
whether the range interval is exclusive or inclusive, respectively.
</p>
<p>
The special values of
<code>
+
</code>
or
<code>
-
</code>
for
<code>
<start>
</code>
and
<code>
<stop>
</code>
mean positive and negative infinite strings, respectively, so for instance the command
<code>
ZRANGE myzset - + BYLEX
</code>
is guaranteed to return all the elements in the sorted set, providing that all the elements have the same score.
</p>
<p>
The
<code>
REV
</code>
options reverses the order of the
<code>
<start>
</code>
and
<code>
<stop>
</code>
elements, where
<code>
<start>
</code>
must be lexicographically greater than
<code>
<stop>
</code>
to produce a non-empty result.
</p>
<h3 id="lexicographical-comparison-of-strings">
Lexicographical comparison of strings
</h3>
<p>
Strings are compared as a binary array of bytes. Because of how the ASCII character set is specified, this means that usually this also have the effect of comparing normal ASCII characters in an obvious dictionary way. However, this is not true if non-plain ASCII strings are used (for example, utf8 strings).
</p>
<p>
However, the user can apply a transformation to the encoded string so that the first part of the element inserted in the sorted set will compare as the user requires for the specific application. For example, if I want to
add strings that will be compared in a case-insensitive way, but I still
want to retrieve the real case when querying, I can add strings in the
following way:
</p>
<pre><code>ZADD autocomplete 0 foo:Foo 0 bar:BAR 0 zap:zap
</code></pre>
<p>
Because of the first
<em>
normalized
</em>
part in every element (before the colon character), we are forcing a given comparison. However, after the range is queried using
<code>
ZRANGE ... BYLEX
</code>
, the application can display to the user the second part of the string, after the colon.
</p>
<p>
The binary nature of the comparison allows to use sorted sets as a general purpose index, for example, the first part of the element can be a 64-bit big-endian number. Since big-endian numbers have the most significant bytes in the initial positions, the binary comparison will match the numerical comparison of the numbers. This can be used in order to implement range queries on 64-bit values. As in the example below, after the first 8 bytes, we can store the value of the element we are indexing.
</p>
<h2 id="examples">
Examples
</h2>
<div class="codetabs cli group flex justify-start items-center flex-wrap box-border rounded-lg mt-0 mb-0 mx-auto bg-slate-900" id="cmds_sorted_set-stepzrange1">
<input checked="" class="radiotab w-0 h-0" data-lang="redis-cli" id="redis-cli_cmds_sorted_set-stepzrange1" name="cmds_sorted_set-stepzrange1" tabindex="1" type="radio"/>
<label class="justify-left label ml-4 pt-3.5 px-3 pb-1 cursor-pointer text-sm text-center bg-redis-ink-900 hover:text-redis-red-600 rounded rounded-mx transition duration-150 ease-in-out" for="redis-cli_cmds_sorted_set-stepzrange1" title="Open example">
>_ Redis CLI
</label>
<div aria-labelledby="tab-cmds_sorted_set-stepzrange1" class="panel order-last hidden w-full mt-0 relative" id="panel_redis-cli_cmds_sorted_set-stepzrange1" role="tabpanel" tabindex="0">
<div class="highlight">
<pre class="chroma"><code class="language-plaintext" data-lang="plaintext"><span class="line hl"><span class="cl">> ZADD myzset 1 "one" 2 "two" 3 "three"
</span></span><span class="line hl"><span class="cl">(integer) 3
</span></span><span class="line hl"><span class="cl">> ZRANGE myzset 0 -1
</span></span><span class="line hl"><span class="cl">1) "one"
</span></span><span class="line hl"><span class="cl">2) "two"
</span></span><span class="line hl"><span class="cl">3) "three"
</span></span><span class="line hl"><span class="cl">> ZRANGE myzset 2 3
</span></span><span class="line hl"><span class="cl">1) "three"
</span></span><span class="line hl"><span class="cl">> ZRANGE myzset -2 -1
</span></span><span class="line hl"><span class="cl">1) "two"
</span></span><span class="line hl"><span class="cl">2) "three"</span></span></code></pre>
</div>
<button class="clipboard-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-10 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="copyCodeToClipboard('#panel_redis-cli_cmds_sorted_set-stepzrange1')" tabindex="1" title="Copy to clipboard">
<svg fill="currentColor" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M9 43.95q-1.2 0-2.1-.9-.9-.9-.9-2.1V10.8h3v30.15h23.7v3Zm6-6q-1.2 0-2.1-.9-.9-.9-.9-2.1v-28q0-1.2.9-2.1.9-.9 2.1-.9h22q1.2 0 2.1.9.9.9.9 2.1v28q0 1.2-.9 2.1-.9.9-2.1.9Zm0-3h22v-28H15v28Zm0 0v-28 28Z">
</path>
</svg>
<div class="tooltip relative inline-block">
<span class="tooltiptext hidden bg-slate-200 rounded rounded-mx text-slate-800 text-center text-xs p-1 absolute right-6 bottom-4">
Copied!
</span>
</div>
</button>
<div class="cli-footer flex items-center justify-between rounded-b-md bg-slate-900 mt-0 px-4 pt-0 mb-0 transition-opacity ease-in-out duration-300 opacity-0 invisible group-hover:opacity-100 group-hover:visible">
<div class="flex-1 text-xs text-white overflow-ellipsis">
Are you tired of using redis-cli? Try Redis Insight - the developer GUI for Redis.
</div>
<div class="text-right">
<a class="rounded rounded-mx px-2 py-1 flex items-center text-white text-xs hover:text-white hover:bg-slate-600 hover:border-transparent focus:outline-none focus:ring-2 focus:white focus:border-slate-500" href="https://redis.com/redis-enterprise/redis-insight/" tabindex="1" title="Get Redis Insight">
<svg class="w-4 h-4 mr-1" fill="none" height="14" viewbox="0 0 14 14" width="14" xmlns="http://www.w3.org/2000/svg">
<path d="M2.26236 5.66895L1.21732 6.07172L7.00018 8.65693V7.79842L2.26236 5.66895Z" fill="#fca5a5">
</path>
<path d="M2.26236 8.02271L1.21732 8.42548L7.00018 11.0119V10.1516L2.26236 8.02271Z" fill="#fca5a5">
</path>
<path d="M1.21732 3.7175L7.00018 6.30392V2.87805L8.66273 2.13423L7.00018 1.49512L1.21732 3.7175Z" fill="#fca5a5">
</path>
<path d="M7.00018 2.8781V6.30366L1.21732 3.71724V5.20004L7.00018 7.79705V8.65526L1.21732 6.07217V7.55496L7.00018 10.1553V11.0135L1.21732 8.42376V9.90656H1.18878L7.00018 12.5051L8.66273 11.7613V2.13428L7.00018 2.8781Z" fill="#f87171">
</path>
<path d="M9.07336 11.5777L10.7359 10.8338V4.01538L9.07336 4.7592V11.5777Z" fill="#f87171">
</path>
<path d="M9.07336 4.75867L10.7359 4.01485L9.07336 3.37573V4.75867Z" fill="#fca5a5">
</path>
<path d="M11.1481 10.6497L12.8112 9.90591V5.896L11.1487 6.63982L11.1481 10.6497Z" fill="#f87171">
</path>
<path d="M11.1481 6.63954L12.8112 5.89572L11.1481 5.25781V6.63954Z" fill="#fca5a5">
</path>
</svg>
<span>
Get Redis Insight
</span>
</a>
</div>
</div>
</div>
<input class="radiotab w-0 h-0" data-lang="python" id="Python_cmds_sorted_set-stepzrange1" name="cmds_sorted_set-stepzrange1" tabindex="1" type="radio"/>
<label class="justify-left label ml-4 pt-3.5 px-3 pb-1 cursor-pointer text-sm text-center bg-redis-ink-900 hover:text-redis-red-600 rounded rounded-mx transition duration-150 ease-in-out" for="Python_cmds_sorted_set-stepzrange1" title="Open example">
Python
</label>
<div aria-labelledby="tab-cmds_sorted_set-stepzrange1" class="panel order-last hidden w-full mt-0 relative" id="panel_Python_cmds_sorted_set-stepzrange1" role="tabpanel" tabindex="0">
<div class="highlight">
<pre class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">redis</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">r</span> <span class="o">=</span> <span class="n">redis</span><span class="o">.</span><span class="n">Redis</span><span class="p">(</span><span class="n">host</span><span class="o">=</span><span class="s2">"localhost"</span><span class="p">,</span> <span class="n">port</span><span class="o">=</span><span class="mi">6379</span><span class="p">,</span> <span class="n">db</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">decode_responses</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">zadd</span><span class="p">(</span><span class="s2">"myzset"</span><span class="p">,</span> <span class="p">{</span><span class="s2">"one"</span><span class="p">:</span> <span class="mi">1</span><span class="p">})</span>
</span></span><span class="line"><span class="cl"><span class="nb">print</span><span class="p">(</span><span class="n">res</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="c1"># >>> 1</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">zadd</span><span class="p">(</span><span class="s2">"myzset"</span><span class="p">,</span> <span class="p">{</span><span class="s2">"uno"</span><span class="p">:</span> <span class="mi">1</span><span class="p">})</span>
</span></span><span class="line"><span class="cl"><span class="nb">print</span><span class="p">(</span><span class="n">res</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="c1"># >>> 1</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">zadd</span><span class="p">(</span><span class="s2">"myzset"</span><span class="p">,</span> <span class="p">{</span><span class="s2">"two"</span><span class="p">:</span> <span class="mi">2</span><span class="p">,</span> <span class="s2">"three"</span><span class="p">:</span> <span class="mi">3</span><span class="p">})</span>
</span></span><span class="line"><span class="cl"><span class="nb">print</span><span class="p">(</span><span class="n">res</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="c1"># >>> 2</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">zrange</span><span class="p">(</span><span class="s2">"myzset"</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">withscores</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="c1"># >>> [('one', 1.0), ('uno', 1.0), ('two', 2.0), ('three', 3.0)]</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line hl"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">zadd</span><span class="p">(</span><span class="s2">"myzset"</span><span class="p">,</span> <span class="p">{</span><span class="s2">"one"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span> <span class="s2">"two"</span><span class="p">:</span><span class="mi">2</span><span class="p">,</span> <span class="s2">"three"</span><span class="p">:</span><span class="mi">3</span><span class="p">})</span>
</span></span><span class="line hl"><span class="cl"><span class="nb">print</span><span class="p">(</span><span class="n">res</span><span class="p">)</span>
</span></span><span class="line hl"><span class="cl"><span class="c1"># >>> 3</span>
</span></span><span class="line hl"><span class="cl">
</span></span><span class="line hl"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">zrange</span><span class="p">(</span><span class="s2">"myzset"</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span>
</span></span><span class="line hl"><span class="cl"><span class="nb">print</span><span class="p">(</span><span class="n">res</span><span class="p">)</span>
</span></span><span class="line hl"><span class="cl"><span class="c1"># >>> ['one', 'two', 'three']</span>
</span></span><span class="line hl"><span class="cl">
</span></span><span class="line hl"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">zrange</span><span class="p">(</span><span class="s2">"myzset"</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span>
</span></span><span class="line hl"><span class="cl"><span class="nb">print</span><span class="p">(</span><span class="n">res</span><span class="p">)</span>
</span></span><span class="line hl"><span class="cl"><span class="c1"># >>> ['three']</span>
</span></span><span class="line hl"><span class="cl">
</span></span><span class="line hl"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">zrange</span><span class="p">(</span><span class="s2">"myzset"</span><span class="p">,</span> <span class="o">-</span><span class="mi">2</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span>
</span></span><span class="line hl"><span class="cl"><span class="nb">print</span><span class="p">(</span><span class="n">res</span><span class="p">)</span>
</span></span><span class="line hl"><span class="cl"><span class="c1"># >>> ['two', 'three']</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">zadd</span><span class="p">(</span><span class="s2">"myzset"</span><span class="p">,</span> <span class="p">{</span><span class="s2">"one"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span> <span class="s2">"two"</span><span class="p">:</span><span class="mi">2</span><span class="p">,</span> <span class="s2">"three"</span><span class="p">:</span><span class="mi">3</span><span class="p">})</span>
</span></span><span class="line"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">zrange</span><span class="p">(</span><span class="s2">"myzset"</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="n">withscores</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="nb">print</span><span class="p">(</span><span class="n">res</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="c1"># >>> [('one', 1.0), ('two', 2.0)]</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">zadd</span><span class="p">(</span><span class="s2">"myzset"</span><span class="p">,</span> <span class="p">{</span><span class="s2">"one"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span> <span class="s2">"two"</span><span class="p">:</span><span class="mi">2</span><span class="p">,</span> <span class="s2">"three"</span><span class="p">:</span><span class="mi">3</span><span class="p">})</span>
</span></span><span class="line"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">zrange</span><span class="p">(</span><span class="s2">"myzset"</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="n">byscore</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">offset</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">num</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="nb">print</span><span class="p">(</span><span class="n">res</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="c1"># >>> ['three']</span>
</span></span></code></pre>
</div>
<button class="clipboard-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-10 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="copyCodeToClipboard('#panel_Python_cmds_sorted_set-stepzrange1')" tabindex="1" title="Copy to clipboard">
<svg fill="currentColor" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M9 43.95q-1.2 0-2.1-.9-.9-.9-.9-2.1V10.8h3v30.15h23.7v3Zm6-6q-1.2 0-2.1-.9-.9-.9-.9-2.1v-28q0-1.2.9-2.1.9-.9 2.1-.9h22q1.2 0 2.1.9.9.9.9 2.1v28q0 1.2-.9 2.1-.9.9-2.1.9Zm0-3h22v-28H15v28Zm0 0v-28 28Z">
</path>
</svg>
<div class="tooltip relative inline-block">
<span class="tooltiptext hidden bg-slate-200 rounded rounded-mx text-slate-800 text-center text-xs p-1 absolute right-6 bottom-4">
Copied!
</span>
</div>
</button>
<button aria-controls="panel_Python_cmds_sorted_set-stepzrange1" class="visibility-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-2 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="toggleVisibleLines(this)" tabindex="1" title="Toggle visibility">
<svg class="hidden" fill="currentColor" id="visibility-off" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="m31.45 27.05-2.2-2.2q1.3-3.55-1.35-5.9-2.65-2.35-5.75-1.2l-2.2-2.2q.85-.55 1.9-.8 1.05-.25 2.15-.25 3.55 0 6.025 2.475Q32.5 19.45 32.5 23q0 1.1-.275 2.175-.275 1.075-.775 1.875Zm6.45 6.45-2-2q2.45-1.8 4.275-4.025Q42 25.25 42.85 23q-2.5-5.55-7.5-8.775Q30.35 11 24.5 11q-2.1 0-4.3.4-2.2.4-3.45.95L14.45 10q1.75-.8 4.475-1.4Q21.65 8 24.25 8q7.15 0 13.075 4.075Q43.25 16.15 46 23q-1.3 3.2-3.35 5.85-2.05 2.65-4.75 4.65Zm2.9 11.3-8.4-8.25q-1.75.7-3.95 1.075T24 38q-7.3 0-13.25-4.075T2 23q1-2.6 2.775-5.075T9.1 13.2L2.8 6.9l2.1-2.15L42.75 42.6ZM11.15 15.3q-1.85 1.35-3.575 3.55Q5.85 21.05 5.1 23q2.55 5.55 7.675 8.775Q17.9 35 24.4 35q1.65 0 3.25-.2t2.4-.6l-3.2-3.2q-.55.25-1.35.375T24 31.5q-3.5 0-6-2.45T15.5 23q0-.75.125-1.5T16 20.15Zm15.25 7.1Zm-5.8 2.9Z">
</path>
</svg>
<svg fill="currentColor" id="visibility-on" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M24 31.5q3.55 0 6.025-2.475Q32.5 26.55 32.5 23q0-3.55-2.475-6.025Q27.55 14.5 24 14.5q-3.55 0-6.025 2.475Q15.5 19.45 15.5 23q0 3.55 2.475 6.025Q20.45 31.5 24 31.5Zm0-2.9q-2.35 0-3.975-1.625T18.4 23q0-2.35 1.625-3.975T24 17.4q2.35 0 3.975 1.625T29.6 23q0 2.35-1.625 3.975T24 28.6Zm0 9.4q-7.3 0-13.2-4.15Q4.9 29.7 2 23q2.9-6.7 8.8-10.85Q16.7 8 24 8q7.3 0 13.2 4.15Q43.1 16.3 46 23q-2.9 6.7-8.8 10.85Q31.3 38 24 38Zm0-15Zm0 12q6.05 0 11.125-3.275T42.85 23q-2.65-5.45-7.725-8.725Q30.05 11 24 11t-11.125 3.275Q7.8 17.55 5.1 23q2.7 5.45 7.775 8.725Q17.95 35 24 35Z">
</path>
</svg>
</button>
<div class="cli-footer flex items-center justify-between rounded-b-md bg-slate-900 mt-0 px-4 pt-0 mb-0 transition-opacity ease-in-out duration-300 opacity-0 invisible group-hover:opacity-100 group-hover:visible">
<a class="rounded rounded-mx px-3 py-1 text-white text-xs hover:text-white hover:bg-slate-600 hover:border-transparent focus:outline-none focus:ring-2 focus:white focus:border-slate-500" href="https://redis.io/docs/latest/develop/connect/clients/python/redis-py/" tabindex="1" title="Quick-Start">
Python Quick-Start
</a>
<div class="w-1/2">
</div>
<div class="flex-1 text-right">
<a class="button text-neutral-400 hover:text-slate-100 h-6 w-6 p-1" href="https://github.com/redis/redis-py/tree/master/doctests/cmds_sorted_set.py" tabindex="1" title="Improve this code example">
<svg fill="github" height="16" viewbox="0 0 18 16" width="18" xmlns="http://www.w3.org/2000/svg">
<path clip-rule="evenodd" d="M8.99953 1.43397e-06C7.09918 -0.000897921 5.26058 0.674713 3.81295 1.90585C2.36533 3.13699 1.40324 4.84324 1.09896 6.71907C0.794684 8.5949 1.1681 10.5178 2.15233 12.1434C3.13657 13.769 4.66734 14.9912 6.47053 15.591C6.87053 15.664 7.01653 15.417 7.01653 15.205C7.01653 15.015 7.00953 14.512 7.00553 13.845C4.78053 14.328 4.31053 12.772 4.31053 12.772C4.16325 12.2887 3.84837 11.8739 3.42253 11.602C2.69653 11.102 3.47753 11.116 3.47753 11.116C3.73043 11.1515 3.97191 11.2442 4.18365 11.3869C4.39539 11.5297 4.57182 11.7189 4.69953 11.94C4.80755 12.1377 4.95378 12.3119 5.12972 12.4526C5.30567 12.5933 5.50782 12.6976 5.72442 12.7595C5.94103 12.8214 6.16778 12.8396 6.39148 12.813C6.61519 12.7865 6.83139 12.7158 7.02753 12.605C7.06381 12.1992 7.24399 11.8197 7.53553 11.535C5.75953 11.335 3.89153 10.647 3.89153 7.581C3.88005 6.78603 4.17513 6.01716 4.71553 5.434C4.47318 4.74369 4.50322 3.98693 4.79953 3.318C4.79953 3.318 5.47053 3.103 6.99953 4.138C8.31074 3.77905 9.69432 3.77905 11.0055 4.138C12.5325 3.103 13.2055 3.318 13.2055 3.318C13.5012 3.9877 13.5294 4.74513 13.2845 5.435C13.8221 6.01928 14.114 6.78817 14.0995 7.582C14.0995 10.655 12.2285 11.332 10.4465 11.53C10.6375 11.724 10.7847 11.9566 10.8784 12.2123C10.972 12.4679 11.0099 12.7405 10.9895 13.012C10.9895 14.081 10.9795 14.944 10.9795 15.206C10.9795 15.42 11.1235 15.669 11.5295 15.591C13.3328 14.9911 14.8636 13.7689 15.8479 12.1432C16.8321 10.5175 17.2054 8.59447 16.901 6.71858C16.5966 4.84268 15.6343 3.13642 14.1865 1.90536C12.7387 0.674306 10.9 -0.0011359 8.99953 1.43397e-06Z" fill="white" fill-rule="evenodd">
</path>
</svg>
</a>
</div>
</div>
</div>
<input class="radiotab w-0 h-0" data-lang="javascript" id="Nodejs_cmds_sorted_set-stepzrange1" name="cmds_sorted_set-stepzrange1" tabindex="1" type="radio"/>
<label class="justify-left label ml-4 pt-3.5 px-3 pb-1 cursor-pointer text-sm text-center bg-redis-ink-900 hover:text-redis-red-600 rounded rounded-mx transition duration-150 ease-in-out" for="Nodejs_cmds_sorted_set-stepzrange1" title="Open example">
Node.js
</label>
<div aria-labelledby="tab-cmds_sorted_set-stepzrange1" class="panel order-last hidden w-full mt-0 relative" id="panel_Nodejs_cmds_sorted_set-stepzrange1" role="tabpanel" tabindex="0">
<div class="highlight">
<pre class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kr">import</span> <span class="p">{</span> <span class="nx">createClient</span> <span class="p">}</span> <span class="nx">from</span> <span class="s1">'redis'</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">client</span> <span class="o">=</span> <span class="nx">createClient</span><span class="p">();</span>
</span></span><span class="line"><span class="cl"><span class="nx">client</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="s1">'error'</span><span class="p">,</span> <span class="nx">err</span> <span class="p">=></span> <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s1">'Redis Client Error'</span><span class="p">,</span> <span class="nx">err</span><span class="p">));</span>
</span></span><span class="line"><span class="cl"><span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">connect</span><span class="p">().</span><span class="k">catch</span><span class="p">(</span><span class="nx">console</span><span class="p">.</span><span class="nx">error</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">val1</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">zAdd</span><span class="p">(</span><span class="s2">"myzset"</span><span class="p">,</span> <span class="p">[{</span> <span class="nx">value</span><span class="o">:</span> <span class="s1">'one'</span><span class="p">,</span> <span class="nx">score</span><span class="o">:</span> <span class="mi">1</span> <span class="p">}]);</span>
</span></span><span class="line"><span class="cl"><span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">val1</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="c1">// returns 1
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">val2</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">zAdd</span><span class="p">(</span><span class="s2">"myzset"</span><span class="p">,</span> <span class="p">[{</span> <span class="nx">value</span><span class="o">:</span> <span class="s1">'uno'</span><span class="p">,</span> <span class="nx">score</span><span class="o">:</span> <span class="mi">1</span> <span class="p">}]);</span>
</span></span><span class="line"><span class="cl"><span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">val2</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="c1">// returns 1
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">val3</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">zAdd</span><span class="p">(</span><span class="s2">"myzset"</span><span class="p">,</span> <span class="p">[{</span> <span class="nx">value</span><span class="o">:</span> <span class="s1">'two'</span><span class="p">,</span> <span class="nx">score</span><span class="o">:</span> <span class="mi">2</span> <span class="p">},</span> <span class="p">{</span> <span class="nx">value</span><span class="o">:</span> <span class="s1">'three'</span><span class="p">,</span> <span class="nx">score</span><span class="o">:</span> <span class="mi">3</span> <span class="p">}]);</span>
</span></span><span class="line"><span class="cl"><span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">val3</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="c1">// returns 2
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">val4</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">zRangeWithScores</span><span class="p">(</span><span class="s2">"myzset"</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">val4</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="c1">// returns [{value: 'one', score: 1}, {value: 'uno', score: 1}, {value: 'two', score: 2}, {value: 'three', score: 3} ]
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line hl"><span class="cl"><span class="kr">const</span> <span class="nx">val5</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">zAdd</span><span class="p">(</span><span class="s2">"myzset"</span><span class="p">,</span> <span class="p">[</span>
</span></span><span class="line hl"><span class="cl"> <span class="p">{</span> <span class="nx">value</span><span class="o">:</span> <span class="s1">'one'</span><span class="p">,</span> <span class="nx">score</span><span class="o">:</span> <span class="mi">1</span> <span class="p">},</span>
</span></span><span class="line hl"><span class="cl"> <span class="p">{</span> <span class="nx">value</span><span class="o">:</span> <span class="s1">'two'</span><span class="p">,</span> <span class="nx">score</span><span class="o">:</span> <span class="mi">2</span> <span class="p">},</span>
</span></span><span class="line hl"><span class="cl"> <span class="p">{</span> <span class="nx">value</span><span class="o">:</span> <span class="s1">'three'</span><span class="p">,</span> <span class="nx">score</span><span class="o">:</span> <span class="mi">3</span> <span class="p">}</span>
</span></span><span class="line hl"><span class="cl"><span class="p">]);</span>
</span></span><span class="line hl"><span class="cl"><span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">val5</span><span class="p">);</span>
</span></span><span class="line hl"><span class="cl"><span class="c1">// returns 3
</span></span></span><span class="line hl"><span class="cl"><span class="c1"></span>
</span></span><span class="line hl"><span class="cl"><span class="kr">const</span> <span class="nx">val6</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">zRange</span><span class="p">(</span><span class="s1">'myzset'</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">);</span>
</span></span><span class="line hl"><span class="cl"><span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">val6</span><span class="p">);</span>
</span></span><span class="line hl"><span class="cl"><span class="c1">// returns ['one', 'two', 'three']
</span></span></span><span class="line hl"><span class="cl"><span class="c1"></span>
</span></span><span class="line hl"><span class="cl"><span class="kr">const</span> <span class="nx">val7</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">zRange</span><span class="p">(</span><span class="s1">'myzset'</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">);</span>
</span></span><span class="line hl"><span class="cl"><span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">val7</span><span class="p">);</span>
</span></span><span class="line hl"><span class="cl"><span class="c1">// returns ['three']
</span></span></span><span class="line hl"><span class="cl"><span class="c1"></span>
</span></span><span class="line hl"><span class="cl"><span class="kr">const</span> <span class="nx">val8</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">zRange</span><span class="p">(</span><span class="s1">'myzset'</span><span class="p">,</span> <span class="o">-</span><span class="mi">2</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">);</span>
</span></span><span class="line hl"><span class="cl"><span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">val8</span><span class="p">);</span>
</span></span><span class="line hl"><span class="cl"><span class="c1">// returns ['two', 'three']
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">val9</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">zAdd</span><span class="p">(</span><span class="s2">"myzset"</span><span class="p">,</span> <span class="p">[</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span> <span class="nx">value</span><span class="o">:</span> <span class="s1">'one'</span><span class="p">,</span> <span class="nx">score</span><span class="o">:</span> <span class="mi">1</span> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span> <span class="nx">value</span><span class="o">:</span> <span class="s1">'two'</span><span class="p">,</span> <span class="nx">score</span><span class="o">:</span> <span class="mi">2</span> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span> <span class="nx">value</span><span class="o">:</span> <span class="s1">'three'</span><span class="p">,</span> <span class="nx">score</span><span class="o">:</span> <span class="mi">3</span> <span class="p">}</span>
</span></span><span class="line"><span class="cl"><span class="p">]);</span>
</span></span><span class="line"><span class="cl"><span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">val9</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="c1">// returns 3
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">val10</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">zRangeWithScores</span><span class="p">(</span><span class="s1">'myzset'</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">val10</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="c1">// returns [{value: 'one', score: 1}, {value: 'two', score: 2}]
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">val11</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">zAdd</span><span class="p">(</span><span class="s2">"myzset"</span><span class="p">,</span> <span class="p">[</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span> <span class="nx">value</span><span class="o">:</span> <span class="s1">'one'</span><span class="p">,</span> <span class="nx">score</span><span class="o">:</span> <span class="mi">1</span> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span> <span class="nx">value</span><span class="o">:</span> <span class="s1">'two'</span><span class="p">,</span> <span class="nx">score</span><span class="o">:</span> <span class="mi">2</span> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span> <span class="nx">value</span><span class="o">:</span> <span class="s1">'three'</span><span class="p">,</span> <span class="nx">score</span><span class="o">:</span> <span class="mi">3</span> <span class="p">}</span>
</span></span><span class="line"><span class="cl"><span class="p">]);</span>
</span></span><span class="line"><span class="cl"><span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">val11</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="c1">// returns 3
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">val12</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">zRange</span><span class="p">(</span><span class="s1">'myzset'</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="p">{</span> <span class="nx">BY</span><span class="o">:</span> <span class="s1">'SCORE'</span><span class="p">,</span> <span class="nx">LIMIT</span><span class="o">:</span> <span class="p">{</span> <span class="nx">offset</span><span class="o">:</span> <span class="mi">1</span><span class="p">,</span> <span class="nx">count</span><span class="o">:</span> <span class="mi">1</span> <span class="p">}</span> <span class="p">});</span>
</span></span><span class="line"><span class="cl"><span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">val12</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="c1">// >>> ['three']
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"><span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">quit</span><span class="p">();</span>
</span></span></code></pre>
</div>
<button class="clipboard-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-10 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="copyCodeToClipboard('#panel_Nodejs_cmds_sorted_set-stepzrange1')" tabindex="1" title="Copy to clipboard">
<svg fill="currentColor" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M9 43.95q-1.2 0-2.1-.9-.9-.9-.9-2.1V10.8h3v30.15h23.7v3Zm6-6q-1.2 0-2.1-.9-.9-.9-.9-2.1v-28q0-1.2.9-2.1.9-.9 2.1-.9h22q1.2 0 2.1.9.9.9.9 2.1v28q0 1.2-.9 2.1-.9.9-2.1.9Zm0-3h22v-28H15v28Zm0 0v-28 28Z">
</path>
</svg>
<div class="tooltip relative inline-block">
<span class="tooltiptext hidden bg-slate-200 rounded rounded-mx text-slate-800 text-center text-xs p-1 absolute right-6 bottom-4">
Copied!
</span>
</div>
</button>
<button aria-controls="panel_Nodejs_cmds_sorted_set-stepzrange1" class="visibility-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-2 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="toggleVisibleLines(this)" tabindex="1" title="Toggle visibility">
<svg class="hidden" fill="currentColor" id="visibility-off" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="m31.45 27.05-2.2-2.2q1.3-3.55-1.35-5.9-2.65-2.35-5.75-1.2l-2.2-2.2q.85-.55 1.9-.8 1.05-.25 2.15-.25 3.55 0 6.025 2.475Q32.5 19.45 32.5 23q0 1.1-.275 2.175-.275 1.075-.775 1.875Zm6.45 6.45-2-2q2.45-1.8 4.275-4.025Q42 25.25 42.85 23q-2.5-5.55-7.5-8.775Q30.35 11 24.5 11q-2.1 0-4.3.4-2.2.4-3.45.95L14.45 10q1.75-.8 4.475-1.4Q21.65 8 24.25 8q7.15 0 13.075 4.075Q43.25 16.15 46 23q-1.3 3.2-3.35 5.85-2.05 2.65-4.75 4.65Zm2.9 11.3-8.4-8.25q-1.75.7-3.95 1.075T24 38q-7.3 0-13.25-4.075T2 23q1-2.6 2.775-5.075T9.1 13.2L2.8 6.9l2.1-2.15L42.75 42.6ZM11.15 15.3q-1.85 1.35-3.575 3.55Q5.85 21.05 5.1 23q2.55 5.55 7.675 8.775Q17.9 35 24.4 35q1.65 0 3.25-.2t2.4-.6l-3.2-3.2q-.55.25-1.35.375T24 31.5q-3.5 0-6-2.45T15.5 23q0-.75.125-1.5T16 20.15Zm15.25 7.1Zm-5.8 2.9Z">
</path>
</svg>
<svg fill="currentColor" id="visibility-on" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M24 31.5q3.55 0 6.025-2.475Q32.5 26.55 32.5 23q0-3.55-2.475-6.025Q27.55 14.5 24 14.5q-3.55 0-6.025 2.475Q15.5 19.45 15.5 23q0 3.55 2.475 6.025Q20.45 31.5 24 31.5Zm0-2.9q-2.35 0-3.975-1.625T18.4 23q0-2.35 1.625-3.975T24 17.4q2.35 0 3.975 1.625T29.6 23q0 2.35-1.625 3.975T24 28.6Zm0 9.4q-7.3 0-13.2-4.15Q4.9 29.7 2 23q2.9-6.7 8.8-10.85Q16.7 8 24 8q7.3 0 13.2 4.15Q43.1 16.3 46 23q-2.9 6.7-8.8 10.85Q31.3 38 24 38Zm0-15Zm0 12q6.05 0 11.125-3.275T42.85 23q-2.65-5.45-7.725-8.725Q30.05 11 24 11t-11.125 3.275Q7.8 17.55 5.1 23q2.7 5.45 7.775 8.725Q17.95 35 24 35Z">
</path>
</svg>
</button>
<div class="cli-footer flex items-center justify-between rounded-b-md bg-slate-900 mt-0 px-4 pt-0 mb-0 transition-opacity ease-in-out duration-300 opacity-0 invisible group-hover:opacity-100 group-hover:visible">
<a class="rounded rounded-mx px-3 py-1 text-white text-xs hover:text-white hover:bg-slate-600 hover:border-transparent focus:outline-none focus:ring-2 focus:white focus:border-slate-500" href="https://redis.io/docs/latest/develop/connect/clients/nodejs/" tabindex="1" title="Quick-Start">
Node.js Quick-Start
</a>
<div class="w-1/2">
</div>
<div class="flex-1 text-right">
<a class="button text-neutral-400 hover:text-slate-100 h-6 w-6 p-1" href="https://github.com/redis/node-redis/tree/emb-examples/doctests/cmds-sorted-set.js" tabindex="1" title="Improve this code example">
<svg fill="github" height="16" viewbox="0 0 18 16" width="18" xmlns="http://www.w3.org/2000/svg">
<path clip-rule="evenodd" d="M8.99953 1.43397e-06C7.09918 -0.000897921 5.26058 0.674713 3.81295 1.90585C2.36533 3.13699 1.40324 4.84324 1.09896 6.71907C0.794684 8.5949 1.1681 10.5178 2.15233 12.1434C3.13657 13.769 4.66734 14.9912 6.47053 15.591C6.87053 15.664 7.01653 15.417 7.01653 15.205C7.01653 15.015 7.00953 14.512 7.00553 13.845C4.78053 14.328 4.31053 12.772 4.31053 12.772C4.16325 12.2887 3.84837 11.8739 3.42253 11.602C2.69653 11.102 3.47753 11.116 3.47753 11.116C3.73043 11.1515 3.97191 11.2442 4.18365 11.3869C4.39539 11.5297 4.57182 11.7189 4.69953 11.94C4.80755 12.1377 4.95378 12.3119 5.12972 12.4526C5.30567 12.5933 5.50782 12.6976 5.72442 12.7595C5.94103 12.8214 6.16778 12.8396 6.39148 12.813C6.61519 12.7865 6.83139 12.7158 7.02753 12.605C7.06381 12.1992 7.24399 11.8197 7.53553 11.535C5.75953 11.335 3.89153 10.647 3.89153 7.581C3.88005 6.78603 4.17513 6.01716 4.71553 5.434C4.47318 4.74369 4.50322 3.98693 4.79953 3.318C4.79953 3.318 5.47053 3.103 6.99953 4.138C8.31074 3.77905 9.69432 3.77905 11.0055 4.138C12.5325 3.103 13.2055 3.318 13.2055 3.318C13.5012 3.9877 13.5294 4.74513 13.2845 5.435C13.8221 6.01928 14.114 6.78817 14.0995 7.582C14.0995 10.655 12.2285 11.332 10.4465 11.53C10.6375 11.724 10.7847 11.9566 10.8784 12.2123C10.972 12.4679 11.0099 12.7405 10.9895 13.012C10.9895 14.081 10.9795 14.944 10.9795 15.206C10.9795 15.42 11.1235 15.669 11.5295 15.591C13.3328 14.9911 14.8636 13.7689 15.8479 12.1432C16.8321 10.5175 17.2054 8.59447 16.901 6.71858C16.5966 4.84268 15.6343 3.13642 14.1865 1.90536C12.7387 0.674306 10.9 -0.0011359 8.99953 1.43397e-06Z" fill="white" fill-rule="evenodd">
</path>
</svg>
</a>
</div>
</div>
</div>
<input class="radiotab w-0 h-0" data-lang="java" id="Java_cmds_sorted_set-stepzrange1" name="cmds_sorted_set-stepzrange1" tabindex="1" type="radio"/>
<label class="justify-left label ml-4 pt-3.5 px-3 pb-1 cursor-pointer text-sm text-center bg-redis-ink-900 hover:text-redis-red-600 rounded rounded-mx transition duration-150 ease-in-out" for="Java_cmds_sorted_set-stepzrange1" title="Open example">
Java
</label>
<div aria-labelledby="tab-cmds_sorted_set-stepzrange1" class="panel order-last hidden w-full mt-0 relative" id="panel_Java_cmds_sorted_set-stepzrange1" role="tabpanel" tabindex="0">
<div class="highlight">
<pre class="chroma"><code class="language-java" data-lang="java"><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">java.util.HashMap</span><span class="o">;</span>
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">java.util.Map</span><span class="o">;</span>
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">java.util.List</span><span class="o">;</span>
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">redis.clients.jedis.UnifiedJedis</span><span class="o">;</span>
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">redis.clients.jedis.params.ZRangeParams</span><span class="o">;</span>
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">redis.clients.jedis.resps.Tuple</span><span class="o">;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kd">public</span> <span class="kd">class</span> <span class="nc">CmdsSortedSetExample</span> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="kd">public</span> <span class="kt">void</span> <span class="nf">run</span><span class="o">()</span> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">UnifiedJedis</span> <span class="n">jedis</span> <span class="o">=</span> <span class="k">new</span> <span class="n">UnifiedJedis</span><span class="o">(</span><span class="s">"redis://localhost:6379"</span><span class="o">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'bzmpop' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'bzpopmax' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'bzpopmin' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">Map</span><span class="o"><</span><span class="n">String</span><span class="o">,</span> <span class="n">Double</span><span class="o">></span> <span class="n">zAddExampleParams</span> <span class="o">=</span> <span class="k">new</span> <span class="n">HashMap</span><span class="o"><>();</span>
</span></span><span class="line"><span class="cl"> <span class="n">zAddExampleParams</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">"one"</span><span class="o">,</span> <span class="mf">1.0</span><span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">long</span> <span class="n">zAddResult1</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">zadd</span><span class="o">(</span><span class="s">"myzset"</span><span class="o">,</span> <span class="n">zAddExampleParams</span><span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">zAddResult1</span><span class="o">);</span> <span class="c1">// >>> 1
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="n">zAddExampleParams</span><span class="o">.</span><span class="na">clear</span><span class="o">();</span>
</span></span><span class="line"><span class="cl"> <span class="n">zAddExampleParams</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">"uno"</span><span class="o">,</span> <span class="mf">1.0</span><span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">long</span> <span class="n">zAddResult2</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">zadd</span><span class="o">(</span><span class="s">"myzset"</span><span class="o">,</span> <span class="n">zAddExampleParams</span><span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">zAddResult2</span><span class="o">);</span> <span class="c1">// >>> 1
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="n">zAddExampleParams</span><span class="o">.</span><span class="na">clear</span><span class="o">();</span>
</span></span><span class="line"><span class="cl"> <span class="n">zAddExampleParams</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">"two"</span><span class="o">,</span> <span class="mf">2.0</span><span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">zAddExampleParams</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">"three"</span><span class="o">,</span> <span class="mf">3.0</span><span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">long</span> <span class="n">zAddResult3</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">zadd</span><span class="o">(</span><span class="s">"myzset"</span><span class="o">,</span> <span class="n">zAddExampleParams</span><span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">zAddResult3</span><span class="o">);</span> <span class="c1">// >>> 2
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="n">List</span><span class="o"><</span><span class="n">Tuple</span><span class="o">></span> <span class="n">zAddResult4</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">zrangeWithScores</span><span class="o">(</span><span class="s">"myzset"</span><span class="o">,</span> <span class="k">new</span> <span class="n">ZRangeParams</span><span class="o">(</span><span class="mi">0</span><span class="o">,</span> <span class="o">-</span><span class="mi">1</span><span class="o">));</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="o">(</span><span class="n">Tuple</span> <span class="n">item</span><span class="o">:</span> <span class="n">zAddResult4</span><span class="o">)</span> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"Element: "</span> <span class="o">+</span> <span class="n">item</span><span class="o">.</span><span class="na">getElement</span><span class="o">()</span> <span class="o">+</span> <span class="s">", Score: "</span> <span class="o">+</span> <span class="n">item</span><span class="o">.</span><span class="na">getScore</span><span class="o">());</span>
</span></span><span class="line"><span class="cl"> <span class="o">}</span>
</span></span><span class="line"><span class="cl"> <span class="c1">// >>> Element: one, Score: 1.0
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="c1">// >>> Element: uno, Score: 1.0
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="c1">// >>> Element: two, Score: 2.0
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="c1">// >>> Element: three, Score: 3.0
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zadd' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zcard' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zcount' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zdiff' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zdiffstore' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zincrby' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zinter' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zintercard' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zinterstore' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zlexcount' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zmpop' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zmscore' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zpopmax' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zpopmin' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrandmember' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line hl"><span class="cl"> <span class="n">Map</span><span class="o"><</span><span class="n">String</span><span class="o">,</span> <span class="n">Double</span><span class="o">></span> <span class="n">zRangeExampleParams1</span> <span class="o">=</span> <span class="k">new</span> <span class="n">HashMap</span><span class="o"><>();</span>
</span></span><span class="line hl"><span class="cl"> <span class="n">zRangeExampleParams1</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">"one"</span><span class="o">,</span> <span class="mf">1.0</span><span class="o">);</span>
</span></span><span class="line hl"><span class="cl"> <span class="n">zRangeExampleParams1</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">"two"</span><span class="o">,</span> <span class="mf">2.0</span><span class="o">);</span>
</span></span><span class="line hl"><span class="cl"> <span class="n">zRangeExampleParams1</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">"three"</span><span class="o">,</span> <span class="mf">3.0</span><span class="o">);</span>
</span></span><span class="line hl"><span class="cl"> <span class="kt">long</span> <span class="n">zRangeResult1</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">zadd</span><span class="o">(</span><span class="s">"myzset"</span><span class="o">,</span> <span class="n">zRangeExampleParams1</span><span class="o">);</span>
</span></span><span class="line hl"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">zRangeResult1</span><span class="o">);</span> <span class="c1">// >>> 3
</span></span></span><span class="line hl"><span class="cl"><span class="c1"></span>
</span></span><span class="line hl"><span class="cl"> <span class="n">List</span><span class="o"><</span><span class="n">String</span><span class="o">></span> <span class="n">zRangeResult2</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">zrange</span><span class="o">(</span><span class="s">"myzset"</span><span class="o">,</span> <span class="k">new</span> <span class="n">ZRangeParams</span><span class="o">(</span><span class="mi">0</span><span class="o">,</span> <span class="o">-</span><span class="mi">1</span><span class="o">));</span>
</span></span><span class="line hl"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">String</span><span class="o">.</span><span class="na">join</span><span class="o">(</span><span class="s">", "</span><span class="o">,</span> <span class="n">zRangeResult2</span><span class="o">));</span> <span class="c1">// >>> one, two, three
</span></span></span><span class="line hl"><span class="cl"><span class="c1"></span>
</span></span><span class="line hl"><span class="cl"> <span class="n">List</span><span class="o"><</span><span class="n">String</span><span class="o">></span> <span class="n">zRangeResult3</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">zrange</span><span class="o">(</span><span class="s">"myzset"</span><span class="o">,</span> <span class="k">new</span> <span class="n">ZRangeParams</span><span class="o">(</span><span class="mi">2</span><span class="o">,</span> <span class="mi">3</span><span class="o">));</span>
</span></span><span class="line hl"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">String</span><span class="o">.</span><span class="na">join</span><span class="o">(</span><span class="s">", "</span><span class="o">,</span> <span class="n">zRangeResult3</span><span class="o">));</span> <span class="c1">// >> three
</span></span></span><span class="line hl"><span class="cl"><span class="c1"></span>
</span></span><span class="line hl"><span class="cl"> <span class="n">List</span><span class="o"><</span><span class="n">String</span><span class="o">></span> <span class="n">zRangeResult4</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">zrange</span><span class="o">(</span><span class="s">"myzset"</span><span class="o">,</span> <span class="k">new</span> <span class="n">ZRangeParams</span><span class="o">(-</span><span class="mi">2</span><span class="o">,</span> <span class="o">-</span><span class="mi">1</span><span class="o">));</span>
</span></span><span class="line hl"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">String</span><span class="o">.</span><span class="na">join</span><span class="o">(</span><span class="s">", "</span><span class="o">,</span> <span class="n">zRangeResult4</span><span class="o">));</span> <span class="c1">// >> two, three
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrange1' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">Map</span><span class="o"><</span><span class="n">String</span><span class="o">,</span> <span class="n">Double</span><span class="o">></span> <span class="n">zRangeExampleParams2</span> <span class="o">=</span> <span class="k">new</span> <span class="n">HashMap</span><span class="o"><>();</span>
</span></span><span class="line"><span class="cl"> <span class="n">zRangeExampleParams2</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">"one"</span><span class="o">,</span> <span class="mf">1.0</span><span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">zRangeExampleParams2</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">"two"</span><span class="o">,</span> <span class="mf">2.0</span><span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">zRangeExampleParams2</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">"three"</span><span class="o">,</span> <span class="mf">3.0</span><span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">long</span> <span class="n">zRangeResult5</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">zadd</span><span class="o">(</span><span class="s">"myzset"</span><span class="o">,</span> <span class="n">zRangeExampleParams2</span><span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">zRangeResult5</span><span class="o">);</span> <span class="c1">// >>> 3
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="n">List</span><span class="o"><</span><span class="n">Tuple</span><span class="o">></span> <span class="n">zRangeResult6</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">zrangeWithScores</span><span class="o">(</span><span class="s">"myzset"</span><span class="o">,</span> <span class="k">new</span> <span class="n">ZRangeParams</span><span class="o">(</span><span class="mi">0</span><span class="o">,</span> <span class="mi">1</span><span class="o">));</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="o">(</span><span class="n">Tuple</span> <span class="n">item</span><span class="o">:</span> <span class="n">zRangeResult6</span><span class="o">)</span> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"Element: "</span> <span class="o">+</span> <span class="n">item</span><span class="o">.</span><span class="na">getElement</span><span class="o">()</span> <span class="o">+</span> <span class="s">", Score: "</span> <span class="o">+</span> <span class="n">item</span><span class="o">.</span><span class="na">getScore</span><span class="o">());</span>
</span></span><span class="line"><span class="cl"> <span class="o">}</span>
</span></span><span class="line"><span class="cl"> <span class="c1">// >>> Element: one, Score: 1.0
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="c1">// >>> Element: two, Score: 2.0
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrange2' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">Map</span><span class="o"><</span><span class="n">String</span><span class="o">,</span> <span class="n">Double</span><span class="o">></span> <span class="n">zRangeExampleParams3</span> <span class="o">=</span> <span class="k">new</span> <span class="n">HashMap</span><span class="o"><>();</span>
</span></span><span class="line"><span class="cl"> <span class="n">zRangeExampleParams3</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">"one"</span><span class="o">,</span> <span class="mf">1.0</span><span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">zRangeExampleParams3</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">"two"</span><span class="o">,</span> <span class="mf">2.0</span><span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">zRangeExampleParams3</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">"three"</span><span class="o">,</span> <span class="mf">3.0</span><span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">long</span> <span class="n">zRangeResult7</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">zadd</span><span class="o">(</span><span class="s">"myzset"</span><span class="o">,</span> <span class="n">zRangeExampleParams3</span><span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">zRangeResult7</span><span class="o">);</span> <span class="c1">// >>> 3
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="n">List</span><span class="o"><</span><span class="n">String</span><span class="o">></span> <span class="n">zRangeResult8</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">zrangeByScore</span><span class="o">(</span><span class="s">"myzset"</span><span class="o">,</span> <span class="s">"(1"</span><span class="o">,</span> <span class="s">"+inf"</span><span class="o">,</span> <span class="mi">1</span><span class="o">,</span> <span class="mi">1</span><span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">String</span><span class="o">.</span><span class="na">join</span><span class="o">(</span><span class="s">", "</span><span class="o">,</span> <span class="n">zRangeResult8</span><span class="o">));</span> <span class="c1">// >>> three
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrange3' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrangebylex' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrangebyscore' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrangestore' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrank' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrem' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zremrangebylex' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zremrangebyrank' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zremrangebyscore' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrevrange' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrevrangebylex' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrevrangebyscore' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrevrank' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zscan' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zscore' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zunion' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zunionstore' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="o">}</span>
</span></span><span class="line"><span class="cl"><span class="o">}</span>
</span></span><span class="line"><span class="cl">
</span></span></code></pre>
</div>
<button class="clipboard-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-10 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="copyCodeToClipboard('#panel_Java_cmds_sorted_set-stepzrange1')" tabindex="1" title="Copy to clipboard">
<svg fill="currentColor" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M9 43.95q-1.2 0-2.1-.9-.9-.9-.9-2.1V10.8h3v30.15h23.7v3Zm6-6q-1.2 0-2.1-.9-.9-.9-.9-2.1v-28q0-1.2.9-2.1.9-.9 2.1-.9h22q1.2 0 2.1.9.9.9.9 2.1v28q0 1.2-.9 2.1-.9.9-2.1.9Zm0-3h22v-28H15v28Zm0 0v-28 28Z">
</path>
</svg>
<div class="tooltip relative inline-block">
<span class="tooltiptext hidden bg-slate-200 rounded rounded-mx text-slate-800 text-center text-xs p-1 absolute right-6 bottom-4">
Copied!
</span>
</div>
</button>
<button aria-controls="panel_Java_cmds_sorted_set-stepzrange1" class="visibility-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-2 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="toggleVisibleLines(this)" tabindex="1" title="Toggle visibility">
<svg class="hidden" fill="currentColor" id="visibility-off" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="m31.45 27.05-2.2-2.2q1.3-3.55-1.35-5.9-2.65-2.35-5.75-1.2l-2.2-2.2q.85-.55 1.9-.8 1.05-.25 2.15-.25 3.55 0 6.025 2.475Q32.5 19.45 32.5 23q0 1.1-.275 2.175-.275 1.075-.775 1.875Zm6.45 6.45-2-2q2.45-1.8 4.275-4.025Q42 25.25 42.85 23q-2.5-5.55-7.5-8.775Q30.35 11 24.5 11q-2.1 0-4.3.4-2.2.4-3.45.95L14.45 10q1.75-.8 4.475-1.4Q21.65 8 24.25 8q7.15 0 13.075 4.075Q43.25 16.15 46 23q-1.3 3.2-3.35 5.85-2.05 2.65-4.75 4.65Zm2.9 11.3-8.4-8.25q-1.75.7-3.95 1.075T24 38q-7.3 0-13.25-4.075T2 23q1-2.6 2.775-5.075T9.1 13.2L2.8 6.9l2.1-2.15L42.75 42.6ZM11.15 15.3q-1.85 1.35-3.575 3.55Q5.85 21.05 5.1 23q2.55 5.55 7.675 8.775Q17.9 35 24.4 35q1.65 0 3.25-.2t2.4-.6l-3.2-3.2q-.55.25-1.35.375T24 31.5q-3.5 0-6-2.45T15.5 23q0-.75.125-1.5T16 20.15Zm15.25 7.1Zm-5.8 2.9Z">
</path>
</svg>
<svg fill="currentColor" id="visibility-on" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M24 31.5q3.55 0 6.025-2.475Q32.5 26.55 32.5 23q0-3.55-2.475-6.025Q27.55 14.5 24 14.5q-3.55 0-6.025 2.475Q15.5 19.45 15.5 23q0 3.55 2.475 6.025Q20.45 31.5 24 31.5Zm0-2.9q-2.35 0-3.975-1.625T18.4 23q0-2.35 1.625-3.975T24 17.4q2.35 0 3.975 1.625T29.6 23q0 2.35-1.625 3.975T24 28.6Zm0 9.4q-7.3 0-13.2-4.15Q4.9 29.7 2 23q2.9-6.7 8.8-10.85Q16.7 8 24 8q7.3 0 13.2 4.15Q43.1 16.3 46 23q-2.9 6.7-8.8 10.85Q31.3 38 24 38Zm0-15Zm0 12q6.05 0 11.125-3.275T42.85 23q-2.65-5.45-7.725-8.725Q30.05 11 24 11t-11.125 3.275Q7.8 17.55 5.1 23q2.7 5.45 7.775 8.725Q17.95 35 24 35Z">
</path>
</svg>
</button>
<div class="cli-footer flex items-center justify-between rounded-b-md bg-slate-900 mt-0 px-4 pt-0 mb-0 transition-opacity ease-in-out duration-300 opacity-0 invisible group-hover:opacity-100 group-hover:visible">
<a class="rounded rounded-mx px-3 py-1 text-white text-xs hover:text-white hover:bg-slate-600 hover:border-transparent focus:outline-none focus:ring-2 focus:white focus:border-slate-500" href="https://redis.io/docs/latest/develop/connect/clients/java/jedis/" tabindex="1" title="Quick-Start">
Java Quick-Start
</a>
<div class="w-1/2">
</div>
<div class="flex-1 text-right">
<a class="button text-neutral-400 hover:text-slate-100 h-6 w-6 p-1" href="https://github.com/redis/jedis/tree/master/src/test/java/io/redis/examples/CmdsSortedSetExample.java" tabindex="1" title="Improve this code example">
<svg fill="github" height="16" viewbox="0 0 18 16" width="18" xmlns="http://www.w3.org/2000/svg">
<path clip-rule="evenodd" d="M8.99953 1.43397e-06C7.09918 -0.000897921 5.26058 0.674713 3.81295 1.90585C2.36533 3.13699 1.40324 4.84324 1.09896 6.71907C0.794684 8.5949 1.1681 10.5178 2.15233 12.1434C3.13657 13.769 4.66734 14.9912 6.47053 15.591C6.87053 15.664 7.01653 15.417 7.01653 15.205C7.01653 15.015 7.00953 14.512 7.00553 13.845C4.78053 14.328 4.31053 12.772 4.31053 12.772C4.16325 12.2887 3.84837 11.8739 3.42253 11.602C2.69653 11.102 3.47753 11.116 3.47753 11.116C3.73043 11.1515 3.97191 11.2442 4.18365 11.3869C4.39539 11.5297 4.57182 11.7189 4.69953 11.94C4.80755 12.1377 4.95378 12.3119 5.12972 12.4526C5.30567 12.5933 5.50782 12.6976 5.72442 12.7595C5.94103 12.8214 6.16778 12.8396 6.39148 12.813C6.61519 12.7865 6.83139 12.7158 7.02753 12.605C7.06381 12.1992 7.24399 11.8197 7.53553 11.535C5.75953 11.335 3.89153 10.647 3.89153 7.581C3.88005 6.78603 4.17513 6.01716 4.71553 5.434C4.47318 4.74369 4.50322 3.98693 4.79953 3.318C4.79953 3.318 5.47053 3.103 6.99953 4.138C8.31074 3.77905 9.69432 3.77905 11.0055 4.138C12.5325 3.103 13.2055 3.318 13.2055 3.318C13.5012 3.9877 13.5294 4.74513 13.2845 5.435C13.8221 6.01928 14.114 6.78817 14.0995 7.582C14.0995 10.655 12.2285 11.332 10.4465 11.53C10.6375 11.724 10.7847 11.9566 10.8784 12.2123C10.972 12.4679 11.0099 12.7405 10.9895 13.012C10.9895 14.081 10.9795 14.944 10.9795 15.206C10.9795 15.42 11.1235 15.669 11.5295 15.591C13.3328 14.9911 14.8636 13.7689 15.8479 12.1432C16.8321 10.5175 17.2054 8.59447 16.901 6.71858C16.5966 4.84268 15.6343 3.13642 14.1865 1.90536C12.7387 0.674306 10.9 -0.0011359 8.99953 1.43397e-06Z" fill="white" fill-rule="evenodd">
</path>
</svg>
</a>
</div>
</div>
</div>
<input class="radiotab w-0 h-0" data-lang="go" id="Go_cmds_sorted_set-stepzrange1" name="cmds_sorted_set-stepzrange1" tabindex="1" type="radio"/>
<label class="justify-left label ml-4 pt-3.5 px-3 pb-1 cursor-pointer text-sm text-center bg-redis-ink-900 hover:text-redis-red-600 rounded rounded-mx transition duration-150 ease-in-out" for="Go_cmds_sorted_set-stepzrange1" title="Open example">
Go
</label>
<div aria-labelledby="tab-cmds_sorted_set-stepzrange1" class="panel order-last hidden w-full mt-0 relative" id="panel_Go_cmds_sorted_set-stepzrange1" role="tabpanel" tabindex="0">
<div class="highlight">
<pre class="chroma"><code class="language-go" data-lang="go"><span class="line"><span class="cl"><span class="kn">package</span> <span class="nx">example_commands_test</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="s">"context"</span>
</span></span><span class="line"><span class="cl"> <span class="s">"fmt"</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="s">"github.com/redis/go-redis/v9"</span>
</span></span><span class="line"><span class="cl"><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kd">func</span> <span class="nf">ExampleClient_zadd_cmd</span><span class="p">()</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">ctx</span> <span class="o">:=</span> <span class="nx">context</span><span class="p">.</span><span class="nf">Background</span><span class="p">()</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="nx">rdb</span> <span class="o">:=</span> <span class="nx">redis</span><span class="p">.</span><span class="nf">NewClient</span><span class="p">(</span><span class="o">&</span><span class="nx">redis</span><span class="p">.</span><span class="nx">Options</span><span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Addr</span><span class="p">:</span> <span class="s">"localhost:6379"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Password</span><span class="p">:</span> <span class="s">""</span><span class="p">,</span> <span class="c1">// no password docs
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="nx">DB</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span> <span class="c1">// use default DB
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="p">})</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="nx">zAddResult1</span><span class="p">,</span> <span class="nx">err</span> <span class="o">:=</span> <span class="nx">rdb</span><span class="p">.</span><span class="nf">ZAdd</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"myzset"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">redis</span><span class="p">.</span><span class="nx">Z</span><span class="p">{</span><span class="nx">Member</span><span class="p">:</span> <span class="s">"one"</span><span class="p">,</span> <span class="nx">Score</span><span class="p">:</span> <span class="mi">1</span><span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="p">).</span><span class="nf">Result</span><span class="p">()</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="nx">err</span> <span class="o">!=</span> <span class="kc">nil</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nb">panic</span><span class="p">(</span><span class="nx">err</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="nx">fmt</span><span class="p">.</span><span class="nf">Println</span><span class="p">(</span><span class="nx">zAddResult1</span><span class="p">)</span> <span class="c1">// >>> 1
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="nx">zAddResult2</span><span class="p">,</span> <span class="nx">err</span> <span class="o">:=</span> <span class="nx">rdb</span><span class="p">.</span><span class="nf">ZAdd</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"myzset"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">redis</span><span class="p">.</span><span class="nx">Z</span><span class="p">{</span><span class="nx">Member</span><span class="p">:</span> <span class="s">"uno"</span><span class="p">,</span> <span class="nx">Score</span><span class="p">:</span> <span class="mi">1</span><span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="p">).</span><span class="nf">Result</span><span class="p">()</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="nx">err</span> <span class="o">!=</span> <span class="kc">nil</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nb">panic</span><span class="p">(</span><span class="nx">err</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="nx">fmt</span><span class="p">.</span><span class="nf">Println</span><span class="p">(</span><span class="nx">zAddResult2</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="nx">zAddResult3</span><span class="p">,</span> <span class="nx">err</span> <span class="o">:=</span> <span class="nx">rdb</span><span class="p">.</span><span class="nf">ZAdd</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"myzset"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">redis</span><span class="p">.</span><span class="nx">Z</span><span class="p">{</span><span class="nx">Member</span><span class="p">:</span> <span class="s">"two"</span><span class="p">,</span> <span class="nx">Score</span><span class="p">:</span> <span class="mi">2</span><span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="nx">redis</span><span class="p">.</span><span class="nx">Z</span><span class="p">{</span><span class="nx">Member</span><span class="p">:</span> <span class="s">"three"</span><span class="p">,</span> <span class="nx">Score</span><span class="p">:</span> <span class="mi">3</span><span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="p">).</span><span class="nf">Result</span><span class="p">()</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="nx">err</span> <span class="o">!=</span> <span class="kc">nil</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nb">panic</span><span class="p">(</span><span class="nx">err</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="nx">fmt</span><span class="p">.</span><span class="nf">Println</span><span class="p">(</span><span class="nx">zAddResult3</span><span class="p">)</span> <span class="c1">// >>> 2
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="nx">zAddResult4</span><span class="p">,</span> <span class="nx">err</span> <span class="o">:=</span> <span class="nx">rdb</span><span class="p">.</span><span class="nf">ZRangeWithScores</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"myzset"</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">).</span><span class="nf">Result</span><span class="p">()</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="nx">err</span> <span class="o">!=</span> <span class="kc">nil</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nb">panic</span><span class="p">(</span><span class="nx">err</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="nx">fmt</span><span class="p">.</span><span class="nf">Println</span><span class="p">(</span><span class="nx">zAddResult4</span><span class="p">)</span> <span class="c1">// >>> [{1 one} {1 uno} {2 two} {3 three}]
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kd">func</span> <span class="nf">ExampleClient_zrange1</span><span class="p">()</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">ctx</span> <span class="o">:=</span> <span class="nx">context</span><span class="p">.</span><span class="nf">Background</span><span class="p">()</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="nx">rdb</span> <span class="o">:=</span> <span class="nx">redis</span><span class="p">.</span><span class="nf">NewClient</span><span class="p">(</span><span class="o">&</span><span class="nx">redis</span><span class="p">.</span><span class="nx">Options</span><span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Addr</span><span class="p">:</span> <span class="s">"localhost:6379"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Password</span><span class="p">:</span> <span class="s">""</span><span class="p">,</span> <span class="c1">// no password docs
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="nx">DB</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span> <span class="c1">// use default DB
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="p">})</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line hl"><span class="cl"> <span class="nx">zrangeResult1</span><span class="p">,</span> <span class="nx">err</span> <span class="o">:=</span> <span class="nx">rdb</span><span class="p">.</span><span class="nf">ZAdd</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"myzset"</span><span class="p">,</span>
</span></span><span class="line hl"><span class="cl"> <span class="nx">redis</span><span class="p">.</span><span class="nx">Z</span><span class="p">{</span><span class="nx">Member</span><span class="p">:</span> <span class="s">"one"</span><span class="p">,</span> <span class="nx">Score</span><span class="p">:</span> <span class="mi">1</span><span class="p">},</span>
</span></span><span class="line hl"><span class="cl"> <span class="nx">redis</span><span class="p">.</span><span class="nx">Z</span><span class="p">{</span><span class="nx">Member</span><span class="p">:</span> <span class="s">"two"</span><span class="p">,</span> <span class="nx">Score</span><span class="p">:</span> <span class="mi">2</span><span class="p">},</span>
</span></span><span class="line hl"><span class="cl"> <span class="nx">redis</span><span class="p">.</span><span class="nx">Z</span><span class="p">{</span><span class="nx">Member</span><span class="p">:</span> <span class="s">"three"</span><span class="p">,</span> <span class="nx">Score</span><span class="p">:</span> <span class="mi">3</span><span class="p">},</span>
</span></span><span class="line hl"><span class="cl"> <span class="p">).</span><span class="nf">Result</span><span class="p">()</span>
</span></span><span class="line hl"><span class="cl">
</span></span><span class="line hl"><span class="cl"> <span class="k">if</span> <span class="nx">err</span> <span class="o">!=</span> <span class="kc">nil</span> <span class="p">{</span>
</span></span><span class="line hl"><span class="cl"> <span class="nb">panic</span><span class="p">(</span><span class="nx">err</span><span class="p">)</span>
</span></span><span class="line hl"><span class="cl"> <span class="p">}</span>
</span></span><span class="line hl"><span class="cl">
</span></span><span class="line hl"><span class="cl"> <span class="nx">fmt</span><span class="p">.</span><span class="nf">Println</span><span class="p">(</span><span class="nx">zrangeResult1</span><span class="p">)</span> <span class="c1">// >>> 3
</span></span></span><span class="line hl"><span class="cl"><span class="c1"></span>
</span></span><span class="line hl"><span class="cl"> <span class="nx">zrangeResult2</span><span class="p">,</span> <span class="nx">err</span> <span class="o">:=</span> <span class="nx">rdb</span><span class="p">.</span><span class="nf">ZRange</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"myzset"</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">).</span><span class="nf">Result</span><span class="p">()</span>
</span></span><span class="line hl"><span class="cl">
</span></span><span class="line hl"><span class="cl"> <span class="k">if</span> <span class="nx">err</span> <span class="o">!=</span> <span class="kc">nil</span> <span class="p">{</span>
</span></span><span class="line hl"><span class="cl"> <span class="nb">panic</span><span class="p">(</span><span class="nx">err</span><span class="p">)</span>
</span></span><span class="line hl"><span class="cl"> <span class="p">}</span>
</span></span><span class="line hl"><span class="cl">
</span></span><span class="line hl"><span class="cl"> <span class="nx">fmt</span><span class="p">.</span><span class="nf">Println</span><span class="p">(</span><span class="nx">zrangeResult2</span><span class="p">)</span> <span class="c1">// >>> [one two three]
</span></span></span><span class="line hl"><span class="cl"><span class="c1"></span>
</span></span><span class="line hl"><span class="cl"> <span class="nx">zrangeResult3</span><span class="p">,</span> <span class="nx">err</span> <span class="o">:=</span> <span class="nx">rdb</span><span class="p">.</span><span class="nf">ZRange</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"myzset"</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">).</span><span class="nf">Result</span><span class="p">()</span>
</span></span><span class="line hl"><span class="cl">
</span></span><span class="line hl"><span class="cl"> <span class="k">if</span> <span class="nx">err</span> <span class="o">!=</span> <span class="kc">nil</span> <span class="p">{</span>
</span></span><span class="line hl"><span class="cl"> <span class="nb">panic</span><span class="p">(</span><span class="nx">err</span><span class="p">)</span>
</span></span><span class="line hl"><span class="cl"> <span class="p">}</span>
</span></span><span class="line hl"><span class="cl">
</span></span><span class="line hl"><span class="cl"> <span class="nx">fmt</span><span class="p">.</span><span class="nf">Println</span><span class="p">(</span><span class="nx">zrangeResult3</span><span class="p">)</span> <span class="c1">// >>> [three]
</span></span></span><span class="line hl"><span class="cl"><span class="c1"></span>
</span></span><span class="line hl"><span class="cl"> <span class="nx">zrangeResult4</span><span class="p">,</span> <span class="nx">err</span> <span class="o">:=</span> <span class="nx">rdb</span><span class="p">.</span><span class="nf">ZRange</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"myzset"</span><span class="p">,</span> <span class="o">-</span><span class="mi">2</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">).</span><span class="nf">Result</span><span class="p">()</span>
</span></span><span class="line hl"><span class="cl">
</span></span><span class="line hl"><span class="cl"> <span class="k">if</span> <span class="nx">err</span> <span class="o">!=</span> <span class="kc">nil</span> <span class="p">{</span>
</span></span><span class="line hl"><span class="cl"> <span class="nb">panic</span><span class="p">(</span><span class="nx">err</span><span class="p">)</span>
</span></span><span class="line hl"><span class="cl"> <span class="p">}</span>
</span></span><span class="line hl"><span class="cl">
</span></span><span class="line hl"><span class="cl"> <span class="nx">fmt</span><span class="p">.</span><span class="nf">Println</span><span class="p">(</span><span class="nx">zrangeResult4</span><span class="p">)</span> <span class="c1">// >>> [two three]
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kd">func</span> <span class="nf">ExampleClient_zrange2</span><span class="p">()</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">ctx</span> <span class="o">:=</span> <span class="nx">context</span><span class="p">.</span><span class="nf">Background</span><span class="p">()</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="nx">rdb</span> <span class="o">:=</span> <span class="nx">redis</span><span class="p">.</span><span class="nf">NewClient</span><span class="p">(</span><span class="o">&</span><span class="nx">redis</span><span class="p">.</span><span class="nx">Options</span><span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Addr</span><span class="p">:</span> <span class="s">"localhost:6379"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Password</span><span class="p">:</span> <span class="s">""</span><span class="p">,</span> <span class="c1">// no password docs
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="nx">DB</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span> <span class="c1">// use default DB
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="p">})</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="nx">zRangeResult5</span><span class="p">,</span> <span class="nx">err</span> <span class="o">:=</span> <span class="nx">rdb</span><span class="p">.</span><span class="nf">ZAdd</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"myzset"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">redis</span><span class="p">.</span><span class="nx">Z</span><span class="p">{</span><span class="nx">Member</span><span class="p">:</span> <span class="s">"one"</span><span class="p">,</span> <span class="nx">Score</span><span class="p">:</span> <span class="mi">1</span><span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="nx">redis</span><span class="p">.</span><span class="nx">Z</span><span class="p">{</span><span class="nx">Member</span><span class="p">:</span> <span class="s">"two"</span><span class="p">,</span> <span class="nx">Score</span><span class="p">:</span> <span class="mi">2</span><span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="nx">redis</span><span class="p">.</span><span class="nx">Z</span><span class="p">{</span><span class="nx">Member</span><span class="p">:</span> <span class="s">"three"</span><span class="p">,</span> <span class="nx">Score</span><span class="p">:</span> <span class="mi">3</span><span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="p">).</span><span class="nf">Result</span><span class="p">()</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="nx">err</span> <span class="o">!=</span> <span class="kc">nil</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nb">panic</span><span class="p">(</span><span class="nx">err</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="nx">fmt</span><span class="p">.</span><span class="nf">Println</span><span class="p">(</span><span class="nx">zRangeResult5</span><span class="p">)</span> <span class="c1">// >>> 3
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="nx">zRangeResult6</span><span class="p">,</span> <span class="nx">err</span> <span class="o">:=</span> <span class="nx">rdb</span><span class="p">.</span><span class="nf">ZRangeWithScores</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"myzset"</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">).</span><span class="nf">Result</span><span class="p">()</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="nx">err</span> <span class="o">!=</span> <span class="kc">nil</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nb">panic</span><span class="p">(</span><span class="nx">err</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="nx">fmt</span><span class="p">.</span><span class="nf">Println</span><span class="p">(</span><span class="nx">zRangeResult6</span><span class="p">)</span> <span class="c1">// >>> [{1 one} {2 two}]
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kd">func</span> <span class="nf">ExampleClient_zrange3</span><span class="p">()</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">ctx</span> <span class="o">:=</span> <span class="nx">context</span><span class="p">.</span><span class="nf">Background</span><span class="p">()</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="nx">rdb</span> <span class="o">:=</span> <span class="nx">redis</span><span class="p">.</span><span class="nf">NewClient</span><span class="p">(</span><span class="o">&</span><span class="nx">redis</span><span class="p">.</span><span class="nx">Options</span><span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Addr</span><span class="p">:</span> <span class="s">"localhost:6379"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Password</span><span class="p">:</span> <span class="s">""</span><span class="p">,</span> <span class="c1">// no password docs
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="nx">DB</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span> <span class="c1">// use default DB
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="p">})</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="nx">zRangeResult7</span><span class="p">,</span> <span class="nx">err</span> <span class="o">:=</span> <span class="nx">rdb</span><span class="p">.</span><span class="nf">ZAdd</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"myzset"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">redis</span><span class="p">.</span><span class="nx">Z</span><span class="p">{</span><span class="nx">Member</span><span class="p">:</span> <span class="s">"one"</span><span class="p">,</span> <span class="nx">Score</span><span class="p">:</span> <span class="mi">1</span><span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="nx">redis</span><span class="p">.</span><span class="nx">Z</span><span class="p">{</span><span class="nx">Member</span><span class="p">:</span> <span class="s">"two"</span><span class="p">,</span> <span class="nx">Score</span><span class="p">:</span> <span class="mi">2</span><span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="nx">redis</span><span class="p">.</span><span class="nx">Z</span><span class="p">{</span><span class="nx">Member</span><span class="p">:</span> <span class="s">"three"</span><span class="p">,</span> <span class="nx">Score</span><span class="p">:</span> <span class="mi">3</span><span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="p">).</span><span class="nf">Result</span><span class="p">()</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="nx">err</span> <span class="o">!=</span> <span class="kc">nil</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nb">panic</span><span class="p">(</span><span class="nx">err</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="nx">fmt</span><span class="p">.</span><span class="nf">Println</span><span class="p">(</span><span class="nx">zRangeResult7</span><span class="p">)</span> <span class="c1">// >>> 3
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="nx">zRangeResult8</span><span class="p">,</span> <span class="nx">err</span> <span class="o">:=</span> <span class="nx">rdb</span><span class="p">.</span><span class="nf">ZRangeArgs</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">redis</span><span class="p">.</span><span class="nx">ZRangeArgs</span><span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Key</span><span class="p">:</span> <span class="s">"myzset"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">ByScore</span><span class="p">:</span> <span class="kc">true</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Start</span><span class="p">:</span> <span class="s">"(1"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Stop</span><span class="p">:</span> <span class="s">"+inf"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Offset</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Count</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="p">).</span><span class="nf">Result</span><span class="p">()</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="nx">err</span> <span class="o">!=</span> <span class="kc">nil</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nb">panic</span><span class="p">(</span><span class="nx">err</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="nx">fmt</span><span class="p">.</span><span class="nf">Println</span><span class="p">(</span><span class="nx">zRangeResult8</span><span class="p">)</span> <span class="c1">// >>> [three]
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span></code></pre>
</div>
<button class="clipboard-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-10 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="copyCodeToClipboard('#panel_Go_cmds_sorted_set-stepzrange1')" tabindex="1" title="Copy to clipboard">
<svg fill="currentColor" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M9 43.95q-1.2 0-2.1-.9-.9-.9-.9-2.1V10.8h3v30.15h23.7v3Zm6-6q-1.2 0-2.1-.9-.9-.9-.9-2.1v-28q0-1.2.9-2.1.9-.9 2.1-.9h22q1.2 0 2.1.9.9.9.9 2.1v28q0 1.2-.9 2.1-.9.9-2.1.9Zm0-3h22v-28H15v28Zm0 0v-28 28Z">
</path>
</svg>
<div class="tooltip relative inline-block">
<span class="tooltiptext hidden bg-slate-200 rounded rounded-mx text-slate-800 text-center text-xs p-1 absolute right-6 bottom-4">
Copied!
</span>
</div>
</button>
<button aria-controls="panel_Go_cmds_sorted_set-stepzrange1" class="visibility-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-2 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="toggleVisibleLines(this)" tabindex="1" title="Toggle visibility">
<svg class="hidden" fill="currentColor" id="visibility-off" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="m31.45 27.05-2.2-2.2q1.3-3.55-1.35-5.9-2.65-2.35-5.75-1.2l-2.2-2.2q.85-.55 1.9-.8 1.05-.25 2.15-.25 3.55 0 6.025 2.475Q32.5 19.45 32.5 23q0 1.1-.275 2.175-.275 1.075-.775 1.875Zm6.45 6.45-2-2q2.45-1.8 4.275-4.025Q42 25.25 42.85 23q-2.5-5.55-7.5-8.775Q30.35 11 24.5 11q-2.1 0-4.3.4-2.2.4-3.45.95L14.45 10q1.75-.8 4.475-1.4Q21.65 8 24.25 8q7.15 0 13.075 4.075Q43.25 16.15 46 23q-1.3 3.2-3.35 5.85-2.05 2.65-4.75 4.65Zm2.9 11.3-8.4-8.25q-1.75.7-3.95 1.075T24 38q-7.3 0-13.25-4.075T2 23q1-2.6 2.775-5.075T9.1 13.2L2.8 6.9l2.1-2.15L42.75 42.6ZM11.15 15.3q-1.85 1.35-3.575 3.55Q5.85 21.05 5.1 23q2.55 5.55 7.675 8.775Q17.9 35 24.4 35q1.65 0 3.25-.2t2.4-.6l-3.2-3.2q-.55.25-1.35.375T24 31.5q-3.5 0-6-2.45T15.5 23q0-.75.125-1.5T16 20.15Zm15.25 7.1Zm-5.8 2.9Z">
</path>
</svg>
<svg fill="currentColor" id="visibility-on" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M24 31.5q3.55 0 6.025-2.475Q32.5 26.55 32.5 23q0-3.55-2.475-6.025Q27.55 14.5 24 14.5q-3.55 0-6.025 2.475Q15.5 19.45 15.5 23q0 3.55 2.475 6.025Q20.45 31.5 24 31.5Zm0-2.9q-2.35 0-3.975-1.625T18.4 23q0-2.35 1.625-3.975T24 17.4q2.35 0 3.975 1.625T29.6 23q0 2.35-1.625 3.975T24 28.6Zm0 9.4q-7.3 0-13.2-4.15Q4.9 29.7 2 23q2.9-6.7 8.8-10.85Q16.7 8 24 8q7.3 0 13.2 4.15Q43.1 16.3 46 23q-2.9 6.7-8.8 10.85Q31.3 38 24 38Zm0-15Zm0 12q6.05 0 11.125-3.275T42.85 23q-2.65-5.45-7.725-8.725Q30.05 11 24 11t-11.125 3.275Q7.8 17.55 5.1 23q2.7 5.45 7.775 8.725Q17.95 35 24 35Z">
</path>
</svg>
</button>
<div class="cli-footer flex items-center justify-between rounded-b-md bg-slate-900 mt-0 px-4 pt-0 mb-0 transition-opacity ease-in-out duration-300 opacity-0 invisible group-hover:opacity-100 group-hover:visible">
<a class="rounded rounded-mx px-3 py-1 text-white text-xs hover:text-white hover:bg-slate-600 hover:border-transparent focus:outline-none focus:ring-2 focus:white focus:border-slate-500" href="https://redis.io/docs/latest/develop/connect/clients/go/" tabindex="1" title="Quick-Start">
Go Quick-Start
</a>
<div class="w-1/2">
</div>
<div class="flex-1 text-right">
<a class="button text-neutral-400 hover:text-slate-100 h-6 w-6 p-1" href="https://github.com/redis/go-redis/tree/master/doctests/cmds_sorted_set_test.go" tabindex="1" title="Improve this code example">
<svg fill="github" height="16" viewbox="0 0 18 16" width="18" xmlns="http://www.w3.org/2000/svg">
<path clip-rule="evenodd" d="M8.99953 1.43397e-06C7.09918 -0.000897921 5.26058 0.674713 3.81295 1.90585C2.36533 3.13699 1.40324 4.84324 1.09896 6.71907C0.794684 8.5949 1.1681 10.5178 2.15233 12.1434C3.13657 13.769 4.66734 14.9912 6.47053 15.591C6.87053 15.664 7.01653 15.417 7.01653 15.205C7.01653 15.015 7.00953 14.512 7.00553 13.845C4.78053 14.328 4.31053 12.772 4.31053 12.772C4.16325 12.2887 3.84837 11.8739 3.42253 11.602C2.69653 11.102 3.47753 11.116 3.47753 11.116C3.73043 11.1515 3.97191 11.2442 4.18365 11.3869C4.39539 11.5297 4.57182 11.7189 4.69953 11.94C4.80755 12.1377 4.95378 12.3119 5.12972 12.4526C5.30567 12.5933 5.50782 12.6976 5.72442 12.7595C5.94103 12.8214 6.16778 12.8396 6.39148 12.813C6.61519 12.7865 6.83139 12.7158 7.02753 12.605C7.06381 12.1992 7.24399 11.8197 7.53553 11.535C5.75953 11.335 3.89153 10.647 3.89153 7.581C3.88005 6.78603 4.17513 6.01716 4.71553 5.434C4.47318 4.74369 4.50322 3.98693 4.79953 3.318C4.79953 3.318 5.47053 3.103 6.99953 4.138C8.31074 3.77905 9.69432 3.77905 11.0055 4.138C12.5325 3.103 13.2055 3.318 13.2055 3.318C13.5012 3.9877 13.5294 4.74513 13.2845 5.435C13.8221 6.01928 14.114 6.78817 14.0995 7.582C14.0995 10.655 12.2285 11.332 10.4465 11.53C10.6375 11.724 10.7847 11.9566 10.8784 12.2123C10.972 12.4679 11.0099 12.7405 10.9895 13.012C10.9895 14.081 10.9795 14.944 10.9795 15.206C10.9795 15.42 11.1235 15.669 11.5295 15.591C13.3328 14.9911 14.8636 13.7689 15.8479 12.1432C16.8321 10.5175 17.2054 8.59447 16.901 6.71858C16.5966 4.84268 15.6343 3.13642 14.1865 1.90536C12.7387 0.674306 10.9 -0.0011359 8.99953 1.43397e-06Z" fill="white" fill-rule="evenodd">
</path>
</svg>
</a>
</div>
</div>
</div>
<input class="radiotab w-0 h-0" data-lang="dotnet" id="Csharp_cmds_sorted_set-stepzrange1" name="cmds_sorted_set-stepzrange1" tabindex="1" type="radio"/>
<label class="justify-left label ml-4 pt-3.5 px-3 pb-1 cursor-pointer text-sm text-center bg-redis-ink-900 hover:text-redis-red-600 rounded rounded-mx transition duration-150 ease-in-out" for="Csharp_cmds_sorted_set-stepzrange1" title="Open example">
C#
</label>
<div aria-labelledby="tab-cmds_sorted_set-stepzrange1" class="panel order-last hidden w-full mt-0 relative" id="panel_Csharp_cmds_sorted_set-stepzrange1" role="tabpanel" tabindex="0">
<div class="highlight">
<pre class="chroma"><code class="language-C#" data-lang="C#"><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">using</span> <span class="nn">NRedisStack.Tests</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="k">using</span> <span class="nn">StackExchange.Redis</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">public</span> <span class="k">class</span> <span class="nc">CmdsSortedSet</span>
</span></span><span class="line"><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">public</span> <span class="k">void</span> <span class="n">run</span><span class="p">()</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="kt">var</span> <span class="n">muxer</span> <span class="p">=</span> <span class="n">ConnectionMultiplexer</span><span class="p">.</span><span class="n">Connect</span><span class="p">(</span><span class="s">"localhost:6379"</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">var</span> <span class="n">db</span> <span class="p">=</span> <span class="n">muxer</span><span class="p">.</span><span class="n">GetDatabase</span><span class="p">();</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'bzmpop' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'bzpopmax' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'bzpopmin' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="kt">bool</span> <span class="n">zAddResult1</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">SortedSetAdd</span><span class="p">(</span><span class="s">"myzset"</span><span class="p">,</span> <span class="s">"one"</span><span class="p">,</span> <span class="m">1</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="n">zAddResult1</span><span class="p">);</span> <span class="c1">// >>> True</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="kt">bool</span> <span class="n">zAddResult2</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">SortedSetAdd</span><span class="p">(</span><span class="s">"myzset"</span><span class="p">,</span> <span class="s">"uno"</span><span class="p">,</span> <span class="m">1</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="n">zAddResult2</span><span class="p">);</span> <span class="c1">// >>> True</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="kt">long</span> <span class="n">zAddResult3</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">SortedSetAdd</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="s">"myzset"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">SortedSetEntry</span><span class="p">[]</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">SortedSetEntry</span><span class="p">(</span><span class="s">"two"</span><span class="p">,</span> <span class="m">2</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">SortedSetEntry</span><span class="p">(</span><span class="s">"three"</span><span class="p">,</span> <span class="m">3</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl"> <span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="n">zAddResult3</span><span class="p">);</span> <span class="c1">// >>> 2</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">SortedSetEntry</span><span class="p">[]</span> <span class="n">zAddResult4</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">SortedSetRangeByRankWithScores</span><span class="p">(</span><span class="s">"myzset"</span><span class="p">,</span> <span class="m">0</span><span class="p">,</span> <span class="p">-</span><span class="m">1</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="s">$"{string.Join("</span><span class="p">,</span> <span class="s">", zAddResult4.Select(b => $"</span><span class="p">{</span><span class="n">b</span><span class="p">.</span><span class="n">Element</span><span class="p">}:</span> <span class="p">{</span><span class="n">b</span><span class="p">.</span><span class="n">Score</span><span class="p">}</span><span class="s">"))}"</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="c1">// >>> one: 1, uno: 1, two: 2, three: 3</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zadd' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zcard' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zcount' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zdiff' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zdiffstore' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zincrby' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zinter' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zintercard' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zinterstore' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zlexcount' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zmpop' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zmscore' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zpopmax' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zpopmin' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrandmember' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line hl"><span class="cl"> <span class="kt">long</span> <span class="n">zRangeResult1</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">SortedSetAdd</span><span class="p">(</span>
</span></span><span class="line hl"><span class="cl"> <span class="s">"myzset"</span><span class="p">,</span>
</span></span><span class="line hl"><span class="cl"> <span class="k">new</span> <span class="n">SortedSetEntry</span><span class="p">[]</span> <span class="p">{</span>
</span></span><span class="line hl"><span class="cl"> <span class="k">new</span> <span class="n">SortedSetEntry</span><span class="p">(</span><span class="s">"one"</span><span class="p">,</span> <span class="m">1</span><span class="p">),</span>
</span></span><span class="line hl"><span class="cl"> <span class="k">new</span> <span class="n">SortedSetEntry</span><span class="p">(</span><span class="s">"two"</span><span class="p">,</span> <span class="m">2</span><span class="p">),</span>
</span></span><span class="line hl"><span class="cl"> <span class="k">new</span> <span class="n">SortedSetEntry</span><span class="p">(</span><span class="s">"three"</span><span class="p">,</span> <span class="m">3</span><span class="p">)</span>
</span></span><span class="line hl"><span class="cl"> <span class="p">}</span>
</span></span><span class="line hl"><span class="cl"> <span class="p">);</span>
</span></span><span class="line hl"><span class="cl"> <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="n">zRangeResult1</span><span class="p">);</span> <span class="c1">// >>> 3</span>
</span></span><span class="line hl"><span class="cl">
</span></span><span class="line hl"><span class="cl"> <span class="n">RedisValue</span><span class="p">[]</span> <span class="n">zRangeResult2</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">SortedSetRangeByRank</span><span class="p">(</span><span class="s">"myzset"</span><span class="p">,</span> <span class="m">0</span><span class="p">,</span> <span class="p">-</span><span class="m">1</span><span class="p">);</span>
</span></span><span class="line hl"><span class="cl"> <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="kt">string</span><span class="p">.</span><span class="n">Join</span><span class="p">(</span><span class="s">", "</span><span class="p">,</span> <span class="n">zRangeResult2</span><span class="p">));</span>
</span></span><span class="line hl"><span class="cl"> <span class="c1">// >>> one, two, three</span>
</span></span><span class="line hl"><span class="cl">
</span></span><span class="line hl"><span class="cl"> <span class="n">RedisValue</span><span class="p">[]</span> <span class="n">zRangeResult3</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">SortedSetRangeByRank</span><span class="p">(</span><span class="s">"myzset"</span><span class="p">,</span> <span class="m">2</span><span class="p">,</span> <span class="m">3</span><span class="p">);</span>
</span></span><span class="line hl"><span class="cl"> <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="kt">string</span><span class="p">.</span><span class="n">Join</span><span class="p">(</span><span class="s">", "</span><span class="p">,</span> <span class="n">zRangeResult3</span><span class="p">));</span>
</span></span><span class="line hl"><span class="cl"> <span class="c1">// >>> three</span>
</span></span><span class="line hl"><span class="cl">
</span></span><span class="line hl"><span class="cl"> <span class="n">RedisValue</span><span class="p">[]</span> <span class="n">zRangeResult4</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">SortedSetRangeByRank</span><span class="p">(</span><span class="s">"myzset"</span><span class="p">,</span> <span class="p">-</span><span class="m">2</span><span class="p">,</span> <span class="p">-</span><span class="m">1</span><span class="p">);</span>
</span></span><span class="line hl"><span class="cl"> <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="kt">string</span><span class="p">.</span><span class="n">Join</span><span class="p">(</span><span class="s">", "</span><span class="p">,</span> <span class="n">zRangeResult4</span><span class="p">));</span>
</span></span><span class="line hl"><span class="cl"> <span class="c1">// >>> two, three</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrange1' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="kt">long</span> <span class="n">zRangeResult5</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">SortedSetAdd</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="s">"myzset"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">SortedSetEntry</span><span class="p">[]</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">SortedSetEntry</span><span class="p">(</span><span class="s">"one"</span><span class="p">,</span> <span class="m">1</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">SortedSetEntry</span><span class="p">(</span><span class="s">"two"</span><span class="p">,</span> <span class="m">2</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">SortedSetEntry</span><span class="p">(</span><span class="s">"three"</span><span class="p">,</span> <span class="m">3</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl"> <span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">SortedSetEntry</span><span class="p">[]</span> <span class="n">zRangeResult6</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">SortedSetRangeByRankWithScores</span><span class="p">(</span><span class="s">"myzset"</span><span class="p">,</span> <span class="m">0</span><span class="p">,</span> <span class="m">1</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="s">$"{string.Join("</span><span class="p">,</span> <span class="s">", zRangeResult6.Select(b => $"</span><span class="p">{</span><span class="n">b</span><span class="p">.</span><span class="n">Element</span><span class="p">}:</span> <span class="p">{</span><span class="n">b</span><span class="p">.</span><span class="n">Score</span><span class="p">}</span><span class="s">"))}"</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="c1">// >>> one: 1, two: 2</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrange2' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="kt">long</span> <span class="n">zRangeResult7</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">SortedSetAdd</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="s">"myzset"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">SortedSetEntry</span><span class="p">[]</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">SortedSetEntry</span><span class="p">(</span><span class="s">"one"</span><span class="p">,</span> <span class="m">1</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">SortedSetEntry</span><span class="p">(</span><span class="s">"two"</span><span class="p">,</span> <span class="m">2</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">SortedSetEntry</span><span class="p">(</span><span class="s">"three"</span><span class="p">,</span> <span class="m">3</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl"> <span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">RedisValue</span><span class="p">[]</span> <span class="n">zRangeResult8</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">SortedSetRangeByScore</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="s">"myzset"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="m">1</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">double</span><span class="p">.</span><span class="n">PositiveInfinity</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">Exclude</span><span class="p">.</span><span class="n">Start</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">skip</span><span class="p">:</span> <span class="m">1</span><span class="p">,</span> <span class="n">take</span><span class="p">:</span> <span class="m">1</span>
</span></span><span class="line"><span class="cl"> <span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="kt">string</span><span class="p">.</span><span class="n">Join</span><span class="p">(</span><span class="s">", "</span><span class="p">,</span> <span class="n">zRangeResult8</span><span class="p">));</span>
</span></span><span class="line"><span class="cl"> <span class="c1">// >>> three</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrange3' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrangebylex' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrangebyscore' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrangestore' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrank' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrem' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zremrangebylex' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zremrangebyrank' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zremrangebyscore' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrevrange' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrevrangebylex' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrevrangebyscore' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrevrank' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zscan' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zscore' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zunion' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zunionstore' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span></code></pre>
</div>
<button class="clipboard-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-10 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="copyCodeToClipboard('#panel_Csharp_cmds_sorted_set-stepzrange1')" tabindex="1" title="Copy to clipboard">
<svg fill="currentColor" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M9 43.95q-1.2 0-2.1-.9-.9-.9-.9-2.1V10.8h3v30.15h23.7v3Zm6-6q-1.2 0-2.1-.9-.9-.9-.9-2.1v-28q0-1.2.9-2.1.9-.9 2.1-.9h22q1.2 0 2.1.9.9.9.9 2.1v28q0 1.2-.9 2.1-.9.9-2.1.9Zm0-3h22v-28H15v28Zm0 0v-28 28Z">
</path>
</svg>
<div class="tooltip relative inline-block">
<span class="tooltiptext hidden bg-slate-200 rounded rounded-mx text-slate-800 text-center text-xs p-1 absolute right-6 bottom-4">
Copied!
</span>
</div>
</button>
<button aria-controls="panel_Csharp_cmds_sorted_set-stepzrange1" class="visibility-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-2 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="toggleVisibleLines(this)" tabindex="1" title="Toggle visibility">
<svg class="hidden" fill="currentColor" id="visibility-off" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="m31.45 27.05-2.2-2.2q1.3-3.55-1.35-5.9-2.65-2.35-5.75-1.2l-2.2-2.2q.85-.55 1.9-.8 1.05-.25 2.15-.25 3.55 0 6.025 2.475Q32.5 19.45 32.5 23q0 1.1-.275 2.175-.275 1.075-.775 1.875Zm6.45 6.45-2-2q2.45-1.8 4.275-4.025Q42 25.25 42.85 23q-2.5-5.55-7.5-8.775Q30.35 11 24.5 11q-2.1 0-4.3.4-2.2.4-3.45.95L14.45 10q1.75-.8 4.475-1.4Q21.65 8 24.25 8q7.15 0 13.075 4.075Q43.25 16.15 46 23q-1.3 3.2-3.35 5.85-2.05 2.65-4.75 4.65Zm2.9 11.3-8.4-8.25q-1.75.7-3.95 1.075T24 38q-7.3 0-13.25-4.075T2 23q1-2.6 2.775-5.075T9.1 13.2L2.8 6.9l2.1-2.15L42.75 42.6ZM11.15 15.3q-1.85 1.35-3.575 3.55Q5.85 21.05 5.1 23q2.55 5.55 7.675 8.775Q17.9 35 24.4 35q1.65 0 3.25-.2t2.4-.6l-3.2-3.2q-.55.25-1.35.375T24 31.5q-3.5 0-6-2.45T15.5 23q0-.75.125-1.5T16 20.15Zm15.25 7.1Zm-5.8 2.9Z">
</path>
</svg>
<svg fill="currentColor" id="visibility-on" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M24 31.5q3.55 0 6.025-2.475Q32.5 26.55 32.5 23q0-3.55-2.475-6.025Q27.55 14.5 24 14.5q-3.55 0-6.025 2.475Q15.5 19.45 15.5 23q0 3.55 2.475 6.025Q20.45 31.5 24 31.5Zm0-2.9q-2.35 0-3.975-1.625T18.4 23q0-2.35 1.625-3.975T24 17.4q2.35 0 3.975 1.625T29.6 23q0 2.35-1.625 3.975T24 28.6Zm0 9.4q-7.3 0-13.2-4.15Q4.9 29.7 2 23q2.9-6.7 8.8-10.85Q16.7 8 24 8q7.3 0 13.2 4.15Q43.1 16.3 46 23q-2.9 6.7-8.8 10.85Q31.3 38 24 38Zm0-15Zm0 12q6.05 0 11.125-3.275T42.85 23q-2.65-5.45-7.725-8.725Q30.05 11 24 11t-11.125 3.275Q7.8 17.55 5.1 23q2.7 5.45 7.775 8.725Q17.95 35 24 35Z">
</path>
</svg>
</button>
<div class="cli-footer flex items-center justify-between rounded-b-md bg-slate-900 mt-0 px-4 pt-0 mb-0 transition-opacity ease-in-out duration-300 opacity-0 invisible group-hover:opacity-100 group-hover:visible">
<a class="rounded rounded-mx px-3 py-1 text-white text-xs hover:text-white hover:bg-slate-600 hover:border-transparent focus:outline-none focus:ring-2 focus:white focus:border-slate-500" href="https://redis.io/docs/latest/develop/connect/clients/dotnet/" tabindex="1" title="Quick-Start">
C# Quick-Start
</a>
<div class="w-1/2">
</div>
<div class="flex-1 text-right">
<a class="button text-neutral-400 hover:text-slate-100 h-6 w-6 p-1" href="https://github.com/redis/NRedisStack/tree/master/tests/Doc/CmdsSortedSetExamples.cs" tabindex="1" title="Improve this code example">
<svg fill="github" height="16" viewbox="0 0 18 16" width="18" xmlns="http://www.w3.org/2000/svg">
<path clip-rule="evenodd" d="M8.99953 1.43397e-06C7.09918 -0.000897921 5.26058 0.674713 3.81295 1.90585C2.36533 3.13699 1.40324 4.84324 1.09896 6.71907C0.794684 8.5949 1.1681 10.5178 2.15233 12.1434C3.13657 13.769 4.66734 14.9912 6.47053 15.591C6.87053 15.664 7.01653 15.417 7.01653 15.205C7.01653 15.015 7.00953 14.512 7.00553 13.845C4.78053 14.328 4.31053 12.772 4.31053 12.772C4.16325 12.2887 3.84837 11.8739 3.42253 11.602C2.69653 11.102 3.47753 11.116 3.47753 11.116C3.73043 11.1515 3.97191 11.2442 4.18365 11.3869C4.39539 11.5297 4.57182 11.7189 4.69953 11.94C4.80755 12.1377 4.95378 12.3119 5.12972 12.4526C5.30567 12.5933 5.50782 12.6976 5.72442 12.7595C5.94103 12.8214 6.16778 12.8396 6.39148 12.813C6.61519 12.7865 6.83139 12.7158 7.02753 12.605C7.06381 12.1992 7.24399 11.8197 7.53553 11.535C5.75953 11.335 3.89153 10.647 3.89153 7.581C3.88005 6.78603 4.17513 6.01716 4.71553 5.434C4.47318 4.74369 4.50322 3.98693 4.79953 3.318C4.79953 3.318 5.47053 3.103 6.99953 4.138C8.31074 3.77905 9.69432 3.77905 11.0055 4.138C12.5325 3.103 13.2055 3.318 13.2055 3.318C13.5012 3.9877 13.5294 4.74513 13.2845 5.435C13.8221 6.01928 14.114 6.78817 14.0995 7.582C14.0995 10.655 12.2285 11.332 10.4465 11.53C10.6375 11.724 10.7847 11.9566 10.8784 12.2123C10.972 12.4679 11.0099 12.7405 10.9895 13.012C10.9895 14.081 10.9795 14.944 10.9795 15.206C10.9795 15.42 11.1235 15.669 11.5295 15.591C13.3328 14.9911 14.8636 13.7689 15.8479 12.1432C16.8321 10.5175 17.2054 8.59447 16.901 6.71858C16.5966 4.84268 15.6343 3.13642 14.1865 1.90536C12.7387 0.674306 10.9 -0.0011359 8.99953 1.43397e-06Z" fill="white" fill-rule="evenodd">
</path>
</svg>
</a>
</div>
</div>
</div>
</div>
<p>
The following example using
<code>
WITHSCORES
</code>
shows how the command returns always an array, but this time, populated with
<em>
element_1
</em>
,
<em>
score_1
</em>
,
<em>
element_2
</em>
,
<em>
score_2
</em>
, ...,
<em>
element_N
</em>
,
<em>
score_N
</em>
.
</p>
<div class="codetabs cli group flex justify-start items-center flex-wrap box-border rounded-lg mt-0 mb-0 mx-auto bg-slate-900" id="cmds_sorted_set-stepzrange2">
<input checked="" class="radiotab w-0 h-0" data-lang="redis-cli" id="redis-cli_cmds_sorted_set-stepzrange2" name="cmds_sorted_set-stepzrange2" tabindex="1" type="radio"/>
<label class="justify-left label ml-4 pt-3.5 px-3 pb-1 cursor-pointer text-sm text-center bg-redis-ink-900 hover:text-redis-red-600 rounded rounded-mx transition duration-150 ease-in-out" for="redis-cli_cmds_sorted_set-stepzrange2" title="Open example">
>_ Redis CLI
</label>
<div aria-labelledby="tab-cmds_sorted_set-stepzrange2" class="panel order-last hidden w-full mt-0 relative" id="panel_redis-cli_cmds_sorted_set-stepzrange2" role="tabpanel" tabindex="0">
<div class="highlight">
<pre class="chroma"><code class="language-plaintext" data-lang="plaintext"><span class="line hl"><span class="cl">> ZADD myzset 1 "one" 2 "two" 3 "three"
</span></span><span class="line hl"><span class="cl">(integer) 3
</span></span><span class="line hl"><span class="cl">> ZRANGE myzset 0 1 WITHSCORES
</span></span><span class="line hl"><span class="cl">1) "one"
</span></span><span class="line hl"><span class="cl">2) "1"
</span></span><span class="line hl"><span class="cl">3) "two"
</span></span><span class="line hl"><span class="cl">4) "2"</span></span></code></pre>
</div>
<button class="clipboard-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-10 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="copyCodeToClipboard('#panel_redis-cli_cmds_sorted_set-stepzrange2')" tabindex="1" title="Copy to clipboard">
<svg fill="currentColor" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M9 43.95q-1.2 0-2.1-.9-.9-.9-.9-2.1V10.8h3v30.15h23.7v3Zm6-6q-1.2 0-2.1-.9-.9-.9-.9-2.1v-28q0-1.2.9-2.1.9-.9 2.1-.9h22q1.2 0 2.1.9.9.9.9 2.1v28q0 1.2-.9 2.1-.9.9-2.1.9Zm0-3h22v-28H15v28Zm0 0v-28 28Z">
</path>
</svg>
<div class="tooltip relative inline-block">
<span class="tooltiptext hidden bg-slate-200 rounded rounded-mx text-slate-800 text-center text-xs p-1 absolute right-6 bottom-4">
Copied!
</span>
</div>
</button>
<div class="cli-footer flex items-center justify-between rounded-b-md bg-slate-900 mt-0 px-4 pt-0 mb-0 transition-opacity ease-in-out duration-300 opacity-0 invisible group-hover:opacity-100 group-hover:visible">
<div class="flex-1 text-xs text-white overflow-ellipsis">
Are you tired of using redis-cli? Try Redis Insight - the developer GUI for Redis.
</div>
<div class="text-right">
<a class="rounded rounded-mx px-2 py-1 flex items-center text-white text-xs hover:text-white hover:bg-slate-600 hover:border-transparent focus:outline-none focus:ring-2 focus:white focus:border-slate-500" href="https://redis.com/redis-enterprise/redis-insight/" tabindex="1" title="Get Redis Insight">
<svg class="w-4 h-4 mr-1" fill="none" height="14" viewbox="0 0 14 14" width="14" xmlns="http://www.w3.org/2000/svg">
<path d="M2.26236 5.66895L1.21732 6.07172L7.00018 8.65693V7.79842L2.26236 5.66895Z" fill="#fca5a5">
</path>
<path d="M2.26236 8.02271L1.21732 8.42548L7.00018 11.0119V10.1516L2.26236 8.02271Z" fill="#fca5a5">
</path>
<path d="M1.21732 3.7175L7.00018 6.30392V2.87805L8.66273 2.13423L7.00018 1.49512L1.21732 3.7175Z" fill="#fca5a5">
</path>
<path d="M7.00018 2.8781V6.30366L1.21732 3.71724V5.20004L7.00018 7.79705V8.65526L1.21732 6.07217V7.55496L7.00018 10.1553V11.0135L1.21732 8.42376V9.90656H1.18878L7.00018 12.5051L8.66273 11.7613V2.13428L7.00018 2.8781Z" fill="#f87171">
</path>
<path d="M9.07336 11.5777L10.7359 10.8338V4.01538L9.07336 4.7592V11.5777Z" fill="#f87171">
</path>
<path d="M9.07336 4.75867L10.7359 4.01485L9.07336 3.37573V4.75867Z" fill="#fca5a5">
</path>
<path d="M11.1481 10.6497L12.8112 9.90591V5.896L11.1487 6.63982L11.1481 10.6497Z" fill="#f87171">
</path>
<path d="M11.1481 6.63954L12.8112 5.89572L11.1481 5.25781V6.63954Z" fill="#fca5a5">
</path>
</svg>
<span>
Get Redis Insight
</span>
</a>
</div>
</div>
</div>
<input class="radiotab w-0 h-0" data-lang="python" id="Python_cmds_sorted_set-stepzrange2" name="cmds_sorted_set-stepzrange2" tabindex="1" type="radio"/>
<label class="justify-left label ml-4 pt-3.5 px-3 pb-1 cursor-pointer text-sm text-center bg-redis-ink-900 hover:text-redis-red-600 rounded rounded-mx transition duration-150 ease-in-out" for="Python_cmds_sorted_set-stepzrange2" title="Open example">
Python
</label>
<div aria-labelledby="tab-cmds_sorted_set-stepzrange2" class="panel order-last hidden w-full mt-0 relative" id="panel_Python_cmds_sorted_set-stepzrange2" role="tabpanel" tabindex="0">
<div class="highlight">
<pre class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">redis</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">r</span> <span class="o">=</span> <span class="n">redis</span><span class="o">.</span><span class="n">Redis</span><span class="p">(</span><span class="n">host</span><span class="o">=</span><span class="s2">"localhost"</span><span class="p">,</span> <span class="n">port</span><span class="o">=</span><span class="mi">6379</span><span class="p">,</span> <span class="n">db</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">decode_responses</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">zadd</span><span class="p">(</span><span class="s2">"myzset"</span><span class="p">,</span> <span class="p">{</span><span class="s2">"one"</span><span class="p">:</span> <span class="mi">1</span><span class="p">})</span>
</span></span><span class="line"><span class="cl"><span class="nb">print</span><span class="p">(</span><span class="n">res</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="c1"># >>> 1</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">zadd</span><span class="p">(</span><span class="s2">"myzset"</span><span class="p">,</span> <span class="p">{</span><span class="s2">"uno"</span><span class="p">:</span> <span class="mi">1</span><span class="p">})</span>
</span></span><span class="line"><span class="cl"><span class="nb">print</span><span class="p">(</span><span class="n">res</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="c1"># >>> 1</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">zadd</span><span class="p">(</span><span class="s2">"myzset"</span><span class="p">,</span> <span class="p">{</span><span class="s2">"two"</span><span class="p">:</span> <span class="mi">2</span><span class="p">,</span> <span class="s2">"three"</span><span class="p">:</span> <span class="mi">3</span><span class="p">})</span>
</span></span><span class="line"><span class="cl"><span class="nb">print</span><span class="p">(</span><span class="n">res</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="c1"># >>> 2</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">zrange</span><span class="p">(</span><span class="s2">"myzset"</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">withscores</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="c1"># >>> [('one', 1.0), ('uno', 1.0), ('two', 2.0), ('three', 3.0)]</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">zadd</span><span class="p">(</span><span class="s2">"myzset"</span><span class="p">,</span> <span class="p">{</span><span class="s2">"one"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span> <span class="s2">"two"</span><span class="p">:</span><span class="mi">2</span><span class="p">,</span> <span class="s2">"three"</span><span class="p">:</span><span class="mi">3</span><span class="p">})</span>
</span></span><span class="line"><span class="cl"><span class="nb">print</span><span class="p">(</span><span class="n">res</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="c1"># >>> 3</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">zrange</span><span class="p">(</span><span class="s2">"myzset"</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="nb">print</span><span class="p">(</span><span class="n">res</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="c1"># >>> ['one', 'two', 'three']</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">zrange</span><span class="p">(</span><span class="s2">"myzset"</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="nb">print</span><span class="p">(</span><span class="n">res</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="c1"># >>> ['three']</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">zrange</span><span class="p">(</span><span class="s2">"myzset"</span><span class="p">,</span> <span class="o">-</span><span class="mi">2</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="nb">print</span><span class="p">(</span><span class="n">res</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="c1"># >>> ['two', 'three']</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line hl"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">zadd</span><span class="p">(</span><span class="s2">"myzset"</span><span class="p">,</span> <span class="p">{</span><span class="s2">"one"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span> <span class="s2">"two"</span><span class="p">:</span><span class="mi">2</span><span class="p">,</span> <span class="s2">"three"</span><span class="p">:</span><span class="mi">3</span><span class="p">})</span>
</span></span><span class="line hl"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">zrange</span><span class="p">(</span><span class="s2">"myzset"</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="n">withscores</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
</span></span><span class="line hl"><span class="cl"><span class="nb">print</span><span class="p">(</span><span class="n">res</span><span class="p">)</span>
</span></span><span class="line hl"><span class="cl"><span class="c1"># >>> [('one', 1.0), ('two', 2.0)]</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">zadd</span><span class="p">(</span><span class="s2">"myzset"</span><span class="p">,</span> <span class="p">{</span><span class="s2">"one"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span> <span class="s2">"two"</span><span class="p">:</span><span class="mi">2</span><span class="p">,</span> <span class="s2">"three"</span><span class="p">:</span><span class="mi">3</span><span class="p">})</span>
</span></span><span class="line"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">zrange</span><span class="p">(</span><span class="s2">"myzset"</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="n">byscore</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">offset</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">num</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="nb">print</span><span class="p">(</span><span class="n">res</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="c1"># >>> ['three']</span>
</span></span></code></pre>
</div>
<button class="clipboard-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-10 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="copyCodeToClipboard('#panel_Python_cmds_sorted_set-stepzrange2')" tabindex="1" title="Copy to clipboard">
<svg fill="currentColor" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M9 43.95q-1.2 0-2.1-.9-.9-.9-.9-2.1V10.8h3v30.15h23.7v3Zm6-6q-1.2 0-2.1-.9-.9-.9-.9-2.1v-28q0-1.2.9-2.1.9-.9 2.1-.9h22q1.2 0 2.1.9.9.9.9 2.1v28q0 1.2-.9 2.1-.9.9-2.1.9Zm0-3h22v-28H15v28Zm0 0v-28 28Z">
</path>
</svg>
<div class="tooltip relative inline-block">
<span class="tooltiptext hidden bg-slate-200 rounded rounded-mx text-slate-800 text-center text-xs p-1 absolute right-6 bottom-4">
Copied!
</span>
</div>
</button>
<button aria-controls="panel_Python_cmds_sorted_set-stepzrange2" class="visibility-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-2 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="toggleVisibleLines(this)" tabindex="1" title="Toggle visibility">
<svg class="hidden" fill="currentColor" id="visibility-off" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="m31.45 27.05-2.2-2.2q1.3-3.55-1.35-5.9-2.65-2.35-5.75-1.2l-2.2-2.2q.85-.55 1.9-.8 1.05-.25 2.15-.25 3.55 0 6.025 2.475Q32.5 19.45 32.5 23q0 1.1-.275 2.175-.275 1.075-.775 1.875Zm6.45 6.45-2-2q2.45-1.8 4.275-4.025Q42 25.25 42.85 23q-2.5-5.55-7.5-8.775Q30.35 11 24.5 11q-2.1 0-4.3.4-2.2.4-3.45.95L14.45 10q1.75-.8 4.475-1.4Q21.65 8 24.25 8q7.15 0 13.075 4.075Q43.25 16.15 46 23q-1.3 3.2-3.35 5.85-2.05 2.65-4.75 4.65Zm2.9 11.3-8.4-8.25q-1.75.7-3.95 1.075T24 38q-7.3 0-13.25-4.075T2 23q1-2.6 2.775-5.075T9.1 13.2L2.8 6.9l2.1-2.15L42.75 42.6ZM11.15 15.3q-1.85 1.35-3.575 3.55Q5.85 21.05 5.1 23q2.55 5.55 7.675 8.775Q17.9 35 24.4 35q1.65 0 3.25-.2t2.4-.6l-3.2-3.2q-.55.25-1.35.375T24 31.5q-3.5 0-6-2.45T15.5 23q0-.75.125-1.5T16 20.15Zm15.25 7.1Zm-5.8 2.9Z">
</path>
</svg>
<svg fill="currentColor" id="visibility-on" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M24 31.5q3.55 0 6.025-2.475Q32.5 26.55 32.5 23q0-3.55-2.475-6.025Q27.55 14.5 24 14.5q-3.55 0-6.025 2.475Q15.5 19.45 15.5 23q0 3.55 2.475 6.025Q20.45 31.5 24 31.5Zm0-2.9q-2.35 0-3.975-1.625T18.4 23q0-2.35 1.625-3.975T24 17.4q2.35 0 3.975 1.625T29.6 23q0 2.35-1.625 3.975T24 28.6Zm0 9.4q-7.3 0-13.2-4.15Q4.9 29.7 2 23q2.9-6.7 8.8-10.85Q16.7 8 24 8q7.3 0 13.2 4.15Q43.1 16.3 46 23q-2.9 6.7-8.8 10.85Q31.3 38 24 38Zm0-15Zm0 12q6.05 0 11.125-3.275T42.85 23q-2.65-5.45-7.725-8.725Q30.05 11 24 11t-11.125 3.275Q7.8 17.55 5.1 23q2.7 5.45 7.775 8.725Q17.95 35 24 35Z">
</path>
</svg>
</button>
<div class="cli-footer flex items-center justify-between rounded-b-md bg-slate-900 mt-0 px-4 pt-0 mb-0 transition-opacity ease-in-out duration-300 opacity-0 invisible group-hover:opacity-100 group-hover:visible">
<a class="rounded rounded-mx px-3 py-1 text-white text-xs hover:text-white hover:bg-slate-600 hover:border-transparent focus:outline-none focus:ring-2 focus:white focus:border-slate-500" href="https://redis.io/docs/latest/develop/connect/clients/python/redis-py/" tabindex="1" title="Quick-Start">
Python Quick-Start
</a>
<div class="w-1/2">
</div>
<div class="flex-1 text-right">
<a class="button text-neutral-400 hover:text-slate-100 h-6 w-6 p-1" href="https://github.com/redis/redis-py/tree/master/doctests/cmds_sorted_set.py" tabindex="1" title="Improve this code example">
<svg fill="github" height="16" viewbox="0 0 18 16" width="18" xmlns="http://www.w3.org/2000/svg">
<path clip-rule="evenodd" d="M8.99953 1.43397e-06C7.09918 -0.000897921 5.26058 0.674713 3.81295 1.90585C2.36533 3.13699 1.40324 4.84324 1.09896 6.71907C0.794684 8.5949 1.1681 10.5178 2.15233 12.1434C3.13657 13.769 4.66734 14.9912 6.47053 15.591C6.87053 15.664 7.01653 15.417 7.01653 15.205C7.01653 15.015 7.00953 14.512 7.00553 13.845C4.78053 14.328 4.31053 12.772 4.31053 12.772C4.16325 12.2887 3.84837 11.8739 3.42253 11.602C2.69653 11.102 3.47753 11.116 3.47753 11.116C3.73043 11.1515 3.97191 11.2442 4.18365 11.3869C4.39539 11.5297 4.57182 11.7189 4.69953 11.94C4.80755 12.1377 4.95378 12.3119 5.12972 12.4526C5.30567 12.5933 5.50782 12.6976 5.72442 12.7595C5.94103 12.8214 6.16778 12.8396 6.39148 12.813C6.61519 12.7865 6.83139 12.7158 7.02753 12.605C7.06381 12.1992 7.24399 11.8197 7.53553 11.535C5.75953 11.335 3.89153 10.647 3.89153 7.581C3.88005 6.78603 4.17513 6.01716 4.71553 5.434C4.47318 4.74369 4.50322 3.98693 4.79953 3.318C4.79953 3.318 5.47053 3.103 6.99953 4.138C8.31074 3.77905 9.69432 3.77905 11.0055 4.138C12.5325 3.103 13.2055 3.318 13.2055 3.318C13.5012 3.9877 13.5294 4.74513 13.2845 5.435C13.8221 6.01928 14.114 6.78817 14.0995 7.582C14.0995 10.655 12.2285 11.332 10.4465 11.53C10.6375 11.724 10.7847 11.9566 10.8784 12.2123C10.972 12.4679 11.0099 12.7405 10.9895 13.012C10.9895 14.081 10.9795 14.944 10.9795 15.206C10.9795 15.42 11.1235 15.669 11.5295 15.591C13.3328 14.9911 14.8636 13.7689 15.8479 12.1432C16.8321 10.5175 17.2054 8.59447 16.901 6.71858C16.5966 4.84268 15.6343 3.13642 14.1865 1.90536C12.7387 0.674306 10.9 -0.0011359 8.99953 1.43397e-06Z" fill="white" fill-rule="evenodd">
</path>
</svg>
</a>
</div>
</div>
</div>
<input class="radiotab w-0 h-0" data-lang="javascript" id="Nodejs_cmds_sorted_set-stepzrange2" name="cmds_sorted_set-stepzrange2" tabindex="1" type="radio"/>
<label class="justify-left label ml-4 pt-3.5 px-3 pb-1 cursor-pointer text-sm text-center bg-redis-ink-900 hover:text-redis-red-600 rounded rounded-mx transition duration-150 ease-in-out" for="Nodejs_cmds_sorted_set-stepzrange2" title="Open example">
Node.js
</label>
<div aria-labelledby="tab-cmds_sorted_set-stepzrange2" class="panel order-last hidden w-full mt-0 relative" id="panel_Nodejs_cmds_sorted_set-stepzrange2" role="tabpanel" tabindex="0">
<div class="highlight">
<pre class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kr">import</span> <span class="p">{</span> <span class="nx">createClient</span> <span class="p">}</span> <span class="nx">from</span> <span class="s1">'redis'</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">client</span> <span class="o">=</span> <span class="nx">createClient</span><span class="p">();</span>
</span></span><span class="line"><span class="cl"><span class="nx">client</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="s1">'error'</span><span class="p">,</span> <span class="nx">err</span> <span class="p">=></span> <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s1">'Redis Client Error'</span><span class="p">,</span> <span class="nx">err</span><span class="p">));</span>
</span></span><span class="line"><span class="cl"><span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">connect</span><span class="p">().</span><span class="k">catch</span><span class="p">(</span><span class="nx">console</span><span class="p">.</span><span class="nx">error</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">val1</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">zAdd</span><span class="p">(</span><span class="s2">"myzset"</span><span class="p">,</span> <span class="p">[{</span> <span class="nx">value</span><span class="o">:</span> <span class="s1">'one'</span><span class="p">,</span> <span class="nx">score</span><span class="o">:</span> <span class="mi">1</span> <span class="p">}]);</span>
</span></span><span class="line"><span class="cl"><span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">val1</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="c1">// returns 1
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">val2</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">zAdd</span><span class="p">(</span><span class="s2">"myzset"</span><span class="p">,</span> <span class="p">[{</span> <span class="nx">value</span><span class="o">:</span> <span class="s1">'uno'</span><span class="p">,</span> <span class="nx">score</span><span class="o">:</span> <span class="mi">1</span> <span class="p">}]);</span>
</span></span><span class="line"><span class="cl"><span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">val2</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="c1">// returns 1
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">val3</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">zAdd</span><span class="p">(</span><span class="s2">"myzset"</span><span class="p">,</span> <span class="p">[{</span> <span class="nx">value</span><span class="o">:</span> <span class="s1">'two'</span><span class="p">,</span> <span class="nx">score</span><span class="o">:</span> <span class="mi">2</span> <span class="p">},</span> <span class="p">{</span> <span class="nx">value</span><span class="o">:</span> <span class="s1">'three'</span><span class="p">,</span> <span class="nx">score</span><span class="o">:</span> <span class="mi">3</span> <span class="p">}]);</span>
</span></span><span class="line"><span class="cl"><span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">val3</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="c1">// returns 2
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">val4</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">zRangeWithScores</span><span class="p">(</span><span class="s2">"myzset"</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">val4</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="c1">// returns [{value: 'one', score: 1}, {value: 'uno', score: 1}, {value: 'two', score: 2}, {value: 'three', score: 3} ]
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">val5</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">zAdd</span><span class="p">(</span><span class="s2">"myzset"</span><span class="p">,</span> <span class="p">[</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span> <span class="nx">value</span><span class="o">:</span> <span class="s1">'one'</span><span class="p">,</span> <span class="nx">score</span><span class="o">:</span> <span class="mi">1</span> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span> <span class="nx">value</span><span class="o">:</span> <span class="s1">'two'</span><span class="p">,</span> <span class="nx">score</span><span class="o">:</span> <span class="mi">2</span> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span> <span class="nx">value</span><span class="o">:</span> <span class="s1">'three'</span><span class="p">,</span> <span class="nx">score</span><span class="o">:</span> <span class="mi">3</span> <span class="p">}</span>
</span></span><span class="line"><span class="cl"><span class="p">]);</span>
</span></span><span class="line"><span class="cl"><span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">val5</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="c1">// returns 3
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">val6</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">zRange</span><span class="p">(</span><span class="s1">'myzset'</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">val6</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="c1">// returns ['one', 'two', 'three']
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">val7</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">zRange</span><span class="p">(</span><span class="s1">'myzset'</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">val7</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="c1">// returns ['three']
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">val8</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">zRange</span><span class="p">(</span><span class="s1">'myzset'</span><span class="p">,</span> <span class="o">-</span><span class="mi">2</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">val8</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="c1">// returns ['two', 'three']
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line hl"><span class="cl"><span class="kr">const</span> <span class="nx">val9</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">zAdd</span><span class="p">(</span><span class="s2">"myzset"</span><span class="p">,</span> <span class="p">[</span>
</span></span><span class="line hl"><span class="cl"> <span class="p">{</span> <span class="nx">value</span><span class="o">:</span> <span class="s1">'one'</span><span class="p">,</span> <span class="nx">score</span><span class="o">:</span> <span class="mi">1</span> <span class="p">},</span>
</span></span><span class="line hl"><span class="cl"> <span class="p">{</span> <span class="nx">value</span><span class="o">:</span> <span class="s1">'two'</span><span class="p">,</span> <span class="nx">score</span><span class="o">:</span> <span class="mi">2</span> <span class="p">},</span>
</span></span><span class="line hl"><span class="cl"> <span class="p">{</span> <span class="nx">value</span><span class="o">:</span> <span class="s1">'three'</span><span class="p">,</span> <span class="nx">score</span><span class="o">:</span> <span class="mi">3</span> <span class="p">}</span>
</span></span><span class="line hl"><span class="cl"><span class="p">]);</span>
</span></span><span class="line hl"><span class="cl"><span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">val9</span><span class="p">);</span>
</span></span><span class="line hl"><span class="cl"><span class="c1">// returns 3
</span></span></span><span class="line hl"><span class="cl"><span class="c1"></span>
</span></span><span class="line hl"><span class="cl"><span class="kr">const</span> <span class="nx">val10</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">zRangeWithScores</span><span class="p">(</span><span class="s1">'myzset'</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">);</span>
</span></span><span class="line hl"><span class="cl"><span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">val10</span><span class="p">);</span>
</span></span><span class="line hl"><span class="cl"><span class="c1">// returns [{value: 'one', score: 1}, {value: 'two', score: 2}]
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">val11</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">zAdd</span><span class="p">(</span><span class="s2">"myzset"</span><span class="p">,</span> <span class="p">[</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span> <span class="nx">value</span><span class="o">:</span> <span class="s1">'one'</span><span class="p">,</span> <span class="nx">score</span><span class="o">:</span> <span class="mi">1</span> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span> <span class="nx">value</span><span class="o">:</span> <span class="s1">'two'</span><span class="p">,</span> <span class="nx">score</span><span class="o">:</span> <span class="mi">2</span> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span> <span class="nx">value</span><span class="o">:</span> <span class="s1">'three'</span><span class="p">,</span> <span class="nx">score</span><span class="o">:</span> <span class="mi">3</span> <span class="p">}</span>
</span></span><span class="line"><span class="cl"><span class="p">]);</span>
</span></span><span class="line"><span class="cl"><span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">val11</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="c1">// returns 3
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">val12</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">zRange</span><span class="p">(</span><span class="s1">'myzset'</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="p">{</span> <span class="nx">BY</span><span class="o">:</span> <span class="s1">'SCORE'</span><span class="p">,</span> <span class="nx">LIMIT</span><span class="o">:</span> <span class="p">{</span> <span class="nx">offset</span><span class="o">:</span> <span class="mi">1</span><span class="p">,</span> <span class="nx">count</span><span class="o">:</span> <span class="mi">1</span> <span class="p">}</span> <span class="p">});</span>
</span></span><span class="line"><span class="cl"><span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">val12</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="c1">// >>> ['three']
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"><span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">quit</span><span class="p">();</span>
</span></span></code></pre>
</div>
<button class="clipboard-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-10 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="copyCodeToClipboard('#panel_Nodejs_cmds_sorted_set-stepzrange2')" tabindex="1" title="Copy to clipboard">
<svg fill="currentColor" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M9 43.95q-1.2 0-2.1-.9-.9-.9-.9-2.1V10.8h3v30.15h23.7v3Zm6-6q-1.2 0-2.1-.9-.9-.9-.9-2.1v-28q0-1.2.9-2.1.9-.9 2.1-.9h22q1.2 0 2.1.9.9.9.9 2.1v28q0 1.2-.9 2.1-.9.9-2.1.9Zm0-3h22v-28H15v28Zm0 0v-28 28Z">
</path>
</svg>
<div class="tooltip relative inline-block">
<span class="tooltiptext hidden bg-slate-200 rounded rounded-mx text-slate-800 text-center text-xs p-1 absolute right-6 bottom-4">
Copied!
</span>
</div>
</button>
<button aria-controls="panel_Nodejs_cmds_sorted_set-stepzrange2" class="visibility-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-2 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="toggleVisibleLines(this)" tabindex="1" title="Toggle visibility">
<svg class="hidden" fill="currentColor" id="visibility-off" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="m31.45 27.05-2.2-2.2q1.3-3.55-1.35-5.9-2.65-2.35-5.75-1.2l-2.2-2.2q.85-.55 1.9-.8 1.05-.25 2.15-.25 3.55 0 6.025 2.475Q32.5 19.45 32.5 23q0 1.1-.275 2.175-.275 1.075-.775 1.875Zm6.45 6.45-2-2q2.45-1.8 4.275-4.025Q42 25.25 42.85 23q-2.5-5.55-7.5-8.775Q30.35 11 24.5 11q-2.1 0-4.3.4-2.2.4-3.45.95L14.45 10q1.75-.8 4.475-1.4Q21.65 8 24.25 8q7.15 0 13.075 4.075Q43.25 16.15 46 23q-1.3 3.2-3.35 5.85-2.05 2.65-4.75 4.65Zm2.9 11.3-8.4-8.25q-1.75.7-3.95 1.075T24 38q-7.3 0-13.25-4.075T2 23q1-2.6 2.775-5.075T9.1 13.2L2.8 6.9l2.1-2.15L42.75 42.6ZM11.15 15.3q-1.85 1.35-3.575 3.55Q5.85 21.05 5.1 23q2.55 5.55 7.675 8.775Q17.9 35 24.4 35q1.65 0 3.25-.2t2.4-.6l-3.2-3.2q-.55.25-1.35.375T24 31.5q-3.5 0-6-2.45T15.5 23q0-.75.125-1.5T16 20.15Zm15.25 7.1Zm-5.8 2.9Z">
</path>
</svg>
<svg fill="currentColor" id="visibility-on" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M24 31.5q3.55 0 6.025-2.475Q32.5 26.55 32.5 23q0-3.55-2.475-6.025Q27.55 14.5 24 14.5q-3.55 0-6.025 2.475Q15.5 19.45 15.5 23q0 3.55 2.475 6.025Q20.45 31.5 24 31.5Zm0-2.9q-2.35 0-3.975-1.625T18.4 23q0-2.35 1.625-3.975T24 17.4q2.35 0 3.975 1.625T29.6 23q0 2.35-1.625 3.975T24 28.6Zm0 9.4q-7.3 0-13.2-4.15Q4.9 29.7 2 23q2.9-6.7 8.8-10.85Q16.7 8 24 8q7.3 0 13.2 4.15Q43.1 16.3 46 23q-2.9 6.7-8.8 10.85Q31.3 38 24 38Zm0-15Zm0 12q6.05 0 11.125-3.275T42.85 23q-2.65-5.45-7.725-8.725Q30.05 11 24 11t-11.125 3.275Q7.8 17.55 5.1 23q2.7 5.45 7.775 8.725Q17.95 35 24 35Z">
</path>
</svg>
</button>
<div class="cli-footer flex items-center justify-between rounded-b-md bg-slate-900 mt-0 px-4 pt-0 mb-0 transition-opacity ease-in-out duration-300 opacity-0 invisible group-hover:opacity-100 group-hover:visible">
<a class="rounded rounded-mx px-3 py-1 text-white text-xs hover:text-white hover:bg-slate-600 hover:border-transparent focus:outline-none focus:ring-2 focus:white focus:border-slate-500" href="https://redis.io/docs/latest/develop/connect/clients/nodejs/" tabindex="1" title="Quick-Start">
Node.js Quick-Start
</a>
<div class="w-1/2">
</div>
<div class="flex-1 text-right">
<a class="button text-neutral-400 hover:text-slate-100 h-6 w-6 p-1" href="https://github.com/redis/node-redis/tree/emb-examples/doctests/cmds-sorted-set.js" tabindex="1" title="Improve this code example">
<svg fill="github" height="16" viewbox="0 0 18 16" width="18" xmlns="http://www.w3.org/2000/svg">
<path clip-rule="evenodd" d="M8.99953 1.43397e-06C7.09918 -0.000897921 5.26058 0.674713 3.81295 1.90585C2.36533 3.13699 1.40324 4.84324 1.09896 6.71907C0.794684 8.5949 1.1681 10.5178 2.15233 12.1434C3.13657 13.769 4.66734 14.9912 6.47053 15.591C6.87053 15.664 7.01653 15.417 7.01653 15.205C7.01653 15.015 7.00953 14.512 7.00553 13.845C4.78053 14.328 4.31053 12.772 4.31053 12.772C4.16325 12.2887 3.84837 11.8739 3.42253 11.602C2.69653 11.102 3.47753 11.116 3.47753 11.116C3.73043 11.1515 3.97191 11.2442 4.18365 11.3869C4.39539 11.5297 4.57182 11.7189 4.69953 11.94C4.80755 12.1377 4.95378 12.3119 5.12972 12.4526C5.30567 12.5933 5.50782 12.6976 5.72442 12.7595C5.94103 12.8214 6.16778 12.8396 6.39148 12.813C6.61519 12.7865 6.83139 12.7158 7.02753 12.605C7.06381 12.1992 7.24399 11.8197 7.53553 11.535C5.75953 11.335 3.89153 10.647 3.89153 7.581C3.88005 6.78603 4.17513 6.01716 4.71553 5.434C4.47318 4.74369 4.50322 3.98693 4.79953 3.318C4.79953 3.318 5.47053 3.103 6.99953 4.138C8.31074 3.77905 9.69432 3.77905 11.0055 4.138C12.5325 3.103 13.2055 3.318 13.2055 3.318C13.5012 3.9877 13.5294 4.74513 13.2845 5.435C13.8221 6.01928 14.114 6.78817 14.0995 7.582C14.0995 10.655 12.2285 11.332 10.4465 11.53C10.6375 11.724 10.7847 11.9566 10.8784 12.2123C10.972 12.4679 11.0099 12.7405 10.9895 13.012C10.9895 14.081 10.9795 14.944 10.9795 15.206C10.9795 15.42 11.1235 15.669 11.5295 15.591C13.3328 14.9911 14.8636 13.7689 15.8479 12.1432C16.8321 10.5175 17.2054 8.59447 16.901 6.71858C16.5966 4.84268 15.6343 3.13642 14.1865 1.90536C12.7387 0.674306 10.9 -0.0011359 8.99953 1.43397e-06Z" fill="white" fill-rule="evenodd">
</path>
</svg>
</a>
</div>
</div>
</div>
<input class="radiotab w-0 h-0" data-lang="java" id="Java_cmds_sorted_set-stepzrange2" name="cmds_sorted_set-stepzrange2" tabindex="1" type="radio"/>
<label class="justify-left label ml-4 pt-3.5 px-3 pb-1 cursor-pointer text-sm text-center bg-redis-ink-900 hover:text-redis-red-600 rounded rounded-mx transition duration-150 ease-in-out" for="Java_cmds_sorted_set-stepzrange2" title="Open example">
Java
</label>
<div aria-labelledby="tab-cmds_sorted_set-stepzrange2" class="panel order-last hidden w-full mt-0 relative" id="panel_Java_cmds_sorted_set-stepzrange2" role="tabpanel" tabindex="0">
<div class="highlight">
<pre class="chroma"><code class="language-java" data-lang="java"><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">java.util.HashMap</span><span class="o">;</span>
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">java.util.Map</span><span class="o">;</span>
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">java.util.List</span><span class="o">;</span>
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">redis.clients.jedis.UnifiedJedis</span><span class="o">;</span>
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">redis.clients.jedis.params.ZRangeParams</span><span class="o">;</span>
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">redis.clients.jedis.resps.Tuple</span><span class="o">;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kd">public</span> <span class="kd">class</span> <span class="nc">CmdsSortedSetExample</span> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="kd">public</span> <span class="kt">void</span> <span class="nf">run</span><span class="o">()</span> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">UnifiedJedis</span> <span class="n">jedis</span> <span class="o">=</span> <span class="k">new</span> <span class="n">UnifiedJedis</span><span class="o">(</span><span class="s">"redis://localhost:6379"</span><span class="o">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'bzmpop' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'bzpopmax' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'bzpopmin' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">Map</span><span class="o"><</span><span class="n">String</span><span class="o">,</span> <span class="n">Double</span><span class="o">></span> <span class="n">zAddExampleParams</span> <span class="o">=</span> <span class="k">new</span> <span class="n">HashMap</span><span class="o"><>();</span>
</span></span><span class="line"><span class="cl"> <span class="n">zAddExampleParams</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">"one"</span><span class="o">,</span> <span class="mf">1.0</span><span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">long</span> <span class="n">zAddResult1</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">zadd</span><span class="o">(</span><span class="s">"myzset"</span><span class="o">,</span> <span class="n">zAddExampleParams</span><span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">zAddResult1</span><span class="o">);</span> <span class="c1">// >>> 1
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="n">zAddExampleParams</span><span class="o">.</span><span class="na">clear</span><span class="o">();</span>
</span></span><span class="line"><span class="cl"> <span class="n">zAddExampleParams</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">"uno"</span><span class="o">,</span> <span class="mf">1.0</span><span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">long</span> <span class="n">zAddResult2</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">zadd</span><span class="o">(</span><span class="s">"myzset"</span><span class="o">,</span> <span class="n">zAddExampleParams</span><span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">zAddResult2</span><span class="o">);</span> <span class="c1">// >>> 1
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="n">zAddExampleParams</span><span class="o">.</span><span class="na">clear</span><span class="o">();</span>
</span></span><span class="line"><span class="cl"> <span class="n">zAddExampleParams</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">"two"</span><span class="o">,</span> <span class="mf">2.0</span><span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">zAddExampleParams</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">"three"</span><span class="o">,</span> <span class="mf">3.0</span><span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">long</span> <span class="n">zAddResult3</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">zadd</span><span class="o">(</span><span class="s">"myzset"</span><span class="o">,</span> <span class="n">zAddExampleParams</span><span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">zAddResult3</span><span class="o">);</span> <span class="c1">// >>> 2
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="n">List</span><span class="o"><</span><span class="n">Tuple</span><span class="o">></span> <span class="n">zAddResult4</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">zrangeWithScores</span><span class="o">(</span><span class="s">"myzset"</span><span class="o">,</span> <span class="k">new</span> <span class="n">ZRangeParams</span><span class="o">(</span><span class="mi">0</span><span class="o">,</span> <span class="o">-</span><span class="mi">1</span><span class="o">));</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="o">(</span><span class="n">Tuple</span> <span class="n">item</span><span class="o">:</span> <span class="n">zAddResult4</span><span class="o">)</span> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"Element: "</span> <span class="o">+</span> <span class="n">item</span><span class="o">.</span><span class="na">getElement</span><span class="o">()</span> <span class="o">+</span> <span class="s">", Score: "</span> <span class="o">+</span> <span class="n">item</span><span class="o">.</span><span class="na">getScore</span><span class="o">());</span>
</span></span><span class="line"><span class="cl"> <span class="o">}</span>
</span></span><span class="line"><span class="cl"> <span class="c1">// >>> Element: one, Score: 1.0
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="c1">// >>> Element: uno, Score: 1.0
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="c1">// >>> Element: two, Score: 2.0
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="c1">// >>> Element: three, Score: 3.0
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zadd' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zcard' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zcount' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zdiff' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zdiffstore' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zincrby' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zinter' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zintercard' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zinterstore' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zlexcount' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zmpop' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zmscore' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zpopmax' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zpopmin' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrandmember' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">Map</span><span class="o"><</span><span class="n">String</span><span class="o">,</span> <span class="n">Double</span><span class="o">></span> <span class="n">zRangeExampleParams1</span> <span class="o">=</span> <span class="k">new</span> <span class="n">HashMap</span><span class="o"><>();</span>
</span></span><span class="line"><span class="cl"> <span class="n">zRangeExampleParams1</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">"one"</span><span class="o">,</span> <span class="mf">1.0</span><span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">zRangeExampleParams1</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">"two"</span><span class="o">,</span> <span class="mf">2.0</span><span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">zRangeExampleParams1</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">"three"</span><span class="o">,</span> <span class="mf">3.0</span><span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">long</span> <span class="n">zRangeResult1</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">zadd</span><span class="o">(</span><span class="s">"myzset"</span><span class="o">,</span> <span class="n">zRangeExampleParams1</span><span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">zRangeResult1</span><span class="o">);</span> <span class="c1">// >>> 3
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="n">List</span><span class="o"><</span><span class="n">String</span><span class="o">></span> <span class="n">zRangeResult2</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">zrange</span><span class="o">(</span><span class="s">"myzset"</span><span class="o">,</span> <span class="k">new</span> <span class="n">ZRangeParams</span><span class="o">(</span><span class="mi">0</span><span class="o">,</span> <span class="o">-</span><span class="mi">1</span><span class="o">));</span>
</span></span><span class="line"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">String</span><span class="o">.</span><span class="na">join</span><span class="o">(</span><span class="s">", "</span><span class="o">,</span> <span class="n">zRangeResult2</span><span class="o">));</span> <span class="c1">// >>> one, two, three
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="n">List</span><span class="o"><</span><span class="n">String</span><span class="o">></span> <span class="n">zRangeResult3</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">zrange</span><span class="o">(</span><span class="s">"myzset"</span><span class="o">,</span> <span class="k">new</span> <span class="n">ZRangeParams</span><span class="o">(</span><span class="mi">2</span><span class="o">,</span> <span class="mi">3</span><span class="o">));</span>
</span></span><span class="line"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">String</span><span class="o">.</span><span class="na">join</span><span class="o">(</span><span class="s">", "</span><span class="o">,</span> <span class="n">zRangeResult3</span><span class="o">));</span> <span class="c1">// >> three
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="n">List</span><span class="o"><</span><span class="n">String</span><span class="o">></span> <span class="n">zRangeResult4</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">zrange</span><span class="o">(</span><span class="s">"myzset"</span><span class="o">,</span> <span class="k">new</span> <span class="n">ZRangeParams</span><span class="o">(-</span><span class="mi">2</span><span class="o">,</span> <span class="o">-</span><span class="mi">1</span><span class="o">));</span>
</span></span><span class="line"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">String</span><span class="o">.</span><span class="na">join</span><span class="o">(</span><span class="s">", "</span><span class="o">,</span> <span class="n">zRangeResult4</span><span class="o">));</span> <span class="c1">// >> two, three
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrange1' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line hl"><span class="cl"> <span class="n">Map</span><span class="o"><</span><span class="n">String</span><span class="o">,</span> <span class="n">Double</span><span class="o">></span> <span class="n">zRangeExampleParams2</span> <span class="o">=</span> <span class="k">new</span> <span class="n">HashMap</span><span class="o"><>();</span>
</span></span><span class="line hl"><span class="cl"> <span class="n">zRangeExampleParams2</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">"one"</span><span class="o">,</span> <span class="mf">1.0</span><span class="o">);</span>
</span></span><span class="line hl"><span class="cl"> <span class="n">zRangeExampleParams2</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">"two"</span><span class="o">,</span> <span class="mf">2.0</span><span class="o">);</span>
</span></span><span class="line hl"><span class="cl"> <span class="n">zRangeExampleParams2</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">"three"</span><span class="o">,</span> <span class="mf">3.0</span><span class="o">);</span>
</span></span><span class="line hl"><span class="cl"> <span class="kt">long</span> <span class="n">zRangeResult5</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">zadd</span><span class="o">(</span><span class="s">"myzset"</span><span class="o">,</span> <span class="n">zRangeExampleParams2</span><span class="o">);</span>
</span></span><span class="line hl"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">zRangeResult5</span><span class="o">);</span> <span class="c1">// >>> 3
</span></span></span><span class="line hl"><span class="cl"><span class="c1"></span>
</span></span><span class="line hl"><span class="cl"> <span class="n">List</span><span class="o"><</span><span class="n">Tuple</span><span class="o">></span> <span class="n">zRangeResult6</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">zrangeWithScores</span><span class="o">(</span><span class="s">"myzset"</span><span class="o">,</span> <span class="k">new</span> <span class="n">ZRangeParams</span><span class="o">(</span><span class="mi">0</span><span class="o">,</span> <span class="mi">1</span><span class="o">));</span>
</span></span><span class="line hl"><span class="cl">
</span></span><span class="line hl"><span class="cl"> <span class="k">for</span> <span class="o">(</span><span class="n">Tuple</span> <span class="n">item</span><span class="o">:</span> <span class="n">zRangeResult6</span><span class="o">)</span> <span class="o">{</span>
</span></span><span class="line hl"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"Element: "</span> <span class="o">+</span> <span class="n">item</span><span class="o">.</span><span class="na">getElement</span><span class="o">()</span> <span class="o">+</span> <span class="s">", Score: "</span> <span class="o">+</span> <span class="n">item</span><span class="o">.</span><span class="na">getScore</span><span class="o">());</span>
</span></span><span class="line hl"><span class="cl"> <span class="o">}</span>
</span></span><span class="line hl"><span class="cl"> <span class="c1">// >>> Element: one, Score: 1.0
</span></span></span><span class="line hl"><span class="cl"><span class="c1"></span> <span class="c1">// >>> Element: two, Score: 2.0
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrange2' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">Map</span><span class="o"><</span><span class="n">String</span><span class="o">,</span> <span class="n">Double</span><span class="o">></span> <span class="n">zRangeExampleParams3</span> <span class="o">=</span> <span class="k">new</span> <span class="n">HashMap</span><span class="o"><>();</span>
</span></span><span class="line"><span class="cl"> <span class="n">zRangeExampleParams3</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">"one"</span><span class="o">,</span> <span class="mf">1.0</span><span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">zRangeExampleParams3</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">"two"</span><span class="o">,</span> <span class="mf">2.0</span><span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">zRangeExampleParams3</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">"three"</span><span class="o">,</span> <span class="mf">3.0</span><span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">long</span> <span class="n">zRangeResult7</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">zadd</span><span class="o">(</span><span class="s">"myzset"</span><span class="o">,</span> <span class="n">zRangeExampleParams3</span><span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">zRangeResult7</span><span class="o">);</span> <span class="c1">// >>> 3
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="n">List</span><span class="o"><</span><span class="n">String</span><span class="o">></span> <span class="n">zRangeResult8</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">zrangeByScore</span><span class="o">(</span><span class="s">"myzset"</span><span class="o">,</span> <span class="s">"(1"</span><span class="o">,</span> <span class="s">"+inf"</span><span class="o">,</span> <span class="mi">1</span><span class="o">,</span> <span class="mi">1</span><span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">String</span><span class="o">.</span><span class="na">join</span><span class="o">(</span><span class="s">", "</span><span class="o">,</span> <span class="n">zRangeResult8</span><span class="o">));</span> <span class="c1">// >>> three
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrange3' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrangebylex' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrangebyscore' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrangestore' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrank' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrem' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zremrangebylex' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zremrangebyrank' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zremrangebyscore' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrevrange' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrevrangebylex' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrevrangebyscore' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrevrank' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zscan' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zscore' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zunion' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zunionstore' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="o">}</span>
</span></span><span class="line"><span class="cl"><span class="o">}</span>
</span></span><span class="line"><span class="cl">
</span></span></code></pre>
</div>
<button class="clipboard-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-10 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="copyCodeToClipboard('#panel_Java_cmds_sorted_set-stepzrange2')" tabindex="1" title="Copy to clipboard">
<svg fill="currentColor" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M9 43.95q-1.2 0-2.1-.9-.9-.9-.9-2.1V10.8h3v30.15h23.7v3Zm6-6q-1.2 0-2.1-.9-.9-.9-.9-2.1v-28q0-1.2.9-2.1.9-.9 2.1-.9h22q1.2 0 2.1.9.9.9.9 2.1v28q0 1.2-.9 2.1-.9.9-2.1.9Zm0-3h22v-28H15v28Zm0 0v-28 28Z">
</path>
</svg>
<div class="tooltip relative inline-block">
<span class="tooltiptext hidden bg-slate-200 rounded rounded-mx text-slate-800 text-center text-xs p-1 absolute right-6 bottom-4">
Copied!
</span>
</div>
</button>
<button aria-controls="panel_Java_cmds_sorted_set-stepzrange2" class="visibility-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-2 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="toggleVisibleLines(this)" tabindex="1" title="Toggle visibility">
<svg class="hidden" fill="currentColor" id="visibility-off" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="m31.45 27.05-2.2-2.2q1.3-3.55-1.35-5.9-2.65-2.35-5.75-1.2l-2.2-2.2q.85-.55 1.9-.8 1.05-.25 2.15-.25 3.55 0 6.025 2.475Q32.5 19.45 32.5 23q0 1.1-.275 2.175-.275 1.075-.775 1.875Zm6.45 6.45-2-2q2.45-1.8 4.275-4.025Q42 25.25 42.85 23q-2.5-5.55-7.5-8.775Q30.35 11 24.5 11q-2.1 0-4.3.4-2.2.4-3.45.95L14.45 10q1.75-.8 4.475-1.4Q21.65 8 24.25 8q7.15 0 13.075 4.075Q43.25 16.15 46 23q-1.3 3.2-3.35 5.85-2.05 2.65-4.75 4.65Zm2.9 11.3-8.4-8.25q-1.75.7-3.95 1.075T24 38q-7.3 0-13.25-4.075T2 23q1-2.6 2.775-5.075T9.1 13.2L2.8 6.9l2.1-2.15L42.75 42.6ZM11.15 15.3q-1.85 1.35-3.575 3.55Q5.85 21.05 5.1 23q2.55 5.55 7.675 8.775Q17.9 35 24.4 35q1.65 0 3.25-.2t2.4-.6l-3.2-3.2q-.55.25-1.35.375T24 31.5q-3.5 0-6-2.45T15.5 23q0-.75.125-1.5T16 20.15Zm15.25 7.1Zm-5.8 2.9Z">
</path>
</svg>
<svg fill="currentColor" id="visibility-on" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M24 31.5q3.55 0 6.025-2.475Q32.5 26.55 32.5 23q0-3.55-2.475-6.025Q27.55 14.5 24 14.5q-3.55 0-6.025 2.475Q15.5 19.45 15.5 23q0 3.55 2.475 6.025Q20.45 31.5 24 31.5Zm0-2.9q-2.35 0-3.975-1.625T18.4 23q0-2.35 1.625-3.975T24 17.4q2.35 0 3.975 1.625T29.6 23q0 2.35-1.625 3.975T24 28.6Zm0 9.4q-7.3 0-13.2-4.15Q4.9 29.7 2 23q2.9-6.7 8.8-10.85Q16.7 8 24 8q7.3 0 13.2 4.15Q43.1 16.3 46 23q-2.9 6.7-8.8 10.85Q31.3 38 24 38Zm0-15Zm0 12q6.05 0 11.125-3.275T42.85 23q-2.65-5.45-7.725-8.725Q30.05 11 24 11t-11.125 3.275Q7.8 17.55 5.1 23q2.7 5.45 7.775 8.725Q17.95 35 24 35Z">
</path>
</svg>
</button>
<div class="cli-footer flex items-center justify-between rounded-b-md bg-slate-900 mt-0 px-4 pt-0 mb-0 transition-opacity ease-in-out duration-300 opacity-0 invisible group-hover:opacity-100 group-hover:visible">
<a class="rounded rounded-mx px-3 py-1 text-white text-xs hover:text-white hover:bg-slate-600 hover:border-transparent focus:outline-none focus:ring-2 focus:white focus:border-slate-500" href="https://redis.io/docs/latest/develop/connect/clients/java/jedis/" tabindex="1" title="Quick-Start">
Java Quick-Start
</a>
<div class="w-1/2">
</div>
<div class="flex-1 text-right">
<a class="button text-neutral-400 hover:text-slate-100 h-6 w-6 p-1" href="https://github.com/redis/jedis/tree/master/src/test/java/io/redis/examples/CmdsSortedSetExample.java" tabindex="1" title="Improve this code example">
<svg fill="github" height="16" viewbox="0 0 18 16" width="18" xmlns="http://www.w3.org/2000/svg">
<path clip-rule="evenodd" d="M8.99953 1.43397e-06C7.09918 -0.000897921 5.26058 0.674713 3.81295 1.90585C2.36533 3.13699 1.40324 4.84324 1.09896 6.71907C0.794684 8.5949 1.1681 10.5178 2.15233 12.1434C3.13657 13.769 4.66734 14.9912 6.47053 15.591C6.87053 15.664 7.01653 15.417 7.01653 15.205C7.01653 15.015 7.00953 14.512 7.00553 13.845C4.78053 14.328 4.31053 12.772 4.31053 12.772C4.16325 12.2887 3.84837 11.8739 3.42253 11.602C2.69653 11.102 3.47753 11.116 3.47753 11.116C3.73043 11.1515 3.97191 11.2442 4.18365 11.3869C4.39539 11.5297 4.57182 11.7189 4.69953 11.94C4.80755 12.1377 4.95378 12.3119 5.12972 12.4526C5.30567 12.5933 5.50782 12.6976 5.72442 12.7595C5.94103 12.8214 6.16778 12.8396 6.39148 12.813C6.61519 12.7865 6.83139 12.7158 7.02753 12.605C7.06381 12.1992 7.24399 11.8197 7.53553 11.535C5.75953 11.335 3.89153 10.647 3.89153 7.581C3.88005 6.78603 4.17513 6.01716 4.71553 5.434C4.47318 4.74369 4.50322 3.98693 4.79953 3.318C4.79953 3.318 5.47053 3.103 6.99953 4.138C8.31074 3.77905 9.69432 3.77905 11.0055 4.138C12.5325 3.103 13.2055 3.318 13.2055 3.318C13.5012 3.9877 13.5294 4.74513 13.2845 5.435C13.8221 6.01928 14.114 6.78817 14.0995 7.582C14.0995 10.655 12.2285 11.332 10.4465 11.53C10.6375 11.724 10.7847 11.9566 10.8784 12.2123C10.972 12.4679 11.0099 12.7405 10.9895 13.012C10.9895 14.081 10.9795 14.944 10.9795 15.206C10.9795 15.42 11.1235 15.669 11.5295 15.591C13.3328 14.9911 14.8636 13.7689 15.8479 12.1432C16.8321 10.5175 17.2054 8.59447 16.901 6.71858C16.5966 4.84268 15.6343 3.13642 14.1865 1.90536C12.7387 0.674306 10.9 -0.0011359 8.99953 1.43397e-06Z" fill="white" fill-rule="evenodd">
</path>
</svg>
</a>
</div>
</div>
</div>
<input class="radiotab w-0 h-0" data-lang="go" id="Go_cmds_sorted_set-stepzrange2" name="cmds_sorted_set-stepzrange2" tabindex="1" type="radio"/>
<label class="justify-left label ml-4 pt-3.5 px-3 pb-1 cursor-pointer text-sm text-center bg-redis-ink-900 hover:text-redis-red-600 rounded rounded-mx transition duration-150 ease-in-out" for="Go_cmds_sorted_set-stepzrange2" title="Open example">
Go
</label>
<div aria-labelledby="tab-cmds_sorted_set-stepzrange2" class="panel order-last hidden w-full mt-0 relative" id="panel_Go_cmds_sorted_set-stepzrange2" role="tabpanel" tabindex="0">
<div class="highlight">
<pre class="chroma"><code class="language-go" data-lang="go"><span class="line"><span class="cl"><span class="kn">package</span> <span class="nx">example_commands_test</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="s">"context"</span>
</span></span><span class="line"><span class="cl"> <span class="s">"fmt"</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="s">"github.com/redis/go-redis/v9"</span>
</span></span><span class="line"><span class="cl"><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kd">func</span> <span class="nf">ExampleClient_zadd_cmd</span><span class="p">()</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">ctx</span> <span class="o">:=</span> <span class="nx">context</span><span class="p">.</span><span class="nf">Background</span><span class="p">()</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="nx">rdb</span> <span class="o">:=</span> <span class="nx">redis</span><span class="p">.</span><span class="nf">NewClient</span><span class="p">(</span><span class="o">&</span><span class="nx">redis</span><span class="p">.</span><span class="nx">Options</span><span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Addr</span><span class="p">:</span> <span class="s">"localhost:6379"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Password</span><span class="p">:</span> <span class="s">""</span><span class="p">,</span> <span class="c1">// no password docs
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="nx">DB</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span> <span class="c1">// use default DB
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="p">})</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="nx">zAddResult1</span><span class="p">,</span> <span class="nx">err</span> <span class="o">:=</span> <span class="nx">rdb</span><span class="p">.</span><span class="nf">ZAdd</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"myzset"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">redis</span><span class="p">.</span><span class="nx">Z</span><span class="p">{</span><span class="nx">Member</span><span class="p">:</span> <span class="s">"one"</span><span class="p">,</span> <span class="nx">Score</span><span class="p">:</span> <span class="mi">1</span><span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="p">).</span><span class="nf">Result</span><span class="p">()</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="nx">err</span> <span class="o">!=</span> <span class="kc">nil</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nb">panic</span><span class="p">(</span><span class="nx">err</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="nx">fmt</span><span class="p">.</span><span class="nf">Println</span><span class="p">(</span><span class="nx">zAddResult1</span><span class="p">)</span> <span class="c1">// >>> 1
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="nx">zAddResult2</span><span class="p">,</span> <span class="nx">err</span> <span class="o">:=</span> <span class="nx">rdb</span><span class="p">.</span><span class="nf">ZAdd</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"myzset"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">redis</span><span class="p">.</span><span class="nx">Z</span><span class="p">{</span><span class="nx">Member</span><span class="p">:</span> <span class="s">"uno"</span><span class="p">,</span> <span class="nx">Score</span><span class="p">:</span> <span class="mi">1</span><span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="p">).</span><span class="nf">Result</span><span class="p">()</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="nx">err</span> <span class="o">!=</span> <span class="kc">nil</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nb">panic</span><span class="p">(</span><span class="nx">err</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="nx">fmt</span><span class="p">.</span><span class="nf">Println</span><span class="p">(</span><span class="nx">zAddResult2</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="nx">zAddResult3</span><span class="p">,</span> <span class="nx">err</span> <span class="o">:=</span> <span class="nx">rdb</span><span class="p">.</span><span class="nf">ZAdd</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"myzset"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">redis</span><span class="p">.</span><span class="nx">Z</span><span class="p">{</span><span class="nx">Member</span><span class="p">:</span> <span class="s">"two"</span><span class="p">,</span> <span class="nx">Score</span><span class="p">:</span> <span class="mi">2</span><span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="nx">redis</span><span class="p">.</span><span class="nx">Z</span><span class="p">{</span><span class="nx">Member</span><span class="p">:</span> <span class="s">"three"</span><span class="p">,</span> <span class="nx">Score</span><span class="p">:</span> <span class="mi">3</span><span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="p">).</span><span class="nf">Result</span><span class="p">()</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="nx">err</span> <span class="o">!=</span> <span class="kc">nil</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nb">panic</span><span class="p">(</span><span class="nx">err</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="nx">fmt</span><span class="p">.</span><span class="nf">Println</span><span class="p">(</span><span class="nx">zAddResult3</span><span class="p">)</span> <span class="c1">// >>> 2
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="nx">zAddResult4</span><span class="p">,</span> <span class="nx">err</span> <span class="o">:=</span> <span class="nx">rdb</span><span class="p">.</span><span class="nf">ZRangeWithScores</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"myzset"</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">).</span><span class="nf">Result</span><span class="p">()</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="nx">err</span> <span class="o">!=</span> <span class="kc">nil</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nb">panic</span><span class="p">(</span><span class="nx">err</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="nx">fmt</span><span class="p">.</span><span class="nf">Println</span><span class="p">(</span><span class="nx">zAddResult4</span><span class="p">)</span> <span class="c1">// >>> [{1 one} {1 uno} {2 two} {3 three}]
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kd">func</span> <span class="nf">ExampleClient_zrange1</span><span class="p">()</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">ctx</span> <span class="o">:=</span> <span class="nx">context</span><span class="p">.</span><span class="nf">Background</span><span class="p">()</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="nx">rdb</span> <span class="o">:=</span> <span class="nx">redis</span><span class="p">.</span><span class="nf">NewClient</span><span class="p">(</span><span class="o">&</span><span class="nx">redis</span><span class="p">.</span><span class="nx">Options</span><span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Addr</span><span class="p">:</span> <span class="s">"localhost:6379"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Password</span><span class="p">:</span> <span class="s">""</span><span class="p">,</span> <span class="c1">// no password docs
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="nx">DB</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span> <span class="c1">// use default DB
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="p">})</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="nx">zrangeResult1</span><span class="p">,</span> <span class="nx">err</span> <span class="o">:=</span> <span class="nx">rdb</span><span class="p">.</span><span class="nf">ZAdd</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"myzset"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">redis</span><span class="p">.</span><span class="nx">Z</span><span class="p">{</span><span class="nx">Member</span><span class="p">:</span> <span class="s">"one"</span><span class="p">,</span> <span class="nx">Score</span><span class="p">:</span> <span class="mi">1</span><span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="nx">redis</span><span class="p">.</span><span class="nx">Z</span><span class="p">{</span><span class="nx">Member</span><span class="p">:</span> <span class="s">"two"</span><span class="p">,</span> <span class="nx">Score</span><span class="p">:</span> <span class="mi">2</span><span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="nx">redis</span><span class="p">.</span><span class="nx">Z</span><span class="p">{</span><span class="nx">Member</span><span class="p">:</span> <span class="s">"three"</span><span class="p">,</span> <span class="nx">Score</span><span class="p">:</span> <span class="mi">3</span><span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="p">).</span><span class="nf">Result</span><span class="p">()</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="nx">err</span> <span class="o">!=</span> <span class="kc">nil</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nb">panic</span><span class="p">(</span><span class="nx">err</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="nx">fmt</span><span class="p">.</span><span class="nf">Println</span><span class="p">(</span><span class="nx">zrangeResult1</span><span class="p">)</span> <span class="c1">// >>> 3
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="nx">zrangeResult2</span><span class="p">,</span> <span class="nx">err</span> <span class="o">:=</span> <span class="nx">rdb</span><span class="p">.</span><span class="nf">ZRange</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"myzset"</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">).</span><span class="nf">Result</span><span class="p">()</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="nx">err</span> <span class="o">!=</span> <span class="kc">nil</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nb">panic</span><span class="p">(</span><span class="nx">err</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="nx">fmt</span><span class="p">.</span><span class="nf">Println</span><span class="p">(</span><span class="nx">zrangeResult2</span><span class="p">)</span> <span class="c1">// >>> [one two three]
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="nx">zrangeResult3</span><span class="p">,</span> <span class="nx">err</span> <span class="o">:=</span> <span class="nx">rdb</span><span class="p">.</span><span class="nf">ZRange</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"myzset"</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">).</span><span class="nf">Result</span><span class="p">()</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="nx">err</span> <span class="o">!=</span> <span class="kc">nil</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nb">panic</span><span class="p">(</span><span class="nx">err</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="nx">fmt</span><span class="p">.</span><span class="nf">Println</span><span class="p">(</span><span class="nx">zrangeResult3</span><span class="p">)</span> <span class="c1">// >>> [three]
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="nx">zrangeResult4</span><span class="p">,</span> <span class="nx">err</span> <span class="o">:=</span> <span class="nx">rdb</span><span class="p">.</span><span class="nf">ZRange</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"myzset"</span><span class="p">,</span> <span class="o">-</span><span class="mi">2</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">).</span><span class="nf">Result</span><span class="p">()</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="nx">err</span> <span class="o">!=</span> <span class="kc">nil</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nb">panic</span><span class="p">(</span><span class="nx">err</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="nx">fmt</span><span class="p">.</span><span class="nf">Println</span><span class="p">(</span><span class="nx">zrangeResult4</span><span class="p">)</span> <span class="c1">// >>> [two three]
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kd">func</span> <span class="nf">ExampleClient_zrange2</span><span class="p">()</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">ctx</span> <span class="o">:=</span> <span class="nx">context</span><span class="p">.</span><span class="nf">Background</span><span class="p">()</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="nx">rdb</span> <span class="o">:=</span> <span class="nx">redis</span><span class="p">.</span><span class="nf">NewClient</span><span class="p">(</span><span class="o">&</span><span class="nx">redis</span><span class="p">.</span><span class="nx">Options</span><span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Addr</span><span class="p">:</span> <span class="s">"localhost:6379"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Password</span><span class="p">:</span> <span class="s">""</span><span class="p">,</span> <span class="c1">// no password docs
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="nx">DB</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span> <span class="c1">// use default DB
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="p">})</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line hl"><span class="cl"> <span class="nx">zRangeResult5</span><span class="p">,</span> <span class="nx">err</span> <span class="o">:=</span> <span class="nx">rdb</span><span class="p">.</span><span class="nf">ZAdd</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"myzset"</span><span class="p">,</span>
</span></span><span class="line hl"><span class="cl"> <span class="nx">redis</span><span class="p">.</span><span class="nx">Z</span><span class="p">{</span><span class="nx">Member</span><span class="p">:</span> <span class="s">"one"</span><span class="p">,</span> <span class="nx">Score</span><span class="p">:</span> <span class="mi">1</span><span class="p">},</span>
</span></span><span class="line hl"><span class="cl"> <span class="nx">redis</span><span class="p">.</span><span class="nx">Z</span><span class="p">{</span><span class="nx">Member</span><span class="p">:</span> <span class="s">"two"</span><span class="p">,</span> <span class="nx">Score</span><span class="p">:</span> <span class="mi">2</span><span class="p">},</span>
</span></span><span class="line hl"><span class="cl"> <span class="nx">redis</span><span class="p">.</span><span class="nx">Z</span><span class="p">{</span><span class="nx">Member</span><span class="p">:</span> <span class="s">"three"</span><span class="p">,</span> <span class="nx">Score</span><span class="p">:</span> <span class="mi">3</span><span class="p">},</span>
</span></span><span class="line hl"><span class="cl"> <span class="p">).</span><span class="nf">Result</span><span class="p">()</span>
</span></span><span class="line hl"><span class="cl">
</span></span><span class="line hl"><span class="cl"> <span class="k">if</span> <span class="nx">err</span> <span class="o">!=</span> <span class="kc">nil</span> <span class="p">{</span>
</span></span><span class="line hl"><span class="cl"> <span class="nb">panic</span><span class="p">(</span><span class="nx">err</span><span class="p">)</span>
</span></span><span class="line hl"><span class="cl"> <span class="p">}</span>
</span></span><span class="line hl"><span class="cl">
</span></span><span class="line hl"><span class="cl"> <span class="nx">fmt</span><span class="p">.</span><span class="nf">Println</span><span class="p">(</span><span class="nx">zRangeResult5</span><span class="p">)</span> <span class="c1">// >>> 3
</span></span></span><span class="line hl"><span class="cl"><span class="c1"></span>
</span></span><span class="line hl"><span class="cl"> <span class="nx">zRangeResult6</span><span class="p">,</span> <span class="nx">err</span> <span class="o">:=</span> <span class="nx">rdb</span><span class="p">.</span><span class="nf">ZRangeWithScores</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"myzset"</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">).</span><span class="nf">Result</span><span class="p">()</span>
</span></span><span class="line hl"><span class="cl">
</span></span><span class="line hl"><span class="cl"> <span class="k">if</span> <span class="nx">err</span> <span class="o">!=</span> <span class="kc">nil</span> <span class="p">{</span>
</span></span><span class="line hl"><span class="cl"> <span class="nb">panic</span><span class="p">(</span><span class="nx">err</span><span class="p">)</span>
</span></span><span class="line hl"><span class="cl"> <span class="p">}</span>
</span></span><span class="line hl"><span class="cl">
</span></span><span class="line hl"><span class="cl"> <span class="nx">fmt</span><span class="p">.</span><span class="nf">Println</span><span class="p">(</span><span class="nx">zRangeResult6</span><span class="p">)</span> <span class="c1">// >>> [{1 one} {2 two}]
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kd">func</span> <span class="nf">ExampleClient_zrange3</span><span class="p">()</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">ctx</span> <span class="o">:=</span> <span class="nx">context</span><span class="p">.</span><span class="nf">Background</span><span class="p">()</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="nx">rdb</span> <span class="o">:=</span> <span class="nx">redis</span><span class="p">.</span><span class="nf">NewClient</span><span class="p">(</span><span class="o">&</span><span class="nx">redis</span><span class="p">.</span><span class="nx">Options</span><span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Addr</span><span class="p">:</span> <span class="s">"localhost:6379"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Password</span><span class="p">:</span> <span class="s">""</span><span class="p">,</span> <span class="c1">// no password docs
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="nx">DB</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span> <span class="c1">// use default DB
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="p">})</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="nx">zRangeResult7</span><span class="p">,</span> <span class="nx">err</span> <span class="o">:=</span> <span class="nx">rdb</span><span class="p">.</span><span class="nf">ZAdd</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"myzset"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">redis</span><span class="p">.</span><span class="nx">Z</span><span class="p">{</span><span class="nx">Member</span><span class="p">:</span> <span class="s">"one"</span><span class="p">,</span> <span class="nx">Score</span><span class="p">:</span> <span class="mi">1</span><span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="nx">redis</span><span class="p">.</span><span class="nx">Z</span><span class="p">{</span><span class="nx">Member</span><span class="p">:</span> <span class="s">"two"</span><span class="p">,</span> <span class="nx">Score</span><span class="p">:</span> <span class="mi">2</span><span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="nx">redis</span><span class="p">.</span><span class="nx">Z</span><span class="p">{</span><span class="nx">Member</span><span class="p">:</span> <span class="s">"three"</span><span class="p">,</span> <span class="nx">Score</span><span class="p">:</span> <span class="mi">3</span><span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="p">).</span><span class="nf">Result</span><span class="p">()</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="nx">err</span> <span class="o">!=</span> <span class="kc">nil</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nb">panic</span><span class="p">(</span><span class="nx">err</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="nx">fmt</span><span class="p">.</span><span class="nf">Println</span><span class="p">(</span><span class="nx">zRangeResult7</span><span class="p">)</span> <span class="c1">// >>> 3
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="nx">zRangeResult8</span><span class="p">,</span> <span class="nx">err</span> <span class="o">:=</span> <span class="nx">rdb</span><span class="p">.</span><span class="nf">ZRangeArgs</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">redis</span><span class="p">.</span><span class="nx">ZRangeArgs</span><span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Key</span><span class="p">:</span> <span class="s">"myzset"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">ByScore</span><span class="p">:</span> <span class="kc">true</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Start</span><span class="p">:</span> <span class="s">"(1"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Stop</span><span class="p">:</span> <span class="s">"+inf"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Offset</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Count</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="p">).</span><span class="nf">Result</span><span class="p">()</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="nx">err</span> <span class="o">!=</span> <span class="kc">nil</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nb">panic</span><span class="p">(</span><span class="nx">err</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="nx">fmt</span><span class="p">.</span><span class="nf">Println</span><span class="p">(</span><span class="nx">zRangeResult8</span><span class="p">)</span> <span class="c1">// >>> [three]
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span></code></pre>
</div>
<button class="clipboard-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-10 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="copyCodeToClipboard('#panel_Go_cmds_sorted_set-stepzrange2')" tabindex="1" title="Copy to clipboard">
<svg fill="currentColor" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M9 43.95q-1.2 0-2.1-.9-.9-.9-.9-2.1V10.8h3v30.15h23.7v3Zm6-6q-1.2 0-2.1-.9-.9-.9-.9-2.1v-28q0-1.2.9-2.1.9-.9 2.1-.9h22q1.2 0 2.1.9.9.9.9 2.1v28q0 1.2-.9 2.1-.9.9-2.1.9Zm0-3h22v-28H15v28Zm0 0v-28 28Z">
</path>
</svg>
<div class="tooltip relative inline-block">
<span class="tooltiptext hidden bg-slate-200 rounded rounded-mx text-slate-800 text-center text-xs p-1 absolute right-6 bottom-4">
Copied!
</span>
</div>
</button>
<button aria-controls="panel_Go_cmds_sorted_set-stepzrange2" class="visibility-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-2 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="toggleVisibleLines(this)" tabindex="1" title="Toggle visibility">
<svg class="hidden" fill="currentColor" id="visibility-off" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="m31.45 27.05-2.2-2.2q1.3-3.55-1.35-5.9-2.65-2.35-5.75-1.2l-2.2-2.2q.85-.55 1.9-.8 1.05-.25 2.15-.25 3.55 0 6.025 2.475Q32.5 19.45 32.5 23q0 1.1-.275 2.175-.275 1.075-.775 1.875Zm6.45 6.45-2-2q2.45-1.8 4.275-4.025Q42 25.25 42.85 23q-2.5-5.55-7.5-8.775Q30.35 11 24.5 11q-2.1 0-4.3.4-2.2.4-3.45.95L14.45 10q1.75-.8 4.475-1.4Q21.65 8 24.25 8q7.15 0 13.075 4.075Q43.25 16.15 46 23q-1.3 3.2-3.35 5.85-2.05 2.65-4.75 4.65Zm2.9 11.3-8.4-8.25q-1.75.7-3.95 1.075T24 38q-7.3 0-13.25-4.075T2 23q1-2.6 2.775-5.075T9.1 13.2L2.8 6.9l2.1-2.15L42.75 42.6ZM11.15 15.3q-1.85 1.35-3.575 3.55Q5.85 21.05 5.1 23q2.55 5.55 7.675 8.775Q17.9 35 24.4 35q1.65 0 3.25-.2t2.4-.6l-3.2-3.2q-.55.25-1.35.375T24 31.5q-3.5 0-6-2.45T15.5 23q0-.75.125-1.5T16 20.15Zm15.25 7.1Zm-5.8 2.9Z">
</path>
</svg>
<svg fill="currentColor" id="visibility-on" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M24 31.5q3.55 0 6.025-2.475Q32.5 26.55 32.5 23q0-3.55-2.475-6.025Q27.55 14.5 24 14.5q-3.55 0-6.025 2.475Q15.5 19.45 15.5 23q0 3.55 2.475 6.025Q20.45 31.5 24 31.5Zm0-2.9q-2.35 0-3.975-1.625T18.4 23q0-2.35 1.625-3.975T24 17.4q2.35 0 3.975 1.625T29.6 23q0 2.35-1.625 3.975T24 28.6Zm0 9.4q-7.3 0-13.2-4.15Q4.9 29.7 2 23q2.9-6.7 8.8-10.85Q16.7 8 24 8q7.3 0 13.2 4.15Q43.1 16.3 46 23q-2.9 6.7-8.8 10.85Q31.3 38 24 38Zm0-15Zm0 12q6.05 0 11.125-3.275T42.85 23q-2.65-5.45-7.725-8.725Q30.05 11 24 11t-11.125 3.275Q7.8 17.55 5.1 23q2.7 5.45 7.775 8.725Q17.95 35 24 35Z">
</path>
</svg>
</button>
<div class="cli-footer flex items-center justify-between rounded-b-md bg-slate-900 mt-0 px-4 pt-0 mb-0 transition-opacity ease-in-out duration-300 opacity-0 invisible group-hover:opacity-100 group-hover:visible">
<a class="rounded rounded-mx px-3 py-1 text-white text-xs hover:text-white hover:bg-slate-600 hover:border-transparent focus:outline-none focus:ring-2 focus:white focus:border-slate-500" href="https://redis.io/docs/latest/develop/connect/clients/go/" tabindex="1" title="Quick-Start">
Go Quick-Start
</a>
<div class="w-1/2">
</div>
<div class="flex-1 text-right">
<a class="button text-neutral-400 hover:text-slate-100 h-6 w-6 p-1" href="https://github.com/redis/go-redis/tree/master/doctests/cmds_sorted_set_test.go" tabindex="1" title="Improve this code example">
<svg fill="github" height="16" viewbox="0 0 18 16" width="18" xmlns="http://www.w3.org/2000/svg">
<path clip-rule="evenodd" d="M8.99953 1.43397e-06C7.09918 -0.000897921 5.26058 0.674713 3.81295 1.90585C2.36533 3.13699 1.40324 4.84324 1.09896 6.71907C0.794684 8.5949 1.1681 10.5178 2.15233 12.1434C3.13657 13.769 4.66734 14.9912 6.47053 15.591C6.87053 15.664 7.01653 15.417 7.01653 15.205C7.01653 15.015 7.00953 14.512 7.00553 13.845C4.78053 14.328 4.31053 12.772 4.31053 12.772C4.16325 12.2887 3.84837 11.8739 3.42253 11.602C2.69653 11.102 3.47753 11.116 3.47753 11.116C3.73043 11.1515 3.97191 11.2442 4.18365 11.3869C4.39539 11.5297 4.57182 11.7189 4.69953 11.94C4.80755 12.1377 4.95378 12.3119 5.12972 12.4526C5.30567 12.5933 5.50782 12.6976 5.72442 12.7595C5.94103 12.8214 6.16778 12.8396 6.39148 12.813C6.61519 12.7865 6.83139 12.7158 7.02753 12.605C7.06381 12.1992 7.24399 11.8197 7.53553 11.535C5.75953 11.335 3.89153 10.647 3.89153 7.581C3.88005 6.78603 4.17513 6.01716 4.71553 5.434C4.47318 4.74369 4.50322 3.98693 4.79953 3.318C4.79953 3.318 5.47053 3.103 6.99953 4.138C8.31074 3.77905 9.69432 3.77905 11.0055 4.138C12.5325 3.103 13.2055 3.318 13.2055 3.318C13.5012 3.9877 13.5294 4.74513 13.2845 5.435C13.8221 6.01928 14.114 6.78817 14.0995 7.582C14.0995 10.655 12.2285 11.332 10.4465 11.53C10.6375 11.724 10.7847 11.9566 10.8784 12.2123C10.972 12.4679 11.0099 12.7405 10.9895 13.012C10.9895 14.081 10.9795 14.944 10.9795 15.206C10.9795 15.42 11.1235 15.669 11.5295 15.591C13.3328 14.9911 14.8636 13.7689 15.8479 12.1432C16.8321 10.5175 17.2054 8.59447 16.901 6.71858C16.5966 4.84268 15.6343 3.13642 14.1865 1.90536C12.7387 0.674306 10.9 -0.0011359 8.99953 1.43397e-06Z" fill="white" fill-rule="evenodd">
</path>
</svg>
</a>
</div>
</div>
</div>
<input class="radiotab w-0 h-0" data-lang="dotnet" id="Csharp_cmds_sorted_set-stepzrange2" name="cmds_sorted_set-stepzrange2" tabindex="1" type="radio"/>
<label class="justify-left label ml-4 pt-3.5 px-3 pb-1 cursor-pointer text-sm text-center bg-redis-ink-900 hover:text-redis-red-600 rounded rounded-mx transition duration-150 ease-in-out" for="Csharp_cmds_sorted_set-stepzrange2" title="Open example">
C#
</label>
<div aria-labelledby="tab-cmds_sorted_set-stepzrange2" class="panel order-last hidden w-full mt-0 relative" id="panel_Csharp_cmds_sorted_set-stepzrange2" role="tabpanel" tabindex="0">
<div class="highlight">
<pre class="chroma"><code class="language-C#" data-lang="C#"><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">using</span> <span class="nn">NRedisStack.Tests</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="k">using</span> <span class="nn">StackExchange.Redis</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">public</span> <span class="k">class</span> <span class="nc">CmdsSortedSet</span>
</span></span><span class="line"><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">public</span> <span class="k">void</span> <span class="n">run</span><span class="p">()</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="kt">var</span> <span class="n">muxer</span> <span class="p">=</span> <span class="n">ConnectionMultiplexer</span><span class="p">.</span><span class="n">Connect</span><span class="p">(</span><span class="s">"localhost:6379"</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">var</span> <span class="n">db</span> <span class="p">=</span> <span class="n">muxer</span><span class="p">.</span><span class="n">GetDatabase</span><span class="p">();</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'bzmpop' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'bzpopmax' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'bzpopmin' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="kt">bool</span> <span class="n">zAddResult1</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">SortedSetAdd</span><span class="p">(</span><span class="s">"myzset"</span><span class="p">,</span> <span class="s">"one"</span><span class="p">,</span> <span class="m">1</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="n">zAddResult1</span><span class="p">);</span> <span class="c1">// >>> True</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="kt">bool</span> <span class="n">zAddResult2</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">SortedSetAdd</span><span class="p">(</span><span class="s">"myzset"</span><span class="p">,</span> <span class="s">"uno"</span><span class="p">,</span> <span class="m">1</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="n">zAddResult2</span><span class="p">);</span> <span class="c1">// >>> True</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="kt">long</span> <span class="n">zAddResult3</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">SortedSetAdd</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="s">"myzset"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">SortedSetEntry</span><span class="p">[]</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">SortedSetEntry</span><span class="p">(</span><span class="s">"two"</span><span class="p">,</span> <span class="m">2</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">SortedSetEntry</span><span class="p">(</span><span class="s">"three"</span><span class="p">,</span> <span class="m">3</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl"> <span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="n">zAddResult3</span><span class="p">);</span> <span class="c1">// >>> 2</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">SortedSetEntry</span><span class="p">[]</span> <span class="n">zAddResult4</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">SortedSetRangeByRankWithScores</span><span class="p">(</span><span class="s">"myzset"</span><span class="p">,</span> <span class="m">0</span><span class="p">,</span> <span class="p">-</span><span class="m">1</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="s">$"{string.Join("</span><span class="p">,</span> <span class="s">", zAddResult4.Select(b => $"</span><span class="p">{</span><span class="n">b</span><span class="p">.</span><span class="n">Element</span><span class="p">}:</span> <span class="p">{</span><span class="n">b</span><span class="p">.</span><span class="n">Score</span><span class="p">}</span><span class="s">"))}"</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="c1">// >>> one: 1, uno: 1, two: 2, three: 3</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zadd' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zcard' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zcount' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zdiff' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zdiffstore' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zincrby' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zinter' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zintercard' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zinterstore' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zlexcount' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zmpop' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zmscore' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zpopmax' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zpopmin' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrandmember' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="kt">long</span> <span class="n">zRangeResult1</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">SortedSetAdd</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="s">"myzset"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">SortedSetEntry</span><span class="p">[]</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">SortedSetEntry</span><span class="p">(</span><span class="s">"one"</span><span class="p">,</span> <span class="m">1</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">SortedSetEntry</span><span class="p">(</span><span class="s">"two"</span><span class="p">,</span> <span class="m">2</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">SortedSetEntry</span><span class="p">(</span><span class="s">"three"</span><span class="p">,</span> <span class="m">3</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl"> <span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="n">zRangeResult1</span><span class="p">);</span> <span class="c1">// >>> 3</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">RedisValue</span><span class="p">[]</span> <span class="n">zRangeResult2</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">SortedSetRangeByRank</span><span class="p">(</span><span class="s">"myzset"</span><span class="p">,</span> <span class="m">0</span><span class="p">,</span> <span class="p">-</span><span class="m">1</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="kt">string</span><span class="p">.</span><span class="n">Join</span><span class="p">(</span><span class="s">", "</span><span class="p">,</span> <span class="n">zRangeResult2</span><span class="p">));</span>
</span></span><span class="line"><span class="cl"> <span class="c1">// >>> one, two, three</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">RedisValue</span><span class="p">[]</span> <span class="n">zRangeResult3</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">SortedSetRangeByRank</span><span class="p">(</span><span class="s">"myzset"</span><span class="p">,</span> <span class="m">2</span><span class="p">,</span> <span class="m">3</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="kt">string</span><span class="p">.</span><span class="n">Join</span><span class="p">(</span><span class="s">", "</span><span class="p">,</span> <span class="n">zRangeResult3</span><span class="p">));</span>
</span></span><span class="line"><span class="cl"> <span class="c1">// >>> three</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">RedisValue</span><span class="p">[]</span> <span class="n">zRangeResult4</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">SortedSetRangeByRank</span><span class="p">(</span><span class="s">"myzset"</span><span class="p">,</span> <span class="p">-</span><span class="m">2</span><span class="p">,</span> <span class="p">-</span><span class="m">1</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="kt">string</span><span class="p">.</span><span class="n">Join</span><span class="p">(</span><span class="s">", "</span><span class="p">,</span> <span class="n">zRangeResult4</span><span class="p">));</span>
</span></span><span class="line"><span class="cl"> <span class="c1">// >>> two, three</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrange1' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line hl"><span class="cl"> <span class="kt">long</span> <span class="n">zRangeResult5</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">SortedSetAdd</span><span class="p">(</span>
</span></span><span class="line hl"><span class="cl"> <span class="s">"myzset"</span><span class="p">,</span>
</span></span><span class="line hl"><span class="cl"> <span class="k">new</span> <span class="n">SortedSetEntry</span><span class="p">[]</span> <span class="p">{</span>
</span></span><span class="line hl"><span class="cl"> <span class="k">new</span> <span class="n">SortedSetEntry</span><span class="p">(</span><span class="s">"one"</span><span class="p">,</span> <span class="m">1</span><span class="p">),</span>
</span></span><span class="line hl"><span class="cl"> <span class="k">new</span> <span class="n">SortedSetEntry</span><span class="p">(</span><span class="s">"two"</span><span class="p">,</span> <span class="m">2</span><span class="p">),</span>
</span></span><span class="line hl"><span class="cl"> <span class="k">new</span> <span class="n">SortedSetEntry</span><span class="p">(</span><span class="s">"three"</span><span class="p">,</span> <span class="m">3</span><span class="p">)</span>
</span></span><span class="line hl"><span class="cl"> <span class="p">}</span>
</span></span><span class="line hl"><span class="cl"> <span class="p">);</span>
</span></span><span class="line hl"><span class="cl">
</span></span><span class="line hl"><span class="cl"> <span class="n">SortedSetEntry</span><span class="p">[]</span> <span class="n">zRangeResult6</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">SortedSetRangeByRankWithScores</span><span class="p">(</span><span class="s">"myzset"</span><span class="p">,</span> <span class="m">0</span><span class="p">,</span> <span class="m">1</span><span class="p">);</span>
</span></span><span class="line hl"><span class="cl"> <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="s">$"{string.Join("</span><span class="p">,</span> <span class="s">", zRangeResult6.Select(b => $"</span><span class="p">{</span><span class="n">b</span><span class="p">.</span><span class="n">Element</span><span class="p">}:</span> <span class="p">{</span><span class="n">b</span><span class="p">.</span><span class="n">Score</span><span class="p">}</span><span class="s">"))}"</span><span class="p">);</span>
</span></span><span class="line hl"><span class="cl"> <span class="c1">// >>> one: 1, two: 2</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrange2' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="kt">long</span> <span class="n">zRangeResult7</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">SortedSetAdd</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="s">"myzset"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">SortedSetEntry</span><span class="p">[]</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">SortedSetEntry</span><span class="p">(</span><span class="s">"one"</span><span class="p">,</span> <span class="m">1</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">SortedSetEntry</span><span class="p">(</span><span class="s">"two"</span><span class="p">,</span> <span class="m">2</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">SortedSetEntry</span><span class="p">(</span><span class="s">"three"</span><span class="p">,</span> <span class="m">3</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl"> <span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">RedisValue</span><span class="p">[]</span> <span class="n">zRangeResult8</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">SortedSetRangeByScore</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="s">"myzset"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="m">1</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="kt">double</span><span class="p">.</span><span class="n">PositiveInfinity</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">Exclude</span><span class="p">.</span><span class="n">Start</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">skip</span><span class="p">:</span> <span class="m">1</span><span class="p">,</span> <span class="n">take</span><span class="p">:</span> <span class="m">1</span>
</span></span><span class="line"><span class="cl"> <span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="kt">string</span><span class="p">.</span><span class="n">Join</span><span class="p">(</span><span class="s">", "</span><span class="p">,</span> <span class="n">zRangeResult8</span><span class="p">));</span>
</span></span><span class="line"><span class="cl"> <span class="c1">// >>> three</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrange3' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrangebylex' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrangebyscore' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrangestore' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrank' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrem' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zremrangebylex' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zremrangebyrank' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zremrangebyscore' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrevrange' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrevrangebylex' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrevrangebyscore' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrevrank' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zscan' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zscore' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zunion' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zunionstore' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span></code></pre>
</div>
<button class="clipboard-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-10 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="copyCodeToClipboard('#panel_Csharp_cmds_sorted_set-stepzrange2')" tabindex="1" title="Copy to clipboard">
<svg fill="currentColor" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M9 43.95q-1.2 0-2.1-.9-.9-.9-.9-2.1V10.8h3v30.15h23.7v3Zm6-6q-1.2 0-2.1-.9-.9-.9-.9-2.1v-28q0-1.2.9-2.1.9-.9 2.1-.9h22q1.2 0 2.1.9.9.9.9 2.1v28q0 1.2-.9 2.1-.9.9-2.1.9Zm0-3h22v-28H15v28Zm0 0v-28 28Z">
</path>
</svg>
<div class="tooltip relative inline-block">
<span class="tooltiptext hidden bg-slate-200 rounded rounded-mx text-slate-800 text-center text-xs p-1 absolute right-6 bottom-4">
Copied!
</span>
</div>
</button>
<button aria-controls="panel_Csharp_cmds_sorted_set-stepzrange2" class="visibility-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-2 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="toggleVisibleLines(this)" tabindex="1" title="Toggle visibility">
<svg class="hidden" fill="currentColor" id="visibility-off" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="m31.45 27.05-2.2-2.2q1.3-3.55-1.35-5.9-2.65-2.35-5.75-1.2l-2.2-2.2q.85-.55 1.9-.8 1.05-.25 2.15-.25 3.55 0 6.025 2.475Q32.5 19.45 32.5 23q0 1.1-.275 2.175-.275 1.075-.775 1.875Zm6.45 6.45-2-2q2.45-1.8 4.275-4.025Q42 25.25 42.85 23q-2.5-5.55-7.5-8.775Q30.35 11 24.5 11q-2.1 0-4.3.4-2.2.4-3.45.95L14.45 10q1.75-.8 4.475-1.4Q21.65 8 24.25 8q7.15 0 13.075 4.075Q43.25 16.15 46 23q-1.3 3.2-3.35 5.85-2.05 2.65-4.75 4.65Zm2.9 11.3-8.4-8.25q-1.75.7-3.95 1.075T24 38q-7.3 0-13.25-4.075T2 23q1-2.6 2.775-5.075T9.1 13.2L2.8 6.9l2.1-2.15L42.75 42.6ZM11.15 15.3q-1.85 1.35-3.575 3.55Q5.85 21.05 5.1 23q2.55 5.55 7.675 8.775Q17.9 35 24.4 35q1.65 0 3.25-.2t2.4-.6l-3.2-3.2q-.55.25-1.35.375T24 31.5q-3.5 0-6-2.45T15.5 23q0-.75.125-1.5T16 20.15Zm15.25 7.1Zm-5.8 2.9Z">
</path>
</svg>
<svg fill="currentColor" id="visibility-on" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M24 31.5q3.55 0 6.025-2.475Q32.5 26.55 32.5 23q0-3.55-2.475-6.025Q27.55 14.5 24 14.5q-3.55 0-6.025 2.475Q15.5 19.45 15.5 23q0 3.55 2.475 6.025Q20.45 31.5 24 31.5Zm0-2.9q-2.35 0-3.975-1.625T18.4 23q0-2.35 1.625-3.975T24 17.4q2.35 0 3.975 1.625T29.6 23q0 2.35-1.625 3.975T24 28.6Zm0 9.4q-7.3 0-13.2-4.15Q4.9 29.7 2 23q2.9-6.7 8.8-10.85Q16.7 8 24 8q7.3 0 13.2 4.15Q43.1 16.3 46 23q-2.9 6.7-8.8 10.85Q31.3 38 24 38Zm0-15Zm0 12q6.05 0 11.125-3.275T42.85 23q-2.65-5.45-7.725-8.725Q30.05 11 24 11t-11.125 3.275Q7.8 17.55 5.1 23q2.7 5.45 7.775 8.725Q17.95 35 24 35Z">
</path>
</svg>
</button>
<div class="cli-footer flex items-center justify-between rounded-b-md bg-slate-900 mt-0 px-4 pt-0 mb-0 transition-opacity ease-in-out duration-300 opacity-0 invisible group-hover:opacity-100 group-hover:visible">
<a class="rounded rounded-mx px-3 py-1 text-white text-xs hover:text-white hover:bg-slate-600 hover:border-transparent focus:outline-none focus:ring-2 focus:white focus:border-slate-500" href="https://redis.io/docs/latest/develop/connect/clients/dotnet/" tabindex="1" title="Quick-Start">
C# Quick-Start
</a>
<div class="w-1/2">
</div>
<div class="flex-1 text-right">
<a class="button text-neutral-400 hover:text-slate-100 h-6 w-6 p-1" href="https://github.com/redis/NRedisStack/tree/master/tests/Doc/CmdsSortedSetExamples.cs" tabindex="1" title="Improve this code example">
<svg fill="github" height="16" viewbox="0 0 18 16" width="18" xmlns="http://www.w3.org/2000/svg">
<path clip-rule="evenodd" d="M8.99953 1.43397e-06C7.09918 -0.000897921 5.26058 0.674713 3.81295 1.90585C2.36533 3.13699 1.40324 4.84324 1.09896 6.71907C0.794684 8.5949 1.1681 10.5178 2.15233 12.1434C3.13657 13.769 4.66734 14.9912 6.47053 15.591C6.87053 15.664 7.01653 15.417 7.01653 15.205C7.01653 15.015 7.00953 14.512 7.00553 13.845C4.78053 14.328 4.31053 12.772 4.31053 12.772C4.16325 12.2887 3.84837 11.8739 3.42253 11.602C2.69653 11.102 3.47753 11.116 3.47753 11.116C3.73043 11.1515 3.97191 11.2442 4.18365 11.3869C4.39539 11.5297 4.57182 11.7189 4.69953 11.94C4.80755 12.1377 4.95378 12.3119 5.12972 12.4526C5.30567 12.5933 5.50782 12.6976 5.72442 12.7595C5.94103 12.8214 6.16778 12.8396 6.39148 12.813C6.61519 12.7865 6.83139 12.7158 7.02753 12.605C7.06381 12.1992 7.24399 11.8197 7.53553 11.535C5.75953 11.335 3.89153 10.647 3.89153 7.581C3.88005 6.78603 4.17513 6.01716 4.71553 5.434C4.47318 4.74369 4.50322 3.98693 4.79953 3.318C4.79953 3.318 5.47053 3.103 6.99953 4.138C8.31074 3.77905 9.69432 3.77905 11.0055 4.138C12.5325 3.103 13.2055 3.318 13.2055 3.318C13.5012 3.9877 13.5294 4.74513 13.2845 5.435C13.8221 6.01928 14.114 6.78817 14.0995 7.582C14.0995 10.655 12.2285 11.332 10.4465 11.53C10.6375 11.724 10.7847 11.9566 10.8784 12.2123C10.972 12.4679 11.0099 12.7405 10.9895 13.012C10.9895 14.081 10.9795 14.944 10.9795 15.206C10.9795 15.42 11.1235 15.669 11.5295 15.591C13.3328 14.9911 14.8636 13.7689 15.8479 12.1432C16.8321 10.5175 17.2054 8.59447 16.901 6.71858C16.5966 4.84268 15.6343 3.13642 14.1865 1.90536C12.7387 0.674306 10.9 -0.0011359 8.99953 1.43397e-06Z" fill="white" fill-rule="evenodd">
</path>
</svg>
</a>
</div>
</div>
</div>
</div>
<p>
This example shows how to query the sorted set by score, excluding the value
<code>
1
</code>
and up to infinity, returning only the second element of the result:
</p>
<div class="codetabs cli group flex justify-start items-center flex-wrap box-border rounded-lg mt-0 mb-0 mx-auto bg-slate-900" id="cmds_sorted_set-stepzrange3">
<input checked="" class="radiotab w-0 h-0" data-lang="redis-cli" id="redis-cli_cmds_sorted_set-stepzrange3" name="cmds_sorted_set-stepzrange3" tabindex="1" type="radio"/>
<label class="justify-left label ml-4 pt-3.5 px-3 pb-1 cursor-pointer text-sm text-center bg-redis-ink-900 hover:text-redis-red-600 rounded rounded-mx transition duration-150 ease-in-out" for="redis-cli_cmds_sorted_set-stepzrange3" title="Open example">
>_ Redis CLI
</label>
<div aria-labelledby="tab-cmds_sorted_set-stepzrange3" class="panel order-last hidden w-full mt-0 relative" id="panel_redis-cli_cmds_sorted_set-stepzrange3" role="tabpanel" tabindex="0">
<div class="highlight">
<pre class="chroma"><code class="language-plaintext" data-lang="plaintext"><span class="line hl"><span class="cl">> ZADD myzset 1 "one" 2 "two" 3 "three"
</span></span><span class="line hl"><span class="cl">(integer) 3
</span></span><span class="line hl"><span class="cl">> ZRANGE myzset (1 +inf BYSCORE LIMIT 1 1
</span></span><span class="line hl"><span class="cl">1) "three"</span></span></code></pre>
</div>
<button class="clipboard-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-10 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="copyCodeToClipboard('#panel_redis-cli_cmds_sorted_set-stepzrange3')" tabindex="1" title="Copy to clipboard">
<svg fill="currentColor" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M9 43.95q-1.2 0-2.1-.9-.9-.9-.9-2.1V10.8h3v30.15h23.7v3Zm6-6q-1.2 0-2.1-.9-.9-.9-.9-2.1v-28q0-1.2.9-2.1.9-.9 2.1-.9h22q1.2 0 2.1.9.9.9.9 2.1v28q0 1.2-.9 2.1-.9.9-2.1.9Zm0-3h22v-28H15v28Zm0 0v-28 28Z">
</path>
</svg>
<div class="tooltip relative inline-block">
<span class="tooltiptext hidden bg-slate-200 rounded rounded-mx text-slate-800 text-center text-xs p-1 absolute right-6 bottom-4">
Copied!
</span>
</div>
</button>
<div class="cli-footer flex items-center justify-between rounded-b-md bg-slate-900 mt-0 px-4 pt-0 mb-0 transition-opacity ease-in-out duration-300 opacity-0 invisible group-hover:opacity-100 group-hover:visible">
<div class="flex-1 text-xs text-white overflow-ellipsis">
Are you tired of using redis-cli? Try Redis Insight - the developer GUI for Redis.
</div>
<div class="text-right">
<a class="rounded rounded-mx px-2 py-1 flex items-center text-white text-xs hover:text-white hover:bg-slate-600 hover:border-transparent focus:outline-none focus:ring-2 focus:white focus:border-slate-500" href="https://redis.com/redis-enterprise/redis-insight/" tabindex="1" title="Get Redis Insight">
<svg class="w-4 h-4 mr-1" fill="none" height="14" viewbox="0 0 14 14" width="14" xmlns="http://www.w3.org/2000/svg">
<path d="M2.26236 5.66895L1.21732 6.07172L7.00018 8.65693V7.79842L2.26236 5.66895Z" fill="#fca5a5">
</path>
<path d="M2.26236 8.02271L1.21732 8.42548L7.00018 11.0119V10.1516L2.26236 8.02271Z" fill="#fca5a5">
</path>
<path d="M1.21732 3.7175L7.00018 6.30392V2.87805L8.66273 2.13423L7.00018 1.49512L1.21732 3.7175Z" fill="#fca5a5">
</path>
<path d="M7.00018 2.8781V6.30366L1.21732 3.71724V5.20004L7.00018 7.79705V8.65526L1.21732 6.07217V7.55496L7.00018 10.1553V11.0135L1.21732 8.42376V9.90656H1.18878L7.00018 12.5051L8.66273 11.7613V2.13428L7.00018 2.8781Z" fill="#f87171">
</path>
<path d="M9.07336 11.5777L10.7359 10.8338V4.01538L9.07336 4.7592V11.5777Z" fill="#f87171">
</path>
<path d="M9.07336 4.75867L10.7359 4.01485L9.07336 3.37573V4.75867Z" fill="#fca5a5">
</path>
<path d="M11.1481 10.6497L12.8112 9.90591V5.896L11.1487 6.63982L11.1481 10.6497Z" fill="#f87171">
</path>
<path d="M11.1481 6.63954L12.8112 5.89572L11.1481 5.25781V6.63954Z" fill="#fca5a5">
</path>
</svg>
<span>
Get Redis Insight
</span>
</a>
</div>
</div>
</div>
<input class="radiotab w-0 h-0" data-lang="python" id="Python_cmds_sorted_set-stepzrange3" name="cmds_sorted_set-stepzrange3" tabindex="1" type="radio"/>
<label class="justify-left label ml-4 pt-3.5 px-3 pb-1 cursor-pointer text-sm text-center bg-redis-ink-900 hover:text-redis-red-600 rounded rounded-mx transition duration-150 ease-in-out" for="Python_cmds_sorted_set-stepzrange3" title="Open example">
Python
</label>
<div aria-labelledby="tab-cmds_sorted_set-stepzrange3" class="panel order-last hidden w-full mt-0 relative" id="panel_Python_cmds_sorted_set-stepzrange3" role="tabpanel" tabindex="0">
<div class="highlight">
<pre class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">redis</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">r</span> <span class="o">=</span> <span class="n">redis</span><span class="o">.</span><span class="n">Redis</span><span class="p">(</span><span class="n">host</span><span class="o">=</span><span class="s2">"localhost"</span><span class="p">,</span> <span class="n">port</span><span class="o">=</span><span class="mi">6379</span><span class="p">,</span> <span class="n">db</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">decode_responses</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">zadd</span><span class="p">(</span><span class="s2">"myzset"</span><span class="p">,</span> <span class="p">{</span><span class="s2">"one"</span><span class="p">:</span> <span class="mi">1</span><span class="p">})</span>
</span></span><span class="line"><span class="cl"><span class="nb">print</span><span class="p">(</span><span class="n">res</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="c1"># >>> 1</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">zadd</span><span class="p">(</span><span class="s2">"myzset"</span><span class="p">,</span> <span class="p">{</span><span class="s2">"uno"</span><span class="p">:</span> <span class="mi">1</span><span class="p">})</span>
</span></span><span class="line"><span class="cl"><span class="nb">print</span><span class="p">(</span><span class="n">res</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="c1"># >>> 1</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">zadd</span><span class="p">(</span><span class="s2">"myzset"</span><span class="p">,</span> <span class="p">{</span><span class="s2">"two"</span><span class="p">:</span> <span class="mi">2</span><span class="p">,</span> <span class="s2">"three"</span><span class="p">:</span> <span class="mi">3</span><span class="p">})</span>
</span></span><span class="line"><span class="cl"><span class="nb">print</span><span class="p">(</span><span class="n">res</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="c1"># >>> 2</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">zrange</span><span class="p">(</span><span class="s2">"myzset"</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">withscores</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="c1"># >>> [('one', 1.0), ('uno', 1.0), ('two', 2.0), ('three', 3.0)]</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">zadd</span><span class="p">(</span><span class="s2">"myzset"</span><span class="p">,</span> <span class="p">{</span><span class="s2">"one"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span> <span class="s2">"two"</span><span class="p">:</span><span class="mi">2</span><span class="p">,</span> <span class="s2">"three"</span><span class="p">:</span><span class="mi">3</span><span class="p">})</span>
</span></span><span class="line"><span class="cl"><span class="nb">print</span><span class="p">(</span><span class="n">res</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="c1"># >>> 3</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">zrange</span><span class="p">(</span><span class="s2">"myzset"</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="nb">print</span><span class="p">(</span><span class="n">res</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="c1"># >>> ['one', 'two', 'three']</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">zrange</span><span class="p">(</span><span class="s2">"myzset"</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="nb">print</span><span class="p">(</span><span class="n">res</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="c1"># >>> ['three']</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">zrange</span><span class="p">(</span><span class="s2">"myzset"</span><span class="p">,</span> <span class="o">-</span><span class="mi">2</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="nb">print</span><span class="p">(</span><span class="n">res</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="c1"># >>> ['two', 'three']</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">zadd</span><span class="p">(</span><span class="s2">"myzset"</span><span class="p">,</span> <span class="p">{</span><span class="s2">"one"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span> <span class="s2">"two"</span><span class="p">:</span><span class="mi">2</span><span class="p">,</span> <span class="s2">"three"</span><span class="p">:</span><span class="mi">3</span><span class="p">})</span>
</span></span><span class="line"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">zrange</span><span class="p">(</span><span class="s2">"myzset"</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="n">withscores</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="nb">print</span><span class="p">(</span><span class="n">res</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="c1"># >>> [('one', 1.0), ('two', 2.0)]</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line hl"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">zadd</span><span class="p">(</span><span class="s2">"myzset"</span><span class="p">,</span> <span class="p">{</span><span class="s2">"one"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span> <span class="s2">"two"</span><span class="p">:</span><span class="mi">2</span><span class="p">,</span> <span class="s2">"three"</span><span class="p">:</span><span class="mi">3</span><span class="p">})</span>
</span></span><span class="line hl"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">zrange</span><span class="p">(</span><span class="s2">"myzset"</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="n">byscore</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">offset</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">num</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span>
</span></span><span class="line hl"><span class="cl"><span class="nb">print</span><span class="p">(</span><span class="n">res</span><span class="p">)</span>
</span></span><span class="line hl"><span class="cl"><span class="c1"># >>> ['three']</span>
</span></span></code></pre>
</div>
<button class="clipboard-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-10 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="copyCodeToClipboard('#panel_Python_cmds_sorted_set-stepzrange3')" tabindex="1" title="Copy to clipboard">
<svg fill="currentColor" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M9 43.95q-1.2 0-2.1-.9-.9-.9-.9-2.1V10.8h3v30.15h23.7v3Zm6-6q-1.2 0-2.1-.9-.9-.9-.9-2.1v-28q0-1.2.9-2.1.9-.9 2.1-.9h22q1.2 0 2.1.9.9.9.9 2.1v28q0 1.2-.9 2.1-.9.9-2.1.9Zm0-3h22v-28H15v28Zm0 0v-28 28Z">
</path>
</svg>
<div class="tooltip relative inline-block">
<span class="tooltiptext hidden bg-slate-200 rounded rounded-mx text-slate-800 text-center text-xs p-1 absolute right-6 bottom-4">
Copied!
</span>
</div>
</button>
<button aria-controls="panel_Python_cmds_sorted_set-stepzrange3" class="visibility-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-2 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="toggleVisibleLines(this)" tabindex="1" title="Toggle visibility">
<svg class="hidden" fill="currentColor" id="visibility-off" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="m31.45 27.05-2.2-2.2q1.3-3.55-1.35-5.9-2.65-2.35-5.75-1.2l-2.2-2.2q.85-.55 1.9-.8 1.05-.25 2.15-.25 3.55 0 6.025 2.475Q32.5 19.45 32.5 23q0 1.1-.275 2.175-.275 1.075-.775 1.875Zm6.45 6.45-2-2q2.45-1.8 4.275-4.025Q42 25.25 42.85 23q-2.5-5.55-7.5-8.775Q30.35 11 24.5 11q-2.1 0-4.3.4-2.2.4-3.45.95L14.45 10q1.75-.8 4.475-1.4Q21.65 8 24.25 8q7.15 0 13.075 4.075Q43.25 16.15 46 23q-1.3 3.2-3.35 5.85-2.05 2.65-4.75 4.65Zm2.9 11.3-8.4-8.25q-1.75.7-3.95 1.075T24 38q-7.3 0-13.25-4.075T2 23q1-2.6 2.775-5.075T9.1 13.2L2.8 6.9l2.1-2.15L42.75 42.6ZM11.15 15.3q-1.85 1.35-3.575 3.55Q5.85 21.05 5.1 23q2.55 5.55 7.675 8.775Q17.9 35 24.4 35q1.65 0 3.25-.2t2.4-.6l-3.2-3.2q-.55.25-1.35.375T24 31.5q-3.5 0-6-2.45T15.5 23q0-.75.125-1.5T16 20.15Zm15.25 7.1Zm-5.8 2.9Z">
</path>
</svg>
<svg fill="currentColor" id="visibility-on" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M24 31.5q3.55 0 6.025-2.475Q32.5 26.55 32.5 23q0-3.55-2.475-6.025Q27.55 14.5 24 14.5q-3.55 0-6.025 2.475Q15.5 19.45 15.5 23q0 3.55 2.475 6.025Q20.45 31.5 24 31.5Zm0-2.9q-2.35 0-3.975-1.625T18.4 23q0-2.35 1.625-3.975T24 17.4q2.35 0 3.975 1.625T29.6 23q0 2.35-1.625 3.975T24 28.6Zm0 9.4q-7.3 0-13.2-4.15Q4.9 29.7 2 23q2.9-6.7 8.8-10.85Q16.7 8 24 8q7.3 0 13.2 4.15Q43.1 16.3 46 23q-2.9 6.7-8.8 10.85Q31.3 38 24 38Zm0-15Zm0 12q6.05 0 11.125-3.275T42.85 23q-2.65-5.45-7.725-8.725Q30.05 11 24 11t-11.125 3.275Q7.8 17.55 5.1 23q2.7 5.45 7.775 8.725Q17.95 35 24 35Z">
</path>
</svg>
</button>
<div class="cli-footer flex items-center justify-between rounded-b-md bg-slate-900 mt-0 px-4 pt-0 mb-0 transition-opacity ease-in-out duration-300 opacity-0 invisible group-hover:opacity-100 group-hover:visible">
<a class="rounded rounded-mx px-3 py-1 text-white text-xs hover:text-white hover:bg-slate-600 hover:border-transparent focus:outline-none focus:ring-2 focus:white focus:border-slate-500" href="https://redis.io/docs/latest/develop/connect/clients/python/redis-py/" tabindex="1" title="Quick-Start">
Python Quick-Start
</a>
<div class="w-1/2">
</div>
<div class="flex-1 text-right">
<a class="button text-neutral-400 hover:text-slate-100 h-6 w-6 p-1" href="https://github.com/redis/redis-py/tree/master/doctests/cmds_sorted_set.py" tabindex="1" title="Improve this code example">
<svg fill="github" height="16" viewbox="0 0 18 16" width="18" xmlns="http://www.w3.org/2000/svg">
<path clip-rule="evenodd" d="M8.99953 1.43397e-06C7.09918 -0.000897921 5.26058 0.674713 3.81295 1.90585C2.36533 3.13699 1.40324 4.84324 1.09896 6.71907C0.794684 8.5949 1.1681 10.5178 2.15233 12.1434C3.13657 13.769 4.66734 14.9912 6.47053 15.591C6.87053 15.664 7.01653 15.417 7.01653 15.205C7.01653 15.015 7.00953 14.512 7.00553 13.845C4.78053 14.328 4.31053 12.772 4.31053 12.772C4.16325 12.2887 3.84837 11.8739 3.42253 11.602C2.69653 11.102 3.47753 11.116 3.47753 11.116C3.73043 11.1515 3.97191 11.2442 4.18365 11.3869C4.39539 11.5297 4.57182 11.7189 4.69953 11.94C4.80755 12.1377 4.95378 12.3119 5.12972 12.4526C5.30567 12.5933 5.50782 12.6976 5.72442 12.7595C5.94103 12.8214 6.16778 12.8396 6.39148 12.813C6.61519 12.7865 6.83139 12.7158 7.02753 12.605C7.06381 12.1992 7.24399 11.8197 7.53553 11.535C5.75953 11.335 3.89153 10.647 3.89153 7.581C3.88005 6.78603 4.17513 6.01716 4.71553 5.434C4.47318 4.74369 4.50322 3.98693 4.79953 3.318C4.79953 3.318 5.47053 3.103 6.99953 4.138C8.31074 3.77905 9.69432 3.77905 11.0055 4.138C12.5325 3.103 13.2055 3.318 13.2055 3.318C13.5012 3.9877 13.5294 4.74513 13.2845 5.435C13.8221 6.01928 14.114 6.78817 14.0995 7.582C14.0995 10.655 12.2285 11.332 10.4465 11.53C10.6375 11.724 10.7847 11.9566 10.8784 12.2123C10.972 12.4679 11.0099 12.7405 10.9895 13.012C10.9895 14.081 10.9795 14.944 10.9795 15.206C10.9795 15.42 11.1235 15.669 11.5295 15.591C13.3328 14.9911 14.8636 13.7689 15.8479 12.1432C16.8321 10.5175 17.2054 8.59447 16.901 6.71858C16.5966 4.84268 15.6343 3.13642 14.1865 1.90536C12.7387 0.674306 10.9 -0.0011359 8.99953 1.43397e-06Z" fill="white" fill-rule="evenodd">
</path>
</svg>
</a>
</div>
</div>
</div>
<input class="radiotab w-0 h-0" data-lang="javascript" id="Nodejs_cmds_sorted_set-stepzrange3" name="cmds_sorted_set-stepzrange3" tabindex="1" type="radio"/>
<label class="justify-left label ml-4 pt-3.5 px-3 pb-1 cursor-pointer text-sm text-center bg-redis-ink-900 hover:text-redis-red-600 rounded rounded-mx transition duration-150 ease-in-out" for="Nodejs_cmds_sorted_set-stepzrange3" title="Open example">
Node.js
</label>
<div aria-labelledby="tab-cmds_sorted_set-stepzrange3" class="panel order-last hidden w-full mt-0 relative" id="panel_Nodejs_cmds_sorted_set-stepzrange3" role="tabpanel" tabindex="0">
<div class="highlight">
<pre class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kr">import</span> <span class="p">{</span> <span class="nx">createClient</span> <span class="p">}</span> <span class="nx">from</span> <span class="s1">'redis'</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">client</span> <span class="o">=</span> <span class="nx">createClient</span><span class="p">();</span>
</span></span><span class="line"><span class="cl"><span class="nx">client</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="s1">'error'</span><span class="p">,</span> <span class="nx">err</span> <span class="p">=></span> <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s1">'Redis Client Error'</span><span class="p">,</span> <span class="nx">err</span><span class="p">));</span>
</span></span><span class="line"><span class="cl"><span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">connect</span><span class="p">().</span><span class="k">catch</span><span class="p">(</span><span class="nx">console</span><span class="p">.</span><span class="nx">error</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">val1</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">zAdd</span><span class="p">(</span><span class="s2">"myzset"</span><span class="p">,</span> <span class="p">[{</span> <span class="nx">value</span><span class="o">:</span> <span class="s1">'one'</span><span class="p">,</span> <span class="nx">score</span><span class="o">:</span> <span class="mi">1</span> <span class="p">}]);</span>
</span></span><span class="line"><span class="cl"><span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">val1</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="c1">// returns 1
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">val2</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">zAdd</span><span class="p">(</span><span class="s2">"myzset"</span><span class="p">,</span> <span class="p">[{</span> <span class="nx">value</span><span class="o">:</span> <span class="s1">'uno'</span><span class="p">,</span> <span class="nx">score</span><span class="o">:</span> <span class="mi">1</span> <span class="p">}]);</span>
</span></span><span class="line"><span class="cl"><span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">val2</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="c1">// returns 1
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">val3</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">zAdd</span><span class="p">(</span><span class="s2">"myzset"</span><span class="p">,</span> <span class="p">[{</span> <span class="nx">value</span><span class="o">:</span> <span class="s1">'two'</span><span class="p">,</span> <span class="nx">score</span><span class="o">:</span> <span class="mi">2</span> <span class="p">},</span> <span class="p">{</span> <span class="nx">value</span><span class="o">:</span> <span class="s1">'three'</span><span class="p">,</span> <span class="nx">score</span><span class="o">:</span> <span class="mi">3</span> <span class="p">}]);</span>
</span></span><span class="line"><span class="cl"><span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">val3</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="c1">// returns 2
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">val4</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">zRangeWithScores</span><span class="p">(</span><span class="s2">"myzset"</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">val4</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="c1">// returns [{value: 'one', score: 1}, {value: 'uno', score: 1}, {value: 'two', score: 2}, {value: 'three', score: 3} ]
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">val5</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">zAdd</span><span class="p">(</span><span class="s2">"myzset"</span><span class="p">,</span> <span class="p">[</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span> <span class="nx">value</span><span class="o">:</span> <span class="s1">'one'</span><span class="p">,</span> <span class="nx">score</span><span class="o">:</span> <span class="mi">1</span> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span> <span class="nx">value</span><span class="o">:</span> <span class="s1">'two'</span><span class="p">,</span> <span class="nx">score</span><span class="o">:</span> <span class="mi">2</span> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span> <span class="nx">value</span><span class="o">:</span> <span class="s1">'three'</span><span class="p">,</span> <span class="nx">score</span><span class="o">:</span> <span class="mi">3</span> <span class="p">}</span>
</span></span><span class="line"><span class="cl"><span class="p">]);</span>
</span></span><span class="line"><span class="cl"><span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">val5</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="c1">// returns 3
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">val6</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">zRange</span><span class="p">(</span><span class="s1">'myzset'</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">val6</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="c1">// returns ['one', 'two', 'three']
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">val7</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">zRange</span><span class="p">(</span><span class="s1">'myzset'</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">val7</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="c1">// returns ['three']
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">val8</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">zRange</span><span class="p">(</span><span class="s1">'myzset'</span><span class="p">,</span> <span class="o">-</span><span class="mi">2</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">val8</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="c1">// returns ['two', 'three']
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">val9</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">zAdd</span><span class="p">(</span><span class="s2">"myzset"</span><span class="p">,</span> <span class="p">[</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span> <span class="nx">value</span><span class="o">:</span> <span class="s1">'one'</span><span class="p">,</span> <span class="nx">score</span><span class="o">:</span> <span class="mi">1</span> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span> <span class="nx">value</span><span class="o">:</span> <span class="s1">'two'</span><span class="p">,</span> <span class="nx">score</span><span class="o">:</span> <span class="mi">2</span> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span> <span class="nx">value</span><span class="o">:</span> <span class="s1">'three'</span><span class="p">,</span> <span class="nx">score</span><span class="o">:</span> <span class="mi">3</span> <span class="p">}</span>
</span></span><span class="line"><span class="cl"><span class="p">]);</span>
</span></span><span class="line"><span class="cl"><span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">val9</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="c1">// returns 3
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">val10</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">zRangeWithScores</span><span class="p">(</span><span class="s1">'myzset'</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">val10</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="c1">// returns [{value: 'one', score: 1}, {value: 'two', score: 2}]
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line hl"><span class="cl"><span class="kr">const</span> <span class="nx">val11</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">zAdd</span><span class="p">(</span><span class="s2">"myzset"</span><span class="p">,</span> <span class="p">[</span>
</span></span><span class="line hl"><span class="cl"> <span class="p">{</span> <span class="nx">value</span><span class="o">:</span> <span class="s1">'one'</span><span class="p">,</span> <span class="nx">score</span><span class="o">:</span> <span class="mi">1</span> <span class="p">},</span>
</span></span><span class="line hl"><span class="cl"> <span class="p">{</span> <span class="nx">value</span><span class="o">:</span> <span class="s1">'two'</span><span class="p">,</span> <span class="nx">score</span><span class="o">:</span> <span class="mi">2</span> <span class="p">},</span>
</span></span><span class="line hl"><span class="cl"> <span class="p">{</span> <span class="nx">value</span><span class="o">:</span> <span class="s1">'three'</span><span class="p">,</span> <span class="nx">score</span><span class="o">:</span> <span class="mi">3</span> <span class="p">}</span>
</span></span><span class="line hl"><span class="cl"><span class="p">]);</span>
</span></span><span class="line hl"><span class="cl"><span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">val11</span><span class="p">);</span>
</span></span><span class="line hl"><span class="cl"><span class="c1">// returns 3
</span></span></span><span class="line hl"><span class="cl"><span class="c1"></span>
</span></span><span class="line hl"><span class="cl"><span class="kr">const</span> <span class="nx">val12</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">zRange</span><span class="p">(</span><span class="s1">'myzset'</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="p">{</span> <span class="nx">BY</span><span class="o">:</span> <span class="s1">'SCORE'</span><span class="p">,</span> <span class="nx">LIMIT</span><span class="o">:</span> <span class="p">{</span> <span class="nx">offset</span><span class="o">:</span> <span class="mi">1</span><span class="p">,</span> <span class="nx">count</span><span class="o">:</span> <span class="mi">1</span> <span class="p">}</span> <span class="p">});</span>
</span></span><span class="line hl"><span class="cl"><span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">val12</span><span class="p">);</span>
</span></span><span class="line hl"><span class="cl"><span class="c1">// >>> ['three']
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"><span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">quit</span><span class="p">();</span>
</span></span></code></pre>
</div>
<button class="clipboard-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-10 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="copyCodeToClipboard('#panel_Nodejs_cmds_sorted_set-stepzrange3')" tabindex="1" title="Copy to clipboard">
<svg fill="currentColor" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M9 43.95q-1.2 0-2.1-.9-.9-.9-.9-2.1V10.8h3v30.15h23.7v3Zm6-6q-1.2 0-2.1-.9-.9-.9-.9-2.1v-28q0-1.2.9-2.1.9-.9 2.1-.9h22q1.2 0 2.1.9.9.9.9 2.1v28q0 1.2-.9 2.1-.9.9-2.1.9Zm0-3h22v-28H15v28Zm0 0v-28 28Z">
</path>
</svg>
<div class="tooltip relative inline-block">
<span class="tooltiptext hidden bg-slate-200 rounded rounded-mx text-slate-800 text-center text-xs p-1 absolute right-6 bottom-4">
Copied!
</span>
</div>
</button>
<button aria-controls="panel_Nodejs_cmds_sorted_set-stepzrange3" class="visibility-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-2 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="toggleVisibleLines(this)" tabindex="1" title="Toggle visibility">
<svg class="hidden" fill="currentColor" id="visibility-off" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="m31.45 27.05-2.2-2.2q1.3-3.55-1.35-5.9-2.65-2.35-5.75-1.2l-2.2-2.2q.85-.55 1.9-.8 1.05-.25 2.15-.25 3.55 0 6.025 2.475Q32.5 19.45 32.5 23q0 1.1-.275 2.175-.275 1.075-.775 1.875Zm6.45 6.45-2-2q2.45-1.8 4.275-4.025Q42 25.25 42.85 23q-2.5-5.55-7.5-8.775Q30.35 11 24.5 11q-2.1 0-4.3.4-2.2.4-3.45.95L14.45 10q1.75-.8 4.475-1.4Q21.65 8 24.25 8q7.15 0 13.075 4.075Q43.25 16.15 46 23q-1.3 3.2-3.35 5.85-2.05 2.65-4.75 4.65Zm2.9 11.3-8.4-8.25q-1.75.7-3.95 1.075T24 38q-7.3 0-13.25-4.075T2 23q1-2.6 2.775-5.075T9.1 13.2L2.8 6.9l2.1-2.15L42.75 42.6ZM11.15 15.3q-1.85 1.35-3.575 3.55Q5.85 21.05 5.1 23q2.55 5.55 7.675 8.775Q17.9 35 24.4 35q1.65 0 3.25-.2t2.4-.6l-3.2-3.2q-.55.25-1.35.375T24 31.5q-3.5 0-6-2.45T15.5 23q0-.75.125-1.5T16 20.15Zm15.25 7.1Zm-5.8 2.9Z">
</path>
</svg>
<svg fill="currentColor" id="visibility-on" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M24 31.5q3.55 0 6.025-2.475Q32.5 26.55 32.5 23q0-3.55-2.475-6.025Q27.55 14.5 24 14.5q-3.55 0-6.025 2.475Q15.5 19.45 15.5 23q0 3.55 2.475 6.025Q20.45 31.5 24 31.5Zm0-2.9q-2.35 0-3.975-1.625T18.4 23q0-2.35 1.625-3.975T24 17.4q2.35 0 3.975 1.625T29.6 23q0 2.35-1.625 3.975T24 28.6Zm0 9.4q-7.3 0-13.2-4.15Q4.9 29.7 2 23q2.9-6.7 8.8-10.85Q16.7 8 24 8q7.3 0 13.2 4.15Q43.1 16.3 46 23q-2.9 6.7-8.8 10.85Q31.3 38 24 38Zm0-15Zm0 12q6.05 0 11.125-3.275T42.85 23q-2.65-5.45-7.725-8.725Q30.05 11 24 11t-11.125 3.275Q7.8 17.55 5.1 23q2.7 5.45 7.775 8.725Q17.95 35 24 35Z">
</path>
</svg>
</button>
<div class="cli-footer flex items-center justify-between rounded-b-md bg-slate-900 mt-0 px-4 pt-0 mb-0 transition-opacity ease-in-out duration-300 opacity-0 invisible group-hover:opacity-100 group-hover:visible">
<a class="rounded rounded-mx px-3 py-1 text-white text-xs hover:text-white hover:bg-slate-600 hover:border-transparent focus:outline-none focus:ring-2 focus:white focus:border-slate-500" href="https://redis.io/docs/latest/develop/connect/clients/nodejs/" tabindex="1" title="Quick-Start">
Node.js Quick-Start
</a>
<div class="w-1/2">
</div>
<div class="flex-1 text-right">
<a class="button text-neutral-400 hover:text-slate-100 h-6 w-6 p-1" href="https://github.com/redis/node-redis/tree/emb-examples/doctests/cmds-sorted-set.js" tabindex="1" title="Improve this code example">
<svg fill="github" height="16" viewbox="0 0 18 16" width="18" xmlns="http://www.w3.org/2000/svg">
<path clip-rule="evenodd" d="M8.99953 1.43397e-06C7.09918 -0.000897921 5.26058 0.674713 3.81295 1.90585C2.36533 3.13699 1.40324 4.84324 1.09896 6.71907C0.794684 8.5949 1.1681 10.5178 2.15233 12.1434C3.13657 13.769 4.66734 14.9912 6.47053 15.591C6.87053 15.664 7.01653 15.417 7.01653 15.205C7.01653 15.015 7.00953 14.512 7.00553 13.845C4.78053 14.328 4.31053 12.772 4.31053 12.772C4.16325 12.2887 3.84837 11.8739 3.42253 11.602C2.69653 11.102 3.47753 11.116 3.47753 11.116C3.73043 11.1515 3.97191 11.2442 4.18365 11.3869C4.39539 11.5297 4.57182 11.7189 4.69953 11.94C4.80755 12.1377 4.95378 12.3119 5.12972 12.4526C5.30567 12.5933 5.50782 12.6976 5.72442 12.7595C5.94103 12.8214 6.16778 12.8396 6.39148 12.813C6.61519 12.7865 6.83139 12.7158 7.02753 12.605C7.06381 12.1992 7.24399 11.8197 7.53553 11.535C5.75953 11.335 3.89153 10.647 3.89153 7.581C3.88005 6.78603 4.17513 6.01716 4.71553 5.434C4.47318 4.74369 4.50322 3.98693 4.79953 3.318C4.79953 3.318 5.47053 3.103 6.99953 4.138C8.31074 3.77905 9.69432 3.77905 11.0055 4.138C12.5325 3.103 13.2055 3.318 13.2055 3.318C13.5012 3.9877 13.5294 4.74513 13.2845 5.435C13.8221 6.01928 14.114 6.78817 14.0995 7.582C14.0995 10.655 12.2285 11.332 10.4465 11.53C10.6375 11.724 10.7847 11.9566 10.8784 12.2123C10.972 12.4679 11.0099 12.7405 10.9895 13.012C10.9895 14.081 10.9795 14.944 10.9795 15.206C10.9795 15.42 11.1235 15.669 11.5295 15.591C13.3328 14.9911 14.8636 13.7689 15.8479 12.1432C16.8321 10.5175 17.2054 8.59447 16.901 6.71858C16.5966 4.84268 15.6343 3.13642 14.1865 1.90536C12.7387 0.674306 10.9 -0.0011359 8.99953 1.43397e-06Z" fill="white" fill-rule="evenodd">
</path>
</svg>
</a>
</div>
</div>
</div>
<input class="radiotab w-0 h-0" data-lang="java" id="Java_cmds_sorted_set-stepzrange3" name="cmds_sorted_set-stepzrange3" tabindex="1" type="radio"/>
<label class="justify-left label ml-4 pt-3.5 px-3 pb-1 cursor-pointer text-sm text-center bg-redis-ink-900 hover:text-redis-red-600 rounded rounded-mx transition duration-150 ease-in-out" for="Java_cmds_sorted_set-stepzrange3" title="Open example">
Java
</label>
<div aria-labelledby="tab-cmds_sorted_set-stepzrange3" class="panel order-last hidden w-full mt-0 relative" id="panel_Java_cmds_sorted_set-stepzrange3" role="tabpanel" tabindex="0">
<div class="highlight">
<pre class="chroma"><code class="language-java" data-lang="java"><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">java.util.HashMap</span><span class="o">;</span>
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">java.util.Map</span><span class="o">;</span>
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">java.util.List</span><span class="o">;</span>
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">redis.clients.jedis.UnifiedJedis</span><span class="o">;</span>
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">redis.clients.jedis.params.ZRangeParams</span><span class="o">;</span>
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">redis.clients.jedis.resps.Tuple</span><span class="o">;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kd">public</span> <span class="kd">class</span> <span class="nc">CmdsSortedSetExample</span> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="kd">public</span> <span class="kt">void</span> <span class="nf">run</span><span class="o">()</span> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">UnifiedJedis</span> <span class="n">jedis</span> <span class="o">=</span> <span class="k">new</span> <span class="n">UnifiedJedis</span><span class="o">(</span><span class="s">"redis://localhost:6379"</span><span class="o">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'bzmpop' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'bzpopmax' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'bzpopmin' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">Map</span><span class="o"><</span><span class="n">String</span><span class="o">,</span> <span class="n">Double</span><span class="o">></span> <span class="n">zAddExampleParams</span> <span class="o">=</span> <span class="k">new</span> <span class="n">HashMap</span><span class="o"><>();</span>
</span></span><span class="line"><span class="cl"> <span class="n">zAddExampleParams</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">"one"</span><span class="o">,</span> <span class="mf">1.0</span><span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">long</span> <span class="n">zAddResult1</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">zadd</span><span class="o">(</span><span class="s">"myzset"</span><span class="o">,</span> <span class="n">zAddExampleParams</span><span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">zAddResult1</span><span class="o">);</span> <span class="c1">// >>> 1
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="n">zAddExampleParams</span><span class="o">.</span><span class="na">clear</span><span class="o">();</span>
</span></span><span class="line"><span class="cl"> <span class="n">zAddExampleParams</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">"uno"</span><span class="o">,</span> <span class="mf">1.0</span><span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">long</span> <span class="n">zAddResult2</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">zadd</span><span class="o">(</span><span class="s">"myzset"</span><span class="o">,</span> <span class="n">zAddExampleParams</span><span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">zAddResult2</span><span class="o">);</span> <span class="c1">// >>> 1
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="n">zAddExampleParams</span><span class="o">.</span><span class="na">clear</span><span class="o">();</span>
</span></span><span class="line"><span class="cl"> <span class="n">zAddExampleParams</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">"two"</span><span class="o">,</span> <span class="mf">2.0</span><span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">zAddExampleParams</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">"three"</span><span class="o">,</span> <span class="mf">3.0</span><span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">long</span> <span class="n">zAddResult3</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">zadd</span><span class="o">(</span><span class="s">"myzset"</span><span class="o">,</span> <span class="n">zAddExampleParams</span><span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">zAddResult3</span><span class="o">);</span> <span class="c1">// >>> 2
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="n">List</span><span class="o"><</span><span class="n">Tuple</span><span class="o">></span> <span class="n">zAddResult4</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">zrangeWithScores</span><span class="o">(</span><span class="s">"myzset"</span><span class="o">,</span> <span class="k">new</span> <span class="n">ZRangeParams</span><span class="o">(</span><span class="mi">0</span><span class="o">,</span> <span class="o">-</span><span class="mi">1</span><span class="o">));</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="o">(</span><span class="n">Tuple</span> <span class="n">item</span><span class="o">:</span> <span class="n">zAddResult4</span><span class="o">)</span> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"Element: "</span> <span class="o">+</span> <span class="n">item</span><span class="o">.</span><span class="na">getElement</span><span class="o">()</span> <span class="o">+</span> <span class="s">", Score: "</span> <span class="o">+</span> <span class="n">item</span><span class="o">.</span><span class="na">getScore</span><span class="o">());</span>
</span></span><span class="line"><span class="cl"> <span class="o">}</span>
</span></span><span class="line"><span class="cl"> <span class="c1">// >>> Element: one, Score: 1.0
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="c1">// >>> Element: uno, Score: 1.0
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="c1">// >>> Element: two, Score: 2.0
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="c1">// >>> Element: three, Score: 3.0
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zadd' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zcard' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zcount' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zdiff' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zdiffstore' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zincrby' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zinter' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zintercard' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zinterstore' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zlexcount' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zmpop' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zmscore' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zpopmax' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zpopmin' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrandmember' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">Map</span><span class="o"><</span><span class="n">String</span><span class="o">,</span> <span class="n">Double</span><span class="o">></span> <span class="n">zRangeExampleParams1</span> <span class="o">=</span> <span class="k">new</span> <span class="n">HashMap</span><span class="o"><>();</span>
</span></span><span class="line"><span class="cl"> <span class="n">zRangeExampleParams1</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">"one"</span><span class="o">,</span> <span class="mf">1.0</span><span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">zRangeExampleParams1</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">"two"</span><span class="o">,</span> <span class="mf">2.0</span><span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">zRangeExampleParams1</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">"three"</span><span class="o">,</span> <span class="mf">3.0</span><span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">long</span> <span class="n">zRangeResult1</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">zadd</span><span class="o">(</span><span class="s">"myzset"</span><span class="o">,</span> <span class="n">zRangeExampleParams1</span><span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">zRangeResult1</span><span class="o">);</span> <span class="c1">// >>> 3
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="n">List</span><span class="o"><</span><span class="n">String</span><span class="o">></span> <span class="n">zRangeResult2</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">zrange</span><span class="o">(</span><span class="s">"myzset"</span><span class="o">,</span> <span class="k">new</span> <span class="n">ZRangeParams</span><span class="o">(</span><span class="mi">0</span><span class="o">,</span> <span class="o">-</span><span class="mi">1</span><span class="o">));</span>
</span></span><span class="line"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">String</span><span class="o">.</span><span class="na">join</span><span class="o">(</span><span class="s">", "</span><span class="o">,</span> <span class="n">zRangeResult2</span><span class="o">));</span> <span class="c1">// >>> one, two, three
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="n">List</span><span class="o"><</span><span class="n">String</span><span class="o">></span> <span class="n">zRangeResult3</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">zrange</span><span class="o">(</span><span class="s">"myzset"</span><span class="o">,</span> <span class="k">new</span> <span class="n">ZRangeParams</span><span class="o">(</span><span class="mi">2</span><span class="o">,</span> <span class="mi">3</span><span class="o">));</span>
</span></span><span class="line"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">String</span><span class="o">.</span><span class="na">join</span><span class="o">(</span><span class="s">", "</span><span class="o">,</span> <span class="n">zRangeResult3</span><span class="o">));</span> <span class="c1">// >> three
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="n">List</span><span class="o"><</span><span class="n">String</span><span class="o">></span> <span class="n">zRangeResult4</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">zrange</span><span class="o">(</span><span class="s">"myzset"</span><span class="o">,</span> <span class="k">new</span> <span class="n">ZRangeParams</span><span class="o">(-</span><span class="mi">2</span><span class="o">,</span> <span class="o">-</span><span class="mi">1</span><span class="o">));</span>
</span></span><span class="line"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">String</span><span class="o">.</span><span class="na">join</span><span class="o">(</span><span class="s">", "</span><span class="o">,</span> <span class="n">zRangeResult4</span><span class="o">));</span> <span class="c1">// >> two, three
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrange1' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">Map</span><span class="o"><</span><span class="n">String</span><span class="o">,</span> <span class="n">Double</span><span class="o">></span> <span class="n">zRangeExampleParams2</span> <span class="o">=</span> <span class="k">new</span> <span class="n">HashMap</span><span class="o"><>();</span>
</span></span><span class="line"><span class="cl"> <span class="n">zRangeExampleParams2</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">"one"</span><span class="o">,</span> <span class="mf">1.0</span><span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">zRangeExampleParams2</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">"two"</span><span class="o">,</span> <span class="mf">2.0</span><span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">zRangeExampleParams2</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">"three"</span><span class="o">,</span> <span class="mf">3.0</span><span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">long</span> <span class="n">zRangeResult5</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">zadd</span><span class="o">(</span><span class="s">"myzset"</span><span class="o">,</span> <span class="n">zRangeExampleParams2</span><span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">zRangeResult5</span><span class="o">);</span> <span class="c1">// >>> 3
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="n">List</span><span class="o"><</span><span class="n">Tuple</span><span class="o">></span> <span class="n">zRangeResult6</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">zrangeWithScores</span><span class="o">(</span><span class="s">"myzset"</span><span class="o">,</span> <span class="k">new</span> <span class="n">ZRangeParams</span><span class="o">(</span><span class="mi">0</span><span class="o">,</span> <span class="mi">1</span><span class="o">));</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="o">(</span><span class="n">Tuple</span> <span class="n">item</span><span class="o">:</span> <span class="n">zRangeResult6</span><span class="o">)</span> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"Element: "</span> <span class="o">+</span> <span class="n">item</span><span class="o">.</span><span class="na">getElement</span><span class="o">()</span> <span class="o">+</span> <span class="s">", Score: "</span> <span class="o">+</span> <span class="n">item</span><span class="o">.</span><span class="na">getScore</span><span class="o">());</span>
</span></span><span class="line"><span class="cl"> <span class="o">}</span>
</span></span><span class="line"><span class="cl"> <span class="c1">// >>> Element: one, Score: 1.0
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="c1">// >>> Element: two, Score: 2.0
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrange2' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line hl"><span class="cl"> <span class="n">Map</span><span class="o"><</span><span class="n">String</span><span class="o">,</span> <span class="n">Double</span><span class="o">></span> <span class="n">zRangeExampleParams3</span> <span class="o">=</span> <span class="k">new</span> <span class="n">HashMap</span><span class="o"><>();</span>
</span></span><span class="line hl"><span class="cl"> <span class="n">zRangeExampleParams3</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">"one"</span><span class="o">,</span> <span class="mf">1.0</span><span class="o">);</span>
</span></span><span class="line hl"><span class="cl"> <span class="n">zRangeExampleParams3</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">"two"</span><span class="o">,</span> <span class="mf">2.0</span><span class="o">);</span>
</span></span><span class="line hl"><span class="cl"> <span class="n">zRangeExampleParams3</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">"three"</span><span class="o">,</span> <span class="mf">3.0</span><span class="o">);</span>
</span></span><span class="line hl"><span class="cl"> <span class="kt">long</span> <span class="n">zRangeResult7</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">zadd</span><span class="o">(</span><span class="s">"myzset"</span><span class="o">,</span> <span class="n">zRangeExampleParams3</span><span class="o">);</span>
</span></span><span class="line hl"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">zRangeResult7</span><span class="o">);</span> <span class="c1">// >>> 3
</span></span></span><span class="line hl"><span class="cl"><span class="c1"></span>
</span></span><span class="line hl"><span class="cl"> <span class="n">List</span><span class="o"><</span><span class="n">String</span><span class="o">></span> <span class="n">zRangeResult8</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">zrangeByScore</span><span class="o">(</span><span class="s">"myzset"</span><span class="o">,</span> <span class="s">"(1"</span><span class="o">,</span> <span class="s">"+inf"</span><span class="o">,</span> <span class="mi">1</span><span class="o">,</span> <span class="mi">1</span><span class="o">);</span>
</span></span><span class="line hl"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">String</span><span class="o">.</span><span class="na">join</span><span class="o">(</span><span class="s">", "</span><span class="o">,</span> <span class="n">zRangeResult8</span><span class="o">));</span> <span class="c1">// >>> three
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrange3' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrangebylex' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrangebyscore' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrangestore' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrank' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrem' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zremrangebylex' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zremrangebyrank' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zremrangebyscore' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrevrange' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrevrangebylex' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrevrangebyscore' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrevrank' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zscan' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zscore' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zunion' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zunionstore' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="o">}</span>
</span></span><span class="line"><span class="cl"><span class="o">}</span>
</span></span><span class="line"><span class="cl">
</span></span></code></pre>
</div>
<button class="clipboard-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-10 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="copyCodeToClipboard('#panel_Java_cmds_sorted_set-stepzrange3')" tabindex="1" title="Copy to clipboard">
<svg fill="currentColor" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M9 43.95q-1.2 0-2.1-.9-.9-.9-.9-2.1V10.8h3v30.15h23.7v3Zm6-6q-1.2 0-2.1-.9-.9-.9-.9-2.1v-28q0-1.2.9-2.1.9-.9 2.1-.9h22q1.2 0 2.1.9.9.9.9 2.1v28q0 1.2-.9 2.1-.9.9-2.1.9Zm0-3h22v-28H15v28Zm0 0v-28 28Z">
</path>
</svg>
<div class="tooltip relative inline-block">
<span class="tooltiptext hidden bg-slate-200 rounded rounded-mx text-slate-800 text-center text-xs p-1 absolute right-6 bottom-4">
Copied!
</span>
</div>
</button>
<button aria-controls="panel_Java_cmds_sorted_set-stepzrange3" class="visibility-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-2 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="toggleVisibleLines(this)" tabindex="1" title="Toggle visibility">
<svg class="hidden" fill="currentColor" id="visibility-off" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="m31.45 27.05-2.2-2.2q1.3-3.55-1.35-5.9-2.65-2.35-5.75-1.2l-2.2-2.2q.85-.55 1.9-.8 1.05-.25 2.15-.25 3.55 0 6.025 2.475Q32.5 19.45 32.5 23q0 1.1-.275 2.175-.275 1.075-.775 1.875Zm6.45 6.45-2-2q2.45-1.8 4.275-4.025Q42 25.25 42.85 23q-2.5-5.55-7.5-8.775Q30.35 11 24.5 11q-2.1 0-4.3.4-2.2.4-3.45.95L14.45 10q1.75-.8 4.475-1.4Q21.65 8 24.25 8q7.15 0 13.075 4.075Q43.25 16.15 46 23q-1.3 3.2-3.35 5.85-2.05 2.65-4.75 4.65Zm2.9 11.3-8.4-8.25q-1.75.7-3.95 1.075T24 38q-7.3 0-13.25-4.075T2 23q1-2.6 2.775-5.075T9.1 13.2L2.8 6.9l2.1-2.15L42.75 42.6ZM11.15 15.3q-1.85 1.35-3.575 3.55Q5.85 21.05 5.1 23q2.55 5.55 7.675 8.775Q17.9 35 24.4 35q1.65 0 3.25-.2t2.4-.6l-3.2-3.2q-.55.25-1.35.375T24 31.5q-3.5 0-6-2.45T15.5 23q0-.75.125-1.5T16 20.15Zm15.25 7.1Zm-5.8 2.9Z">
</path>
</svg>
<svg fill="currentColor" id="visibility-on" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M24 31.5q3.55 0 6.025-2.475Q32.5 26.55 32.5 23q0-3.55-2.475-6.025Q27.55 14.5 24 14.5q-3.55 0-6.025 2.475Q15.5 19.45 15.5 23q0 3.55 2.475 6.025Q20.45 31.5 24 31.5Zm0-2.9q-2.35 0-3.975-1.625T18.4 23q0-2.35 1.625-3.975T24 17.4q2.35 0 3.975 1.625T29.6 23q0 2.35-1.625 3.975T24 28.6Zm0 9.4q-7.3 0-13.2-4.15Q4.9 29.7 2 23q2.9-6.7 8.8-10.85Q16.7 8 24 8q7.3 0 13.2 4.15Q43.1 16.3 46 23q-2.9 6.7-8.8 10.85Q31.3 38 24 38Zm0-15Zm0 12q6.05 0 11.125-3.275T42.85 23q-2.65-5.45-7.725-8.725Q30.05 11 24 11t-11.125 3.275Q7.8 17.55 5.1 23q2.7 5.45 7.775 8.725Q17.95 35 24 35Z">
</path>
</svg>
</button>
<div class="cli-footer flex items-center justify-between rounded-b-md bg-slate-900 mt-0 px-4 pt-0 mb-0 transition-opacity ease-in-out duration-300 opacity-0 invisible group-hover:opacity-100 group-hover:visible">
<a class="rounded rounded-mx px-3 py-1 text-white text-xs hover:text-white hover:bg-slate-600 hover:border-transparent focus:outline-none focus:ring-2 focus:white focus:border-slate-500" href="https://redis.io/docs/latest/develop/connect/clients/java/jedis/" tabindex="1" title="Quick-Start">
Java Quick-Start
</a>
<div class="w-1/2">
</div>
<div class="flex-1 text-right">
<a class="button text-neutral-400 hover:text-slate-100 h-6 w-6 p-1" href="https://github.com/redis/jedis/tree/master/src/test/java/io/redis/examples/CmdsSortedSetExample.java" tabindex="1" title="Improve this code example">
<svg fill="github" height="16" viewbox="0 0 18 16" width="18" xmlns="http://www.w3.org/2000/svg">
<path clip-rule="evenodd" d="M8.99953 1.43397e-06C7.09918 -0.000897921 5.26058 0.674713 3.81295 1.90585C2.36533 3.13699 1.40324 4.84324 1.09896 6.71907C0.794684 8.5949 1.1681 10.5178 2.15233 12.1434C3.13657 13.769 4.66734 14.9912 6.47053 15.591C6.87053 15.664 7.01653 15.417 7.01653 15.205C7.01653 15.015 7.00953 14.512 7.00553 13.845C4.78053 14.328 4.31053 12.772 4.31053 12.772C4.16325 12.2887 3.84837 11.8739 3.42253 11.602C2.69653 11.102 3.47753 11.116 3.47753 11.116C3.73043 11.1515 3.97191 11.2442 4.18365 11.3869C4.39539 11.5297 4.57182 11.7189 4.69953 11.94C4.80755 12.1377 4.95378 12.3119 5.12972 12.4526C5.30567 12.5933 5.50782 12.6976 5.72442 12.7595C5.94103 12.8214 6.16778 12.8396 6.39148 12.813C6.61519 12.7865 6.83139 12.7158 7.02753 12.605C7.06381 12.1992 7.24399 11.8197 7.53553 11.535C5.75953 11.335 3.89153 10.647 3.89153 7.581C3.88005 6.78603 4.17513 6.01716 4.71553 5.434C4.47318 4.74369 4.50322 3.98693 4.79953 3.318C4.79953 3.318 5.47053 3.103 6.99953 4.138C8.31074 3.77905 9.69432 3.77905 11.0055 4.138C12.5325 3.103 13.2055 3.318 13.2055 3.318C13.5012 3.9877 13.5294 4.74513 13.2845 5.435C13.8221 6.01928 14.114 6.78817 14.0995 7.582C14.0995 10.655 12.2285 11.332 10.4465 11.53C10.6375 11.724 10.7847 11.9566 10.8784 12.2123C10.972 12.4679 11.0099 12.7405 10.9895 13.012C10.9895 14.081 10.9795 14.944 10.9795 15.206C10.9795 15.42 11.1235 15.669 11.5295 15.591C13.3328 14.9911 14.8636 13.7689 15.8479 12.1432C16.8321 10.5175 17.2054 8.59447 16.901 6.71858C16.5966 4.84268 15.6343 3.13642 14.1865 1.90536C12.7387 0.674306 10.9 -0.0011359 8.99953 1.43397e-06Z" fill="white" fill-rule="evenodd">
</path>
</svg>
</a>
</div>
</div>
</div>
<input class="radiotab w-0 h-0" data-lang="go" id="Go_cmds_sorted_set-stepzrange3" name="cmds_sorted_set-stepzrange3" tabindex="1" type="radio"/>
<label class="justify-left label ml-4 pt-3.5 px-3 pb-1 cursor-pointer text-sm text-center bg-redis-ink-900 hover:text-redis-red-600 rounded rounded-mx transition duration-150 ease-in-out" for="Go_cmds_sorted_set-stepzrange3" title="Open example">
Go
</label>
<div aria-labelledby="tab-cmds_sorted_set-stepzrange3" class="panel order-last hidden w-full mt-0 relative" id="panel_Go_cmds_sorted_set-stepzrange3" role="tabpanel" tabindex="0">
<div class="highlight">
<pre class="chroma"><code class="language-go" data-lang="go"><span class="line"><span class="cl"><span class="kn">package</span> <span class="nx">example_commands_test</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="s">"context"</span>
</span></span><span class="line"><span class="cl"> <span class="s">"fmt"</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="s">"github.com/redis/go-redis/v9"</span>
</span></span><span class="line"><span class="cl"><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kd">func</span> <span class="nf">ExampleClient_zadd_cmd</span><span class="p">()</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">ctx</span> <span class="o">:=</span> <span class="nx">context</span><span class="p">.</span><span class="nf">Background</span><span class="p">()</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="nx">rdb</span> <span class="o">:=</span> <span class="nx">redis</span><span class="p">.</span><span class="nf">NewClient</span><span class="p">(</span><span class="o">&</span><span class="nx">redis</span><span class="p">.</span><span class="nx">Options</span><span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Addr</span><span class="p">:</span> <span class="s">"localhost:6379"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Password</span><span class="p">:</span> <span class="s">""</span><span class="p">,</span> <span class="c1">// no password docs
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="nx">DB</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span> <span class="c1">// use default DB
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="p">})</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="nx">zAddResult1</span><span class="p">,</span> <span class="nx">err</span> <span class="o">:=</span> <span class="nx">rdb</span><span class="p">.</span><span class="nf">ZAdd</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"myzset"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">redis</span><span class="p">.</span><span class="nx">Z</span><span class="p">{</span><span class="nx">Member</span><span class="p">:</span> <span class="s">"one"</span><span class="p">,</span> <span class="nx">Score</span><span class="p">:</span> <span class="mi">1</span><span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="p">).</span><span class="nf">Result</span><span class="p">()</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="nx">err</span> <span class="o">!=</span> <span class="kc">nil</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nb">panic</span><span class="p">(</span><span class="nx">err</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="nx">fmt</span><span class="p">.</span><span class="nf">Println</span><span class="p">(</span><span class="nx">zAddResult1</span><span class="p">)</span> <span class="c1">// >>> 1
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="nx">zAddResult2</span><span class="p">,</span> <span class="nx">err</span> <span class="o">:=</span> <span class="nx">rdb</span><span class="p">.</span><span class="nf">ZAdd</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"myzset"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">redis</span><span class="p">.</span><span class="nx">Z</span><span class="p">{</span><span class="nx">Member</span><span class="p">:</span> <span class="s">"uno"</span><span class="p">,</span> <span class="nx">Score</span><span class="p">:</span> <span class="mi">1</span><span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="p">).</span><span class="nf">Result</span><span class="p">()</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="nx">err</span> <span class="o">!=</span> <span class="kc">nil</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nb">panic</span><span class="p">(</span><span class="nx">err</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="nx">fmt</span><span class="p">.</span><span class="nf">Println</span><span class="p">(</span><span class="nx">zAddResult2</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="nx">zAddResult3</span><span class="p">,</span> <span class="nx">err</span> <span class="o">:=</span> <span class="nx">rdb</span><span class="p">.</span><span class="nf">ZAdd</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"myzset"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">redis</span><span class="p">.</span><span class="nx">Z</span><span class="p">{</span><span class="nx">Member</span><span class="p">:</span> <span class="s">"two"</span><span class="p">,</span> <span class="nx">Score</span><span class="p">:</span> <span class="mi">2</span><span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="nx">redis</span><span class="p">.</span><span class="nx">Z</span><span class="p">{</span><span class="nx">Member</span><span class="p">:</span> <span class="s">"three"</span><span class="p">,</span> <span class="nx">Score</span><span class="p">:</span> <span class="mi">3</span><span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="p">).</span><span class="nf">Result</span><span class="p">()</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="nx">err</span> <span class="o">!=</span> <span class="kc">nil</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nb">panic</span><span class="p">(</span><span class="nx">err</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="nx">fmt</span><span class="p">.</span><span class="nf">Println</span><span class="p">(</span><span class="nx">zAddResult3</span><span class="p">)</span> <span class="c1">// >>> 2
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="nx">zAddResult4</span><span class="p">,</span> <span class="nx">err</span> <span class="o">:=</span> <span class="nx">rdb</span><span class="p">.</span><span class="nf">ZRangeWithScores</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"myzset"</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">).</span><span class="nf">Result</span><span class="p">()</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="nx">err</span> <span class="o">!=</span> <span class="kc">nil</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nb">panic</span><span class="p">(</span><span class="nx">err</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="nx">fmt</span><span class="p">.</span><span class="nf">Println</span><span class="p">(</span><span class="nx">zAddResult4</span><span class="p">)</span> <span class="c1">// >>> [{1 one} {1 uno} {2 two} {3 three}]
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kd">func</span> <span class="nf">ExampleClient_zrange1</span><span class="p">()</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">ctx</span> <span class="o">:=</span> <span class="nx">context</span><span class="p">.</span><span class="nf">Background</span><span class="p">()</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="nx">rdb</span> <span class="o">:=</span> <span class="nx">redis</span><span class="p">.</span><span class="nf">NewClient</span><span class="p">(</span><span class="o">&</span><span class="nx">redis</span><span class="p">.</span><span class="nx">Options</span><span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Addr</span><span class="p">:</span> <span class="s">"localhost:6379"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Password</span><span class="p">:</span> <span class="s">""</span><span class="p">,</span> <span class="c1">// no password docs
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="nx">DB</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span> <span class="c1">// use default DB
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="p">})</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="nx">zrangeResult1</span><span class="p">,</span> <span class="nx">err</span> <span class="o">:=</span> <span class="nx">rdb</span><span class="p">.</span><span class="nf">ZAdd</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"myzset"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">redis</span><span class="p">.</span><span class="nx">Z</span><span class="p">{</span><span class="nx">Member</span><span class="p">:</span> <span class="s">"one"</span><span class="p">,</span> <span class="nx">Score</span><span class="p">:</span> <span class="mi">1</span><span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="nx">redis</span><span class="p">.</span><span class="nx">Z</span><span class="p">{</span><span class="nx">Member</span><span class="p">:</span> <span class="s">"two"</span><span class="p">,</span> <span class="nx">Score</span><span class="p">:</span> <span class="mi">2</span><span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="nx">redis</span><span class="p">.</span><span class="nx">Z</span><span class="p">{</span><span class="nx">Member</span><span class="p">:</span> <span class="s">"three"</span><span class="p">,</span> <span class="nx">Score</span><span class="p">:</span> <span class="mi">3</span><span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="p">).</span><span class="nf">Result</span><span class="p">()</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="nx">err</span> <span class="o">!=</span> <span class="kc">nil</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nb">panic</span><span class="p">(</span><span class="nx">err</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="nx">fmt</span><span class="p">.</span><span class="nf">Println</span><span class="p">(</span><span class="nx">zrangeResult1</span><span class="p">)</span> <span class="c1">// >>> 3
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="nx">zrangeResult2</span><span class="p">,</span> <span class="nx">err</span> <span class="o">:=</span> <span class="nx">rdb</span><span class="p">.</span><span class="nf">ZRange</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"myzset"</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">).</span><span class="nf">Result</span><span class="p">()</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="nx">err</span> <span class="o">!=</span> <span class="kc">nil</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nb">panic</span><span class="p">(</span><span class="nx">err</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="nx">fmt</span><span class="p">.</span><span class="nf">Println</span><span class="p">(</span><span class="nx">zrangeResult2</span><span class="p">)</span> <span class="c1">// >>> [one two three]
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="nx">zrangeResult3</span><span class="p">,</span> <span class="nx">err</span> <span class="o">:=</span> <span class="nx">rdb</span><span class="p">.</span><span class="nf">ZRange</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"myzset"</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">).</span><span class="nf">Result</span><span class="p">()</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="nx">err</span> <span class="o">!=</span> <span class="kc">nil</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nb">panic</span><span class="p">(</span><span class="nx">err</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="nx">fmt</span><span class="p">.</span><span class="nf">Println</span><span class="p">(</span><span class="nx">zrangeResult3</span><span class="p">)</span> <span class="c1">// >>> [three]
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="nx">zrangeResult4</span><span class="p">,</span> <span class="nx">err</span> <span class="o">:=</span> <span class="nx">rdb</span><span class="p">.</span><span class="nf">ZRange</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"myzset"</span><span class="p">,</span> <span class="o">-</span><span class="mi">2</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">).</span><span class="nf">Result</span><span class="p">()</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="nx">err</span> <span class="o">!=</span> <span class="kc">nil</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nb">panic</span><span class="p">(</span><span class="nx">err</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="nx">fmt</span><span class="p">.</span><span class="nf">Println</span><span class="p">(</span><span class="nx">zrangeResult4</span><span class="p">)</span> <span class="c1">// >>> [two three]
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kd">func</span> <span class="nf">ExampleClient_zrange2</span><span class="p">()</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">ctx</span> <span class="o">:=</span> <span class="nx">context</span><span class="p">.</span><span class="nf">Background</span><span class="p">()</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="nx">rdb</span> <span class="o">:=</span> <span class="nx">redis</span><span class="p">.</span><span class="nf">NewClient</span><span class="p">(</span><span class="o">&</span><span class="nx">redis</span><span class="p">.</span><span class="nx">Options</span><span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Addr</span><span class="p">:</span> <span class="s">"localhost:6379"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Password</span><span class="p">:</span> <span class="s">""</span><span class="p">,</span> <span class="c1">// no password docs
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="nx">DB</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span> <span class="c1">// use default DB
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="p">})</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="nx">zRangeResult5</span><span class="p">,</span> <span class="nx">err</span> <span class="o">:=</span> <span class="nx">rdb</span><span class="p">.</span><span class="nf">ZAdd</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"myzset"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">redis</span><span class="p">.</span><span class="nx">Z</span><span class="p">{</span><span class="nx">Member</span><span class="p">:</span> <span class="s">"one"</span><span class="p">,</span> <span class="nx">Score</span><span class="p">:</span> <span class="mi">1</span><span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="nx">redis</span><span class="p">.</span><span class="nx">Z</span><span class="p">{</span><span class="nx">Member</span><span class="p">:</span> <span class="s">"two"</span><span class="p">,</span> <span class="nx">Score</span><span class="p">:</span> <span class="mi">2</span><span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="nx">redis</span><span class="p">.</span><span class="nx">Z</span><span class="p">{</span><span class="nx">Member</span><span class="p">:</span> <span class="s">"three"</span><span class="p">,</span> <span class="nx">Score</span><span class="p">:</span> <span class="mi">3</span><span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="p">).</span><span class="nf">Result</span><span class="p">()</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="nx">err</span> <span class="o">!=</span> <span class="kc">nil</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nb">panic</span><span class="p">(</span><span class="nx">err</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="nx">fmt</span><span class="p">.</span><span class="nf">Println</span><span class="p">(</span><span class="nx">zRangeResult5</span><span class="p">)</span> <span class="c1">// >>> 3
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="nx">zRangeResult6</span><span class="p">,</span> <span class="nx">err</span> <span class="o">:=</span> <span class="nx">rdb</span><span class="p">.</span><span class="nf">ZRangeWithScores</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"myzset"</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">).</span><span class="nf">Result</span><span class="p">()</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="nx">err</span> <span class="o">!=</span> <span class="kc">nil</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nb">panic</span><span class="p">(</span><span class="nx">err</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="nx">fmt</span><span class="p">.</span><span class="nf">Println</span><span class="p">(</span><span class="nx">zRangeResult6</span><span class="p">)</span> <span class="c1">// >>> [{1 one} {2 two}]
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kd">func</span> <span class="nf">ExampleClient_zrange3</span><span class="p">()</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">ctx</span> <span class="o">:=</span> <span class="nx">context</span><span class="p">.</span><span class="nf">Background</span><span class="p">()</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="nx">rdb</span> <span class="o">:=</span> <span class="nx">redis</span><span class="p">.</span><span class="nf">NewClient</span><span class="p">(</span><span class="o">&</span><span class="nx">redis</span><span class="p">.</span><span class="nx">Options</span><span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Addr</span><span class="p">:</span> <span class="s">"localhost:6379"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">Password</span><span class="p">:</span> <span class="s">""</span><span class="p">,</span> <span class="c1">// no password docs
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="nx">DB</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span> <span class="c1">// use default DB
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="p">})</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line hl"><span class="cl"> <span class="nx">zRangeResult7</span><span class="p">,</span> <span class="nx">err</span> <span class="o">:=</span> <span class="nx">rdb</span><span class="p">.</span><span class="nf">ZAdd</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"myzset"</span><span class="p">,</span>
</span></span><span class="line hl"><span class="cl"> <span class="nx">redis</span><span class="p">.</span><span class="nx">Z</span><span class="p">{</span><span class="nx">Member</span><span class="p">:</span> <span class="s">"one"</span><span class="p">,</span> <span class="nx">Score</span><span class="p">:</span> <span class="mi">1</span><span class="p">},</span>
</span></span><span class="line hl"><span class="cl"> <span class="nx">redis</span><span class="p">.</span><span class="nx">Z</span><span class="p">{</span><span class="nx">Member</span><span class="p">:</span> <span class="s">"two"</span><span class="p">,</span> <span class="nx">Score</span><span class="p">:</span> <span class="mi">2</span><span class="p">},</span>
</span></span><span class="line hl"><span class="cl"> <span class="nx">redis</span><span class="p">.</span><span class="nx">Z</span><span class="p">{</span><span class="nx">Member</span><span class="p">:</span> <span class="s">"three"</span><span class="p">,</span> <span class="nx">Score</span><span class="p">:</span> <span class="mi">3</span><span class="p">},</span>
</span></span><span class="line hl"><span class="cl"> <span class="p">).</span><span class="nf">Result</span><span class="p">()</span>
</span></span><span class="line hl"><span class="cl">
</span></span><span class="line hl"><span class="cl"> <span class="k">if</span> <span class="nx">err</span> <span class="o">!=</span> <span class="kc">nil</span> <span class="p">{</span>
</span></span><span class="line hl"><span class="cl"> <span class="nb">panic</span><span class="p">(</span><span class="nx">err</span><span class="p">)</span>
</span></span><span class="line hl"><span class="cl"> <span class="p">}</span>
</span></span><span class="line hl"><span class="cl">
</span></span><span class="line hl"><span class="cl"> <span class="nx">fmt</span><span class="p">.</span><span class="nf">Println</span><span class="p">(</span><span class="nx">zRangeResult7</span><span class="p">)</span> <span class="c1">// >>> 3
</span></span></span><span class="line hl"><span class="cl"><span class="c1"></span>
</span></span><span class="line hl"><span class="cl"> <span class="nx">zRangeResult8</span><span class="p">,</span> <span class="nx">err</span> <span class="o">:=</span> <span class="nx">rdb</span><span class="p">.</span><span class="nf">ZRangeArgs</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span>
</span></span><span class="line hl"><span class="cl"> <span class="nx">redis</span><span class="p">.</span><span class="nx">ZRangeArgs</span><span class="p">{</span>
</span></span><span class="line hl"><span class="cl"> <span class="nx">Key</span><span class="p">:</span> <span class="s">"myzset"</span><span class="p">,</span>
</span></span><span class="line hl"><span class="cl"> <span class="nx">ByScore</span><span class="p">:</span> <span class="kc">true</span><span class="p">,</span>
</span></span><span class="line hl"><span class="cl"> <span class="nx">Start</span><span class="p">:</span> <span class="s">"(1"</span><span class="p">,</span>
</span></span><span class="line hl"><span class="cl"> <span class="nx">Stop</span><span class="p">:</span> <span class="s">"+inf"</span><span class="p">,</span>
</span></span><span class="line hl"><span class="cl"> <span class="nx">Offset</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
</span></span><span class="line hl"><span class="cl"> <span class="nx">Count</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
</span></span><span class="line hl"><span class="cl"> <span class="p">},</span>
</span></span><span class="line hl"><span class="cl"> <span class="p">).</span><span class="nf">Result</span><span class="p">()</span>
</span></span><span class="line hl"><span class="cl">
</span></span><span class="line hl"><span class="cl"> <span class="k">if</span> <span class="nx">err</span> <span class="o">!=</span> <span class="kc">nil</span> <span class="p">{</span>
</span></span><span class="line hl"><span class="cl"> <span class="nb">panic</span><span class="p">(</span><span class="nx">err</span><span class="p">)</span>
</span></span><span class="line hl"><span class="cl"> <span class="p">}</span>
</span></span><span class="line hl"><span class="cl">
</span></span><span class="line hl"><span class="cl"> <span class="nx">fmt</span><span class="p">.</span><span class="nf">Println</span><span class="p">(</span><span class="nx">zRangeResult8</span><span class="p">)</span> <span class="c1">// >>> [three]
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span></code></pre>
</div>
<button class="clipboard-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-10 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="copyCodeToClipboard('#panel_Go_cmds_sorted_set-stepzrange3')" tabindex="1" title="Copy to clipboard">
<svg fill="currentColor" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M9 43.95q-1.2 0-2.1-.9-.9-.9-.9-2.1V10.8h3v30.15h23.7v3Zm6-6q-1.2 0-2.1-.9-.9-.9-.9-2.1v-28q0-1.2.9-2.1.9-.9 2.1-.9h22q1.2 0 2.1.9.9.9.9 2.1v28q0 1.2-.9 2.1-.9.9-2.1.9Zm0-3h22v-28H15v28Zm0 0v-28 28Z">
</path>
</svg>
<div class="tooltip relative inline-block">
<span class="tooltiptext hidden bg-slate-200 rounded rounded-mx text-slate-800 text-center text-xs p-1 absolute right-6 bottom-4">
Copied!
</span>
</div>
</button>
<button aria-controls="panel_Go_cmds_sorted_set-stepzrange3" class="visibility-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-2 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="toggleVisibleLines(this)" tabindex="1" title="Toggle visibility">
<svg class="hidden" fill="currentColor" id="visibility-off" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="m31.45 27.05-2.2-2.2q1.3-3.55-1.35-5.9-2.65-2.35-5.75-1.2l-2.2-2.2q.85-.55 1.9-.8 1.05-.25 2.15-.25 3.55 0 6.025 2.475Q32.5 19.45 32.5 23q0 1.1-.275 2.175-.275 1.075-.775 1.875Zm6.45 6.45-2-2q2.45-1.8 4.275-4.025Q42 25.25 42.85 23q-2.5-5.55-7.5-8.775Q30.35 11 24.5 11q-2.1 0-4.3.4-2.2.4-3.45.95L14.45 10q1.75-.8 4.475-1.4Q21.65 8 24.25 8q7.15 0 13.075 4.075Q43.25 16.15 46 23q-1.3 3.2-3.35 5.85-2.05 2.65-4.75 4.65Zm2.9 11.3-8.4-8.25q-1.75.7-3.95 1.075T24 38q-7.3 0-13.25-4.075T2 23q1-2.6 2.775-5.075T9.1 13.2L2.8 6.9l2.1-2.15L42.75 42.6ZM11.15 15.3q-1.85 1.35-3.575 3.55Q5.85 21.05 5.1 23q2.55 5.55 7.675 8.775Q17.9 35 24.4 35q1.65 0 3.25-.2t2.4-.6l-3.2-3.2q-.55.25-1.35.375T24 31.5q-3.5 0-6-2.45T15.5 23q0-.75.125-1.5T16 20.15Zm15.25 7.1Zm-5.8 2.9Z">
</path>
</svg>
<svg fill="currentColor" id="visibility-on" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M24 31.5q3.55 0 6.025-2.475Q32.5 26.55 32.5 23q0-3.55-2.475-6.025Q27.55 14.5 24 14.5q-3.55 0-6.025 2.475Q15.5 19.45 15.5 23q0 3.55 2.475 6.025Q20.45 31.5 24 31.5Zm0-2.9q-2.35 0-3.975-1.625T18.4 23q0-2.35 1.625-3.975T24 17.4q2.35 0 3.975 1.625T29.6 23q0 2.35-1.625 3.975T24 28.6Zm0 9.4q-7.3 0-13.2-4.15Q4.9 29.7 2 23q2.9-6.7 8.8-10.85Q16.7 8 24 8q7.3 0 13.2 4.15Q43.1 16.3 46 23q-2.9 6.7-8.8 10.85Q31.3 38 24 38Zm0-15Zm0 12q6.05 0 11.125-3.275T42.85 23q-2.65-5.45-7.725-8.725Q30.05 11 24 11t-11.125 3.275Q7.8 17.55 5.1 23q2.7 5.45 7.775 8.725Q17.95 35 24 35Z">
</path>
</svg>
</button>
<div class="cli-footer flex items-center justify-between rounded-b-md bg-slate-900 mt-0 px-4 pt-0 mb-0 transition-opacity ease-in-out duration-300 opacity-0 invisible group-hover:opacity-100 group-hover:visible">
<a class="rounded rounded-mx px-3 py-1 text-white text-xs hover:text-white hover:bg-slate-600 hover:border-transparent focus:outline-none focus:ring-2 focus:white focus:border-slate-500" href="https://redis.io/docs/latest/develop/connect/clients/go/" tabindex="1" title="Quick-Start">
Go Quick-Start
</a>
<div class="w-1/2">
</div>
<div class="flex-1 text-right">
<a class="button text-neutral-400 hover:text-slate-100 h-6 w-6 p-1" href="https://github.com/redis/go-redis/tree/master/doctests/cmds_sorted_set_test.go" tabindex="1" title="Improve this code example">
<svg fill="github" height="16" viewbox="0 0 18 16" width="18" xmlns="http://www.w3.org/2000/svg">
<path clip-rule="evenodd" d="M8.99953 1.43397e-06C7.09918 -0.000897921 5.26058 0.674713 3.81295 1.90585C2.36533 3.13699 1.40324 4.84324 1.09896 6.71907C0.794684 8.5949 1.1681 10.5178 2.15233 12.1434C3.13657 13.769 4.66734 14.9912 6.47053 15.591C6.87053 15.664 7.01653 15.417 7.01653 15.205C7.01653 15.015 7.00953 14.512 7.00553 13.845C4.78053 14.328 4.31053 12.772 4.31053 12.772C4.16325 12.2887 3.84837 11.8739 3.42253 11.602C2.69653 11.102 3.47753 11.116 3.47753 11.116C3.73043 11.1515 3.97191 11.2442 4.18365 11.3869C4.39539 11.5297 4.57182 11.7189 4.69953 11.94C4.80755 12.1377 4.95378 12.3119 5.12972 12.4526C5.30567 12.5933 5.50782 12.6976 5.72442 12.7595C5.94103 12.8214 6.16778 12.8396 6.39148 12.813C6.61519 12.7865 6.83139 12.7158 7.02753 12.605C7.06381 12.1992 7.24399 11.8197 7.53553 11.535C5.75953 11.335 3.89153 10.647 3.89153 7.581C3.88005 6.78603 4.17513 6.01716 4.71553 5.434C4.47318 4.74369 4.50322 3.98693 4.79953 3.318C4.79953 3.318 5.47053 3.103 6.99953 4.138C8.31074 3.77905 9.69432 3.77905 11.0055 4.138C12.5325 3.103 13.2055 3.318 13.2055 3.318C13.5012 3.9877 13.5294 4.74513 13.2845 5.435C13.8221 6.01928 14.114 6.78817 14.0995 7.582C14.0995 10.655 12.2285 11.332 10.4465 11.53C10.6375 11.724 10.7847 11.9566 10.8784 12.2123C10.972 12.4679 11.0099 12.7405 10.9895 13.012C10.9895 14.081 10.9795 14.944 10.9795 15.206C10.9795 15.42 11.1235 15.669 11.5295 15.591C13.3328 14.9911 14.8636 13.7689 15.8479 12.1432C16.8321 10.5175 17.2054 8.59447 16.901 6.71858C16.5966 4.84268 15.6343 3.13642 14.1865 1.90536C12.7387 0.674306 10.9 -0.0011359 8.99953 1.43397e-06Z" fill="white" fill-rule="evenodd">
</path>
</svg>
</a>
</div>
</div>
</div>
<input class="radiotab w-0 h-0" data-lang="dotnet" id="Csharp_cmds_sorted_set-stepzrange3" name="cmds_sorted_set-stepzrange3" tabindex="1" type="radio"/>
<label class="justify-left label ml-4 pt-3.5 px-3 pb-1 cursor-pointer text-sm text-center bg-redis-ink-900 hover:text-redis-red-600 rounded rounded-mx transition duration-150 ease-in-out" for="Csharp_cmds_sorted_set-stepzrange3" title="Open example">
C#
</label>
<div aria-labelledby="tab-cmds_sorted_set-stepzrange3" class="panel order-last hidden w-full mt-0 relative" id="panel_Csharp_cmds_sorted_set-stepzrange3" role="tabpanel" tabindex="0">
<div class="highlight">
<pre class="chroma"><code class="language-C#" data-lang="C#"><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">using</span> <span class="nn">NRedisStack.Tests</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="k">using</span> <span class="nn">StackExchange.Redis</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">public</span> <span class="k">class</span> <span class="nc">CmdsSortedSet</span>
</span></span><span class="line"><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">public</span> <span class="k">void</span> <span class="n">run</span><span class="p">()</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="kt">var</span> <span class="n">muxer</span> <span class="p">=</span> <span class="n">ConnectionMultiplexer</span><span class="p">.</span><span class="n">Connect</span><span class="p">(</span><span class="s">"localhost:6379"</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">var</span> <span class="n">db</span> <span class="p">=</span> <span class="n">muxer</span><span class="p">.</span><span class="n">GetDatabase</span><span class="p">();</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'bzmpop' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'bzpopmax' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'bzpopmin' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="kt">bool</span> <span class="n">zAddResult1</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">SortedSetAdd</span><span class="p">(</span><span class="s">"myzset"</span><span class="p">,</span> <span class="s">"one"</span><span class="p">,</span> <span class="m">1</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="n">zAddResult1</span><span class="p">);</span> <span class="c1">// >>> True</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="kt">bool</span> <span class="n">zAddResult2</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">SortedSetAdd</span><span class="p">(</span><span class="s">"myzset"</span><span class="p">,</span> <span class="s">"uno"</span><span class="p">,</span> <span class="m">1</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="n">zAddResult2</span><span class="p">);</span> <span class="c1">// >>> True</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="kt">long</span> <span class="n">zAddResult3</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">SortedSetAdd</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="s">"myzset"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">SortedSetEntry</span><span class="p">[]</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">SortedSetEntry</span><span class="p">(</span><span class="s">"two"</span><span class="p">,</span> <span class="m">2</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">SortedSetEntry</span><span class="p">(</span><span class="s">"three"</span><span class="p">,</span> <span class="m">3</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl"> <span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="n">zAddResult3</span><span class="p">);</span> <span class="c1">// >>> 2</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">SortedSetEntry</span><span class="p">[]</span> <span class="n">zAddResult4</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">SortedSetRangeByRankWithScores</span><span class="p">(</span><span class="s">"myzset"</span><span class="p">,</span> <span class="m">0</span><span class="p">,</span> <span class="p">-</span><span class="m">1</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="s">$"{string.Join("</span><span class="p">,</span> <span class="s">", zAddResult4.Select(b => $"</span><span class="p">{</span><span class="n">b</span><span class="p">.</span><span class="n">Element</span><span class="p">}:</span> <span class="p">{</span><span class="n">b</span><span class="p">.</span><span class="n">Score</span><span class="p">}</span><span class="s">"))}"</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="c1">// >>> one: 1, uno: 1, two: 2, three: 3</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zadd' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zcard' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zcount' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zdiff' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zdiffstore' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zincrby' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zinter' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zintercard' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zinterstore' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zlexcount' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zmpop' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zmscore' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zpopmax' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zpopmin' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrandmember' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="kt">long</span> <span class="n">zRangeResult1</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">SortedSetAdd</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="s">"myzset"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">SortedSetEntry</span><span class="p">[]</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">SortedSetEntry</span><span class="p">(</span><span class="s">"one"</span><span class="p">,</span> <span class="m">1</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">SortedSetEntry</span><span class="p">(</span><span class="s">"two"</span><span class="p">,</span> <span class="m">2</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">SortedSetEntry</span><span class="p">(</span><span class="s">"three"</span><span class="p">,</span> <span class="m">3</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl"> <span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="n">zRangeResult1</span><span class="p">);</span> <span class="c1">// >>> 3</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">RedisValue</span><span class="p">[]</span> <span class="n">zRangeResult2</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">SortedSetRangeByRank</span><span class="p">(</span><span class="s">"myzset"</span><span class="p">,</span> <span class="m">0</span><span class="p">,</span> <span class="p">-</span><span class="m">1</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="kt">string</span><span class="p">.</span><span class="n">Join</span><span class="p">(</span><span class="s">", "</span><span class="p">,</span> <span class="n">zRangeResult2</span><span class="p">));</span>
</span></span><span class="line"><span class="cl"> <span class="c1">// >>> one, two, three</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">RedisValue</span><span class="p">[]</span> <span class="n">zRangeResult3</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">SortedSetRangeByRank</span><span class="p">(</span><span class="s">"myzset"</span><span class="p">,</span> <span class="m">2</span><span class="p">,</span> <span class="m">3</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="kt">string</span><span class="p">.</span><span class="n">Join</span><span class="p">(</span><span class="s">", "</span><span class="p">,</span> <span class="n">zRangeResult3</span><span class="p">));</span>
</span></span><span class="line"><span class="cl"> <span class="c1">// >>> three</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">RedisValue</span><span class="p">[]</span> <span class="n">zRangeResult4</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">SortedSetRangeByRank</span><span class="p">(</span><span class="s">"myzset"</span><span class="p">,</span> <span class="p">-</span><span class="m">2</span><span class="p">,</span> <span class="p">-</span><span class="m">1</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="kt">string</span><span class="p">.</span><span class="n">Join</span><span class="p">(</span><span class="s">", "</span><span class="p">,</span> <span class="n">zRangeResult4</span><span class="p">));</span>
</span></span><span class="line"><span class="cl"> <span class="c1">// >>> two, three</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrange1' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="kt">long</span> <span class="n">zRangeResult5</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">SortedSetAdd</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="s">"myzset"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">SortedSetEntry</span><span class="p">[]</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">SortedSetEntry</span><span class="p">(</span><span class="s">"one"</span><span class="p">,</span> <span class="m">1</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">SortedSetEntry</span><span class="p">(</span><span class="s">"two"</span><span class="p">,</span> <span class="m">2</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">SortedSetEntry</span><span class="p">(</span><span class="s">"three"</span><span class="p">,</span> <span class="m">3</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl"> <span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">SortedSetEntry</span><span class="p">[]</span> <span class="n">zRangeResult6</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">SortedSetRangeByRankWithScores</span><span class="p">(</span><span class="s">"myzset"</span><span class="p">,</span> <span class="m">0</span><span class="p">,</span> <span class="m">1</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="s">$"{string.Join("</span><span class="p">,</span> <span class="s">", zRangeResult6.Select(b => $"</span><span class="p">{</span><span class="n">b</span><span class="p">.</span><span class="n">Element</span><span class="p">}:</span> <span class="p">{</span><span class="n">b</span><span class="p">.</span><span class="n">Score</span><span class="p">}</span><span class="s">"))}"</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="c1">// >>> one: 1, two: 2</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrange2' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line hl"><span class="cl"> <span class="kt">long</span> <span class="n">zRangeResult7</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">SortedSetAdd</span><span class="p">(</span>
</span></span><span class="line hl"><span class="cl"> <span class="s">"myzset"</span><span class="p">,</span>
</span></span><span class="line hl"><span class="cl"> <span class="k">new</span> <span class="n">SortedSetEntry</span><span class="p">[]</span> <span class="p">{</span>
</span></span><span class="line hl"><span class="cl"> <span class="k">new</span> <span class="n">SortedSetEntry</span><span class="p">(</span><span class="s">"one"</span><span class="p">,</span> <span class="m">1</span><span class="p">),</span>
</span></span><span class="line hl"><span class="cl"> <span class="k">new</span> <span class="n">SortedSetEntry</span><span class="p">(</span><span class="s">"two"</span><span class="p">,</span> <span class="m">2</span><span class="p">),</span>
</span></span><span class="line hl"><span class="cl"> <span class="k">new</span> <span class="n">SortedSetEntry</span><span class="p">(</span><span class="s">"three"</span><span class="p">,</span> <span class="m">3</span><span class="p">)</span>
</span></span><span class="line hl"><span class="cl"> <span class="p">}</span>
</span></span><span class="line hl"><span class="cl"> <span class="p">);</span>
</span></span><span class="line hl"><span class="cl">
</span></span><span class="line hl"><span class="cl"> <span class="n">RedisValue</span><span class="p">[]</span> <span class="n">zRangeResult8</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">SortedSetRangeByScore</span><span class="p">(</span>
</span></span><span class="line hl"><span class="cl"> <span class="s">"myzset"</span><span class="p">,</span>
</span></span><span class="line hl"><span class="cl"> <span class="m">1</span><span class="p">,</span>
</span></span><span class="line hl"><span class="cl"> <span class="kt">double</span><span class="p">.</span><span class="n">PositiveInfinity</span><span class="p">,</span>
</span></span><span class="line hl"><span class="cl"> <span class="n">Exclude</span><span class="p">.</span><span class="n">Start</span><span class="p">,</span>
</span></span><span class="line hl"><span class="cl"> <span class="n">skip</span><span class="p">:</span> <span class="m">1</span><span class="p">,</span> <span class="n">take</span><span class="p">:</span> <span class="m">1</span>
</span></span><span class="line hl"><span class="cl"> <span class="p">);</span>
</span></span><span class="line hl"><span class="cl"> <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="kt">string</span><span class="p">.</span><span class="n">Join</span><span class="p">(</span><span class="s">", "</span><span class="p">,</span> <span class="n">zRangeResult8</span><span class="p">));</span>
</span></span><span class="line hl"><span class="cl"> <span class="c1">// >>> three</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrange3' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrangebylex' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrangebyscore' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrangestore' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrank' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrem' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zremrangebylex' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zremrangebyrank' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zremrangebyscore' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrevrange' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrevrangebylex' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrevrangebyscore' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zrevrank' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zscan' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zscore' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zunion' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'zunionstore' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span></code></pre>
</div>
<button class="clipboard-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-10 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="copyCodeToClipboard('#panel_Csharp_cmds_sorted_set-stepzrange3')" tabindex="1" title="Copy to clipboard">
<svg fill="currentColor" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M9 43.95q-1.2 0-2.1-.9-.9-.9-.9-2.1V10.8h3v30.15h23.7v3Zm6-6q-1.2 0-2.1-.9-.9-.9-.9-2.1v-28q0-1.2.9-2.1.9-.9 2.1-.9h22q1.2 0 2.1.9.9.9.9 2.1v28q0 1.2-.9 2.1-.9.9-2.1.9Zm0-3h22v-28H15v28Zm0 0v-28 28Z">
</path>
</svg>
<div class="tooltip relative inline-block">
<span class="tooltiptext hidden bg-slate-200 rounded rounded-mx text-slate-800 text-center text-xs p-1 absolute right-6 bottom-4">
Copied!
</span>
</div>
</button>
<button aria-controls="panel_Csharp_cmds_sorted_set-stepzrange3" class="visibility-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-2 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="toggleVisibleLines(this)" tabindex="1" title="Toggle visibility">
<svg class="hidden" fill="currentColor" id="visibility-off" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="m31.45 27.05-2.2-2.2q1.3-3.55-1.35-5.9-2.65-2.35-5.75-1.2l-2.2-2.2q.85-.55 1.9-.8 1.05-.25 2.15-.25 3.55 0 6.025 2.475Q32.5 19.45 32.5 23q0 1.1-.275 2.175-.275 1.075-.775 1.875Zm6.45 6.45-2-2q2.45-1.8 4.275-4.025Q42 25.25 42.85 23q-2.5-5.55-7.5-8.775Q30.35 11 24.5 11q-2.1 0-4.3.4-2.2.4-3.45.95L14.45 10q1.75-.8 4.475-1.4Q21.65 8 24.25 8q7.15 0 13.075 4.075Q43.25 16.15 46 23q-1.3 3.2-3.35 5.85-2.05 2.65-4.75 4.65Zm2.9 11.3-8.4-8.25q-1.75.7-3.95 1.075T24 38q-7.3 0-13.25-4.075T2 23q1-2.6 2.775-5.075T9.1 13.2L2.8 6.9l2.1-2.15L42.75 42.6ZM11.15 15.3q-1.85 1.35-3.575 3.55Q5.85 21.05 5.1 23q2.55 5.55 7.675 8.775Q17.9 35 24.4 35q1.65 0 3.25-.2t2.4-.6l-3.2-3.2q-.55.25-1.35.375T24 31.5q-3.5 0-6-2.45T15.5 23q0-.75.125-1.5T16 20.15Zm15.25 7.1Zm-5.8 2.9Z">
</path>
</svg>
<svg fill="currentColor" id="visibility-on" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M24 31.5q3.55 0 6.025-2.475Q32.5 26.55 32.5 23q0-3.55-2.475-6.025Q27.55 14.5 24 14.5q-3.55 0-6.025 2.475Q15.5 19.45 15.5 23q0 3.55 2.475 6.025Q20.45 31.5 24 31.5Zm0-2.9q-2.35 0-3.975-1.625T18.4 23q0-2.35 1.625-3.975T24 17.4q2.35 0 3.975 1.625T29.6 23q0 2.35-1.625 3.975T24 28.6Zm0 9.4q-7.3 0-13.2-4.15Q4.9 29.7 2 23q2.9-6.7 8.8-10.85Q16.7 8 24 8q7.3 0 13.2 4.15Q43.1 16.3 46 23q-2.9 6.7-8.8 10.85Q31.3 38 24 38Zm0-15Zm0 12q6.05 0 11.125-3.275T42.85 23q-2.65-5.45-7.725-8.725Q30.05 11 24 11t-11.125 3.275Q7.8 17.55 5.1 23q2.7 5.45 7.775 8.725Q17.95 35 24 35Z">
</path>
</svg>
</button>
<div class="cli-footer flex items-center justify-between rounded-b-md bg-slate-900 mt-0 px-4 pt-0 mb-0 transition-opacity ease-in-out duration-300 opacity-0 invisible group-hover:opacity-100 group-hover:visible">
<a class="rounded rounded-mx px-3 py-1 text-white text-xs hover:text-white hover:bg-slate-600 hover:border-transparent focus:outline-none focus:ring-2 focus:white focus:border-slate-500" href="https://redis.io/docs/latest/develop/connect/clients/dotnet/" tabindex="1" title="Quick-Start">
C# Quick-Start
</a>
<div class="w-1/2">
</div>
<div class="flex-1 text-right">
<a class="button text-neutral-400 hover:text-slate-100 h-6 w-6 p-1" href="https://github.com/redis/NRedisStack/tree/master/tests/Doc/CmdsSortedSetExamples.cs" tabindex="1" title="Improve this code example">
<svg fill="github" height="16" viewbox="0 0 18 16" width="18" xmlns="http://www.w3.org/2000/svg">
<path clip-rule="evenodd" d="M8.99953 1.43397e-06C7.09918 -0.000897921 5.26058 0.674713 3.81295 1.90585C2.36533 3.13699 1.40324 4.84324 1.09896 6.71907C0.794684 8.5949 1.1681 10.5178 2.15233 12.1434C3.13657 13.769 4.66734 14.9912 6.47053 15.591C6.87053 15.664 7.01653 15.417 7.01653 15.205C7.01653 15.015 7.00953 14.512 7.00553 13.845C4.78053 14.328 4.31053 12.772 4.31053 12.772C4.16325 12.2887 3.84837 11.8739 3.42253 11.602C2.69653 11.102 3.47753 11.116 3.47753 11.116C3.73043 11.1515 3.97191 11.2442 4.18365 11.3869C4.39539 11.5297 4.57182 11.7189 4.69953 11.94C4.80755 12.1377 4.95378 12.3119 5.12972 12.4526C5.30567 12.5933 5.50782 12.6976 5.72442 12.7595C5.94103 12.8214 6.16778 12.8396 6.39148 12.813C6.61519 12.7865 6.83139 12.7158 7.02753 12.605C7.06381 12.1992 7.24399 11.8197 7.53553 11.535C5.75953 11.335 3.89153 10.647 3.89153 7.581C3.88005 6.78603 4.17513 6.01716 4.71553 5.434C4.47318 4.74369 4.50322 3.98693 4.79953 3.318C4.79953 3.318 5.47053 3.103 6.99953 4.138C8.31074 3.77905 9.69432 3.77905 11.0055 4.138C12.5325 3.103 13.2055 3.318 13.2055 3.318C13.5012 3.9877 13.5294 4.74513 13.2845 5.435C13.8221 6.01928 14.114 6.78817 14.0995 7.582C14.0995 10.655 12.2285 11.332 10.4465 11.53C10.6375 11.724 10.7847 11.9566 10.8784 12.2123C10.972 12.4679 11.0099 12.7405 10.9895 13.012C10.9895 14.081 10.9795 14.944 10.9795 15.206C10.9795 15.42 11.1235 15.669 11.5295 15.591C13.3328 14.9911 14.8636 13.7689 15.8479 12.1432C16.8321 10.5175 17.2054 8.59447 16.901 6.71858C16.5966 4.84268 15.6343 3.13642 14.1865 1.90536C12.7387 0.674306 10.9 -0.0011359 8.99953 1.43397e-06Z" fill="white" fill-rule="evenodd">
</path>
</svg>
</a>
</div>
</div>
</div>
</div>
<p>
Give these commands a try in the interactive console:
</p>
<div class="bg-slate-900 border-b border-slate-700 rounded-t-xl px-4 py-3 w-full flex">
<svg class="shrink-0 h-[1.0625rem] w-[1.0625rem] fill-slate-50" fill="currentColor" viewbox="0 0 20 20">
<path d="M2.5 10C2.5 5.85786 5.85786 2.5 10 2.5C14.1421 2.5 17.5 5.85786 17.5 10C17.5 14.1421 14.1421 17.5 10 17.5C5.85786 17.5 2.5 14.1421 2.5 10Z">
</path>
</svg>
<svg class="shrink-0 h-[1.0625rem] w-[1.0625rem] fill-slate-50" fill="currentColor" viewbox="0 0 20 20">
<path d="M10 2.5L18.6603 17.5L1.33975 17.5L10 2.5Z">
</path>
</svg>
<svg class="shrink-0 h-[1.0625rem] w-[1.0625rem] fill-slate-50" fill="currentColor" viewbox="0 0 20 20">
<path d="M10 2.5L12.0776 7.9322L17.886 8.22949L13.3617 11.8841L14.8738 17.5L10 14.3264L5.1262 17.5L6.63834 11.8841L2.11403 8.22949L7.92238 7.9322L10 2.5Z">
</path>
</svg>
</div>
<form class="redis-cli overflow-y-auto max-h-80">
<pre tabindex="0">redis> ZADD myzset 1 "one" 2 "two" 3 "three"
(integer) 3
redis> ZRANGE myzset 0 -1
1) "one"
2) "two"
3) "three"
redis> ZRANGE myzset 2 3
1) "three"
redis> ZRANGE myzset -2 -1
1) "two"
2) "three"
</pre>
<div class="prompt" style="">
<span>
redis>
</span>
<input autocomplete="off" name="prompt" spellcheck="false" type="text"/>
</div>
</form>
<h2 id="resp2resp3-reply">
RESP2/RESP3 Reply
</h2>
<a href="../../develop/reference/protocol-spec#arrays">
Array reply
</a>
: a list of members in the specified range with, optionally, their scores when the
<em>
WITHSCORES
</em>
option is given.
<br/>
<h2>
History
</h2>
<ul>
<li>
Starting with Redis version 6.2.0: Added the
<code>
REV
</code>
,
<code>
BYSCORE
</code>
,
<code>
BYLEX
</code>
and
<code>
LIMIT
</code>
options.
</li>
</ul>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/commands/zrange/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/oss_and_stack/install/install-stack/mac-os/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Install Redis Stack on macOS
</h1>
<p class="text-lg -mt-5 mb-10">
How to install Redis Stack on macOS
</p>
<p>
To install Redis Stack on macOS, use
<a href="https://brew.sh/">
Homebrew
</a>
. Make sure that you have
<a href="https://docs.brew.sh/Installation">
Homebrew installed
</a>
before starting on the installation instructions below.
</p>
<p>
There are three brew casks available.
</p>
<ul>
<li>
<code>
redis-stack
</code>
contains both
<code>
redis-stack-server
</code>
and
<code>
redis-stack-redisinsight
</code>
casks.
</li>
<li>
<code>
redis-stack-server
</code>
provides Redis Stack server only.
</li>
<li>
<code>
redis-stack-redisinsight
</code>
contains Redis Insight.
</li>
</ul>
<h2 id="install-using-homebrew">
Install using Homebrew
</h2>
<p>
First, tap the Redis Stack Homebrew tap:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">brew tap redis-stack/redis-stack</span></span></code></pre>
</div>
<p>
Next, run
<code>
brew install
</code>
:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">brew install redis-stack</span></span></code></pre>
</div>
<p>
The
<code>
redis-stack-server
</code>
cask will install all Redis and Redis Stack binaries. How you run these binaries depends on whether you already have Redis installed on your system.
</p>
<h3 id="first-time-redis-installation">
First-time Redis installation
</h3>
<p>
If this is the first time you've installed Redis on your system, you need to be sure that your
<code>
PATH
</code>
variable includes the Redis Stack installation location. This location is either
<code>
/opt/homebrew/bin
</code>
for Apple silicon Macs or
<code>
/usr/local/bin
</code>
for Intel-based Macs.
</p>
<p>
To check this, run:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nb">echo</span> <span class="nv">$PATH</span></span></span></code></pre>
</div>
<p>
Then, confirm that the output contains
<code>
/opt/homebrew/bin
</code>
(Apple silicon Macs) or
<code>
/usr/local/bin
</code>
(Intel Mac). If these directories are not in the output, see the "Existing Redis installation" instructions below.
</p>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Note:
</div>
Because Redis Stack is installed using a brew cask via the
<code>
brew tap
</code>
command, it will not be integrated with the
<code>
brew services
</code>
command.
</div>
</div>
<h3 id="existing-redis-installation">
Existing Redis installation
</h3>
<p>
If you have an existing Redis installation on your system, then might want to modify your
<code>
$PATH
</code>
to ensure that you're using the latest Redis Stack binaries.
</p>
<p>
Open the file
<code>
~/.bashrc
</code>
or
<code>
~/zshrc
</code>
(depending on your shell), and add the following lines.
</p>
<p>
For Intel-based Macs:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nb">export</span> <span class="nv">PATH</span><span class="o">=</span>/usr/local/Caskroom/redis-stack-server/<VERSION>/bin:<span class="nv">$PATH</span></span></span></code></pre>
</div>
<p>
For Apple silicon Macs:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nb">export</span> <span class="nv">PATH</span><span class="o">=</span>/opt/homebrew/Caskroom/redis-stack-server/<VERSION>/bin:<span class="nv">$PATH</span></span></span></code></pre>
</div>
<p>
In both cases, replace
<code>
<VERSION>
</code>
with your version of Redis Stack. For example, with version 6.2.0, path is as follows:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nb">export</span> <span class="nv">PATH</span><span class="o">=</span>/opt/homebrew/Caskroom/redis-stack-server/6.2.0/bin:<span class="nv">$PATH</span></span></span></code></pre>
</div>
<h3 id="start-redis-stack-server">
Start Redis Stack Server
</h3>
<p>
You can now start Redis Stack Server as follows:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">redis-stack-server</span></span></code></pre>
</div>
<h2 id="installing-redis-after-installing-redis-stack">
Installing Redis after installing Redis Stack
</h2>
<p>
If you've already installed Redis Stack with Homebrew and then try to install Redis with
<code>
brew install redis
</code>
, you may encounter errors like the following:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">Error: The brew link step did not <span class="nb">complete</span> successfully
</span></span><span class="line"><span class="cl">The formula built, but is not symlinked into /usr/local
</span></span><span class="line"><span class="cl">Could not symlink bin/redis-benchmark
</span></span><span class="line"><span class="cl">Target /usr/local/bin/redis-benchmark
</span></span><span class="line"><span class="cl">already exists. You may want to remove it:
</span></span><span class="line"><span class="cl">rm <span class="s1">'/usr/local/bin/redis-benchmark'</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">To force the link and overwrite all conflicting files:
</span></span><span class="line"><span class="cl">brew link --overwrite redis
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">To list all files that would be deleted:
</span></span><span class="line"><span class="cl">brew link --overwrite --dry-run redis</span></span></code></pre>
</div>
<p>
In this case, you can overwrite the Redis binaries installed by Redis Stack by running:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">brew link --overwrite redis</span></span></code></pre>
</div>
<p>
However, Redis Stack Server will still be installed. To uninstall Redis Stack Server, see below.
</p>
<h2 id="uninstall-redis-stack">
Uninstall Redis Stack
</h2>
<p>
To uninstall Redis Stack, run:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">brew uninstall redis-stack-redisinsight redis-stack-server redis-stack
</span></span><span class="line"><span class="cl">brew untap redis-stack/redis-stack</span></span></code></pre>
</div>
<h2 id="connect-to-redis">
Connect to Redis
</h2>
<p>
Once Redis is running, you can test it by running
<code>
redis-cli
</code>
:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">redis-cli</span></span></code></pre>
</div>
<p>
Test the connection with the
<code>
ping
</code>
command:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">127.0.0.1:6379> ping
</span></span><span class="line"><span class="cl">PONG</span></span></code></pre>
</div>
<p>
You can also test that your Redis server is running using
<a href="/docs/latest/develop/tools/insight/">
Redis Insight
</a>
.
</p>
<h2 id="next-steps">
Next steps
</h2>
<p>
Once you have a running Redis instance, you may want to:
</p>
<ul>
<li>
Try the
<a href="/docs/latest/develop/tools/cli/">
Redis CLI tutorial
</a>
</li>
<li>
Connect using one of the
<a href="/docs/latest/develop/clients/">
Redis clients
</a>
</li>
<li>
<a href="/docs/latest/operate/oss_and_stack/install/install-redis/#install-redis-properly">
Install Redis "properly"
</a>
for production use.
</li>
</ul>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/oss_and_stack/install/install-stack/mac-os/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/integrate/write-behind/installation/install-rdi-cli/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Install Write-behind CLI
</h1>
<p class="text-lg -mt-5 mb-10">
Install Write-behind CLI
</p>
<p>
The following installation instructions install the Write-behind CLI on a local workstation.
</p>
<p>
Write-behind installation is done via the Write-behind CLI. The CLI should have network access to the Redis Enterprise cluster API (port 9443 by default).
</p>
<h3 id="download-write-behind-cli">
Download Write-behind CLI
</h3>
<h4 id="ubuntu-2004">
Ubuntu 20.04
</h4>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">wget https://qa-onprem.s3.amazonaws.com/redis-di/latest/redis-di-ubuntu20.04-latest.tar.gz -O /tmp/redis-di.tar.gz
</span></span></code></pre>
</div>
<h4 id="ubuntu-1804">
Ubuntu 18.04
</h4>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">wget https://qa-onprem.s3.amazonaws.com/redis-di/latest/redis-di-ubuntu18.04-latest.tar.gz -O /tmp/redis-di.tar.gz
</span></span></code></pre>
</div>
<h4 id="rhel-8">
RHEL 8
</h4>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">wget https://qa-onprem.s3.amazonaws.com/redis-di/latest/redis-di-rhel8-latest.tar.gz -O /tmp/redis-di.tar.gz
</span></span></code></pre>
</div>
<h4 id="rhel-7">
RHEL 7
</h4>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">wget https://qa-onprem.s3.amazonaws.com/redis-di/latest/redis-di-rhel7-latest.tar.gz -O /tmp/redis-di.tar.gz
</span></span></code></pre>
</div>
<h2 id="install-write-behind-cli">
Install Write-behind CLI
</h2>
<p>
Unpack the downloaded
<code>
redis-di.tar.gz
</code>
into the
<code>
/usr/local/bin/
</code>
directory:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">sudo tar xvf /tmp/redis-di.tar.gz -C /usr/local/bin/
</span></span></code></pre>
</div>
<blockquote>
<p>
Note: Non-root users should unpack to a directory with write permission and run
<code>
redis-di
</code>
directly from it.
</p>
</blockquote>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/integrate/write-behind/installation/install-rdi-cli/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/7.4/references/rest-api/requests/users/password/.html | <section class="prose w-full py-12 max-w-none">
<h1>
User password requests
</h1>
<p class="text-lg -mt-5 mb-10">
User password requests
</p>
<table>
<thead>
<tr>
<th>
Method
</th>
<th>
Path
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="#update-password">
PUT
</a>
</td>
<td>
<code>
/v1/users/password
</code>
</td>
<td>
Change an existing password
</td>
</tr>
<tr>
<td>
<a href="#add-password">
POST
</a>
</td>
<td>
<code>
/v1/users/password
</code>
</td>
<td>
Add a new password
</td>
</tr>
<tr>
<td>
<a href="#delete-password">
DELETE
</a>
</td>
<td>
<code>
/v1/users/password
</code>
</td>
<td>
Delete a password
</td>
</tr>
</tbody>
</table>
<h2 id="update-password">
Update password
</h2>
<pre><code>PUT /v1/users/password
</code></pre>
<p>
Reset the password list of an internal user to include a new password.
</p>
<h3 id="put-request">
Request
</h3>
<h4 id="example-http-request">
Example HTTP request
</h4>
<pre><code>PUT /users/password
</code></pre>
<h4 id="example-json-body">
Example JSON body
</h4>
<div class="highlight">
<pre class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"username"</span><span class="p">:</span> <span class="s2">"johnsmith"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"old_password"</span><span class="p">:</span> <span class="s2">"a password that exists in the current list"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"new_password"</span><span class="p">:</span> <span class="s2">"the new (single) password"</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span></code></pre>
</div>
<h4 id="request-headers">
Request headers
</h4>
<table>
<thead>
<tr>
<th>
Key
</th>
<th>
Value
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
Host
</td>
<td>
cnm.cluster.fqdn
</td>
<td>
Domain name
</td>
</tr>
<tr>
<td>
Accept
</td>
<td>
application/json
</td>
<td>
Accepted media type
</td>
</tr>
</tbody>
</table>
<h4 id="request-body">
Request body
</h4>
<p>
The request must contain a single JSON object with the following fields:
</p>
<table>
<thead>
<tr>
<th>
Field
</th>
<th>
Type
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
username
</td>
<td>
string
</td>
<td>
Affected user (required)
</td>
</tr>
<tr>
<td>
old_password
</td>
<td>
string
</td>
<td>
A password that exists in the current list (required)
</td>
</tr>
<tr>
<td>
new_password
</td>
<td>
string
</td>
<td>
The new password (required)
</td>
</tr>
</tbody>
</table>
<h3 id="put-response">
Response
</h3>
<p>
Returns a status code to indicate password update success or failure.
</p>
<h3 id="put-error-codes">
Error codes
</h3>
<p>
When errors are reported, the server may return a JSON object with
<code>
error_code
</code>
and
<code>
message
</code>
fields that provide additional information.
The following are possible
<code>
error_code
</code>
values:
</p>
<table>
<thead>
<tr>
<th>
Code
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
password_not_complex
</td>
<td>
The given password is not complex enough (Only work when the password_complexity feature is enabled).
</td>
</tr>
<tr>
<td>
new_password_same_as_current
</td>
<td>
The given new password is identical to one of the already existing passwords.
</td>
</tr>
</tbody>
</table>
<h3 id="put-status-codes">
Status codes
</h3>
<table>
<thead>
<tr>
<th>
Code
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1">
200 OK
</a>
</td>
<td>
Success, password changed
</td>
</tr>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1">
400 Bad Request
</a>
</td>
<td>
Bad or missing parameters.
</td>
</tr>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2">
401 Unauthorized
</a>
</td>
<td>
The user is unauthorized.
</td>
</tr>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5">
404 Not Found
</a>
</td>
<td>
Attempting to reset password to a non-existing user.
</td>
</tr>
</tbody>
</table>
<h2 id="add-password">
Add password
</h2>
<pre><code>POST /v1/users/password
</code></pre>
<p>
Add a new password to an internal user's passwords list.
</p>
<h3 id="post-request">
Request
</h3>
<h4 id="example-http-request-1">
Example HTTP request
</h4>
<pre><code>POST /users/password
</code></pre>
<h4 id="example-json-body-1">
Example JSON body
</h4>
<div class="highlight">
<pre class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"username"</span><span class="p">:</span> <span class="s2">"johnsmith"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"old_password"</span><span class="p">:</span> <span class="s2">"an existing password"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"new_password"</span><span class="p">:</span> <span class="s2">"a password to add"</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span></code></pre>
</div>
<h4 id="request-headers-1">
Request headers
</h4>
<table>
<thead>
<tr>
<th>
Key
</th>
<th>
Value
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
Host
</td>
<td>
cnm.cluster.fqdn
</td>
<td>
Domain name
</td>
</tr>
<tr>
<td>
Accept
</td>
<td>
application/json
</td>
<td>
Accepted media type
</td>
</tr>
</tbody>
</table>
<h4 id="request-body-1">
Request body
</h4>
<p>
The request must contain a single JSON object with the following fields:
</p>
<table>
<thead>
<tr>
<th>
Field
</th>
<th>
Type
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
username
</td>
<td>
string
</td>
<td>
Affected user (required)
</td>
</tr>
<tr>
<td>
old_password
</td>
<td>
string
</td>
<td>
A password that exists in the current list (required)
</td>
</tr>
<tr>
<td>
new_password
</td>
<td>
string
</td>
<td>
The new (single) password (required)
</td>
</tr>
</tbody>
</table>
<h3 id="post-response">
Response
</h3>
<p>
Returns a status code to indicate password creation success or failure. If an error occurs, the response body may include a more specific error code and message.
</p>
<h3 id="post-error-codes">
Error codes
</h3>
<p>
When errors are reported, the server may return a JSON object with
<code>
error_code
</code>
and
<code>
message
</code>
fields that provide additional information.
The following are possible
<code>
error_code
</code>
values:
</p>
<table>
<thead>
<tr>
<th>
Code
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
password_not_complex
</td>
<td>
The given password is not complex enough (Only work when the password_complexity feature is enabled).
</td>
</tr>
<tr>
<td>
new_password_same_as_current
</td>
<td>
The given new password is identical to one of the already existing passwords.
</td>
</tr>
</tbody>
</table>
<h3 id="post-status-codes">
Status codes
</h3>
<table>
<thead>
<tr>
<th>
Code
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1">
200 OK
</a>
</td>
<td>
Success, new password was added to the list of valid passwords.
</td>
</tr>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1">
400 Bad Request
</a>
</td>
<td>
Bad or missing parameters.
</td>
</tr>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2">
401 Unauthorized
</a>
</td>
<td>
The user is unauthorized.
</td>
</tr>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5">
404 Not Found
</a>
</td>
<td>
Attempting to add a password to a non-existing user.
</td>
</tr>
</tbody>
</table>
<h2 id="delete-password">
Delete password
</h2>
<pre><code>DELETE /v1/users/password
</code></pre>
<p>
Delete a password from an internal user's passwords list.
</p>
<h3 id="delete-request">
Request
</h3>
<h4 id="example-http-request-2">
Example HTTP request
</h4>
<pre><code>DELETE /users/password
</code></pre>
<h4 id="example-json-body-2">
Example JSON body
</h4>
<div class="highlight">
<pre class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"username"</span><span class="p">:</span> <span class="s2">"johnsmith"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"old_password"</span><span class="p">:</span> <span class="s2">"an existing password"</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span></code></pre>
</div>
<h4 id="request-headers-2">
Request headers
</h4>
<table>
<thead>
<tr>
<th>
Key
</th>
<th>
Value
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
Host
</td>
<td>
cnm.cluster.fqdn
</td>
<td>
Domain name
</td>
</tr>
<tr>
<td>
Accept
</td>
<td>
application/json
</td>
<td>
Accepted media type
</td>
</tr>
</tbody>
</table>
<h4 id="request-body-2">
Request body
</h4>
<p>
The request must contain a single JSON with the following fields:
</p>
<table>
<thead>
<tr>
<th>
Field
</th>
<th>
Type
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
username
</td>
<td>
string
</td>
<td>
Affected user (required)
</td>
</tr>
<tr>
<td>
old_password
</td>
<td>
string
</td>
<td>
Existing password to be deleted (required)
</td>
</tr>
</tbody>
</table>
<h3 id="delete-response">
Response
</h3>
<h3 id="delete-error-codes">
Error codes
</h3>
<p>
When errors are reported, the server may return a JSON object with
<code>
error_code
</code>
and
<code>
message
</code>
fields that provide additional information.
The following are possible
<code>
error_code
</code>
values:
</p>
<table>
<thead>
<tr>
<th>
Code
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
cannot_delete_last_password
</td>
<td>
Cannot delete the last password of a user
</td>
</tr>
</tbody>
</table>
<h3 id="delete-status-codes">
Status codes
</h3>
<table>
<thead>
<tr>
<th>
Code
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1">
200 OK
</a>
</td>
<td>
Success, new password was deleted from the list of valid passwords.
</td>
</tr>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1">
400 Bad Request
</a>
</td>
<td>
Bad or missing parameters.
</td>
</tr>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2">
401 Unauthorized
</a>
</td>
<td>
The user is unauthorized.
</td>
</tr>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5">
404 Not Found
</a>
</td>
<td>
Attempting to delete a password to a non-existing user.
</td>
</tr>
</tbody>
</table>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/7.4/references/rest-api/requests/users/password/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/commands/xgroup-destroy/.html | <section class="prose w-full py-12">
<h1 class="command-name">
XGROUP DESTROY
</h1>
<div class="font-semibold text-redis-ink-900">
Syntax
</div>
<pre class="command-syntax">XGROUP DESTROY key group</pre>
<dl class="grid grid-cols-[auto,1fr] gap-2 mb-12">
<dt class="font-semibold text-redis-ink-900 m-0">
Available since:
</dt>
<dd class="m-0">
5.0.0
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
Time complexity:
</dt>
<dd class="m-0">
O(N) where N is the number of entries in the group's pending entries list (PEL).
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
ACL categories:
</dt>
<dd class="m-0">
<code>
@write
</code>
<span class="mr-1 last:hidden">
,
</span>
<code>
@stream
</code>
<span class="mr-1 last:hidden">
,
</span>
<code>
@slow
</code>
<span class="mr-1 last:hidden">
,
</span>
</dd>
</dl>
<p>
The
<code>
XGROUP DESTROY
</code>
command completely destroys a consumer group.
</p>
<p>
The consumer group will be destroyed even if there are active consumers, and pending messages, so make sure to call this command only when really needed.
</p>
<h2 id="resp2resp3-reply">
RESP2/RESP3 Reply
</h2>
<a href="../../develop/reference/protocol-spec#integers">
Integer reply
</a>
: the number of destroyed consumer groups, either 0 or 1.
<br/>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/commands/xgroup-destroy/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/kubernetes/re-clusters/multi-namespace/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Manage databases in multiple namespaces
</h1>
<p class="text-lg -mt-5 mb-10">
Redis Enterprise for Kubernetes allows you to deploy to multiple namespaces within your Kubernetes cluster. This article shows you how to configure your Redis Enterprise cluster to connect to databases in multiple namespaces
</p>
<p>
Multiple Redis Enterprise database resources (REDBs) can be associated with a single Redis Enterprise cluster resource (REC) even if they reside in different namespaces.
</p>
<p>
To learn more about designing a multi-namespace Redis Enterprise cluster, see
<a href="/docs/latest/operate/kubernetes/architecture/deployment-options/">
flexible deployment options
</a>
.
</p>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Warning:
</div>
Multi-namespace installations don't support Active-Active databases (REEADB). Only databases created with the REDB resource are supported in multi-namespace deployments at this time.
</div>
</div>
<h2 id="prerequisites">
Prerequisites
</h2>
<p>
Before configuring a multi-namespace deployment, you must have a running
<a href="/docs/latest/operate/kubernetes/deployment/quick-start/">
Redis Enterprise cluster (REC)
</a>
. See more information in the
<a href="/docs/latest/operate/kubernetes/deployment/">
deployment
</a>
section.
</p>
<h2 id="create-role-and-role-binding-for-managed-namespaces">
Create role and role binding for managed namespaces
</h2>
<p>
Both the operator and the RedisEnterpriseCluster (REC) resource need access to each namespace the REC will manage. For each
<strong>
managed
</strong>
namespace, create a
<code>
role.yaml
</code>
and
<code>
role_binding.yaml
</code>
file within the managed namespace, as shown in the examples below.
</p>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Note:
</div>
These will need to be reapplied each time you
<a href="/docs/latest/operate/kubernetes/upgrade/upgrade-redis-cluster/">
upgrade
</a>
.
</div>
</div>
<p>
Replace
<code>
<rec-namespace>
</code>
with the namespace the REC resides in.
Replace
<code>
<service-account-name>
</code>
with your own value (defaults to the REC name).
</p>
<p>
<code>
role.yaml
</code>
example:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-yaml" data-lang="yaml"><span class="line"><span class="cl"><span class="nt">kind</span><span class="p">:</span><span class="w"> </span><span class="l">Role</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">apiVersion</span><span class="p">:</span><span class="w"> </span><span class="l">rbac.authorization.k8s.io/v1</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">metadata</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l">redb-role</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">labels</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">app</span><span class="p">:</span><span class="w"> </span><span class="l">redis-enterprise</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">rules</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="nt">apiGroups</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="l">app.redislabs.com</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">resources</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="s2">"redisenterpriseclusters"</span><span class="p">,</span><span class="w"> </span><span class="s2">"redisenterpriseclusters/status"</span><span class="p">,</span><span class="w"> </span><span class="s2">"redisenterpriseclusters/finalizers"</span><span class="p">,</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="s2">"redisenterprisedatabases"</span><span class="p">,</span><span class="w"> </span><span class="s2">"redisenterprisedatabases/status"</span><span class="p">,</span><span class="w"> </span><span class="s2">"redisenterprisedatabases/finalizers"</span><span class="p">,</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="s2">"redisenterpriseremoteclusters"</span><span class="p">,</span><span class="w"> </span><span class="s2">"redisenterpriseremoteclusters/status"</span><span class="p">,</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="s2">"redisenterpriseremoteclusters/finalizers"</span><span class="p">,</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="s2">"redisenterpriseactiveactivedatabases"</span><span class="p">,</span><span class="w"> </span><span class="s2">"redisenterpriseactiveactivedatabases/status"</span><span class="p">,</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="s2">"redisenterpriseactiveactivedatabases/finalizers"</span><span class="p">]</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">verbs</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="s2">"delete"</span><span class="p">,</span><span class="w"> </span><span class="s2">"deletecollection"</span><span class="p">,</span><span class="w"> </span><span class="s2">"get"</span><span class="p">,</span><span class="w"> </span><span class="s2">"list"</span><span class="p">,</span><span class="w"> </span><span class="s2">"patch"</span><span class="p">,</span><span class="w"> </span><span class="s2">"create"</span><span class="p">,</span><span class="w"> </span><span class="s2">"update"</span><span class="p">,</span><span class="w"> </span><span class="s2">"watch"</span><span class="p">]</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="nt">apiGroups</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="s2">""</span><span class="p">]</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">resources</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="s2">"secrets"</span><span class="p">]</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">verbs</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="s2">"update"</span><span class="p">,</span><span class="w"> </span><span class="s2">"get"</span><span class="p">,</span><span class="w"> </span><span class="s2">"read"</span><span class="p">,</span><span class="w"> </span><span class="s2">"list"</span><span class="p">,</span><span class="w"> </span><span class="s2">"listallnamespaces"</span><span class="p">,</span><span class="w"> </span><span class="s2">"watch"</span><span class="p">,</span><span class="w"> </span><span class="s2">"watchlist"</span><span class="p">,</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="s2">"watchlistallnamespaces"</span><span class="p">,</span><span class="w"> </span><span class="s2">"create"</span><span class="p">,</span><span class="s2">"patch"</span><span class="p">,</span><span class="s2">"replace"</span><span class="p">,</span><span class="s2">"delete"</span><span class="p">,</span><span class="s2">"deletecollection"</span><span class="p">]</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="nt">apiGroups</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="s2">""</span><span class="p">]</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">resources</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="s2">"endpoints"</span><span class="p">]</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">verbs</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="s2">"get"</span><span class="p">,</span><span class="w"> </span><span class="s2">"list"</span><span class="p">,</span><span class="w"> </span><span class="s2">"watch"</span><span class="p">]</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="nt">apiGroups</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="s2">""</span><span class="p">]</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">resources</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="s2">"events"</span><span class="p">]</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">verbs</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="s2">"create"</span><span class="p">]</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="nt">apiGroups</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="s2">""</span><span class="p">]</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">resources</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="s2">"services"</span><span class="p">]</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">verbs</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="s2">"get"</span><span class="p">,</span><span class="w"> </span><span class="s2">"watch"</span><span class="p">,</span><span class="w"> </span><span class="s2">"list"</span><span class="p">,</span><span class="w"> </span><span class="s2">"update"</span><span class="p">,</span><span class="w"> </span><span class="s2">"patch"</span><span class="p">,</span><span class="w"> </span><span class="s2">"create"</span><span class="p">,</span><span class="w"> </span><span class="s2">"delete"</span><span class="p">]</span><span class="w">
</span></span></span></code></pre>
</div>
<p>
<code>
role_binding.yaml
</code>
example:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-yaml" data-lang="yaml"><span class="line"><span class="cl"><span class="nt">kind</span><span class="p">:</span><span class="w"> </span><span class="l">RoleBinding</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">apiVersion</span><span class="p">:</span><span class="w"> </span><span class="l">rbac.authorization.k8s.io/v1</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">metadata</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l">redb-role</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">labels</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">app</span><span class="p">:</span><span class="w"> </span><span class="l">redis-enterprise</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">subjects</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"></span>- <span class="nt">kind</span><span class="p">:</span><span class="w"> </span><span class="l">ServiceAccount</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l">redis-enterprise-operator</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">namespace</span><span class="p">:</span><span class="w"> </span><span class="l"><rec-namespace></span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"></span>- <span class="nt">kind</span><span class="p">:</span><span class="w"> </span><span class="l">ServiceAccount</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l"><service-account-name></span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">namespace</span><span class="p">:</span><span class="w"> </span><span class="l"><rec-namespace></span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">roleRef</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">kind</span><span class="p">:</span><span class="w"> </span><span class="l">Role</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l">redb-role</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">apiGroup</span><span class="p">:</span><span class="w"> </span><span class="l">rbac.authorization.k8s.io</span><span class="w">
</span></span></span></code></pre>
</div>
<p>
Apply the files, replacing
<code>
<managed-namespace>
</code>
with your own values:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">kubectl apply -f role.yaml -n <managed-namespace>
</span></span><span class="line"><span class="cl">kubectl apply -f role_binding.yaml -n <managed-namespace>
</span></span></code></pre>
</div>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Note:
</div>
If the REC is configured to watch a namespace without setting the role and role binding permissions, or a namespace that is not yet created, the operator will fail and halt normal operations.
</div>
</div>
<h2 id="update-redis-enterprise-operator-configmap">
Update Redis Enterprise operator ConfigMap
</h2>
<p>
There are two methods of updating the operator ConfigMap (
<code>
operator-environment-config
</code>
) to specify which namespaces to manage.
</p>
<ul>
<li>
Method 1: Configure the operator to watch for a namespace label and add this label to managed namespaces (available in versions 6.4.2-4 or later).
</li>
<li>
Method 2: Configure the operator with an explicit list of namespaces to manage.
</li>
</ul>
<p>
You can create this ConfigMap manually before deployment, or it will be created automatically after the operator was deployed.
</p>
<h3 id="method-1-namespace-label-available-in-versions-642-4-or-later">
Method 1: Namespace label (available in versions 6.4.2-4 or later)
</h3>
<ol>
<li>
Create the
<code>
cluster_role_binding.yaml
</code>
and
<code>
cluster_role.yaml
</code>
files. Replace the
<code>
<rec-namespace>
</code>
with the namespace the Redis Enterprise cluster (REC) resides in.
</li>
</ol>
<p>
<code>
operator_cluster_role.yaml
</code>
example:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-yaml" data-lang="yaml"><span class="line"><span class="cl"><span class="w"> </span><span class="nt">apiVersion</span><span class="p">:</span><span class="w"> </span><span class="l">rbac.authorization.k8s.io/v1</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">kind</span><span class="p">:</span><span class="w"> </span><span class="l">ClusterRole</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">metadata</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l">redis-enterprise-operator-consumer-ns</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">labels</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">app</span><span class="p">:</span><span class="w"> </span><span class="l">redis-enterprise</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">rules</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="nt">apiGroups</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="s2">""</span><span class="p">]</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">resources</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="s2">"namespaces"</span><span class="p">]</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">verbs</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="s2">"list"</span><span class="p">,</span><span class="w"> </span><span class="s2">"watch"</span><span class="p">]</span><span class="w">
</span></span></span></code></pre>
</div>
<p>
<code>
operator_cluster_role_binding.yaml
</code>
example:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-yaml" data-lang="yaml"><span class="line"><span class="cl"><span class="w"> </span><span class="nt">kind</span><span class="p">:</span><span class="w"> </span><span class="l">ClusterRoleBinding</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">apiVersion</span><span class="p">:</span><span class="w"> </span><span class="l">rbac.authorization.k8s.io/v1</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">metadata</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l">redis-enterprise-operator-consumer-ns</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">labels</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">app</span><span class="p">:</span><span class="w"> </span><span class="l">redis-enterprise</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">subjects</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="nt">kind</span><span class="p">:</span><span class="w"> </span><span class="l">ServiceAccount</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l">redis-enterprise-operator</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">namespace</span><span class="p">:</span><span class="w"> </span><span class="l"><rec-namespace></span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">roleRef</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">kind</span><span class="p">:</span><span class="w"> </span><span class="l">ClusterRole</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l">redis-enterprise-operator-consumer-ns</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">apiGroup</span><span class="p">:</span><span class="w"> </span><span class="l">rbac.authorization.k8s.io</span><span class="w">
</span></span></span></code></pre>
</div>
<ol start="2">
<li>
Apply the files.
</li>
</ol>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">kubectl apply -f operator_cluster_role.yaml
</span></span><span class="line"><span class="cl">kubectl apply -f operator_cluster_role_binding.yaml
</span></span></code></pre>
</div>
<ol start="3">
<li>
Patch the ConfigMap in the REC namespace (
<code>
<rec-namespace>
</code>
) to identify the managed namespaces with your label (
<code>
<label-name>
</code>
).
</li>
</ol>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl"> kubectl patch ConfigMap/operator-environment-config <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span>-n <rec-namespace> <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span>--type merge <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span>-p <span class="s1">'{"data": {"REDB_NAMESPACES_LABEL": "<label-name>"}}'</span>
</span></span></code></pre>
</div>
<ol start="4">
<li>
For each managed namespace, apply the same label. Replace
<code>
<managed-namespace>
</code>
with the namespace the REC will manage. Replace
<code>
<label-name>
</code>
with the value used in the previous step. If you specify a value for
<code>
<label-value>
</code>
, both the label name and value in managed namespaces must match to be detected by the operator. If the
<code>
<label-value>
</code>
is empty, only the label name needs to match on managed namespaces and the value is disregarded.
</li>
</ol>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">kubectl label namespace <managed-namespace> <label-name><span class="o">=</span><label-value>
</span></span></code></pre>
</div>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Note:
</div>
The operator restarts when it detects a namespace label was added or removed.
</div>
</div>
<h3 id="method-2-explicit-namespace-list">
Method 2: Explicit namespace list
</h3>
<p>
Patch the
<code>
operator-environment-config
</code>
in the REC namespace with a new environment variable (
<code>
REDB_NAMESPACES
</code>
).
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">kubectl patch ConfigMap/operator-environment-config <span class="se">\ </span>
</span></span><span class="line"><span class="cl">-n <rec-namespace> <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span>--type merge <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span>-p <span class="s1">'{"data":{"REDB_NAMESPACES": "<comma,separated,list,of,namespaces,to,watch"}}'</span>
</span></span></code></pre>
</div>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Warning:
</div>
Only configure the operator to watch a namespace after the namespace is created and configured with the role/role_binding as explained above. If configured to watch a namespace without setting those permissions or a namespace that is not created yet, the operator will fail and not perform normal operations.
</div>
</div>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/kubernetes/re-clusters/multi-namespace/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/integrate/confluent-with-redis-cloud/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Confluent with Redis Cloud
</h1>
<p class="text-lg -mt-5 mb-10">
Describes how to integrate Redis Cloud into Confluent Cloud.
</p>
<p>
You can send data from
<a href="https://confluent.cloud/">
Confluent Cloud
</a>
to your Redis Cloud database using the
<a href="https://docs.confluent.io/cloud/current/connectors/cc-redis-sink.html">
Redis Sink connector for Confluent Cloud
</a>
.
</p>
<h2 id="prerequisites">
Prerequisites
</h2>
<p>
Before you add the Redis Sink Confluent connector to your Confluent Cloud cluster:
</p>
<ol>
<li>
<p>
<a href="/docs/latest/operate/rc/databases/create-database/">
Create a database
</a>
in the same region as your Confluent Cloud cluster.
</p>
</li>
<li>
<p>
If you decide to
<a href="/docs/latest/operate/rc/security/database-security/tls-ssl/">
enable Transport Layer Security (TLS)
</a>
for your Redis database,
<a href="/docs/latest/operate/rc/security/database-security/tls-ssl/#download-certificates">
download the server certificate
</a>
from the Redis Cloud console and
<a href="#encode-server-certificate">
encode it
</a>
to be used with Confluent Cloud.
</p>
</li>
<li>
<p>
Ensure you meet the prerequisites in the
<a href="https://docs.confluent.io/cloud/current/connectors/cc-redis-sink.html#quick-start">
Redis Sink connector documentation
</a>
to set up your Redis Sink with Confluent Cloud.
</p>
</li>
</ol>
<h3 id="encode-server-certificate">
Encode server certificate
</h3>
<p>
If you decide to enable Transport Layer Security (TLS) for your database, you will need to encode the
<a href="/docs/latest/operate/rc/security/database-security/tls-ssl/#download-certificates">
server certificate
</a>
(
<code>
redis_ca.pem
</code>
) for use as the Confluent Cloud Truststore file. To do this:
</p>
<ol>
<li>
<p>
Use a base64 utility to encode
<code>
redis_ca.pem
</code>
into base64 in a new file. For example, using the
<a href="https://linux.die.net/man/1/base64">
<code>
base64
</code>
command-line utility
</a>
:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">$ base64 -i redis_ca.pem -o <truststore_file_name>
</span></span></code></pre>
</div>
</li>
<li>
<p>
Using a text editor, add the following text to the beginning of the truststore file:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">data:text/plain;base64
</span></span></code></pre>
</div>
</li>
<li>
<p>
Save and close the truststore file.
</p>
</li>
</ol>
<h2 id="connect-the-redis-sink-connector-to-redis-cloud">
Connect the Redis Sink connector to Redis Cloud
</h2>
<p>
To add the Redis Sink connector to your Confluent Cloud environment from the Redis Cloud console:
</p>
<ol>
<li>
<p>
From the
<a href="https://cloud.redis.io/">
Redis Cloud console
</a>
, select
<strong>
Account Settings
</strong>
and then select the
<strong>
Integrations
</strong>
tab.
</p>
</li>
<li>
<p>
Select the
<strong>
Configure
</strong>
button in the
<strong>
Confluent
</strong>
tile.
</p>
<a href="/docs/latest/images/rc/account-settings-integrations-confluent.png" sdata-lightbox="/images/rc/account-settings-integrations-confluent.png">
<img alt="The Confluent integration tile." src="/docs/latest/images/rc/account-settings-integrations-confluent.png"/>
</a>
</li>
<li>
<p>
This will take you to
<a href="https://confluent.cloud/go/new-sink-connector/RedisSink">
New Sink Connector
</a>
on Confluent Cloud. If you have more than one Confluent Cloud environment or Cluster, select your environment and cluster from the lists and select
<strong>
Continue
</strong>
.
</p>
<a href="/docs/latest/images/rc/confluent-create-connector.png" sdata-lightbox="/images/rc/confluent-create-connector.png">
<img alt="Select your environment and cluster from the Create a Connector selector." src="/docs/latest/images/rc/confluent-create-connector.png"/>
</a>
</li>
<li>
<p>
From there, follow the steps to
<a href="https://docs.confluent.io/cloud/current/connectors/cc-redis-sink.html#step-4-enter-the-connector-details">
Enter the connector details
</a>
on the Confluent documentation.
</p>
<p>
When you get to the
<strong>
Authentication
</strong>
step, fill in the fields with the following information:
</p>
<ul>
<li>
<strong>
Redis hostname
</strong>
: The Public endpoint of your database, without the port number. This can be found in the
<a href="https://cloud.redis.io/">
Redis Cloud console
</a>
from the database list or from the
<strong>
General
</strong>
section of the
<strong>
Configuration
</strong>
tab for the source database.
</li>
<li>
<strong>
Redis port number
</strong>
: The database's port. This is the number at the end of your database's Public endpoint.
</li>
<li>
<strong>
Redis database index
</strong>
: Set this to 0 for a Redis Cloud database.
</li>
<li>
<strong>
Redis server password
</strong>
: Enter the database password. If you have not set your own database user and password, use the
<a href="/docs/latest/operate/rc/security/access-control/data-access-control/default-user/">
default user password
</a>
, which appears in the
<strong>
Security
</strong>
section of the
<strong>
Configuration
</strong>
tab of the database details screen.
</li>
<li>
<strong>
SSL mode
</strong>
: Set depending on what type of
<a href="/docs/latest/operate/rc/security/database-security/tls-ssl/">
TLS authentication
</a>
is set for your database.
<ul>
<li>
If TLS authentication is turned off, select
<strong>
disabled
</strong>
.
</li>
<li>
If TLS authentication is turned on, select
<strong>
server
</strong>
.
</li>
</ul>
</li>
<li>
<strong>
Trustore file
</strong>
: If the
<strong>
SSL mode
</strong>
is set to
<strong>
server
</strong>
, upload the truststore file created when you
<a href="#encode-server-certificate">
encoded the server certificate
</a>
.
</li>
<li>
<strong>
Redis Server mode
</strong>
: If
<a href="/docs/latest/operate/rc/databases/configuration/clustering/#oss-cluster-api">
OSS Cluster API
</a>
is enabled, select
<strong>
Cluster
</strong>
. Otherwise, select
<strong>
Standalone
</strong>
.
</li>
</ul>
<p>
Select
<strong>
Continue
</strong>
once you have entered the database information. Enter the rest of the
<a href="https://docs.confluent.io/cloud/current/connectors/cc-redis-sink.html#step-4-enter-the-connector-details">
connector details
</a>
from the
<strong>
Configuration
</strong>
step.
</p>
</li>
<li>
<p>
<a href="/docs/latest/operate/rc/rc-quickstart/#connect-to-a-database">
Connect to your database
</a>
to verify that data is being stored.
</p>
</li>
</ol>
<nav>
</nav>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/integrate/confluent-with-redis-cloud/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/commands/cf.add/.html | <section class="prose w-full py-12">
<h1 class="command-name">
CF.ADD
</h1>
<div class="font-semibold text-redis-ink-900">
Syntax
</div>
<pre class="command-syntax">CF.ADD key item</pre>
<dl class="grid grid-cols-[auto,1fr] gap-2 mb-12">
<dt class="font-semibold text-redis-ink-900 m-0">
Available in:
</dt>
<dd class="m-0">
<a href="/docs/stack">
Redis Stack
</a>
/
<a href="/docs/data-types/probabilistic">
Bloom 1.0.0
</a>
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
Time complexity:
</dt>
<dd class="m-0">
O(k + i), where k is the number of sub-filters and i is maxIterations
</dd>
</dl>
<p>
Adds an item to the cuckoo filter.
</p>
<p>
Cuckoo filters can contain the same item multiple times, and consider each addition as separate.
Use
<a href="/docs/latest/commands/cf.addnx/">
<code>
CF.ADDNX
</code>
</a>
to add an item only if it does not exist.
</p>
<h2 id="required-arguments">
Required arguments
</h2>
<details open="">
<summary>
<code>
key
</code>
</summary>
<p>
is key name for a cuckoo filter to add the item to.
</p>
<p>
If
<code>
key
</code>
does not exist - a new cuckoo filter is created.
</p>
</details>
<details open="">
<summary>
<code>
item
</code>
</summary>
<p>
is an item to add.
</p>
</details>
<h2 id="return-value">
Return value
</h2>
<p>
Returns one of these replies:
</p>
<ul>
<li>
<a href="/docs/latest/develop/reference/protocol-spec/#integers">
Integer reply
</a>
- where "1" means that the item has been added successfully
</li>
<li>
[] on error (invalid arguments, wrong key type, etc.) and also when the filter is full
</li>
</ul>
<h2 id="complexity">
Complexity
</h2>
<p>
O(n + i), where n is the number of
<code>
sub-filters
</code>
and i is
<code>
maxIterations
</code>
.
Adding items requires up to 2 memory accesses per
<code>
sub-filter
</code>
.
But as the filter fills up, both locations for an item might be full.
The filter attempts to
<code>
Cuckoo
</code>
swap items up to
<code>
maxIterations
</code>
times.
</p>
<h2 id="examples">
Examples
</h2>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">redis> CF.ADD cf item1
</span></span><span class="line"><span class="cl"><span class="o">(</span>integer<span class="o">)</span> <span class="m">1</span>
</span></span><span class="line"><span class="cl">redis> CF.ADD cf item1
</span></span><span class="line"><span class="cl"><span class="o">(</span>integer<span class="o">)</span> <span class="m">1</span></span></span></code></pre>
</div>
<br/>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/commands/cf.add/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/security/encryption/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Encryption in Redis Enterprise Software
</h1>
<p class="text-lg -mt-5 mb-10">
Encryption in Redis Enterprise Software.
</p>
<p>
Redis Enterprise Software uses encryption to secure communications between clusters, nodes, databases, and clients and to protect
<a href="https://en.wikipedia.org/wiki/Data_in_transit">
data in transit
</a>
,
<a href="https://en.wikipedia.org/wiki/Data_at_rest">
at rest
</a>
, and
<a href="https://en.wikipedia.org/wiki/Data_in_use">
in use
</a>
.
</p>
<h2 id="encrypt-data-in-transit">
Encrypt data in transit
</h2>
<h3 id="tls">
TLS
</h3>
<p>
Redis Enterprise Software uses
<a href="/docs/latest/operate/rs/security/encryption/tls/">
Transport Layer Security (TLS)
</a>
to encrypt communications for the following:
</p>
<ul>
<li>
<p>
Cluster Manager UI
</p>
</li>
<li>
<p>
Command-line utilities
</p>
</li>
<li>
<p>
REST API
</p>
</li>
<li>
<p>
Internode communication
</p>
</li>
</ul>
<p>
You can also
<a href="/docs/latest/operate/rs/security/encryption/tls/enable-tls/">
enable TLS authentication
</a>
for the following:
</p>
<ul>
<li>
<p>
Communication from clients or applications to your database
</p>
</li>
<li>
<p>
Communication from your database to other clusters for replication using
<a href="/docs/latest/operate/rs/databases/import-export/replica-of/">
Replica Of
</a>
</p>
</li>
<li>
<p>
Communication to and from your database to other clusters for
<a href="/docs/latest/operate/rs/databases/active-active/">
Active-Active
</a>
synchronization
</p>
</li>
</ul>
<h3 id="internode-encryption">
Internode encryption
</h3>
<p>
<a href="/docs/latest/operate/rs/security/encryption/internode-encryption/">
Internode encryption
</a>
uses TLS to encrypt data in transit between cluster nodes.
</p>
<p>
By default, internode encryption is enabled for the control plane, which manages the cluster and databases. If you also want to encrypt replication and proxy communications between database shards on different nodes,
<a href="/docs/latest/operate/rs/security/encryption/internode-encryption/#enable-data-internode-encryption">
enable data internode encryption
</a>
.
</p>
<h3 id="require-https-for-rest-api-endpoints">
Require HTTPS for REST API endpoints
</h3>
<p>
By default, the Redis Enterprise Software API supports communication over HTTP and HTTPS. However, you can
<a href="/docs/latest/operate/rs/references/rest-api/encryption/">
turn off HTTP support
</a>
to ensure that API requests are encrypted.
</p>
<h2 id="encrypt-data-at-rest">
Encrypt data at rest
</h2>
<h3 id="file-system-encryption">
File system encryption
</h3>
<p>
To encrypt data stored on disk, use file system-based encryption capabilities available on Linux operating systems before you install Redis Enterprise Software.
</p>
<h3 id="private-key-encryption">
Private key encryption
</h3>
<p>
Enable PEM encryption to
<a href="/docs/latest/operate/rs/security/encryption/pem-encryption/">
encrypt all private keys
</a>
on disk.
</p>
<h2 id="encrypt-data-in-use">
Encrypt data in use
</h2>
<h3 id="client-side-encryption">
Client-side encryption
</h3>
<p>
Use client-side encryption to encrypt the data an application stores in a Redis database. The application decrypts the data when it retrieves it from the database.
</p>
<p>
You can add client-side encryption logic to your application or use built-in client functions.
</p>
<p>
Client-side encryption has the following limitations:
</p>
<ul>
<li>
<p>
Operations that must operate on the data, such as increments, comparisons, and searches will not function properly.
</p>
</li>
<li>
<p>
Increases management overhead.
</p>
</li>
<li>
<p>
Reduces performance.
</p>
</li>
</ul>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/security/encryption/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/commands/cf.scandump/.html | <section class="prose w-full py-12">
<h1 class="command-name">
CF.SCANDUMP
</h1>
<div class="font-semibold text-redis-ink-900">
Syntax
</div>
<pre class="command-syntax">CF.SCANDUMP key iterator</pre>
<dl class="grid grid-cols-[auto,1fr] gap-2 mb-12">
<dt class="font-semibold text-redis-ink-900 m-0">
Available in:
</dt>
<dd class="m-0">
<a href="/docs/stack">
Redis Stack
</a>
/
<a href="/docs/data-types/probabilistic">
Bloom 1.0.0
</a>
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
Time complexity:
</dt>
<dd class="m-0">
O(n), where n is the capacity
</dd>
</dl>
<p>
Begins an incremental save of the cuckoo filter.
</p>
<p>
This command is useful for large cuckoo filters that cannot fit into the
<a href="/docs/latest/commands/dump/">
<code>
DUMP
</code>
</a>
and
<a href="/docs/latest/commands/restore/">
<code>
RESTORE
</code>
</a>
model.
</p>
<p>
The first time this command is called, the value of
<code>
iter
</code>
should be 0.
</p>
<p>
This command returns successive
<code>
(iter, data)
</code>
pairs until
<code>
(0, NULL)
</code>
indicates completion.
</p>
<h2 id="required-arguments">
Required arguments
</h2>
<details open="">
<summary>
<code>
key
</code>
</summary>
<p>
is key name for a cuckoo filter to save.
</p>
</details>
<details open="">
<summary>
<code>
iterator
</code>
</summary>
<p>
Iterator value; either 0 or the iterator from a previous invocation of this command
</p>
</details>
<h2 id="return-value">
Return value
</h2>
<p>
Returns one of these replies:
</p>
<ul>
<li>
<p>
<a href="/docs/latest/develop/reference/protocol-spec/#arrays">
Array reply
</a>
of
<a href="/docs/latest/develop/reference/protocol-spec/#integers">
Integer reply
</a>
(
<em>
Iterator
</em>
) and [] (
<em>
Data
</em>
).
</p>
<p>
The Iterator is passed as input to the next invocation of
<code>
CF.SCANDUMP
</code>
. If
<em>
Iterator
</em>
is 0, then it means iteration has completed.
</p>
<p>
The iterator-data pair should also be passed to
<a href="/docs/latest/commands/cf.loadchunk/">
<code>
CF.LOADCHUNK
</code>
</a>
when restoring the filter.
</p>
</li>
<li>
<p>
[] on error (invalid arguments, key not found, wrong key type, etc.)
</p>
</li>
</ul>
<h2 id="examples">
Examples
</h2>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">redis> CF.RESERVE cf <span class="m">8</span>
</span></span><span class="line"><span class="cl">OK
</span></span><span class="line"><span class="cl">redis> CF.ADD cf item1
</span></span><span class="line"><span class="cl"><span class="o">(</span>integer<span class="o">)</span> <span class="m">1</span>
</span></span><span class="line"><span class="cl">redis> CF.SCANDUMP cf <span class="m">0</span>
</span></span><span class="line"><span class="cl">1<span class="o">)</span> <span class="o">(</span>integer<span class="o">)</span> <span class="m">1</span>
</span></span><span class="line"><span class="cl">2<span class="o">)</span> <span class="s2">"\x01\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x02\x00\x14\x00\x01\x008\x9a\xe0\xd8\xc3\x7f\x00\x00"</span>
</span></span><span class="line"><span class="cl">redis> CF.SCANDUMP cf <span class="m">1</span>
</span></span><span class="line"><span class="cl">1<span class="o">)</span> <span class="o">(</span>integer<span class="o">)</span> <span class="m">9</span>
</span></span><span class="line"><span class="cl">2<span class="o">)</span> <span class="s2">"\x00\x00\x00\x00\a\x00\x00\x00"</span>
</span></span><span class="line"><span class="cl">redis> CF.SCANDUMP cf <span class="m">9</span>
</span></span><span class="line"><span class="cl">1<span class="o">)</span> <span class="o">(</span>integer<span class="o">)</span> <span class="m">0</span>
</span></span><span class="line"><span class="cl">2<span class="o">)</span> <span class="o">(</span>nil<span class="o">)</span>
</span></span><span class="line"><span class="cl">redis> DEL bf
</span></span><span class="line"><span class="cl"><span class="o">(</span>integer<span class="o">)</span> <span class="m">1</span>
</span></span><span class="line"><span class="cl">redis> CF.LOADCHUNK cf <span class="m">1</span> <span class="s2">"\x01\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x02\x00\x14\x00\x01\x008\x9a\xe0\xd8\xc3\x7f\x00\x00"</span>
</span></span><span class="line"><span class="cl">OK
</span></span><span class="line"><span class="cl">redis> CF.LOADCHUNK cf <span class="m">9</span> <span class="s2">"\x00\x00\x00\x00\a\x00\x00\x00"</span>
</span></span><span class="line"><span class="cl">OK
</span></span><span class="line"><span class="cl">redis> CF.EXISTS cf item1
</span></span><span class="line"><span class="cl"><span class="o">(</span>integer<span class="o">)</span> <span class="m">1</span></span></span></code></pre>
</div>
<p>
Python code:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nv">chunks</span> <span class="o">=</span> <span class="o">[]</span>
</span></span><span class="line"><span class="cl"><span class="nv">iter</span> <span class="o">=</span> <span class="m">0</span>
</span></span><span class="line"><span class="cl"><span class="k">while</span> True:
</span></span><span class="line"><span class="cl"> iter, <span class="nv">data</span> <span class="o">=</span> CF.SCANDUMP<span class="o">(</span>key, iter<span class="o">)</span>
</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="nv">iter</span> <span class="o">==</span> 0:
</span></span><span class="line"><span class="cl"> <span class="nb">break</span>
</span></span><span class="line"><span class="cl"> <span class="k">else</span>:
</span></span><span class="line"><span class="cl"> chunks.append<span class="o">([</span>iter, data<span class="o">])</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># Load it back</span>
</span></span><span class="line"><span class="cl"><span class="k">for</span> chunk in chunks:
</span></span><span class="line"><span class="cl"> iter, <span class="nv">data</span> <span class="o">=</span> chunk
</span></span><span class="line"><span class="cl"> CF.LOADCHUNK<span class="o">(</span>key, iter, data<span class="o">)</span></span></span></code></pre>
</div>
<p>
</p>
<br/>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/commands/cf.scandump/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/references/cli-utilities/rladmin/cluster/join/.html | <section class="prose w-full py-12 max-w-none">
<h1>
rladmin cluster join
</h1>
<p class="text-lg -mt-5 mb-10">
Adds a node to an existing cluster.
</p>
<p>
Adds a node to an existing cluster.
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">rladmin cluster join
</span></span><span class="line"><span class="cl"> nodes <node IP address>
</span></span><span class="line"><span class="cl"> username <admin user email>
</span></span><span class="line"><span class="cl"> password <admin password>
</span></span><span class="line"><span class="cl"> <span class="o">[</span> ephemeral_path <path> <span class="o">]</span>
</span></span><span class="line"><span class="cl"> <span class="o">[</span> persistent_path <path> <span class="o">]</span>
</span></span><span class="line"><span class="cl"> <span class="o">[</span> ccs_persistent_path <path> <span class="o">]</span>
</span></span><span class="line"><span class="cl"> <span class="o">[</span> rack_id <node rack ID> <span class="o">]</span>
</span></span><span class="line"><span class="cl"> <span class="o">[</span> override_rack_id <span class="o">]</span>
</span></span><span class="line"><span class="cl"> <span class="o">[</span> replace_node <node UID> <span class="o">]</span>
</span></span><span class="line"><span class="cl"> <span class="o">[</span> flash_enabled <span class="o">]</span>
</span></span><span class="line"><span class="cl"> <span class="o">[</span> flash_path <path> <span class="o">]</span>
</span></span><span class="line"><span class="cl"> <span class="o">[</span> addr <IP.address> <span class="o">]</span>
</span></span><span class="line"><span class="cl"> <span class="o">[</span> external_addr <IP.address.1> <span class="o">[</span><IP.address.2> ... <IP.address.N><span class="o">]</span> <span class="o">]</span>
</span></span><span class="line"><span class="cl"> <span class="o">[</span> override_repair <span class="o">]</span>
</span></span><span class="line"><span class="cl"> <span class="o">[</span> accept_servers <span class="o">{</span> enabled <span class="p">|</span> disabled <span class="o">}</span> <span class="o">]</span>
</span></span><span class="line"><span class="cl"> <span class="o">[</span> cnm_http_port <port> <span class="o">]</span>
</span></span></code></pre>
</div>
<h3 id="parameters">
Parameters
</h3>
<table>
<thead>
<tr>
<th>
Parameter
</th>
<th>
Type/Value
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
accept_servers
</td>
<td>
'enabled'
<br/>
'disabled'
</td>
<td>
Allows allocation of resources on the new node when enabled (optional)
</td>
</tr>
<tr>
<td>
addr
</td>
<td>
IP address
</td>
<td>
Sets a node's internal IP address. If not provided, the node sets the address automatically. (optional)
</td>
</tr>
<tr>
<td>
ccs_persistent_path
</td>
<td>
filepath (default:Β /var/opt/redislabs/persist)
</td>
<td>
Path to the CCS snapshot location (the default is the same as persistent_path) (optional)
</td>
</tr>
<tr>
<td>
cnm_http_port
</td>
<td>
integer
</td>
<td>
Joins a cluster that has a non-default cnm_http_port (optional)
</td>
</tr>
<tr>
<td>
ephemeral_path
</td>
<td>
filepath
</td>
<td>
Path to the ephemeral storage location (optional)
</td>
</tr>
<tr>
<td>
external_addr
</td>
<td>
list of IP addresses
</td>
<td>
Sets a node's external IP addresses (space-delimited list). If not provided, the node sets the address automatically. (optional)
</td>
</tr>
<tr>
<td>
flash_enabled
</td>
<td>
</td>
<td>
Enables flash capabilities for a database (optional)
</td>
</tr>
<tr>
<td>
flash_path
</td>
<td>
filepath (default:Β /var/opt/redislabs/flash)
</td>
<td>
Path to the flash storage location in case the node does not support CAPI (required if flash_enabled)
</td>
</tr>
<tr>
<td>
nodes
</td>
<td>
IP address
</td>
<td>
Internal IP address of an existing node in the cluster
</td>
</tr>
<tr>
<td>
override_rack_id
</td>
<td>
</td>
<td>
Changes to a new rack, specified by
<code>
rack_id
</code>
(optional)
</td>
</tr>
<tr>
<td>
override_repair
</td>
<td>
</td>
<td>
Enables joining a cluster with a dead node (optional)
</td>
</tr>
<tr>
<td>
password
</td>
<td>
string
</td>
<td>
Admin user's password
</td>
</tr>
<tr>
<td>
persistent_path
</td>
<td>
filepath (default:Β /var/opt/redislabs/persist)
</td>
<td>
Path to the persistent storage location (optional)
</td>
</tr>
<tr>
<td>
rack_id
</td>
<td>
string
</td>
<td>
Moves the node to the specified rack (optional)
</td>
</tr>
<tr>
<td>
replace_node
</td>
<td>
integer
</td>
<td>
Replaces the specified node with the new node (optional)
</td>
</tr>
<tr>
<td>
username
</td>
<td>
email address
</td>
<td>
Admin user's email address
</td>
</tr>
</tbody>
</table>
<h3 id="returns">
Returns
</h3>
<p>
Returns
<code>
ok
</code>
if the node joined the cluster successfully. Otherwise, it returns an error message.
</p>
<h3 id="example">
Example
</h3>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">$ rladmin cluster join nodes 192.0.2.2 <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> username [email protected] <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> password admin-password
</span></span><span class="line"><span class="cl">Joining cluster... ok
</span></span></code></pre>
</div>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/references/cli-utilities/rladmin/cluster/join/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/commands/json.objkeys/.html | <section class="prose w-full py-12">
<h1 class="command-name">
JSON.OBJKEYS
</h1>
<div class="font-semibold text-redis-ink-900">
Syntax
</div>
<pre class="command-syntax">JSON.OBJKEYS key [path]</pre>
<dl class="grid grid-cols-[auto,1fr] gap-2 mb-12">
<dt class="font-semibold text-redis-ink-900 m-0">
Available in:
</dt>
<dd class="m-0">
<a href="/docs/stack">
Redis Stack
</a>
/
<a href="/docs/data-types/json">
JSON 1.0.0
</a>
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
Time complexity:
</dt>
<dd class="m-0">
O(N) when path is evaluated to a single value, where N is the number of keys in the object, O(N) when path is evaluated to multiple values, where N is the size of the key
</dd>
</dl>
<p>
Return the keys in the object that's referenced by
<code>
path
</code>
</p>
<p>
<a href="#examples">
Examples
</a>
</p>
<h2 id="required-arguments">
Required arguments
</h2>
<details open="">
<summary>
<code>
key
</code>
</summary>
<p>
is key to parse. Returns
<code>
null
</code>
for nonexistent keys.
</p>
</details>
<h2 id="optional-arguments">
Optional arguments
</h2>
<details open="">
<summary>
<code>
path
</code>
</summary>
<p>
is JSONPath to specify. Default is root
<code>
$
</code>
. Returns
<code>
null
</code>
for nonexistant path.
</p>
</details>
<h2 id="return">
Return
</h2>
<p>
JSON.OBJKEYS returns an array of array replies for each path, an array of the key names in the object as a bulk string reply, or
<code>
nil
</code>
if the matching JSON value is not an object.
For more information about replies, see
<a href="/docs/latest/develop/reference/protocol-spec/">
Redis serialization protocol specification
</a>
.
</p>
<h2 id="examples">
Examples
</h2>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">redis> JSON.SET doc $ <span class="s1">'{"a":[3], "nested": {"a": {"b":2, "c": 1}}}'</span>
</span></span><span class="line"><span class="cl">OK
</span></span><span class="line"><span class="cl">redis> JSON.OBJKEYS doc $..a
</span></span><span class="line"><span class="cl">1<span class="o">)</span> <span class="o">(</span>nil<span class="o">)</span>
</span></span><span class="line"><span class="cl">2<span class="o">)</span> 1<span class="o">)</span> <span class="s2">"b"</span>
</span></span><span class="line"><span class="cl"> 2<span class="o">)</span> <span class="s2">"c"</span></span></span></code></pre>
</div>
<h2 id="see-also">
See also
</h2>
<p>
<a href="/docs/latest/commands/json.arrindex/">
<code>
JSON.ARRINDEX
</code>
</a>
|
<a href="/docs/latest/commands/json.arrinsert/">
<code>
JSON.ARRINSERT
</code>
</a>
</p>
<h2 id="related-topics">
Related topics
</h2>
<ul>
<li>
<a href="/docs/latest/develop/data-types/json/">
RedisJSON
</a>
</li>
<li>
<a href="/docs/latest/develop/interact/search-and-query/indexing/">
Index and search JSON documents
</a>
</li>
</ul>
<br/>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/commands/json.objkeys/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rc/logs-reports/usage-reports/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Usage reports
</h1>
<p class="text-lg -mt-5 mb-10">
You can view usage reports to track the memory usage and shard usage of all your databases.
</p>
<p>
The
<strong>
Usage Report
</strong>
shows the daily memory usage and shard usage of all databases from the subscriptions associated with your account.
</p>
<a href="/docs/latest/images/rc/usage-report-memory-usage.png" sdata-lightbox="/images/rc/usage-report-memory-usage.png">
<img src="/docs/latest/images/rc/usage-report-memory-usage.png"/>
</a>
<p>
To filter the data, you can:
</p>
<ul>
<li>
Select a month and year from the
<strong>
View Statement For
</strong>
list to view the daily memory usage during a specific month.
</li>
<li>
Select a subscription from the
<strong>
Subscription
</strong>
list to view the daily memory usage of a specific subscription associated with your account.
</li>
<li>
Select a database from the
<strong>
Database
</strong>
list to view the daily memory usage of a specific database.
</li>
</ul>
<p>
You can also hold the pointer over each bar in the graph to view the precise memory usage on that day.
</p>
<h2 id="download-cost-report">
Download cost report
</h2>
<p>
Select the
<strong>
Cost report
</strong>
button to download a report of all shard costs in CSV format.
</p>
<a href="/docs/latest/images/rc/button-cost-report-download.png" sdata-lightbox="/images/rc/button-cost-report-download.png">
<img alt="The cost report download button." src="/docs/latest/images/rc/button-cost-report-download.png" width="150px"/>
</a>
<p>
The report gives a breakdown of all your Redis billing unit costs, per subscription and database, by month. Subscriptions under the minimum subscription price are broken down into actual billing unit prices and the difference from minimum price.
</p>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rc/logs-reports/usage-reports/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/commands/hexpire/.html | <section class="prose w-full py-12">
<h1 class="command-name">
HEXPIRE
</h1>
<div class="font-semibold text-redis-ink-900">
Syntax
</div>
<pre class="command-syntax">HEXPIRE key seconds [NX | XX | GT | LT] FIELDS numfields
field [field ...]</pre>
<dl class="grid grid-cols-[auto,1fr] gap-2 mb-12">
<dt class="font-semibold text-redis-ink-900 m-0">
Available since:
</dt>
<dd class="m-0">
7.4.0
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
Time complexity:
</dt>
<dd class="m-0">
O(N) where N is the number of arguments to the command
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
ACL categories:
</dt>
<dd class="m-0">
<code>
@write
</code>
<span class="mr-1 last:hidden">
,
</span>
<code>
@hash
</code>
<span class="mr-1 last:hidden">
,
</span>
<code>
@fast
</code>
<span class="mr-1 last:hidden">
,
</span>
</dd>
</dl>
<p>
Set an expiration (TTL or time to live) on one or more fields of a given hash key. You must specify at least one field.
Field(s) will automatically be deleted from the hash key when their TTLs expire.
</p>
<p>
Field expirations will only be cleared by commands that delete or overwrite the
contents of the hash fields, including
<a href="/docs/latest/commands/hdel/">
<code>
HDEL
</code>
</a>
and
<a href="/docs/latest/commands/hset/">
<code>
HSET
</code>
</a>
commands.
This means that all the operations that conceptually
<em>
alter
</em>
the value stored at a hash key's field without replacing it with a new one will leave the TTL untouched.
</p>
<p>
You can clear the TTL using the
<a href="/docs/latest/commands/hpersist/">
<code>
HPERSIST
</code>
</a>
command, which turns the hash field back into a persistent field.
</p>
<p>
Note that calling
<code>
HEXPIRE
</code>
/
<a href="/docs/latest/commands/hpexpire/">
<code>
HPEXPIRE
</code>
</a>
with a zero TTL or
<a href="/docs/latest/commands/hexpireat/">
<code>
HEXPIREAT
</code>
</a>
/
<a href="/docs/latest/commands/hpexpireat/">
<code>
HPEXPIREAT
</code>
</a>
with a time in the past will result in the hash field being deleted.
</p>
<h2 id="options">
Options
</h2>
<p>
The
<code>
HEXPIRE
</code>
command supports a set of options:
</p>
<ul>
<li>
<code>
NX
</code>
-- For each specified field, set expiration only when the field has no expiration.
</li>
<li>
<code>
XX
</code>
-- For each specified field, set expiration only when the field has an existing expiration.
</li>
<li>
<code>
GT
</code>
-- For each specified field, set expiration only when the new expiration is greater than current one.
</li>
<li>
<code>
LT
</code>
-- For each specified field, set expiration only when the new expiration is less than current one.
</li>
</ul>
<p>
A non-volatile field is treated as an infinite TTL for the purpose of
<code>
GT
</code>
and
<code>
LT
</code>
.
The
<code>
NX
</code>
,
<code>
XX
</code>
,
<code>
GT
</code>
, and
<code>
LT
</code>
options are mutually exclusive.
</p>
<h2 id="refreshing-expires">
Refreshing expires
</h2>
<p>
You can call
<code>
HEXPIRE
</code>
using as argument a field that already has an
existing TTL set.
In this case, the time to live is
<em>
updated
</em>
to the new value.
</p>
<h2 id="example">
Example
</h2>
<pre tabindex="0"><code>redis> HEXPIRE no-key 20 NX FIELDS 2 field1 field2
(nil)
redis> HSET mykey field1 "hello" field2 "world"
(integer 2)
redis> HEXPIRE mykey 10 FIELDS 3 field1 field2 field3
1) (integer) 1
2) (integer) 1
3) (integer) -2
redis> HGETALL mykey
(empty array)
</code></pre>
<h2 id="resp2resp3-reply">
RESP2/RESP3 Reply
</h2>
<p>
One of the following:
</p>
<ul>
<li>
<a href="../../develop/reference/protocol-spec#arrays">
Array reply
</a>
. For each field:
<ul>
<li>
<a href="../../develop/reference/protocol-spec#integers">
Integer reply
</a>
:
<code>
-2
</code>
if no such field exists in the provided hash key, or the provided key does not exist.
</li>
<li>
<a href="../../develop/reference/protocol-spec#integers">
Integer reply
</a>
:
<code>
0
</code>
if the specified NX | XX | GT | LT condition has not been met.
</li>
<li>
<a href="../../develop/reference/protocol-spec#integers">
Integer reply
</a>
:
<code>
1
</code>
if the expiration time was set/updated.
</li>
<li>
<a href="../../develop/reference/protocol-spec#integers">
Integer reply
</a>
:
<code>
2
</code>
when
<code>
HEXPIRE
</code>
/
<code>
HPEXPIRE
</code>
is called with 0 seconds/milliseconds or when
<code>
HEXPIREAT
</code>
/
<code>
HPEXPIREAT
</code>
is called with a past Unix time in seconds/milliseconds.
</li>
</ul>
</li>
<li>
<a href="../../develop/reference/protocol-spec#simple-errors">
Simple error reply
</a>
:
<ul>
<li>
if parsing failed, mandatory arguments are missing, unknown arguments are specified, or argument values are of the wrong type or out of range.
</li>
<li>
if the provided key exists but is not a hash.
</li>
</ul>
</li>
</ul>
<br/>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/commands/hexpire/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/oss_and_stack/stack-with-enterprise/deprecated-features/triggers-and-functions/configuration/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Configuration
</h1>
<p class="text-lg -mt-5 mb-10">
Configure the operation parameters
</p>
<div class="banner-article rounded-md">
<p>
The Redis Stack triggers and functions feature preview has ended and it will not be promoted to GA.
</p>
</div>
<p>
Redis Stack's triggers and functions feature provides configuration options to control its operation. These options can be set when the module is bootstrapped and, in some cases, at runtime.
</p>
<p>
The following sections describe the configuration options and how to set them.
</p>
<h2 id="bootstrap-configuration">
Bootstrap configuration
</h2>
<p>
You can set your configuration options when the module is loaded.
When the module is loaded at start time, the module configuration can be defined in the Redis configuration file. When loading the module at runtime the configuration can be given to the
<a href="/docs/latest/commands/module-loadex/">
<code>
MODULE LOADEX
</code>
</a>
command. Each configuration must be prefixed with the module name,
<code>
redisgears_2.<configuration name>
</code>
.
</p>
<h2 id="runtime-configuration">
Runtime configuration
</h2>
<p>
You may set certain configuration options at runtime. Setting a configuration at runtime is done using
<a href="/docs/latest/commands/config-set/">
<code>
CONFIG SET
</code>
</a>
command. Here each configuration must be prefixed with the module name,
<code>
redisgears_2.<configuration name>
</code>
.
</p>
<p>
Example:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">> config <span class="nb">set</span> redisgears_2.lock-redis-timeout <span class="m">1000</span>
</span></span><span class="line"><span class="cl">OK
</span></span></code></pre>
</div>
<h2 id="configurations">
Configurations
</h2>
<h3 id="execution-threads">
execution-threads
</h3>
<p>
The
<code>
execution-threads
</code>
configuration option controls the number of background threads that run JS code.
<strong>
Note that libraries are considered single threaded
</strong>
. This configuration allows Redis to parallelize the invocation of multiple libraries.
</p>
<p>
<em>
Expected Value
</em>
</p>
<p>
Integer
</p>
<p>
<em>
Default
</em>
</p>
<p>
1
</p>
<p>
<em>
Minimum Value
</em>
</p>
<p>
1
</p>
<p>
<em>
Maximum Value
</em>
</p>
<p>
32
</p>
<p>
<em>
Runtime Configurability
</em>
</p>
<p>
No
</p>
<h3 id="library-fatal-failure-policy">
library-fatal-failure-policy
</h3>
<p>
The
<code>
library-fatal-failure-policy
</code>
configuration option controls how to handle a fatal error. A fatal error is consider one of the following:
</p>
<ul>
<li>
Block timeout - The function blocks the Redis processes for too long (configurable using the
<a href="#lock-redis-timeout">
lock-redis-timeout
</a>
configuration value)
</li>
<li>
OOM - The function consumes too much memory (configurable using the
<a href="#v8-maxmemory">
v8-maxmemory
</a>
configuration value).
</li>
</ul>
<p>
This configuration basically allows choosing between two options:
</p>
<ul>
<li>
Do not break atomicity property, even at the cost of killing the Redis processes.
</li>
<li>
Keep my Redis processes alive, even at the cost of losing atomicity.
</li>
</ul>
<p>
<em>
Expected Value
</em>
</p>
<ul>
<li>
kill - Save the atomicity property. Risk of killing the Redis processes.
</li>
<li>
abort - Abort the invocation of the function and keep the Redis processes alive. Risk of losing the atomicity property.
</li>
</ul>
<p>
<em>
Default
</em>
</p>
<p>
abort
</p>
<p>
<em>
Runtime Configurability
</em>
</p>
<p>
Yes
</p>
<h3 id="v8-maxmemory">
v8-maxmemory
</h3>
<p>
The
<code>
v8-maxmemory
</code>
configuration option controls the maximum amount of memory used by all V8 libraries. Exceeding this limit is considered a fatal error and will be handled base on the
<a href="#library-fatal-failure-policy">
library-fatal-failure-policy
</a>
configuration value.
</p>
<p>
<em>
Expected Value
</em>
</p>
<p>
Integer
</p>
<p>
<em>
Default
</em>
</p>
<p>
200M
</p>
<p>
<em>
Minimum Value
</em>
</p>
<p>
50M
</p>
<p>
<em>
Maximum Value
</em>
</p>
<p>
1G
</p>
<p>
<em>
Runtime Configurability
</em>
</p>
<p>
No
</p>
<h3 id="v8-library-initial-memory-usage">
v8-library-initial-memory-usage
</h3>
<p>
The
<code>
v8-library-initial-memory-usage
</code>
configuration option controls the initial memory given to a single V8 library. This value can not be greater then
<a href="#v8-library-initial-memory-limit">
<code>
v8-library-initial-memory-limit
</code>
</a>
or
<a href="#v8-maxmemory">
v8-maxmemory
</a>
.
</p>
<p>
<em>
Expected Value
</em>
</p>
<p>
Integer
</p>
<p>
<em>
Default
</em>
</p>
<p>
2M
</p>
<p>
<em>
Minimum Value
</em>
</p>
<p>
1M
</p>
<p>
<em>
Maximum Value
</em>
</p>
<p>
10M
</p>
<p>
<em>
Runtime Configurability
</em>
</p>
<p>
No
</p>
<h3 id="v8-library-initial-memory-limit">
v8-library-initial-memory-limit
</h3>
<p>
The
<code>
v8-library-initial-memory-limit
</code>
configuration option controls the initial memory limit on a single V8 library. This value can not be greater then
<a href="#v8-maxmemory">
v8-maxmemory
</a>
.
</p>
<p>
<em>
Expected Value
</em>
</p>
<p>
Integer
</p>
<p>
<em>
Default
</em>
</p>
<p>
3M
</p>
<p>
<em>
Minimum Value
</em>
</p>
<p>
2M
</p>
<p>
<em>
Maximum Value
</em>
</p>
<p>
20M
</p>
<p>
<em>
Runtime Configurability
</em>
</p>
<p>
No
</p>
<h3 id="v8-library-memory-usage-delta">
v8-library-memory-usage-delta
</h3>
<p>
The
<code>
v8-library-memory-usage-delta
</code>
configuration option controls the delta by which we will increase the V8 library memory limit once the limit reached. This value can not be greater then
<a href="#v8-maxmemory">
v8-maxmemory
</a>
.
</p>
<p>
<em>
Expected Value
</em>
</p>
<p>
Integer
</p>
<p>
<em>
Default
</em>
</p>
<p>
1M
</p>
<p>
<em>
Minimum Value
</em>
</p>
<p>
1M
</p>
<p>
<em>
Maximum Value
</em>
</p>
<p>
10M
</p>
<p>
<em>
Runtime Configurability
</em>
</p>
<p>
No
</p>
<h3 id="lock-redis-timeout">
lock-redis-timeout
</h3>
<p>
The
<code>
lock-redis-timeout
</code>
configuration option controls the maximum amount of time (in MS) a library can lock Redis. Exceeding this limit is considered a fatal error and will be handled based on the
<a href="#library-fatal-failure-policy">
library-fatal-failure-policy
</a>
configuration value. This
configuration only affects library loading at runtime with
<code>
TFUNCTION LOAD
</code>
.
The timeout for loading a library from RDB is set separately via
<a href="#db-loading-lock-redis-timeout">
db-loading-lock-redis-timeout
</a>
.
</p>
<p>
<em>
Expected Value
</em>
</p>
<p>
Integer
</p>
<p>
<em>
Default
</em>
</p>
<p>
500 MS
</p>
<p>
<em>
Minimum Value
</em>
</p>
<p>
100 MS
</p>
<p>
<em>
Maximum Value
</em>
</p>
<p>
Unlimited
</p>
<p>
<em>
Runtime Configurability
</em>
</p>
<p>
Yes
</p>
<h4 id="side-effects">
Side effects
</h4>
<p>
When setting
<code>
lock-redis-timeout
</code>
, if the new value is higher than the
<code>
db-loading-lock-redis-timeout
</code>
, the
<code>
db-loading-lock-redis-timeout
</code>
is also updated to
this value.
</p>
<h3 id="db-loading-lock-redis-timeout">
db-loading-lock-redis-timeout
</h3>
<p>
This timeout configuration is used for setting the upper time limit
(in milliseconds) for the library loading from RDB.
</p>
<p>
<em>
Expected Value
</em>
</p>
<p>
Integer
</p>
<p>
<em>
Default
</em>
</p>
<p>
30000 MS
</p>
<p>
<em>
Minimum Value
</em>
</p>
<p>
100 MS
</p>
<p>
<em>
Maximum Value
</em>
</p>
<p>
Unlimited
</p>
<p>
<em>
Runtime Configurability
</em>
</p>
<p>
Yes
</p>
<h4 id="notes">
Notes
</h4>
<p>
The value cannot be lower than the value of
<code>
lock-redis-timeout
</code>
.
</p>
<h3 id="remote-task-default-timeout">
remote-task-default-timeout
</h3>
<p>
The
<code>
remote-task-default-timeout
</code>
configuration option controls the timeout when waiting for a remote task to finish. If the timeout is reached an error will result.
</p>
<p>
<em>
Expected Value
</em>
</p>
<p>
Integer
</p>
<p>
<em>
Default
</em>
</p>
<p>
500 MS
</p>
<p>
<em>
Minimum Value
</em>
</p>
<p>
1 MS
</p>
<p>
<em>
Maximum Value
</em>
</p>
<p>
Unlimited
</p>
<p>
<em>
Runtime Configurability
</em>
</p>
<p>
Yes
</p>
<h3 id="error-verbosity">
error-verbosity
</h3>
<p>
The
<code>
error-verbosity
</code>
configuration option controls the verbosity of error messages that will be provided by triggers and functions. The higher the value the more verbose the error messages will be (for example, including stack traces and extra information for better analysis and debugging).
</p>
<p>
<em>
Expected Value
</em>
</p>
<p>
Integer
</p>
<p>
<em>
Default
</em>
</p>
<p>
1
</p>
<p>
<em>
Minimum Value
</em>
</p>
<p>
1
</p>
<p>
<em>
Maximum Value
</em>
</p>
<p>
2
</p>
<p>
<em>
Runtime Configurability
</em>
</p>
<p>
Yes
</p>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/oss_and_stack/stack-with-enterprise/deprecated-features/triggers-and-functions/configuration/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/release-notes/legacy-release-notes/rs-5-4-10-december-2019/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Redis Enterprise Software Release Notes 5.4.10 (December 2019)
</h1>
<p>
<a href="https://redislabs.com/redis-enterprise/software/downloads/#downloads">
Redis Enterprise Software (RS) 5.4.10
</a>
is now available.
This release includes an improved synchronization mechanism for Active-Active Redis and Replica-of, several enhancements, and bug fixes.
</p>
<h2 id="overview">
Overview
</h2>
<p>
Follow these
<a href="/docs/latest/operate/rs/installing-upgrading/upgrading/">
instructions
</a>
for upgrading to RS 5.4.10 from RS 5.0 and above.
</p>
<h2 id="new-features">
New features
</h2>
<h3 id="synchronization-mechanism-in-active-active-redis-and-replica-of">
Synchronization mechanism in Active-Active Redis and Replica-of
</h3>
<p>
RS 5.4.10 incorporates the improved
<a href="/docs/latest/operate/rs/databases/active-active/#syncer-process">
Redis synchronization mechanism
</a>
(
<a href="/docs/latest/operate/oss_and_stack/management/replication/">
PSYNC2
</a>
) for Active-Active Redis (CRDB) and Replica-of.
</p>
<p>
As a result, failure scenarios in any A-A replica (and the source database of Replica-of), require only partial synchronization between the cross-region replicas instead of full synchronization that can be costly in time and bandwidth.
</p>
<h3 id="rs-on-rhel-7-supports-openssl-102-and-up">
RS on RHEL 7 supports OpenSSL 1.0.2 and up
</h3>
<p>
To keep RS secure and keep our internal libraries up-to-date, starting from RS 5.4.10 our RHEL 7 installations require a minimum of OpenSSL 1.0.2.
</p>
<p>
When you install or upgrade RS 5.4.10 on RHEL 7 with older version of OpenSLL, the installation fails with the error:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">Error: Package: redislabs-5.4.10-1.rhel7.x86_64 <span class="o">(</span>/redislabs-5.4.10-1.rhel7.x86_64<span class="o">)</span>
</span></span><span class="line"><span class="cl"> Requires: libcrypto.so.10<span class="o">(</span>OPENSSL_1.0.2<span class="o">)(</span>64bit<span class="o">)</span>
</span></span></code></pre>
</div>
<p>
If you see this error, upgrade to OpenSSL 1.0.2 or higher before you install RS.
</p>
<h2 id="additional-capabilities">
Additional capabilities
</h2>
<ul>
<li>
<p>
The following new GA releases of Redis Modules are bundled in RS 5.4.10:
</p>
<ul>
<li>
RedisBloom, version 2.0.3
</li>
<li>
RedisSearch, version 1.4.18
</li>
<li>
RedisJson, version 1.0.4
</li>
<li>
RedisGraph, version 1.2.2
</li>
<li>
RedisTimeSeries, version 1.0.3
</li>
</ul>
</li>
<li>
<p>
Version 5.0.5 of Redis OSS, along with a fix to a corruption related to the HyperLogLog (that is part of
<a href="https://raw.githubusercontent.com/antirez/redis/5.0/00-RELEASENOTES">
Redis 5.0.6
</a>
) are merged into RS 5.4.10.
</p>
</li>
<li>
<p>
Using REST API, you can retrieve various license details such as activation date, expiration date,and the number of licensed shards. To get these details, run:
</p>
<p>
<code>
curl -v -u <user>:<password> https://localhost:9443/v1/license
</code>
</p>
</li>
<li>
<p>
Updated PDNS version from 4.1.5 to 4.1.13.
</p>
</li>
</ul>
<h2 id="information">
Information
</h2>
<ul>
<li>
End of Life (EOL) for Redis Enterprise Software 5.4, as well as for Redis Modules and previous RS versions, can be found
<a href="https://docs.redis.com/latest/rs/installing-upgrading/product-lifecycle">
here
</a>
.
</li>
<li>
Google Chrome browser on macOS Catalina requires self-signed certificate generated after June 2019 to include the extendedKeyUsage field in order to connect to the RS admin console.
If you use a self-signed certificate that does not include this field,
<a href="/docs/latest/operate/rs/security/certificates/updating-certificates/">
update the self-signed certificate
</a>
.
</li>
<li>
When you upgrade an Active-Active Redis with active AOF from version RS 5.4.2 or lower to version RS 5.4.4 or higher:
<ul>
<li>
If replication is enabled, you must run the BGREWRITEAOF command on all replica shards after the upgrade.
</li>
<li>
If replication is not enabled, you must run the BGREWRITEAOF command on all shards after the upgrade.
</li>
</ul>
</li>
</ul>
<h2 id="important-fixes">
Important fixes
</h2>
<ul>
<li>
The titles of the βrladmin status nodesβ command output were updated from βRAMβ to βFREE_RAMβ (the amount of RAM in the node that is currently not used) and from βAVAILABLE_RAMβ to βPROVISIONAL_RAMβ (the amount of RAM in the node that can be provisioned).
</li>
<li>
RS31492 - Upgraded dependent libraries:
<a href="https://github.com/redislabsdev/Redis-Enterprise/pull/4209/commits/3b5a408696b91a0b545f670ce35bb920d5a4beb4">
python-cryptography to version 2.7
</a>
;
<a href="https://github.com/redislabsdev/Redis-Enterprise/pull/4209/commits/4ab171d4467bd91c6b38cec81da3c52a6113a787">
NGINX to version 1.16.0
</a>
;
<a href="https://github.com/redislabsdev/Redis-Enterprise/pull/4209/commits/11e814ae0d14c85b248bc7451edbbbcb71f3858f">
PyYaml to version 5.1.2
</a>
;
<a href="https://github.com/redislabsdev/Redis-Enterprise/pull/4209/commits/0e2ab74b4e2b2dc9872a86fbdb5593f5354eb103">
python-requests to version 2.22.0
</a>
;
<a href="https://github.com/redislabsdev/Redis-Enterprise/pull/4209/commits/038e44163d7dc1fed4e3b67cb252a84583c2f44a">
urllib3 to version 1.25.3
</a>
</li>
<li>
RS31187 - Upgraded the internal Python interpreter to version 2.7.16
</li>
<li>
RS33042 - Fixed Support Package to contain complete SLOWLOG information
</li>
<li>
RS32699 - Avoided unnecessary restart and failover of Redis processes when Active-Active database is upgraded
</li>
<li>
RS32061 - Improved support of the Redis WAIT command
</li>
<li>
RS31759 - Fixed failure during database import
</li>
<li>
RS31747 - Fixed failure in upgrade from version 5.0.0-31 to 5.4.6-11
</li>
<li>
RS30063 - Fixed the upgrade process when WatchdogAPI fails to bind to its port
</li>
<li>
RS31477 - Fixed wrong calculation of nodeβs βAVAILABLE_RAMβ (βPROVISIONAL_RAMβ) as displayed the output of βrladmin status nodesβ command
</li>
<li>
RS30165 - Fixed failover scenario that did not take place during node restart
</li>
<li>
RS29250 - REST API documentation was updated to include the SFTP and Mount Point backup/export options
</li>
<li>
RS27327 - Improved the backup timing when using the database parameter of βbackup_interval_offsetβ through the REST API
</li>
<li>
RS33883 - HCSAN command in Active-Active Redis updated to return Integer instead of a String.
</li>
<li>
Fixed a limitation so Redis 5 and Redis 4 can be selected as the Redis version to use CRDB and RoF
</li>
</ul>
<h2 id="known-limitations">
Known limitations
</h2>
<h3 id="upgrade">
Upgrade
</h3>
<ul>
<li>
<a href="/docs/latest/operate/rs/release-notes/legacy-release-notes/rs-5-4-2-april-2019/">
RS 5.4.2
</a>
introduced new Active-Active Redis (CRDB) capabilities
that improve its compatibility with open source Redis.
Now the string data-type in Active-Active Redis (CRDB) is implicitly and dynamically typed, just like open source Redis.
To use the new capabilities on nodes that are upgraded from version RS 5.4.2 or lower,
you must
<a href="/docs/latest/operate/rs/installing-upgrading/upgrading/#upgrading-crdbs">
upgrade the CRDB protocol
</a>
.
</li>
<li>
Before you upgrade a database with RediSearch Module to Redis 5.0,
you must
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/install/upgrade-module/">
upgrade the RediSearch Module
</a>
to version 1.4.2 or above.
</li>
<li>
Node upgrade fails if the SSL certificates were configured in version 5.0.2 or above
by manually updating the certificates on the disk instead of
<a href="/docs/latest/operate/rs/security/certificates/updating-certificates/">
updating them through the API
</a>
.
For assistance with this issue,
<a href="https://redislabs.com/company/support/">
contact Redis support
</a>
.
</li>
<li>
We recommend that you test module upgrade commands in a test environment before you upgrade modules in a production environment.
The module upgrade arguments are not validated during the upgrade process and incorrect arguments can cause unexpected downtime.
</li>
<li>
Starting from RS 5.4.2, to preserve the current Redis major.minor version during database upgrade you must use the
<code>
keep_redis_version
</code>
option instead of
<code>
keep_current_version
</code>
.
</li>
</ul>
<h3 id="cluster-api">
Cluster API
</h3>
<ul>
<li>
<p>
The API for removing a node is updated in RS 5.4.2 or higher. The API call must include json data and the "Content-Type: application/json" header. For example:
</p>
<p>
<code>
curl -X POST -H "Content-Type: application/json" -i -k -u [email protected]:password https://localhost:9443/v1/nodes/3/actions/remove --data "{}"
</code>
</p>
</li>
</ul>
<h3 id="discovery-service">
Discovery service
</h3>
<ul>
<li>
For
<a href="/docs/latest/operate/rs/databases/durability-ha/discovery-service/">
Redis Sentinel (Discovery Service)
</a>
, every database name must be unique across the cluster.
</li>
</ul>
<h3 id="redis-commands">
Redis commands
</h3>
<ul>
<li>
The capability of disabling specific Redis commands does not work on commands specific to Redis Modules.
</li>
<li>
The CLIENT ID command cannot guarantee incremental IDs between clients that connect to different nodes under multi proxy policies.
</li>
<li>
CLIENT UNBLOCK command is not supported in RS 5.4 and above
</li>
<li>
Starting from RS 5.4.2 and after upgrading the CRDB, TYPE command for string data-type in CRDBs return "string" (OSS Redis standard).
</li>
</ul>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/release-notes/legacy-release-notes/rs-5-4-10-december-2019/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/commands/zmpop/.html | <section class="prose w-full py-12">
<h1 class="command-name">
ZMPOP
</h1>
<div class="font-semibold text-redis-ink-900">
Syntax
</div>
<pre class="command-syntax">ZMPOP numkeys key [key ...] <MIN | MAX> [COUNTΒ count]</pre>
<dl class="grid grid-cols-[auto,1fr] gap-2 mb-12">
<dt class="font-semibold text-redis-ink-900 m-0">
Available since:
</dt>
<dd class="m-0">
7.0.0
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
Time complexity:
</dt>
<dd class="m-0">
O(K) + O(M*log(N)) where K is the number of provided keys, N being the number of elements in the sorted set, and M being the number of elements popped.
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
ACL categories:
</dt>
<dd class="m-0">
<code>
@write
</code>
<span class="mr-1 last:hidden">
,
</span>
<code>
@sortedset
</code>
<span class="mr-1 last:hidden">
,
</span>
<code>
@slow
</code>
<span class="mr-1 last:hidden">
,
</span>
</dd>
</dl>
<p>
Pops one or more elements, that are member-score pairs, from the first non-empty sorted set in the provided list of key names.
</p>
<p>
<code>
ZMPOP
</code>
and
<a href="/docs/latest/commands/bzmpop/">
<code>
BZMPOP
</code>
</a>
are similar to the following, more limited, commands:
</p>
<ul>
<li>
<a href="/docs/latest/commands/zpopmin/">
<code>
ZPOPMIN
</code>
</a>
or
<a href="/docs/latest/commands/zpopmax/">
<code>
ZPOPMAX
</code>
</a>
which take only one key, and can return multiple elements.
</li>
<li>
<a href="/docs/latest/commands/bzpopmin/">
<code>
BZPOPMIN
</code>
</a>
or
<a href="/docs/latest/commands/bzpopmax/">
<code>
BZPOPMAX
</code>
</a>
which take multiple keys, but return only one element from just one key.
</li>
</ul>
<p>
See
<a href="/docs/latest/commands/bzmpop/">
<code>
BZMPOP
</code>
</a>
for the blocking variant of this command.
</p>
<p>
When the
<code>
MIN
</code>
modifier is used, the elements popped are those with the lowest scores from the first non-empty sorted set. The
<code>
MAX
</code>
modifier causes elements with the highest scores to be popped.
The optional
<code>
COUNT
</code>
can be used to specify the number of elements to pop, and is set to 1 by default.
</p>
<p>
The number of popped elements is the minimum from the sorted set's cardinality and
<code>
COUNT
</code>
's value.
</p>
<h2 id="examples">
Examples
</h2>
<div class="bg-slate-900 border-b border-slate-700 rounded-t-xl px-4 py-3 w-full flex">
<svg class="shrink-0 h-[1.0625rem] w-[1.0625rem] fill-slate-50" fill="currentColor" viewbox="0 0 20 20">
<path d="M2.5 10C2.5 5.85786 5.85786 2.5 10 2.5C14.1421 2.5 17.5 5.85786 17.5 10C17.5 14.1421 14.1421 17.5 10 17.5C5.85786 17.5 2.5 14.1421 2.5 10Z">
</path>
</svg>
<svg class="shrink-0 h-[1.0625rem] w-[1.0625rem] fill-slate-50" fill="currentColor" viewbox="0 0 20 20">
<path d="M10 2.5L18.6603 17.5L1.33975 17.5L10 2.5Z">
</path>
</svg>
<svg class="shrink-0 h-[1.0625rem] w-[1.0625rem] fill-slate-50" fill="currentColor" viewbox="0 0 20 20">
<path d="M10 2.5L12.0776 7.9322L17.886 8.22949L13.3617 11.8841L14.8738 17.5L10 14.3264L5.1262 17.5L6.63834 11.8841L2.11403 8.22949L7.92238 7.9322L10 2.5Z">
</path>
</svg>
</div>
<form class="redis-cli overflow-y-auto max-h-80">
<pre tabindex="0">redis> ZMPOP 1 notsuchkey MIN
(nil)
redis> ZADD myzset 1 "one" 2 "two" 3 "three"
(integer) 3
redis> ZMPOP 1 myzset MIN
1) "myzset"
2) 1) 1) "one"
2) "1"
redis> ZRANGE myzset 0 -1 WITHSCORES
1) "two"
2) "2"
3) "three"
4) "3"
redis> ZMPOP 1 myzset MAX COUNT 10
1) "myzset"
2) 1) 1) "three"
2) "3"
2) 1) "two"
2) "2"
redis> ZADD myzset2 4 "four" 5 "five" 6 "six"
(integer) 3
redis> ZMPOP 2 myzset myzset2 MIN COUNT 10
1) "myzset2"
2) 1) 1) "four"
2) "4"
2) 1) "five"
2) "5"
3) 1) "six"
2) "6"
redis> ZRANGE myzset 0 -1 WITHSCORES
(empty array)
redis> ZMPOP 2 myzset myzset2 MAX COUNT 10
(nil)
redis> ZRANGE myzset2 0 -1 WITHSCORES
(empty array)
redis> EXISTS myzset myzset2
(integer) 0
</pre>
<div class="prompt" style="">
<span>
redis>
</span>
<input autocomplete="off" name="prompt" spellcheck="false" type="text"/>
</div>
</form>
<h2 id="resp2-reply">
RESP2 Reply
</h2>
<p>
One of the following:
</p>
<ul>
<li>
<a href="../../develop/reference/protocol-spec#bulk-strings">
Nil reply
</a>
: when no element could be popped.
</li>
<li>
<a href="../../develop/reference/protocol-spec#arrays">
Array reply
</a>
: A two-element array with the first element being the name of the key from which elements were popped, and the second element is an array of the popped elements. Every entry in the elements array is also an array that contains the member and its score.
</li>
</ul>
<h2 id="resp3-reply">
RESP3 Reply
</h2>
<p>
One of the following:
</p>
<ul>
<li>
<a href="../../develop/reference/protocol-spec#nulls">
Null reply
</a>
: when no element could be popped.
</li>
<li>
<a href="../../develop/reference/protocol-spec#arrays">
Array reply
</a>
: A two-element array with the first element being the name of the key from which elements were popped, and the second element is an array of the popped elements. Every entry in the elements array is also an array that contains the member and its score.
</li>
</ul>
<br/>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/commands/zmpop/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/commands/groupgeneric.html | <section class="prose w-full py-12">
<h1>
Commands
</h1>
</section>
|
https://redis.io/docs/latest/operate/rs/references/rest-api/requests/bdbs/alerts/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Database alerts requests
</h1>
<p class="text-lg -mt-5 mb-10">
Database alert requests
</p>
<table>
<thead>
<tr>
<th>
Method
</th>
<th>
Path
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="#get-all-bdbs-alerts">
GET
</a>
</td>
<td>
<code>
/v1/bdbs/alerts
</code>
</td>
<td>
Get all alert states for all databases
</td>
</tr>
<tr>
<td>
<a href="#get-bdbs-alerts">
GET
</a>
</td>
<td>
<code>
/v1/bdbs/alerts/{uid}
</code>
</td>
<td>
Get all alert states for a specific database
</td>
</tr>
<tr>
<td>
<a href="#get-bdbs-alert">
GET
</a>
</td>
<td>
<code>
/v1/bdbs/alerts/{uid}/{alert}
</code>
</td>
<td>
Get a specific database alert state
</td>
</tr>
<tr>
<td>
<a href="#post-bdbs-alerts">
POST
</a>
</td>
<td>
<code>
/v1/bdbs/alerts/{uid}
</code>
</td>
<td>
Update a databaseβs alerts configuration
</td>
</tr>
</tbody>
</table>
<h2 id="get-all-bdbs-alerts">
Get all database alerts
</h2>
<pre><code>GET /v1/bdbs/alerts
</code></pre>
<p>
Get all alert states for all databases.
</p>
<h4 id="required-permissions">
Required permissions
</h4>
<table>
<thead>
<tr>
<th>
Permission name
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="/docs/latest/operate/rs/references/rest-api/permissions/#view_all_bdbs_alerts">
view_all_bdbs_alerts
</a>
</td>
</tr>
</tbody>
</table>
<h3 id="get-all-request">
Request
</h3>
<h4 id="example-http-request">
Example HTTP request
</h4>
<pre><code>GET /bdbs/alerts
</code></pre>
<h4 id="request-headers">
Request headers
</h4>
<table>
<thead>
<tr>
<th>
Key
</th>
<th>
Value
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
Host
</td>
<td>
cnm.cluster.fqdn
</td>
<td>
Domain name
</td>
</tr>
<tr>
<td>
Accept
</td>
<td>
application/json
</td>
<td>
Accepted media type
</td>
</tr>
</tbody>
</table>
<h3 id="get-all-response">
Response
</h3>
<p>
Returns a hash of alert UIDs and the
<a href="/docs/latest/operate/rs/references/rest-api/objects/alert/">
alerts
</a>
states for each database.
</p>
<h4 id="example-json-body">
Example JSON body
</h4>
<div class="highlight">
<pre class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"1"</span><span class="p">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"bdb_size"</span><span class="p">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"enabled"</span><span class="p">:</span> <span class="kc">true</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"state"</span><span class="p">:</span> <span class="kc">true</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"threshold"</span><span class="p">:</span> <span class="s2">"80"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"change_time"</span><span class="p">:</span> <span class="s2">"2014-08-29T11:19:49Z"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"severity"</span><span class="p">:</span> <span class="s2">"WARNING"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"change_value"</span><span class="p">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"state"</span><span class="p">:</span> <span class="kc">true</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"threshold"</span><span class="p">:</span> <span class="s2">"80"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"memory_util"</span><span class="p">:</span> <span class="mf">81.2</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"..."</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"..."</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span></code></pre>
</div>
<h3 id="get-all-status-codes">
Status codes
</h3>
<table>
<thead>
<tr>
<th>
Code
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1">
200 OK
</a>
</td>
<td>
No error
</td>
</tr>
</tbody>
</table>
<h2 id="get-bdbs-alerts">
Get database alerts
</h2>
<pre><code>GET /v1/bdbs/alerts/{int: uid}
</code></pre>
<p>
Get all alert states for a database.
</p>
<h4 id="required-permissions-1">
Required permissions
</h4>
<table>
<thead>
<tr>
<th>
Permission name
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="/docs/latest/operate/rs/references/rest-api/permissions/#view_bdb_alerts">
view_bdb_alerts
</a>
</td>
</tr>
</tbody>
</table>
<h3 id="get-request-alerts">
Request
</h3>
<h4 id="example-http-request-1">
Example HTTP request
</h4>
<pre><code>GET /bdbs/alerts/1
</code></pre>
<h4 id="request-headers-1">
Request headers
</h4>
<table>
<thead>
<tr>
<th>
Key
</th>
<th>
Value
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
Host
</td>
<td>
cnm.cluster.fqdn
</td>
<td>
Domain name
</td>
</tr>
<tr>
<td>
Accept
</td>
<td>
application/json
</td>
<td>
Accepted media type
</td>
</tr>
</tbody>
</table>
<h3 id="get-response-alerts">
Response
</h3>
<p>
Returns a hash of
<a href="/docs/latest/operate/rs/references/rest-api/objects/alert/">
alert objects
</a>
and their states.
</p>
<h4 id="example-json-body-1">
Example JSON body
</h4>
<div class="highlight">
<pre class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"bdb_size"</span><span class="p">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"enabled"</span><span class="p">:</span> <span class="kc">true</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"state"</span><span class="p">:</span> <span class="kc">true</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"threshold"</span><span class="p">:</span> <span class="s2">"80"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"severity"</span><span class="p">:</span> <span class="s2">"WARNING"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"change_time"</span><span class="p">:</span> <span class="s2">"2014-08-29T11:19:49Z"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"change_value"</span><span class="p">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"state"</span><span class="p">:</span> <span class="kc">true</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"threshold"</span><span class="p">:</span> <span class="s2">"80"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"memory_util"</span><span class="p">:</span> <span class="mf">81.2</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"..."</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span></code></pre>
</div>
<h3 id="get-status-codes-alerts">
Status codes
</h3>
<table>
<thead>
<tr>
<th>
Code
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1">
200 OK
</a>
</td>
<td>
No error
</td>
</tr>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5">
404 Not Found
</a>
</td>
<td>
Specified bdb does not exist
</td>
</tr>
</tbody>
</table>
<h2 id="get-bdbs-alert">
Get database alert
</h2>
<pre><code>GET /v1/bdbs/alerts/{int: uid}/{alert}
</code></pre>
<p>
Get a database alert state.
</p>
<h4 id="required-permissions-2">
Required permissions
</h4>
<table>
<thead>
<tr>
<th>
Permission name
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="/docs/latest/operate/rs/references/rest-api/permissions/#view_bdb_alerts">
view_bdb_alerts
</a>
</td>
</tr>
</tbody>
</table>
<h3 id="get-request">
Request
</h3>
<h4 id="example-http-request-2">
Example HTTP request
</h4>
<pre><code>GET /bdbs/alerts/1/bdb_size
</code></pre>
<h4 id="request-headers-2">
Request headers
</h4>
<table>
<thead>
<tr>
<th>
Key
</th>
<th>
Value
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
Host
</td>
<td>
cnm.cluster.fqdn
</td>
<td>
Domain name
</td>
</tr>
<tr>
<td>
Accept
</td>
<td>
application/json
</td>
<td>
Accepted media type
</td>
</tr>
</tbody>
</table>
<h4 id="url-parameters">
URL parameters
</h4>
<table>
<thead>
<tr>
<th>
Field
</th>
<th>
Type
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
uid
</td>
<td>
integer
</td>
<td>
The unique ID of the database
</td>
</tr>
<tr>
<td>
alert
</td>
<td>
string
</td>
<td>
The alert name
</td>
</tr>
</tbody>
</table>
<h3 id="get-response">
Response
</h3>
<p>
Returns an
<a href="/docs/latest/operate/rs/references/rest-api/objects/alert/">
alert object
</a>
.
</p>
<h4 id="example-json-body-2">
Example JSON body
</h4>
<div class="highlight">
<pre class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"enabled"</span><span class="p">:</span> <span class="kc">true</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"state"</span><span class="p">:</span> <span class="kc">true</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"threshold"</span><span class="p">:</span> <span class="s2">"80"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"severity"</span><span class="p">:</span> <span class="s2">"WARNING"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"change_time"</span><span class="p">:</span> <span class="s2">"2014-08-29T11:19:49Z"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"change_value"</span><span class="p">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"state"</span><span class="p">:</span> <span class="kc">true</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"threshold"</span><span class="p">:</span> <span class="s2">"80"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"memory_util"</span><span class="p">:</span> <span class="mf">81.2</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span></code></pre>
</div>
<h3 id="get-status-codes">
Status codes
</h3>
<table>
<thead>
<tr>
<th>
Code
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1">
200 OK
</a>
</td>
<td>
No error
</td>
</tr>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1">
400 Bad Request
</a>
</td>
<td>
Bad request
</td>
</tr>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5">
404 Not Found
</a>
</td>
<td>
Specified alert or bdb does not exist
</td>
</tr>
</tbody>
</table>
<h2 id="post-bdbs-alerts">
Update database alert
</h2>
<pre><code>POST /v1/bdbs/alerts/{int: uid}
</code></pre>
<p>
Updates a database's alerts configuration.
</p>
<h4 id="required-permissions-3">
Required permissions
</h4>
<table>
<thead>
<tr>
<th>
Permission name
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="/docs/latest/operate/rs/references/rest-api/permissions/#update_bdb_alerts">
update_bdb_alerts
</a>
</td>
</tr>
</tbody>
</table>
<h3 id="post-request">
Request
</h3>
<p>
If passed with the dry_run URL query string, the function will validate the alert thresholds, but not commit them.
</p>
<h4 id="example-http-request-3">
Example HTTP request
</h4>
<pre><code>POST /bdbs/alerts/1
</code></pre>
<h4 id="example-json-body-3">
Example JSON body
</h4>
<div class="highlight">
<pre class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"bdb_size"</span><span class="p">:{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"threshold"</span><span class="p">:</span><span class="s2">"80"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"enabled"</span><span class="p">:</span><span class="kc">true</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"bdb_high_syncer_lag"</span><span class="p">:{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"threshold"</span><span class="p">:</span><span class="s2">""</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"enabled"</span><span class="p">:</span><span class="kc">false</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"bdb_low_throughput"</span><span class="p">:{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"threshold"</span><span class="p">:</span><span class="s2">"1"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"enabled"</span><span class="p">:</span><span class="kc">true</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"bdb_high_latency"</span><span class="p">:{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"threshold"</span><span class="p">:</span><span class="s2">"3000"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"enabled"</span><span class="p">:</span><span class="kc">true</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"bdb_high_throughput"</span><span class="p">:{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"threshold"</span><span class="p">:</span><span class="s2">"1"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"enabled"</span><span class="p">:</span><span class="kc">true</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"bdb_backup_delayed"</span><span class="p">:{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"threshold"</span><span class="p">:</span><span class="s2">"1800"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"enabled"</span><span class="p">:</span><span class="kc">true</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span></code></pre>
</div>
<h4 id="request-headers-3">
Request headers
</h4>
<table>
<thead>
<tr>
<th>
Key
</th>
<th>
Value
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
Host
</td>
<td>
cnm.cluster.fqdn
</td>
<td>
Domain name
</td>
</tr>
<tr>
<td>
Accept
</td>
<td>
application/json
</td>
<td>
Accepted media type
</td>
</tr>
</tbody>
</table>
<h4 id="url-parameters-1">
URL parameters
</h4>
<table>
<thead>
<tr>
<th>
Field
</th>
<th>
Type
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
uid
</td>
<td>
integer
</td>
<td>
Database ID
</td>
</tr>
<tr>
<td>
dry_run
</td>
<td>
string
</td>
<td>
Validate the alert thresholds but do not apply them
</td>
</tr>
</tbody>
</table>
<h4 id="request-body">
Request body
</h4>
<p>
The request must contain a single JSON object with one or many database
<a href="/docs/latest/operate/rs/references/rest-api/objects/alert/">
alert objects
</a>
.
</p>
<h3 id="post-response">
Response
</h3>
<p>
The response includes the updated database
<a href="/docs/latest/operate/rs/references/rest-api/objects/alert/">
alerts
</a>
.
</p>
<h3 id="post-status-codes">
Status codes
</h3>
<table>
<thead>
<tr>
<th>
Code
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5">
404 Not Found
</a>
</td>
<td>
Specified database was not found.
</td>
</tr>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.7">
406 Not Acceptable
</a>
</td>
<td>
Invalid configuration parameters provided.
</td>
</tr>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1">
200 OK
</a>
</td>
<td>
Success, database alerts updated.
</td>
</tr>
</tbody>
</table>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/references/rest-api/requests/bdbs/alerts/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/commands/zpopmax/.html | <section class="prose w-full py-12">
<h1 class="command-name">
ZPOPMAX
</h1>
<div class="font-semibold text-redis-ink-900">
Syntax
</div>
<pre class="command-syntax">ZPOPMAX key [count]</pre>
<dl class="grid grid-cols-[auto,1fr] gap-2 mb-12">
<dt class="font-semibold text-redis-ink-900 m-0">
Available since:
</dt>
<dd class="m-0">
5.0.0
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
Time complexity:
</dt>
<dd class="m-0">
O(log(N)*M) with N being the number of elements in the sorted set, and M being the number of elements popped.
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
ACL categories:
</dt>
<dd class="m-0">
<code>
@write
</code>
<span class="mr-1 last:hidden">
,
</span>
<code>
@sortedset
</code>
<span class="mr-1 last:hidden">
,
</span>
<code>
@fast
</code>
<span class="mr-1 last:hidden">
,
</span>
</dd>
</dl>
<p>
Removes and returns up to
<code>
count
</code>
members with the highest scores in the sorted
set stored at
<code>
key
</code>
.
</p>
<p>
When left unspecified, the default value for
<code>
count
</code>
is 1. Specifying a
<code>
count
</code>
value that is higher than the sorted set's cardinality will not produce an
error. When returning multiple elements, the one with the highest score will
be the first, followed by the elements with lower scores.
</p>
<h2 id="examples">
Examples
</h2>
<div class="bg-slate-900 border-b border-slate-700 rounded-t-xl px-4 py-3 w-full flex">
<svg class="shrink-0 h-[1.0625rem] w-[1.0625rem] fill-slate-50" fill="currentColor" viewbox="0 0 20 20">
<path d="M2.5 10C2.5 5.85786 5.85786 2.5 10 2.5C14.1421 2.5 17.5 5.85786 17.5 10C17.5 14.1421 14.1421 17.5 10 17.5C5.85786 17.5 2.5 14.1421 2.5 10Z">
</path>
</svg>
<svg class="shrink-0 h-[1.0625rem] w-[1.0625rem] fill-slate-50" fill="currentColor" viewbox="0 0 20 20">
<path d="M10 2.5L18.6603 17.5L1.33975 17.5L10 2.5Z">
</path>
</svg>
<svg class="shrink-0 h-[1.0625rem] w-[1.0625rem] fill-slate-50" fill="currentColor" viewbox="0 0 20 20">
<path d="M10 2.5L12.0776 7.9322L17.886 8.22949L13.3617 11.8841L14.8738 17.5L10 14.3264L5.1262 17.5L6.63834 11.8841L2.11403 8.22949L7.92238 7.9322L10 2.5Z">
</path>
</svg>
</div>
<form class="redis-cli overflow-y-auto max-h-80">
<pre tabindex="0">redis> ZADD myzset 1 "one"
Unexpected token '<', "<html>
<h"... is not valid JSON
redis> ZADD myzset 2 "two"
Unexpected token '<', "<html>
<h"... is not valid JSON
redis> ZADD myzset 3 "three"
Unexpected token '<', "<html>
<h"... is not valid JSON
redis> ZPOPMAX myzset
Unexpected token '<', "<html>
<h"... is not valid JSON
</pre>
<div class="prompt" style="">
<span>
redis>
</span>
<input autocomplete="off" name="prompt" spellcheck="false" type="text"/>
</div>
</form>
<h2 id="resp2resp3-reply">
RESP2/RESP3 Reply
</h2>
<ul>
<li>
<a href="../../develop/reference/protocol-spec#arrays">
Array reply
</a>
: a list of popped elements and scores.
</li>
</ul>
<br/>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/commands/zpopmax/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/commands/zrangestore/.html | <section class="prose w-full py-12">
<h1 class="command-name">
ZRANGESTORE
</h1>
<div class="font-semibold text-redis-ink-900">
Syntax
</div>
<pre class="command-syntax">ZRANGESTORE dst src min max [BYSCORE | BYLEX] [REV] [LIMITΒ offset
count]</pre>
<dl class="grid grid-cols-[auto,1fr] gap-2 mb-12">
<dt class="font-semibold text-redis-ink-900 m-0">
Available since:
</dt>
<dd class="m-0">
6.2.0
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
Time complexity:
</dt>
<dd class="m-0">
O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements stored into the destination key.
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
ACL categories:
</dt>
<dd class="m-0">
<code>
@write
</code>
<span class="mr-1 last:hidden">
,
</span>
<code>
@sortedset
</code>
<span class="mr-1 last:hidden">
,
</span>
<code>
@slow
</code>
<span class="mr-1 last:hidden">
,
</span>
</dd>
</dl>
<p>
This command is like
<a href="/docs/latest/commands/zrange/">
<code>
ZRANGE
</code>
</a>
, but stores the result in the
<code>
<dst>
</code>
destination key.
</p>
<h2 id="examples">
Examples
</h2>
<div class="bg-slate-900 border-b border-slate-700 rounded-t-xl px-4 py-3 w-full flex">
<svg class="shrink-0 h-[1.0625rem] w-[1.0625rem] fill-slate-50" fill="currentColor" viewbox="0 0 20 20">
<path d="M2.5 10C2.5 5.85786 5.85786 2.5 10 2.5C14.1421 2.5 17.5 5.85786 17.5 10C17.5 14.1421 14.1421 17.5 10 17.5C5.85786 17.5 2.5 14.1421 2.5 10Z">
</path>
</svg>
<svg class="shrink-0 h-[1.0625rem] w-[1.0625rem] fill-slate-50" fill="currentColor" viewbox="0 0 20 20">
<path d="M10 2.5L18.6603 17.5L1.33975 17.5L10 2.5Z">
</path>
</svg>
<svg class="shrink-0 h-[1.0625rem] w-[1.0625rem] fill-slate-50" fill="currentColor" viewbox="0 0 20 20">
<path d="M10 2.5L12.0776 7.9322L17.886 8.22949L13.3617 11.8841L14.8738 17.5L10 14.3264L5.1262 17.5L6.63834 11.8841L2.11403 8.22949L7.92238 7.9322L10 2.5Z">
</path>
</svg>
</div>
<form class="redis-cli overflow-y-auto max-h-80">
<pre tabindex="0">redis> ZADD srczset 1 "one" 2 "two" 3 "three" 4 "four"
(integer) 4
redis> ZRANGESTORE dstzset srczset 2 -1
(integer) 2
redis> ZRANGE dstzset 0 -1
1) "three"
2) "four"
</pre>
<div class="prompt" style="">
<span>
redis>
</span>
<input autocomplete="off" name="prompt" spellcheck="false" type="text"/>
</div>
</form>
<h2 id="resp2resp3-reply">
RESP2/RESP3 Reply
</h2>
<a href="../../develop/reference/protocol-spec#integers">
Integer reply
</a>
: the number of elements in the resulting sorted set.
<br/>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/commands/zrangestore/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/commands/subscribe/.html | <section class="prose w-full py-12">
<h1 class="command-name">
SUBSCRIBE
</h1>
<div class="font-semibold text-redis-ink-900">
Syntax
</div>
<pre class="command-syntax">SUBSCRIBE channel [channel ...]</pre>
<dl class="grid grid-cols-[auto,1fr] gap-2 mb-12">
<dt class="font-semibold text-redis-ink-900 m-0">
Available since:
</dt>
<dd class="m-0">
2.0.0
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
Time complexity:
</dt>
<dd class="m-0">
O(N) where N is the number of channels to subscribe to.
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
ACL categories:
</dt>
<dd class="m-0">
<code>
@pubsub
</code>
<span class="mr-1 last:hidden">
,
</span>
<code>
@slow
</code>
<span class="mr-1 last:hidden">
,
</span>
</dd>
</dl>
<p>
Subscribes the client to the specified channels.
</p>
<p>
Once the client enters the subscribed state it is not supposed to issue any
other commands, except for additional
<code>
SUBSCRIBE
</code>
,
<a href="/docs/latest/commands/ssubscribe/">
<code>
SSUBSCRIBE
</code>
</a>
,
<a href="/docs/latest/commands/psubscribe/">
<code>
PSUBSCRIBE
</code>
</a>
,
<a href="/docs/latest/commands/unsubscribe/">
<code>
UNSUBSCRIBE
</code>
</a>
,
<a href="/docs/latest/commands/sunsubscribe/">
<code>
SUNSUBSCRIBE
</code>
</a>
,
<a href="/docs/latest/commands/punsubscribe/">
<code>
PUNSUBSCRIBE
</code>
</a>
,
<a href="/docs/latest/commands/ping/">
<code>
PING
</code>
</a>
,
<a href="/docs/latest/commands/reset/">
<code>
RESET
</code>
</a>
and
<a href="/docs/latest/commands/quit/">
<code>
QUIT
</code>
</a>
commands.
However, if RESP3 is used (see
<a href="/docs/latest/commands/hello/">
<code>
HELLO
</code>
</a>
) it is possible for a client to issue any commands while in subscribed state.
</p>
<p>
For more information, see
<a href="/docs/latest/develop/interact/pubsub/">
Pub/sub
</a>
.
</p>
<h2 id="behavior-change-history">
Behavior change history
</h2>
<ul>
<li>
<code>
>= 6.2.0
</code>
:
<a href="/docs/latest/commands/reset/">
<code>
RESET
</code>
</a>
can be called to exit subscribed state.
</li>
</ul>
<h2 id="resp2resp3-reply">
RESP2/RESP3 Reply
</h2>
When successful, this command doesn't return anything. Instead, for each channel, one message with the first element being the string
<code>
subscribe
</code>
is pushed as a confirmation that the command succeeded.
<br/>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/commands/subscribe/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/references/rest-api/objects/services_configuration/stats_archiver/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Stats archiver object
</h1>
<p class="text-lg -mt-5 mb-10">
Documents the stats_archiver object used with Redis Enterprise Software REST API calls.
</p>
<table>
<thead>
<tr>
<th>
Name
</th>
<th>
Type/Value
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
operating_mode
</td>
<td>
'disabled'
<br/>
'enabled'
</td>
<td>
Enable/disable the stats archiver service
</td>
</tr>
</tbody>
</table>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/references/rest-api/objects/services_configuration/stats_archiver/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/commands/geohash/.html | <section class="prose w-full py-12">
<h1 class="command-name">
GEOHASH
</h1>
<div class="font-semibold text-redis-ink-900">
Syntax
</div>
<pre class="command-syntax">GEOHASH key [member [member ...]]</pre>
<dl class="grid grid-cols-[auto,1fr] gap-2 mb-12">
<dt class="font-semibold text-redis-ink-900 m-0">
Available since:
</dt>
<dd class="m-0">
3.2.0
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
Time complexity:
</dt>
<dd class="m-0">
O(1) for each member requested.
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
ACL categories:
</dt>
<dd class="m-0">
<code>
@read
</code>
<span class="mr-1 last:hidden">
,
</span>
<code>
@geo
</code>
<span class="mr-1 last:hidden">
,
</span>
<code>
@slow
</code>
<span class="mr-1 last:hidden">
,
</span>
</dd>
</dl>
<p>
Return valid
<a href="https://en.wikipedia.org/wiki/Geohash">
Geohash
</a>
strings representing the position of one or more elements in a sorted set value representing a geospatial index (where elements were added using
<a href="/docs/latest/commands/geoadd/">
<code>
GEOADD
</code>
</a>
).
</p>
<p>
Normally Redis represents positions of elements using a variation of the Geohash
technique where positions are encoded using 52 bit integers. The encoding is
also different compared to the standard because the initial min and max
coordinates used during the encoding and decoding process are different. This
command however
<strong>
returns a standard Geohash
</strong>
in the form of a string as
described in the
<a href="https://en.wikipedia.org/wiki/Geohash">
Wikipedia article
</a>
and compatible with the
<a href="http://geohash.org">
geohash.org
</a>
web site.
</p>
<h2 id="geohash-string-properties">
Geohash string properties
</h2>
<p>
The command returns 11 characters Geohash strings, so no precision is lost
compared to the Redis internal 52 bit representation. The returned Geohashes
have the following properties:
</p>
<ol>
<li>
They can be shortened removing characters from the right. It will lose precision but will still point to the same area.
</li>
<li>
It is possible to use them in
<code>
geohash.org
</code>
URLs such as
<code>
http://geohash.org/<geohash-string>
</code>
. This is an
<a href="http://geohash.org/sqdtr74hyu0">
example of such URL
</a>
.
</li>
<li>
Strings with a similar prefix are nearby, but the contrary is not true, it is possible that strings with different prefixes are nearby too.
</li>
</ol>
<h2 id="examples">
Examples
</h2>
<div class="bg-slate-900 border-b border-slate-700 rounded-t-xl px-4 py-3 w-full flex">
<svg class="shrink-0 h-[1.0625rem] w-[1.0625rem] fill-slate-50" fill="currentColor" viewbox="0 0 20 20">
<path d="M2.5 10C2.5 5.85786 5.85786 2.5 10 2.5C14.1421 2.5 17.5 5.85786 17.5 10C17.5 14.1421 14.1421 17.5 10 17.5C5.85786 17.5 2.5 14.1421 2.5 10Z">
</path>
</svg>
<svg class="shrink-0 h-[1.0625rem] w-[1.0625rem] fill-slate-50" fill="currentColor" viewbox="0 0 20 20">
<path d="M10 2.5L18.6603 17.5L1.33975 17.5L10 2.5Z">
</path>
</svg>
<svg class="shrink-0 h-[1.0625rem] w-[1.0625rem] fill-slate-50" fill="currentColor" viewbox="0 0 20 20">
<path d="M10 2.5L12.0776 7.9322L17.886 8.22949L13.3617 11.8841L14.8738 17.5L10 14.3264L5.1262 17.5L6.63834 11.8841L2.11403 8.22949L7.92238 7.9322L10 2.5Z">
</path>
</svg>
</div>
<form class="redis-cli overflow-y-auto max-h-80">
<pre tabindex="0">redis> GEOADD Sicily 13.361389 38.115556 "Palermo" 15.087269 37.502669 "Catania"
(integer) 2
redis> GEOHASH Sicily Palermo Catania
1) "sqc8b49rny0"
2) "sqdtr74hyu0"
</pre>
<div class="prompt" style="">
<span>
redis>
</span>
<input autocomplete="off" name="prompt" spellcheck="false" type="text"/>
</div>
</form>
<h2 id="resp2-reply">
RESP2 Reply
</h2>
<a href="../../develop/reference/protocol-spec#arrays">
Array reply
</a>
: an array where each element is the Geohash corresponding to each member name passed as an argument to the command.
<h2 id="resp3-reply">
RESP3 Reply
</h2>
<a href="../../develop/reference/protocol-spec#arrays">
Array reply
</a>
: An array where each element is the Geohash corresponding to each member name passed as an argument to the command.
<br/>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/commands/geohash/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rc/resilient-apps/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Develop highly available and resilient apps with Redis Cloud
</h1>
<p class="text-lg -mt-5 mb-10">
Set up your Redis Cloud databases to enable stable and highly available apps.
</p>
<p>
You can set up your Redis Cloud databases and Redis Client libraries to ensure your app re-connects to your database after unexpected failover events or network outages and minimize data losses.
</p>
<h2 id="set-up-databases">
Set up databases
</h2>
<p>
These settings can be turned on when you create or edit your database.
</p>
<h3 id="enable-data-persistence">
Enable data persistence
</h3>
<p>
Enabling
<a href="/docs/latest/operate/rc/databases/configuration/high-availability/">
Data persistence
</a>
allows Redis to save your data to a durable storage medium, such as a disk, to ensure data availability in case of memory loss or system failure.
</p>
<p>
Redis Cloud supports the following data persistence options:
</p>
<ul>
<li>
<p>
An
<strong>
Append-Only File
</strong>
maintains a record of write operations. This lets you restore data by using the record to reconstruct the database up to the point of failure. The Append-only file updates on every write or every second.
</p>
</li>
<li>
<p>
A
<strong>
Snapshot
</strong>
is a copy of the in-memory database, taken at periodic intervals (one, six, or twelve hours). You can restore data to the snapshot's point in time.
</p>
</li>
</ul>
<p>
Append-only files provide greater protection than snapshots at the cost of resources and recovery time.
Although snapshot recovery is faster, the risk of data loss is higher, depending on the time between failure and the most recent snapshot.
</p>
<p>
If you do not enable data persistence, your data may be lost if the database goes down. It is best practice to enable data persistence for all production databases. You can turn on data persistence when you create or edit your database.
</p>
<h3 id="enable-replication">
Enable replication
</h3>
<p>
<a href="/docs/latest/operate/rc/databases/configuration/high-availability/">
Database replication
</a>
allows for automatic failover and greater fault tolerance. Replication can prevent data loss in the event of a hardware or zone failure.
</p>
<p>
Redis Cloud supports these replication settings:
</p>
<ul>
<li>
<strong>
No replication
</strong>
: You will have a single copy of your database in one zone. If anything happens to your database, your app will not be able to connect to it.
</li>
<li>
<strong>
Single-Zone
</strong>
: Your database will have a primary dataset and a replica dataset located in the same cloud zone. If anything happens to the primary database, the replica takes over and becomes the new primary. Your app will connect to the new primary database automatically with the same endpoint.
</li>
<li>
<strong>
Multi-Zone
</strong>
<em>
(or Multi-AZ)
</em>
: The primary and its replicas are stored in different availability zones. This means that your app will connect to the new primary database zone automatically if an entire availability zone becomes unavailable.
</li>
</ul>
<p>
You can enable replication when you create your database. You can switch between no replication and single-zone replication after your create your database. However, you can't switch from no replication or single-zone replication to multi-zone replication.
</p>
<p>
It is best practice to enable replication for any databases that need to be highly available.
</p>
<h3 id="set-manual-maintenance-windows">
Set manual maintenance windows
</h3>
<p>
Redis maintains your Redis Cloud subscriptions and databases as needed to ensure your databases are running the most stable and up-to-date version of Redis. By default, Redis will perform
<a href="/docs/latest/operate/rc/subscriptions/maintenance/">
maintenance
</a>
automatically while limiting service disruption as much as possible.
</p>
<p>
For stable apps, you may want to control when Redis can perform maintenance on your databases. For Redis Cloud Pro subscriptions, you can
<a href="/docs/latest/operate/rc/subscriptions/maintenance/set-maintenance-windows/">
set manual maintenance windows
</a>
to ensure non-urgent maintenance will occur at set times. Configuring or altering the maintenance window will not have any impact on your subscription or databases.
</p>
<p>
A Redis Cloud Essentials database has a set maintenance window based on the region where it is located. See
<a href="/docs/latest/operate/rc/subscriptions/maintenance/#redis-cloud-essentials">
Essentials maintenance
</a>
for more information.
</p>
<h2 id="set-up-redis-clients">
Set up Redis clients
</h2>
<p>
When you're developing your apps, it is best to use specific Redis Client features to connect to Redis Cloud if they are available for your preferred client.
</p>
<p>
See
<a href="/docs/latest/develop/clients/">
Clients
</a>
to learn how to connect with the official Redis clients.
</p>
<h3 id="re-attempt-connections">
Re-attempt connections
</h3>
<p>
Some clients allow you to re-try connecting to your database if the connection fails. For these clients, we recommend that you implement connection re-attempts to ensure high availability and connection stability.
</p>
<p>
View your
<a href="/docs/latest/develop/clients/">
client's docs
</a>
to learn more.
</p>
<h3 id="refresh-dns">
Refresh DNS
</h3>
<p>
Your application may disconnect from your database either during planned maintenance or for other, unplanned reasons. Most Redis clients are set to refresh their DNS address when they reconnect to the database, and you will not be required to perform any further action. If you encounter connectivity problems for more than a minute during maintenance then you should refresh your DNS entries.
</p>
<p>
Depending on the client, you may be recommended to turn off the DNS cache entirely. Refer to your
<a href="/docs/latest/develop/clients/">
client's docs
</a>
to learn more.
</p>
<h3 id="use-the-wait-and-waitaof-commands">
Use the WAIT and WAITAOF commands
</h3>
<p>
The
<a href="/docs/latest/commands/wait/">
WAIT
</a>
and
<a href="/docs/latest/commands/waitaof/">
WAITAOF
</a>
commands block the current client until all previous write commands are persisted between replicas. With these commands, your application guarantees that acknowledged writes are recorded between replicas.
</p>
<p>
For more info, see
<a href="/docs/latest/operate/rs/clusters/optimize/wait/">
Use the WAIT command for strong consistency
</a>
.
</p>
<h2 id="more-info">
More info
</h2>
<ul>
<li>
<a href="/docs/latest/develop/clients/">
Redis Clients
</a>
</li>
<li>
<a href="/docs/latest/operate/rc/databases/configuration/active-active-redis/">
Active-Active Redis
</a>
</li>
<li>
<a href="/docs/latest/operate/rs/databases/active-active/develop/">
Active-Active Redis applications
</a>
</li>
</ul>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rc/resilient-apps/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/integrate/write-behind/reference/cli/redis-di/.html | <section class="prose w-full py-12 max-w-none">
<h1>
redis-di
</h1>
<p class="text-lg -mt-5 mb-10">
A command line tool to manage & configure Write-behind
</p>
<h2 id="usage">
Usage
</h2>
<pre tabindex="0"><code>Usage: redis-di [OPTIONS] COMMAND [ARGS]...
</code></pre>
<h2 id="options">
Options
</h2>
<ul>
<li>
<p>
<code>
version
</code>
:
</p>
<ul>
<li>
Type: BOOL
</li>
<li>
Default:
<code>
false
</code>
</li>
<li>
Usage:
<code>
--version
</code>
</li>
</ul>
<p>
Show the version and exit.
</p>
</li>
<li>
<p>
<code>
help
</code>
:
</p>
<ul>
<li>
Type: BOOL
</li>
<li>
Default:
<code>
false
</code>
</li>
<li>
Usage:
<code>
--help
</code>
</li>
</ul>
<p>
Show this message and exit.
</p>
</li>
</ul>
<h2 id="cli-help">
CLI help
</h2>
<pre tabindex="0"><code>Usage: redis-di [OPTIONS] COMMAND [ARGS]...
A command line tool to manage & configure Write-behind
Options:
--version Show the version and exit.
--help Show this message and exit.
Commands:
add-context Adds a new context
configure Configures the Write-behind Database so it is ready to...
create Creates the Write-behind Database instance
delete Deletes Write-behind database permanently
delete-all-contexts Deletes all contexts
delete-context Deletes a context
deploy Deploys the Write-behind configurations including target
describe-job Describes a transformation engine's job
dump-support-package Dumps Write-behind support package
get-rejected Returns all the stored rejected entries
list-contexts Lists all saved contexts
list-jobs Lists transformation engine's jobs
monitor Monitors Write-behind by collecting metrics and exporting...
reset Resets the pipeline into initial full sync mode
scaffold Generates configuration files for Write-behind and...
set-context Sets a context to be the active one
set-secret Writes a secret to Redis secret store
start Starts the pipeline
status Displays the status of the pipeline end to end
stop Stops the pipeline
trace Starts a trace session for troubleshooting data...
upgrade Upgrades Write-behind Engine without losing data or downtime
</code></pre>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/integrate/write-behind/reference/cli/redis-di/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/security/access-control/manage-users/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Manage user security
</h1>
<p class="text-lg -mt-5 mb-10">
Manage user account security settings.
</p>
<p>
Redis Enterprise supports the following user account security settings:
</p>
<ul>
<li>
Password complexity
</li>
<li>
Password expiration
</li>
<li>
User lockouts
</li>
<li>
Account inactivity timeout
</li>
</ul>
<h2 id="manage-users-and-user-security">
Manage users and user security
</h2>
<nav>
<a href="/docs/latest/operate/rs/security/access-control/manage-users/login-lockout/">
Manage user login
</a>
<p>
Manage user login lockout and session timeout.
</p>
<a href="/docs/latest/operate/rs/security/access-control/manage-users/default-user/">
Manage default user
</a>
<p>
Manage a database's default user.
</p>
</nav>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/security/access-control/manage-users/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/oss_and_stack/stack-with-enterprise/search/scalable-query-best-practices/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Best practices for scalable Redis Query Engine
</h1>
<p class="text-lg -mt-5 mb-10">
Best practices for scalable Redis Query Engine in Redis Software and Redis Cloud.
</p>
<p>
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/search/query-performance-factor/">
Vertical scaling of Redis Query Engine
</a>
requires configuring query performance factors. With careful crafting of search indices and queries, query performance factors allow throughput scaling up to 16X. The following recommendations help queries avoid accessing the keyspace and enable Redis Query Engine to benefit from additional CPUs allocated by query performance factors.
</p>
<h2 id="best-candidates-for-query-performance-factor-improvements">
Best candidates for query performance factor improvements
</h2>
<ul>
<li>
<p>
Query types:
</p>
<ul>
<li>
<p>
<a href="/docs/latest/develop/interact/search-and-query/query/full-text/">
Full-text
</a>
</p>
</li>
<li>
<p>
<a href="/docs/latest/develop/interact/search-and-query/advanced-concepts/tags/">
Tag
</a>
</p>
</li>
<li>
<p>
<a href="/docs/latest/develop/interact/search-and-query/query/vector-search/">
Vector
</a>
</p>
</li>
</ul>
</li>
<li>
<p>
Result set types:
</p>
<ul>
<li>
<p>
Small result sets
</p>
</li>
<li>
<p>
Document subsets that are indexed in their
<a href="/docs/latest/develop/interact/search-and-query/advanced-concepts/sorting/#normalization-unf-option">
non-normalized
</a>
form
</p>
</li>
</ul>
</li>
</ul>
<h2 id="indexing-best-practices">
Indexing best practices
</h2>
<p>
Follow these best practices for
<a href="/docs/latest/develop/interact/search-and-query/indexing/">
indexing
</a>
:
</p>
<ul>
<li>
<p>
Include fields in the index definition that are used in the query or the required result sets (projections).
</p>
</li>
<li>
<p>
Use
<code>
SORTABLE
</code>
for all fields returned in result sets.
</p>
</li>
<li>
<p>
Use the
<code>
UNF
</code>
option for
<code>
TAG
</code>
and
<code>
GEO
</code>
fields.
</p>
</li>
<li>
<p>
Use the
<code>
NOSTEM
</code>
option for
<code>
TEXT
</code>
fields.
</p>
</li>
</ul>
<h2 id="query-best-practices">
Query best practices
</h2>
<p>
Follow these best practices for
<a href="/docs/latest/develop/interact/search-and-query/query/">
queries
</a>
:
</p>
<ul>
<li>
<p>
Specify the result set fields in the
<code>
RETURN
</code>
or
<code>
LOAD
</code>
clauses and include them in the index definition. Donβt just return the default result set from
<a href="/docs/latest/commands/ft.search/">
<code>
FT.SEARCH
</code>
</a>
or
<code>
LOAD *
</code>
from
<a href="/docs/latest/commands/ft.aggregate/">
<code>
FT.AGGREGATE
</code>
</a>
.
</p>
</li>
<li>
<p>
Use
<code>
LIMIT
</code>
to reduce the result set size.
</p>
</li>
<li>
<p>
Use
<a href="/docs/latest/develop/interact/search-and-query/advanced-concepts/dialects/#dialect-3">
<code>
DIALECT 3
</code>
</a>
or higher for any queries against JSON.
</p>
</li>
</ul>
<h2 id="index-and-query-examples">
Index and query examples
</h2>
<p>
The following examples depict an anti-pattern index schema and query, followed by a corrected schema and query, which allows for scalability with the Redis Query Engine.
</p>
<h3 id="anti-pattern-index-schema">
Anti-pattern index schema
</h3>
<p>
The following index schema is not optimized for vertical scaling:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">FT.CREATE jsonidx:profiles ON JSON PREFIX <span class="m">1</span> profiles:
</span></span><span class="line"><span class="cl"> SCHEMA $.tags.* as t NUMERIC SORTABLE
</span></span><span class="line"><span class="cl"> $.firstName as name TEXT
</span></span><span class="line"><span class="cl"> $.location as loc GEO
</span></span></code></pre>
</div>
<h3 id="anti-pattern-query">
Anti-pattern query
</h3>
<p>
The following query is not optimized for vertical scaling:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">FT.AGGREGATE jsonidx:profiles <span class="s1">'@t:[1299 1299]'</span> LOAD * LIMIT <span class="m">0</span> <span class="m">10</span>
</span></span></code></pre>
</div>
<h3 id="improved-index-schema">
Improved index schema
</h3>
<p>
Here's an improved index schema that follows best practices for vertical scaling:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">FT.CREATE jsonidx:profiles ON JSON PREFIX <span class="m">1</span> profiles:
</span></span><span class="line"><span class="cl"> SCHEMA $.tags.* as t NUMERIC SORTABLE
</span></span><span class="line"><span class="cl"> $.firstName as name TEXT NOSTEM SORTABLE
</span></span><span class="line"><span class="cl"> $.lastName as lastname TEXT NOSTEM SORTABLE
</span></span><span class="line"><span class="cl"> $.location as loc GEO SORTABLE
</span></span><span class="line"><span class="cl"> $.id as id TAG SORTABLE UNF
</span></span><span class="line"><span class="cl"> $.ver as ver TAG SORTABLE UNF
</span></span></code></pre>
</div>
<h3 id="improved-query">
Improved query
</h3>
<p>
Here's an improved query that follows best practices for vertical scaling:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">FT.AGGREGATE jsonidx:profiles <span class="s1">'@t:[1299 1299]'</span>
</span></span><span class="line"><span class="cl"> LOAD <span class="m">6</span> id t nam<span class="s2">" lastname loc ver
</span></span></span><span class="line"><span class="cl"><span class="s2"> LIMIT 0 10
</span></span></span><span class="line"><span class="cl"><span class="s2"> DIALECT 3
</span></span></span></code></pre>
</div>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/oss_and_stack/stack-with-enterprise/search/scalable-query-best-practices/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/kubernetes/re-clusters/cluster-recovery/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Recover a Redis Enterprise cluster on Kubernetes
</h1>
<p class="text-lg -mt-5 mb-10">
This task describes how to recover a Redis Enterprise cluster on Kubernetes.
</p>
<p>
When a Redis Enterprise cluster loses contact with more than half of its nodes either because of failed nodes or network split,
the cluster stops responding to client connections.
When this happens, you must recover the cluster to restore the connections.
</p>
<p>
You can also perform cluster recovery to reset cluster nodes, to troubleshoot issues, or in a case of active/passive failover.
</p>
<p>
The Redis Enterprise for Kubernetes automates these recovery steps:
</p>
<ol>
<li>
Recreates a fresh Redis Enterprise cluster
</li>
<li>
Mounts the persistent storage with the recovery files from the original cluster to the nodes of the new cluster
</li>
<li>
Recovers the cluster configuration on the first node in the new cluster
</li>
<li>
Joins the remaining nodes to the new cluster.
</li>
</ol>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Warning:
</div>
Redis Enterprise for Kubernetes 7.2.4-2 introduces a new limitation. You cannot recover or upgrade your cluster if there are databases with old module versions or manually uploaded modules. See the
<a href="/docs/latest/operate/rs/release-notes/rs-7-2-4-releases/rs-7-2-4-52/#cluster-recovery-with-manually-uploaded-modules">
Redis Enterprise Software 7.2.4 known limitations
</a>
for more details.
</div>
</div>
<h2 id="prerequisites">
Prerequisites
</h2>
<ul>
<li>
For cluster recovery, the cluster must be
<a href="/docs/latest/operate/kubernetes/recommendations/persistent-volumes/">
deployed with persistence
</a>
.
</li>
</ul>
<h2 id="recover-a-cluster">
Recover a cluster
</h2>
<ol>
<li>
<p>
Edit the REC resource to set the
<code>
clusterRecovery
</code>
flag to
<code>
true
</code>
.
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">kubectl patch rec <cluster-name> --type merge --patch <span class="s1">'{"spec":{"clusterRecovery":true}}'</span>
</span></span></code></pre>
</div>
</li>
<li>
<p>
Wait for the cluster to recover until it is in the "Running" state.
</p>
<p>
To see the state of the cluster, run:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">watch <span class="s2">"kubectl describe rec | grep State"</span>
</span></span></code></pre>
</div>
</li>
<li>
<p>
To recover the database, see
<a href="/docs/latest/operate/rs/databases/recover/">
Recover a failed database
</a>
.
</p>
</li>
</ol>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/kubernetes/re-clusters/cluster-recovery/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/commands/ft.synupdate.html | <section class="prose w-full py-12">
<h1 class="command-name">
FT.SYNUPDATE
</h1>
<div class="font-semibold text-redis-ink-900">
Syntax
</div>
<pre class="command-syntax">FT.SYNUPDATE index synonym_group_id
[SKIPINITIALSCAN] term [term ...]
</pre>
<dl class="grid grid-cols-[auto,1fr] gap-2 mb-12">
<dt class="font-semibold text-redis-ink-900 m-0">
Available in:
</dt>
<dd class="m-0">
<a href="/docs/stack">
Redis Stack
</a>
/
<a href="/docs/interact/search-and-query">
Search 1.2.0
</a>
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
Time complexity:
</dt>
<dd class="m-0">
O(1)
</dd>
</dl>
<p>
Update a synonym group
</p>
<p>
<a href="#examples">
Examples
</a>
</p>
<h2 id="required-arguments">
Required arguments
</h2>
<details open="">
<summary>
<code>
index
</code>
</summary>
<p>
is index name.
</p>
</details>
<details open="">
<summary>
<code>
synonym_group_id
</code>
</summary>
<p>
is synonym group to return.
</p>
</details>
<p>
Use FT.SYNUPDATE to create or update a synonym group with additional terms. The command triggers a scan of all documents.
</p>
<h2 id="optional-parameters">
Optional parameters
</h2>
<details open="">
<summary>
<code>
SKIPINITIALSCAN
</code>
</summary>
<p>
does not scan and index, and only documents that are indexed after the update are affected.
</p>
</details>
<h2 id="return">
Return
</h2>
<p>
FT.SYNUPDATE returns a simple string reply
<code>
OK
</code>
if executed correctly, or an error reply otherwise.
</p>
<h2 id="examples">
Examples
</h2>
<details open="">
<summary>
<b>
Update a synonym group
</b>
</summary>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">127.0.0.1:6379> FT.SYNUPDATE idx synonym hello hi shalom
</span></span><span class="line"><span class="cl">OK</span></span></code></pre>
</div>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">127.0.0.1:6379> FT.SYNUPDATE idx synonym SKIPINITIALSCAN hello hi shalom
</span></span><span class="line"><span class="cl">OK</span></span></code></pre>
</div>
</details>
<h2 id="see-also">
See also
</h2>
<p>
<a href="/docs/latest/commands/ft.syndump/">
<code>
FT.SYNDUMP
</code>
</a>
</p>
<h2 id="related-topics">
Related topics
</h2>
<p>
<a href="/docs/latest/develop/interact/search-and-query/">
RediSearch
</a>
</p>
<br/>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/commands/ft.synupdate/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/commands/tdigest.trimmed_mean/.html | <section class="prose w-full py-12">
<h1 class="command-name">
TDIGEST.TRIMMED_MEAN
</h1>
<div class="font-semibold text-redis-ink-900">
Syntax
</div>
<pre class="command-syntax">TDIGEST.TRIMMED_MEAN key low_cut_quantile high_cut_quantile</pre>
<dl class="grid grid-cols-[auto,1fr] gap-2 mb-12">
<dt class="font-semibold text-redis-ink-900 m-0">
Available in:
</dt>
<dd class="m-0">
<a href="/docs/stack">
Redis Stack
</a>
/
<a href="/docs/data-types/probabilistic">
Bloom 2.4.0
</a>
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
Time complexity:
</dt>
<dd class="m-0">
O(N) where N is the number of centroids
</dd>
</dl>
<p>
Returns an estimation of the mean value from the sketch, excluding observation values outside the low and high cutoff quantiles.
</p>
<h2 id="required-arguments">
Required arguments
</h2>
<details open="">
<summary>
<code>
key
</code>
</summary>
is key name for an existing t-digest sketch.
</details>
<details open="">
<summary>
<code>
low_cut_quantile
</code>
</summary>
<p>
Foating-point value in the range [0..1], should be lower than
<code>
high_cut_quantile
</code>
</p>
<p>
When equal to 0: No low cut.
</p>
<p>
When higher than 0: Exclude observation values lower than this quantile.
</p>
</details>
<details open="">
<summary>
<code>
high_cut_quantile
</code>
</summary>
<p>
Floating-point value in the range [0..1], should be higher than
<code>
low_cut_quantile
</code>
</p>
<p>
When lower than 1: Exclude observation values higher than or equal to this quantile.
</p>
<p>
When equal to 1: No high cut.
</p>
</details>
<h2 id="return-value">
Return value
</h2>
<p>
<a href="/docs/latest/develop/reference/protocol-spec/#simple-strings">
Simple string reply
</a>
estimation of the mean value. 'nan' if the sketch is empty.
</p>
<h2 id="examples">
Examples
</h2>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">redis> TDIGEST.CREATE t COMPRESSION <span class="m">1000</span>
</span></span><span class="line"><span class="cl">OK
</span></span><span class="line"><span class="cl">redis> TDIGEST.ADD t <span class="m">1</span> <span class="m">2</span> <span class="m">3</span> <span class="m">4</span> <span class="m">5</span> <span class="m">6</span> <span class="m">7</span> <span class="m">8</span> <span class="m">9</span> <span class="m">10</span>
</span></span><span class="line"><span class="cl">OK
</span></span><span class="line"><span class="cl">redis> TDIGEST.TRIMMED_MEAN t 0.1 0.6
</span></span><span class="line"><span class="cl"><span class="s2">"4"</span>
</span></span><span class="line"><span class="cl">redis> TDIGEST.TRIMMED_MEAN t 0.3 0.9
</span></span><span class="line"><span class="cl"><span class="s2">"6.5"</span>
</span></span><span class="line"><span class="cl">redis> TDIGEST.TRIMMED_MEAN t <span class="m">0</span> <span class="m">1</span>
</span></span><span class="line"><span class="cl"><span class="s2">"5.5"</span></span></span></code></pre>
</div>
<br/>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/commands/tdigest.trimmed_mean/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/databases/configure/shard-placement/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Configure shard placement
</h1>
<p class="text-lg -mt-5 mb-10">
Configure shard placement to improve performance.
</p>
<p>
In Redis Enterprise Software , the location of master and replica shards on the cluster nodes can impact the database and node performance.
Master shards and their corresponding replica shards are always placed on separate nodes for data resiliency.
The
<a href="/docs/latest/operate/rs/databases/memory-performance/shard-placement-policy/">
shard placement policy
</a>
helps to maintain optimal performance and resiliency.
</p>
<p>
In addition to the shard placement policy, considerations that determine shard placement are:
</p>
<ul>
<li>
Separation of master and replica shards
</li>
<li>
Available persistence and Auto Tiering storage
</li>
<li>
<a href="/docs/latest/operate/rs/clusters/configure/rack-zone-awareness/">
Rack-zone awareness
</a>
</li>
<li>
Memory available to host the database when fully populated
</li>
</ul>
<p>
The shard placement policies are:
</p>
<ul>
<li>
<code>
dense
</code>
- Place as many shards as possible on the smallest number of nodes to reduce the latency between the proxy and the database shards;
Recommended for Redis on RAM databases to optimize memory resources
</li>
<li>
<code>
sparse
</code>
- Spread the shards across as many nodes in the cluster as possible to spread the traffic across cluster nodes;
Recommended for databases with Auto Tiering enabled to optimize disk resources
</li>
</ul>
<p>
When you create a Redis Enterprise Software cluster, the default shard placement policy (
<code>
dense
</code>
) is assigned to all databases that you create on the cluster.
</p>
<p>
You can:
</p>
<ul>
<li>
Change the default shard placement policy for the cluster to
<code>
sparse
</code>
so that the cluster applies that policy to all databases that you create
</li>
<li>
Change the shard placement policy for each database after the database is created
</li>
</ul>
<h2 id="default-shard-placement-policy">
Default shard placement policy
</h2>
<p>
When you create a new cluster, the cluster configuration has a
<code>
dense
</code>
default shard placement policy.
When you create a database, this default policy is applied to the new database.
</p>
<p>
To see the current default shard placement policy, run
<code>
rladmin info cluster
</code>
:
</p>
<a href="/docs/latest/images/rs/shard_placement_info_cluster.png" sdata-lightbox="/images/rs/shard_placement_info_cluster.png">
<img src="/docs/latest/images/rs/shard_placement_info_cluster.png"/>
</a>
<p>
To change the default shard placement policy so that new databases are created with the
<code>
sparse
</code>
shard placement policy, run:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">rladmin tune cluster default_shards_placement <span class="o">[</span> dense <span class="p">|</span> sparse <span class="o">]</span>
</span></span></code></pre>
</div>
<h2 id="shard-placement-policy-for-a-database">
Shard placement policy for a database
</h2>
<p>
To see the shard placement policy for a database in
<code>
rladmin status
</code>
.
</p>
<a href="/docs/latest/images/rs/shard_placement_rladmin_status.png" sdata-lightbox="/images/rs/shard_placement_rladmin_status.png">
<img src="/docs/latest/images/rs/shard_placement_rladmin_status.png"/>
</a>
<p>
To change the shard placement policy for a database, run:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">rladmin placement db <span class="o">[</span> database name <span class="p">|</span> database ID <span class="o">]</span> <span class="o">[</span> dense <span class="p">|</span> sparse <span class="o">]</span>
</span></span></code></pre>
</div>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/databases/configure/shard-placement/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/7.4/installing-upgrading/install/customize-user-and-group/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Customize system user and group
</h1>
<p class="text-lg -mt-5 mb-10">
Specify the user and group who own all Redis Enterprise Software processes.
</p>
<p>
By default, Redis Enterprise Software is installed with the user:group
<code>
redislabs:redislabs
</code>
. See
<a href="/docs/latest/operate/rs/7.4/security/access-control/">
Access control
</a>
for user and group security information.
</p>
<p>
During installation, you can specify the user and group that own all Redis Enterprise Software processes.
</p>
<p>
If you specify the user only, then installation is run with the primary group that the user belongs to.
</p>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Note:
</div>
<ul>
<li>
Custom installation user is supported on Red Hat Enterprise Linux.
</li>
<li>
When you install with custom directories, the installation does not run as an RPM file.
</li>
<li>
You must create the user and group before attempting to install Redis Software.
</li>
<li>
You can specify an LDAP user as the installation user.
</li>
</ul>
</div>
</div>
<p>
To customize the user or group during
<a href="/docs/latest/operate/rs/7.4/installing-upgrading/install/install-on-linux/">
installation
</a>
, include the
<code>
--os-user
</code>
or
<code>
--os-group
</code>
<a href="/docs/latest/operate/rs/7.4/installing-upgrading/install/install-script/">
command-line options
</a>
when you run the
<code>
install.sh
</code>
script. For example:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">sudo ./install.sh --os-user <user> --os-group <group>
</span></span></code></pre>
</div>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/7.4/installing-upgrading/install/customize-user-and-group/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/databases/import-export/schedule-backups/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Schedule periodic backups
</h1>
<p class="text-lg -mt-5 mb-10">
Schedule backups of your databases to make sure you always have valid backups.
</p>
<p>
Periodic backups provide a way to restore data with minimal data loss. With Redis Enterprise Software, you can schedule periodic backups to occur once a day (every 24 hours), twice a day (every twelve hours), every four hours, or every hour.
</p>
<p>
As of v6.2.8, you can specify the start time for 24-hour or 12-hour backups.
</p>
<p>
To make an on-demand backup,
<a href="/docs/latest/operate/rs/databases/import-export/export-data/">
export your data
</a>
.
</p>
<p>
You can schedule backups to a variety of locations, including:
</p>
<ul>
<li>
FTP server
</li>
<li>
SFTP server
</li>
<li>
Local mount point
</li>
<li>
Amazon Simple Storage Service (S3)
</li>
<li>
Azure Blob Storage
</li>
<li>
Google Cloud Storage
</li>
</ul>
<p>
The backup process creates compressed (.gz) RDB files that you can
<a href="/docs/latest/operate/rs/databases/import-export/import-data/">
import into a database
</a>
.
</p>
<p>
When you back up a database configured for database clustering,
Redis Enterprise Software creates a backup file for each shard in the configuration. All backup files are copied to the storage location.
</p>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Note:
</div>
<ul>
<li>
Make sure that you have enough space available in your storage location.
If there is not enough space in the backup location, the backup fails.
</li>
<li>
The backup configuration only applies to the database it is configured on.
</li>
<li>
To limit the parallel backup for shards, set both
<a href="/docs/latest/operate/rs/references/cli-utilities/rladmin/tune/#tune-cluster">
<code>
tune cluster max_simultaneous_backups
</code>
</a>
and
<a href="/docs/latest/operate/rs/references/cli-utilities/rladmin/tune/#tune-node">
<code>
tune node max_redis_forks
</code>
</a>
.
<code>
max_simultaneous_backups
</code>
is set to 4 by default.
</li>
</ul>
</div>
</div>
<h2 id="schedule-periodic-backups">
Schedule periodic backups
</h2>
<p>
Before scheduling periodic backups, verify that your storage location exists and is available to the user running Redis Enterprise Software (
<code>
redislabs
</code>
by default). You should verify that:
</p>
<ul>
<li>
Permissions are set correctly.
</li>
<li>
The user running Redis Enterprise Software is authorized to access the storage location.
</li>
<li>
The authorization credentials work.
</li>
</ul>
<p>
Storage location access is verified before periodic backups are scheduled.
</p>
<p>
To schedule periodic backups for a database:
</p>
<ol>
<li>
<p>
Sign in to the Redis Enterprise Software Cluster Manager UI using admin credentials.
</p>
</li>
<li>
<p>
From the
<strong>
Databases
</strong>
list, select the database, then select
<strong>
Configuration
</strong>
.
</p>
</li>
<li>
<p>
Select the
<strong>
Edit
</strong>
button.
</p>
</li>
<li>
<p>
Expand the
<strong>
Durability
</strong>
section.
</p>
</li>
<li>
<p>
In the
<strong>
Scheduled backup
</strong>
section, click
<strong>
Add backup path
</strong>
to open the
<strong>
Path configuration
</strong>
dialog.
</p>
</li>
<li>
<p>
Select the tab that corresponds to your storage location type, enter the location details, and select
<strong>
Done
</strong>
.
</p>
<p>
See
<a href="#supported-storage-locations">
Supported storage locations
</a>
for more information about each storage location type.
</p>
</li>
<li>
<p>
Set the backup
<strong>
Interval
</strong>
and
<strong>
Starting time
</strong>
.
</p>
<table>
<thead>
<tr>
<th>
Setting
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<strong>
Interval
</strong>
</td>
<td>
Specifies the frequency of the backup; that is, the time between each backup snapshot.
<br/>
<br/>
Supported values include
<em>
Every 24 hours
</em>
,
<em>
Every 12 hours
</em>
,
<em>
Every 4 hours
</em>
, and
<em>
Every hour
</em>
.
</td>
</tr>
<tr>
<td>
<strong>
Starting time
</strong>
</td>
<td>
<em>
v6.2.8 or later:
</em>
Specifies the start time for the backup; available when
<strong>
Interval
</strong>
is set to
<em>
Every 24 hours
</em>
or
<em>
Every 12 hours
</em>
.
<br/>
<br/>
If not specified, defaults to a time selected by Redis Enterprise Software.
</td>
</tr>
</tbody>
</table>
</li>
<li>
<p>
Select
<strong>
Save
</strong>
.
</p>
</li>
</ol>
<p>
Access to the storage location is verified when you apply your updates. This means the location, credentials, and other details must exist and function before you can enable periodic backups.
</p>
<h2 id="default-backup-start-time">
Default backup start time
</h2>
<p>
If you do
<em>
not
</em>
specify a start time for twenty-four or twelve hour backups, Redis Enterprise Software chooses a random starting time for you.
</p>
<p>
This choice assumes that your database is deployed to a multi-tenant cluster containing multiple databases. This means that default start times are staggered (offset) to ensure availability. This is done by calculating a random offset which specifies a number of seconds added to the start time.
</p>
<p>
Here's how it works:
</p>
<ul>
<li>
Assume you're enabling the backup at 4:00 pm (1600 hours).
</li>
<li>
You choose to back up your database every 12 hours.
</li>
<li>
Because you didn't set a start time, the cluster randomly chooses an offset of 4,320 seconds (or 72 minutes).
</li>
</ul>
<p>
This means your first periodic backup occurs 72 minutes after the time you enabled periodic backups (4:00Β pmΒ +Β 72Β minutes). Backups repeat every twelve hours at roughly same time.
</p>
<p>
The backup time is imprecise because they're started by a trigger process that runs every five minutes. When the process wakes, it compares the current time to the scheduled backup time. If that time has passed, it triggers a backup.
</p>
<p>
If the previous backup fails, the trigger process retries the backup until it succeeds.
</p>
<p>
In addition, throttling and resource limits also affect backup times.
</p>
<p>
For help with specific backup issues,
<a href="https://redis.com/company/support/">
contact support
</a>
.
</p>
<h2 id="supported-storage-locations">
Supported storage locations
</h2>
<p>
Database backups can be saved to a local mount point, transferred to
<a href="https://en.wikipedia.org/wiki/Uniform_Resource_Identifier">
a URI
</a>
using FTP/SFTP, or stored on cloud provider storage.
</p>
<p>
When saved to a local mount point or a cloud provider, backup locations need to be available to
<a href="/docs/latest/operate/rs/installing-upgrading/install/customize-user-and-group/">
the group and user
</a>
running Redis Enterprise Software,
<code>
redislabs:redislabs
</code>
by default.
</p>
<p>
Redis Enterprise Software needs the ability to view permissions and update objects in the storage location. Implementation details vary according to the provider and your configuration. To learn more, consult the provider's documentation.
</p>
<p>
The following sections provide general guidelines. Because provider features change frequently, use your provider's documentation for the latest info.
</p>
<h3 id="ftp-server">
FTP server
</h3>
<p>
Before enabling backups to an FTP server, verify that:
</p>
<ul>
<li>
Your Redis Enterprise cluster can connect and authenticate to the FTP server.
</li>
<li>
The user specified in the FTP server location has read and write privileges.
</li>
</ul>
<p>
To store your backups on an FTP server, set its
<strong>
Backup Path
</strong>
using the following syntax:
</p>
<p>
<code>
ftp://[username]:[password]@[host]:[port]/[path]/
</code>
</p>
<p>
Where:
</p>
<ul>
<li>
<em>
protocol
</em>
: the server's protocol, can be either
<code>
ftp
</code>
or
<code>
ftps
</code>
.
</li>
<li>
<em>
username
</em>
: your username, if needed.
</li>
<li>
<em>
password
</em>
: your password, if needed.
</li>
<li>
<em>
hostname
</em>
: the hostname or IP address of the server.
</li>
<li>
<em>
port
</em>
: the port number of the server, if needed.
</li>
<li>
<em>
path
</em>
: the backup path, if needed.
</li>
</ul>
<p>
Example:
<code>
ftp://username:[email protected]/home/backups/
</code>
</p>
<p>
The user account needs permission to write files to the server.
</p>
<h3 id="sftp-server">
SFTP server
</h3>
<p>
Before enabling backups to an SFTP server, make sure that:
</p>
<ul>
<li>
<p>
Your Redis Enterprise cluster can connect and authenticate to the SFTP server.
</p>
</li>
<li>
<p>
The user specified in the SFTP server location has read and write privileges.
</p>
</li>
<li>
<p>
The SSH private keys are specified correctly. You can use the key generated by the cluster or specify a custom key.
</p>
<p>
To use the cluster auto generated key:
</p>
<ol>
<li>
<p>
Go to
<strong>
Cluster > Security > Certificates
</strong>
.
</p>
</li>
<li>
<p>
Expand
<strong>
Cluster SSH Public Key
</strong>
.
</p>
</li>
<li>
<p>
Download or copy the cluster SSH public key to the appropriate location on the SFTP server.
</p>
<p>
Use the server documentation to determine the appropriate location for the SSH public key.
</p>
</li>
</ol>
</li>
</ul>
<p>
To backup to an SFTP server, enter the SFTP server location in the format:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">sftp://user:password@host<:custom_port>/path/
</span></span></code></pre>
</div>
<p>
For example:
<code>
sftp://username:[email protected]/home/backups/
</code>
</p>
<h3 id="local-mount-point">
Local mount point
</h3>
<p>
Before enabling periodic backups to a local mount point, verify that:
</p>
<ul>
<li>
The node can connect to the destination server, the one hosting the mount point.
</li>
<li>
The
<code>
redislabs:redislabs
</code>
user has read and write privileges on the local mount point
and on the destination server.
</li>
<li>
The backup location has enough disk space for your backup files. Backup files
are saved with filenames that include the timestamp, which means that earlier backups are not overwritten.
</li>
</ul>
<p>
To back up to a local mount point:
</p>
<ol>
<li>
<p>
On each node in the cluster, create the mount point:
</p>
<ol>
<li>
<p>
Connect to a shell running on Redis Enterprise Software server hosting the node.
</p>
</li>
<li>
<p>
Mount the remote storage to a local mount point.
</p>
<p>
For example:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">sudo mount -t nfs 192.168.10.204:/DataVolume/Public /mnt/Public
</span></span></code></pre>
</div>
</li>
</ol>
</li>
<li>
<p>
In the path for the backup location, enter the mount point.
</p>
<p>
For example:
<code>
/mnt/Public
</code>
</p>
</li>
<li>
<p>
Verify that the user running Redis Enterprise Software has permissions to access and update files in the mount location.
</p>
</li>
</ol>
<h3 id="aws-simple-storage-service">
AWS Simple Storage Service
</h3>
<p>
To store backups in an Amazon Web Services (AWS) Simple Storage Service (S3)
<a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/creating-buckets-s3.html">
bucket
</a>
:
</p>
<ol>
<li>
<p>
Sign in to the
<a href="https://console.aws.amazon.com/">
AWS Management Console
</a>
.
</p>
</li>
<li>
<p>
<a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/creating-buckets-s3.html">
Create an S3 bucket
</a>
if you do not already have one.
</p>
</li>
<li>
<p>
<a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_users_create.html#id_users_create_console">
Create an IAM User
</a>
with permission to add objects to the bucket.
</p>
</li>
<li>
<p>
<a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html#Using_CreateAccessKey">
Create an access key
</a>
for that user if you do not already have one.
</p>
</li>
<li>
<p>
In the Redis Enterprise Software Cluster Manager UI, when you enter the backup location details:
</p>
<ul>
<li>
<p>
Select the
<strong>
AWS S3
</strong>
tab on the
<strong>
Path configuration
</strong>
dialog.
</p>
</li>
<li>
<p>
In the
<strong>
Path
</strong>
field, enter the path of your bucket.
</p>
</li>
<li>
<p>
In the
<strong>
Access Key ID
</strong>
field, enter the access key ID.
</p>
</li>
<li>
<p>
In the
<strong>
Secret Access Key
</strong>
field, enter the secret access key.
</p>
</li>
</ul>
</li>
</ol>
<p>
You can also connect to a storage service that uses the S3 protocol but is not hosted by Amazon AWS. The storage service must have a valid SSL certificate. To connect to an S3-compatible storage location, run
<a href="/docs/latest/operate/rs/references/cli-utilities/rladmin/cluster/config/">
<code>
rladmin cluster config
</code>
</a>
:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">rladmin cluster config s3_url <URL>
</span></span></code></pre>
</div>
<p>
Replace
<code>
<URL>
</code>
with the hostname or IP address of the S3-compatible storage location.
</p>
<h3 id="google-cloud-storage">
Google Cloud Storage
</h3>
<p>
For
<a href="https://developers.google.com/console/">
Google Cloud
</a>
subscriptions, store your backups in a Google Cloud Storage bucket:
</p>
<ol>
<li>
<p>
Sign in to the Google Cloud Platform console.
</p>
</li>
<li>
<p>
<a href="https://cloud.google.com/iam/docs/creating-managing-service-account-keys#creating">
Create a JSON service account key
</a>
if you do not already have one.
</p>
</li>
<li>
<p>
<a href="https://cloud.google.com/storage/docs/creating-buckets#create_a_new_bucket">
Create a bucket
</a>
if you do not already have one.
</p>
</li>
<li>
<p>
<a href="https://cloud.google.com/storage/docs/access-control/using-iam-permissions#bucket-add">
Add a principal
</a>
to your bucket:
</p>
<ul>
<li>
<p>
In the
<strong>
New principals
</strong>
field, add the
<code>
client_email
</code>
from the service account key.
</p>
</li>
<li>
<p>
Select "Storage Legacy Bucket Writer" from the
<strong>
Role
</strong>
list.
</p>
</li>
</ul>
</li>
<li>
<p>
In the Redis Enterprise Software Cluster Manager UI, when you enter the backup location details:
</p>
<ul>
<li>
<p>
Select the
<strong>
Google Cloud Storage
</strong>
tab on the
<strong>
Path configuration
</strong>
dialog.
</p>
</li>
<li>
<p>
In the
<strong>
Path
</strong>
field, enter the path of your bucket.
</p>
</li>
<li>
<p>
In the
<strong>
Client ID
</strong>
field, enter the
<code>
client_id
</code>
from the service account key.
</p>
</li>
<li>
<p>
In the
<strong>
Client Email
</strong>
field, enter the
<code>
client_email
</code>
from the service account key.
</p>
</li>
<li>
<p>
In the
<strong>
Private Key ID
</strong>
field, enter the
<code>
private_key_id
</code>
from the service account key.
</p>
</li>
<li>
<p>
In the
<strong>
Private Key
</strong>
field, enter the
<code>
private_key
</code>
from the service account key.
Replace
<code>
\n
</code>
with new lines.
</p>
</li>
</ul>
</li>
</ol>
<h3 id="azure-blob-storage">
Azure Blob Storage
</h3>
<p>
To store your backup in Microsoft Azure Blob Storage, sign in to the Azure portal and then:
</p>
<p>
To export to Microsoft Azure Blob Storage, sign in to the Azure portal and then:
</p>
<ol>
<li>
<p>
<a href="https://docs.microsoft.com/en-us/azure/storage/common/storage-account-create">
Create an Azure Storage account
</a>
if you do not already have one.
</p>
</li>
<li>
<p>
<a href="https://docs.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-portal#create-a-container">
Create a container
</a>
if you do not already have one.
</p>
</li>
<li>
<p>
<a href="https://docs.microsoft.com/en-us/azure/storage/common/storage-account-keys-manage">
Manage storage account access keys
</a>
to find the storage account name and account keys.
</p>
</li>
<li>
<p>
In the Redis Enterprise Software Cluster Manager UI, when you enter the backup location details:
</p>
<ul>
<li>
<p>
Select the
<strong>
Azure Blob Storage
</strong>
tab on the
<strong>
Path configuration
</strong>
dialog.
</p>
</li>
<li>
<p>
In the
<strong>
Path
</strong>
field, enter the path of your bucket.
</p>
</li>
<li>
<p>
In the
<strong>
Azure Account Name
</strong>
field, enter your storage account name.
</p>
</li>
<li>
<p>
In the
<strong>
Azure Account Key
</strong>
field, enter the storage account key.
</p>
</li>
</ul>
</li>
</ol>
<p>
To learn more, see
<a href="https://docs.microsoft.com/en-us/azure/storage/common/storage-auth">
Authorizing access to data in Azure Storage
</a>
.
</p>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/databases/import-export/schedule-backups/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/commands/psync/.html | <section class="prose w-full py-12">
<h1 class="command-name">
PSYNC
</h1>
<div class="font-semibold text-redis-ink-900">
Syntax
</div>
<pre class="command-syntax">PSYNC replicationid offset</pre>
<dl class="grid grid-cols-[auto,1fr] gap-2 mb-12">
<dt class="font-semibold text-redis-ink-900 m-0">
Available since:
</dt>
<dd class="m-0">
2.8.0
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
Time complexity:
</dt>
<dd class="m-0">
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
ACL categories:
</dt>
<dd class="m-0">
<code>
@admin
</code>
<span class="mr-1 last:hidden">
,
</span>
<code>
@slow
</code>
<span class="mr-1 last:hidden">
,
</span>
<code>
@dangerous
</code>
<span class="mr-1 last:hidden">
,
</span>
</dd>
</dl>
<p>
Initiates a replication stream from the master.
</p>
<p>
The
<code>
PSYNC
</code>
command is called by Redis replicas for initiating a replication
stream from the master.
</p>
<p>
For more information about replication in Redis please check the
<a href="/docs/latest/operate/oss_and_stack/management/replication/">
replication page
</a>
.
</p>
<h2 id="resp2resp3-reply">
RESP2/RESP3 Reply
</h2>
<strong>
Non-standard return value
</strong>
, a bulk transfer of the data followed by
<code>
PING
</code>
and write requests from the master.
<br/>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/commands/psync/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/references/cli-utilities/crdb-cli/crdb/flush/.html | <section class="prose w-full py-12 max-w-none">
<h1>
crdb-cli crdb flush
</h1>
<p class="text-lg -mt-5 mb-10">
Clears all keys from an Active-Active database.
</p>
<p>
Clears all keys from an Active-Active database.
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">crdb-cli crdb flush --crdb-guid <guid>
</span></span><span class="line"><span class="cl"> <span class="o">[</span> --no-wait <span class="o">]</span>
</span></span></code></pre>
</div>
<p>
This command is irreversible. If the data in your database is important, back it up before you flush the database.
</p>
<h3 id="parameters">
Parameters
</h3>
<table>
<thead>
<tr>
<th>
Parameter
</th>
<th>
Value
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
crdb-guid
</td>
<td>
string
</td>
<td>
The GUID of the database (required)
</td>
</tr>
<tr>
<td>
no-wait
</td>
<td>
</td>
<td>
Does not wait for the task to complete
</td>
</tr>
</tbody>
</table>
<h3 id="returns">
Returns
</h3>
<p>
Returns the task ID of the task clearing the database.
</p>
<p>
If
<code>
--no-wait
</code>
is specified, the command exits. Otherwise, it will wait for the database to be cleared and return
<code>
finished
</code>
.
</p>
<h3 id="example">
Example
</h3>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">$ crdb-cli crdb flush --crdb-guid d84f6fe4-5bb7-49d2-a188-8900e09c6f66
</span></span><span class="line"><span class="cl">Task 53cdc59e-ecf5-4564-a8dd-448d71f9e568 created
</span></span><span class="line"><span class="cl"> ---> Status changed: queued -> started
</span></span><span class="line"><span class="cl"> ---> Status changed: started -> finished
</span></span></code></pre>
</div>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/references/cli-utilities/crdb-cli/crdb/flush/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/7.4/references/cli-utilities/crdb-cli/.html | <section class="prose w-full py-12 max-w-none">
<h1>
crdb-cli
</h1>
<p class="text-lg -mt-5 mb-10">
Manage Active-Active databases.
</p>
<p>
An
<a href="/docs/latest/operate/rs/7.4/databases/active-active/">
Active-Active database
</a>
(also known as CRDB or conflict-free replicated database)
replicates your data across Redis Enterprise Software clusters located in geographically distributed regions.
Active-Active databases allow read-write access in all locations, making them ideal for distributed applications that require fast response times and disaster recovery.
</p>
<p>
The Active-Active database on an individual cluster is called an
<strong>
instance
</strong>
.
Each cluster that hosts an instance is called a
<strong>
participating cluster
</strong>
.
</p>
<p>
An Active-Active database requires two or more participating clusters.
Each instance is responsible for updating the instances that reside on other participating clusters with the transactions it receives.
Write conflicts are resolved using
<a href="/docs/latest/operate/rs/7.4/databases/active-active/">
conflict-free replicated data types
</a>
(CRDTs).
</p>
<p>
To programmatically maintain an Active-Active database and its instances, you can use the
<code>
crdb-cli
</code>
command-line tool.
</p>
<h2 id="crdb-cli-commands">
<code>
crdb-cli
</code>
commands
</h2>
<table>
<thead>
<tr>
<th style="text-align:left">
Command
</th>
<th style="text-align:left">
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">
<a href="/docs/latest/operate/rs/7.4/references/cli-utilities/crdb-cli/crdb/">
crdb
</a>
</td>
<td style="text-align:left">
Manage Active-Active databases.
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/operate/rs/7.4/references/cli-utilities/crdb-cli/task/">
task
</a>
</td>
<td style="text-align:left">
Manage Active-Active tasks.
</td>
</tr>
</tbody>
</table>
<h2 id="use-the-crdb-cli">
Use the crdb-cli
</h2>
<p>
To use the
<code>
crdb-cli
</code>
tool, use SSH to sign in to a Redis Enterprise host with a user that belongs to the group that Redis Enterprise Software was installed with (Default:
<strong>
redislabs
</strong>
).
If you sign in with a non-root user, you must add
<code>
/opt/redislabs/bin/
</code>
to your
<code>
PATH
</code>
environment variables.
</p>
<p>
<code>
crdb-cli
</code>
commands use the syntax:
<code>
crdb-cli <command> <arguments>
</code>
to let you:
</p>
<ul>
<li>
Create, list, update, flush, or delete an Active-Active database.
</li>
<li>
Add or remove an instance of the Active-Active database on a specific cluster.
</li>
</ul>
<p>
Each command creates a task.
</p>
<p>
By default, the command runs immediately and displays the result in the output.
</p>
<p>
If you use the
<nobr>
<code>
--no-wait
</code>
</nobr>
flag, the command runs in the background so that your application is not delayed by the response.
</p>
<p>
Use the
<a href="/docs/latest/operate/rs/7.4/references/cli-utilities/crdb-cli/task/">
<code>
crdb-cli task
</code>
commands
</a>
to manage Active-Active database tasks.
</p>
<p>
For each
<code>
crdb-cli
</code>
command, you can use
<nobr>
<code>
--help
</code>
</nobr>
for additional information about the command.
</p>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/7.4/references/cli-utilities/crdb-cli/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/7.4/installing-upgrading/install/plan-deployment/configuring-aws-instances/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Configure AWS EC2 instances for Redis Enterprise Software
</h1>
<p class="text-lg -mt-5 mb-10">
Considerations for installing and running Redis Enterprise Software on Amazon Elastic Cloud Compute (EC2) instances.
</p>
<p>
There are some special considerations for installing
and running Redis Enterprise Software on Amazon Elastic Cloud Compute (EC2) instances.
</p>
<p>
These include:
</p>
<ul>
<li>
<a href="#storage">
Storage considerations
</a>
</li>
<li>
<a href="#instance-types">
Instance types
</a>
</li>
<li>
<a href="#security">
Security group configuration
</a>
</li>
</ul>
<h2 id="storage">
Storage considerations
</h2>
<p>
AWS EC2 instances are ephemeral, but your persistent database storage should
not be. If you require a persistent storage location for your database,
the storage must be located outside of the instance. When you
set up an instance, make sure it has a properly sized EBS-backed volume
connected. When you set up Redis Enterprise Software on the instance, make sure that
<a href="/docs/latest/operate/rs/7.4/installing-upgrading/install/plan-deployment/persistent-ephemeral-storage/">
the
persistence storage
</a>
is configured to use this volume.
</p>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Note:
</div>
<p>
After
<a href="/docs/latest/operate/rs/7.4/installing-upgrading/">
installing the Redis Enterprise SoftwareΒ package
</a>
on the instance
and
<strong>
before
</strong>
running through
<a href="/docs/latest/operate/rs/7.4/clusters/new-cluster-setup/">
the setup process
</a>
,
you must give the group
<code>
redislabs
</code>
permission to the EBS volume by
running the following command from the OS command-line interface (CLI):
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">chown redislabs:redislabs /< ebs folder name>
</span></span></code></pre>
</div>
</div>
</div>
<p>
Another feature that may be of importance to you is the use of
Provisioned IOPS for EBS-backed volumes. Provisioned IOPS guarantee a
certain level of disk performance. There are two features in Redis Enterprise Software where
this feature could be critical to use:
</p>
<ol>
<li>
When using
<a href="/docs/latest/operate/rs/7.4/databases/auto-tiering/">
Auto Tiering
</a>
</li>
<li>
When using AOF on every write and there is a high write load. In
this case, the provisioned IOPS should be on the nodes used as
replicas in the cluster.
</li>
</ol>
<h2 id="instance-types">
Instance types
</h2>
<p>
Choose an instance type that has (at minimum) enough free memory and
disk space to meet the Redis Enterprise Software
<a href="/docs/latest/operate/rs/7.4/installing-upgrading/install/plan-deployment/hardware-requirements/">
hardware
requirements
</a>
.
</p>
<p>
In addition, some instance types are optimized for EBS-backed volumes
and some are not. If you are using persistent storage, you should use an
instance type that is, especially if disk drain rate matters to your database
implementation.
</p>
<h2 id="security">
Security group configuration
</h2>
<p>
When configuring the security group:
</p>
<ul>
<li>
Define a custom TCP rule for port 8443 to allow web browser access
to the Redis Enterprise Software Cluster Manager UI from the IP address range you use to
access the Cluster Manager UI.
</li>
<li>
If you are using the DNS resolving option with Redis Enterprise Software, define a DNS UDP
rule for port 53 to allow access to the databases' endpoints by
using the
<a href="/docs/latest/operate/rs/7.4/networking/cluster-dns/">
DNS resolving mechanism
</a>
.
</li>
<li>
To create a cluster that has multiple nodes all running as instances on AWS,
you need to define a security group that has an All TCP rule for all ports, 0 - 65535,
and add it to all instances that are part of the cluster.
This ensures that all nodes are able to communicate with each other.
To limit the number of open ports, you can open only the
<a href="/docs/latest/operate/rs/7.4/networking/port-configurations/">
ports used by Redis Enterprise Software
</a>
.
</li>
</ul>
<p>
After successfully launching the instances:
</p>
<ol>
<li>
Install Redis Enterprise Software from the
<a href="/docs/latest/operate/rs/7.4/installing-upgrading/">
Linux package or AWS AMI
</a>
.
</li>
<li>
<a href="/docs/latest/operate/rs/7.4/clusters/new-cluster-setup/">
Set up the cluster
</a>
.
</li>
</ol>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/7.4/installing-upgrading/install/plan-deployment/configuring-aws-instances/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/7.4/installing-upgrading/upgrading/upgrade-os/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Upgrade a cluster's operating system
</h1>
<p class="text-lg -mt-5 mb-10">
Upgrade a Redis Enterprise Software cluster's operating system to a later major version.
</p>
<p>
To upgrade the operating system (OS) on a Redis Enterprise Software cluster to a later major version, perform a rolling upgrade. Because you upgrade one node at a time, you can upgrade your cluster's OS without downtime.
</p>
<h2 id="prerequisites">
Prerequisites
</h2>
<p>
Before you upgrade a cluster's operating system:
</p>
<ol>
<li>
<p>
<a href="/docs/latest/operate/rs/7.4/installing-upgrading/upgrading/upgrade-cluster/">
Upgrade all nodes in the cluster
</a>
to a Redis Enterprise Software version that supports the OS's current version and upgrade version.
</p>
<p>
To learn which versions of Redis Enterprise Software support specific OS versions, see
<a href="/docs/latest/operate/rs/7.4/references/supported-platforms/#supported-platforms">
Supported platforms
</a>
.
</p>
</li>
<li>
<p>
If the cluster contains databases that use modules:
</p>
<ol>
<li>
<p>
Update all nodes in the cluster to
<a href="/docs/latest/operate/rs/release-notes/rs-7-2-4-releases/">
Redis Enterprise Software version 7.2.4-52
</a>
or later before you upgrade the OS.
</p>
</li>
<li>
<p>
Check the status of modules using
<a href="/docs/latest/operate/rs/7.4/references/cli-utilities/rladmin/">
<code>
rladmin
</code>
</a>
:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">rladmin status modules
</span></span></code></pre>
</div>
<p>
The output lists the module versions installed on the cluster and the module versions used by existing databases:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">CLUSTER MODULES:
</span></span><span class="line"><span class="cl">MODULE VERSION
</span></span><span class="line"><span class="cl">RedisBloom 2.6.3
</span></span><span class="line"><span class="cl">RediSearch <span class="m">2</span> 2.8.4
</span></span><span class="line"><span class="cl">RedisGears 2.0.12
</span></span><span class="line"><span class="cl">RedisGraph 2.10.12
</span></span><span class="line"><span class="cl">RedisJSON 2.6.6
</span></span><span class="line"><span class="cl">RedisTimeSeries 1.10.6
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">DATABASE MODULES:
</span></span><span class="line"><span class="cl">DB:ID NAME MODULE VERSION ARGS STATUS
</span></span><span class="line"><span class="cl">db:1 db1 RediSearch <span class="m">2</span> 2.6.9 PARTITIONS AUTO OK, OLD MODULE VERSION
</span></span><span class="line"><span class="cl">db:1 db1 RedisJSON 2.4.7 OK, OLD MODULE VERSION
</span></span></code></pre>
</div>
</li>
<li>
<p>
If any databases use custom modules, manually uploaded modules, or modules marked with
<code>
OLD MODULE VERSION
</code>
, upload module packages for the OS upgrade version to a cluster node. See
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/install/add-module-to-cluster/">
Install a module on a cluster
</a>
for instructions.
</p>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Note:
</div>
<p>
The uploaded module packages have the following requirements:
</p>
<ul>
<li>
<p>
The module is compiled for the OS upgrade version.
</p>
</li>
<li>
<p>
The module version matches the version currently used by databases.
</p>
</li>
</ul>
</div>
</div>
</li>
</ol>
</li>
<li>
<p>
If the cluster uses custom directories, make sure the OS upgrade version also supports custom directories, and specify the same custom directories during installation for all nodes. See
<a href="/docs/latest/operate/rs/7.4/installing-upgrading/install/customize-install-directories/">
Customize installation directories
</a>
for details.
</p>
</li>
</ol>
<h2 id="perform-os-rolling-upgrade">
Perform OS rolling upgrade
</h2>
<p>
To upgrade the cluster's operating system, use one of the following rolling upgrade methods:
</p>
<ul>
<li>
<p>
<a href="#extra-node-upgrade">
Extra node method
</a>
- recommended if you have additional resources available
</p>
</li>
<li>
<p>
<a href="#replace-node-upgrade">
Replace node method
</a>
- recommended if you cannot temporarily allocate additional resources
</p>
</li>
</ul>
<h3 id="extra-node-upgrade">
Extra node upgrade method
</h3>
<ol>
<li>
<p>
Create a node with the OS upgrade version.
</p>
</li>
<li>
<p>
<a href="/docs/latest/operate/rs/7.4/installing-upgrading/install/install-on-linux/">
Install the cluster's current Redis Enterprise Software version
</a>
on the new node using the installation package for the OS upgrade version.
</p>
</li>
<li>
<p>
<a href="/docs/latest/operate/rs/7.4/clusters/add-node/">
Add the new node
</a>
to the cluster.
</p>
</li>
<li>
<p>
<a href="/docs/latest/operate/rs/7.4/clusters/remove-node/#remove-a-node">
Remove one node
</a>
running the earlier OS version from the cluster.
</p>
</li>
<li>
<p>
Repeat the previous steps until all nodes with the earlier OS version are removed.
</p>
</li>
</ol>
<h3 id="replace-node-upgrade">
Replace node upgrade method
</h3>
<ol>
<li>
<p>
<a href="/docs/latest/operate/rs/7.4/clusters/remove-node/#remove-a-node">
Remove a node
</a>
with the earlier OS version from the cluster.
</p>
</li>
<li>
<p>
Uninstall Redis Enterprise Software from the removed node:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">sudo ./rl_uninstall.sh
</span></span></code></pre>
</div>
</li>
<li>
<p>
Either upgrade the existing node to the OS upgrade version, or create a new node with the OS upgrade version.
</p>
</li>
<li>
<p>
<a href="/docs/latest/operate/rs/7.4/installing-upgrading/install/install-on-linux/">
Install the cluster's current Redis Enterprise Software version
</a>
on the upgraded node using the installation package for the OS upgrade version.
</p>
</li>
<li>
<p>
<a href="/docs/latest/operate/rs/7.4/clusters/add-node/">
Add the new node
</a>
to the cluster.
</p>
<p>
If you want to reuse the removed node's ID when you add the node to the cluster, run
<a href="/docs/latest/operate/rs/7.4/references/cli-utilities/rladmin/cluster/join/">
<code>
rladmin cluster join
</code>
</a>
with the
<code>
replace_node
</code>
flag:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">rladmin cluster join nodes <cluster_member_ip_address> username <username> password <password> replace_node <node_id>
</span></span></code></pre>
</div>
</li>
<li>
<p>
Verify node health:
</p>
<ol>
<li>
<p>
Run
<code>
rlcheck
</code>
on all nodes:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">rlcheck
</span></span></code></pre>
</div>
<p>
The output lists the result of each verification test:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl"><span class="c1">##### Welcome to Redis Enterprise Cluster settings verification utility ####</span>
</span></span><span class="line"><span class="cl">Running test: verify_bootstrap_status
</span></span><span class="line"><span class="cl"> PASS
</span></span><span class="line"><span class="cl">...
</span></span><span class="line"><span class="cl">Running test: verify_encrypted_gossip
</span></span><span class="line"><span class="cl"> PASS
</span></span><span class="line"><span class="cl">Summary:
</span></span><span class="line"><span class="cl">-------
</span></span><span class="line"><span class="cl">ALL TESTS PASSED.
</span></span></code></pre>
</div>
<p>
For healthy nodes, the expected output is
<code>
ALL TESTS PASSED
</code>
.
</p>
</li>
<li>
<p>
Run
<a href="/docs/latest/operate/rs/7.4/references/cli-utilities/rladmin/status/">
<code>
rladmin status
</code>
</a>
on the new node:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">rladmin status extra all
</span></span></code></pre>
</div>
<p>
The expected output is the
<code>
OK
</code>
status for the cluster, nodes, endpoints, and shards:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">CLUSTER:
</span></span><span class="line"><span class="cl">OK. Cluster master: <span class="m">2</span> <span class="o">(</span><IP.address><span class="o">)</span>
</span></span><span class="line"><span class="cl">Cluster health: OK, <span class="o">[</span>0, 0.0, 0.0<span class="o">]</span>
</span></span><span class="line"><span class="cl">failures/minute - avg1 0.00, avg15 0.00, avg60 0.00.
</span></span><span class="line"><span class="cl">...
</span></span></code></pre>
</div>
</li>
</ol>
</li>
<li>
<p>
Repeat the previous steps until all nodes with the earlier OS version are replaced.
</p>
</li>
</ol>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/7.4/installing-upgrading/upgrading/upgrade-os/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/7.4/references/rest-api/requests/cluster/module-capabilities/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Cluster module capabilities requests
</h1>
<p class="text-lg -mt-5 mb-10">
Redis module capabilities requests
</p>
<table>
<thead>
<tr>
<th>
Method
</th>
<th>
Path
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="#get-cluster-module-capabilities">
GET
</a>
</td>
<td>
<code>
/v1/cluster/module-capabilities
</code>
</td>
<td>
List possible Redis module capabilities
</td>
</tr>
</tbody>
</table>
<h2 id="get-cluster-module-capabilities">
List Redis module capabilities
</h2>
<pre><code>GET /v1/cluster/module-capabilities
</code></pre>
<p>
List possible Redis module capabilities.
</p>
<h4 id="required-permissions">
Required permissions
</h4>
<table>
<thead>
<tr>
<th>
Permission name
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="/docs/latest/operate/rs/7.4/references/rest-api/permissions/#view_cluster_modules">
view_cluster_modules
</a>
</td>
</tr>
</tbody>
</table>
<h3 id="get-request">
Request
</h3>
<h4 id="example-http-request">
Example HTTP request
</h4>
<pre><code>GET /cluster/module-capabilities
</code></pre>
<h4 id="request-headers">
Request headers
</h4>
<table>
<thead>
<tr>
<th>
Key
</th>
<th>
Value
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
Host
</td>
<td>
cnm.cluster.fqdn
</td>
<td>
Domain name
</td>
</tr>
<tr>
<td>
Accept
</td>
<td>
*/*
</td>
<td>
Accepted media type
</td>
</tr>
</tbody>
</table>
<h3 id="get-response">
Response
</h3>
<p>
Returns a JSON object that contains a list of capability names and descriptions.
</p>
<h4 id="example-json-body">
Example JSON body
</h4>
<div class="highlight">
<pre class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"all_capabilities"</span><span class="p">:</span> <span class="p">[</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span><span class="nt">"name"</span><span class="p">:</span> <span class="s2">"types"</span><span class="p">,</span> <span class="nt">"desc"</span><span class="p">:</span> <span class="s2">"module has its own types and not only operate on existing redis types"</span><span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span><span class="nt">"name"</span><span class="p">:</span> <span class="s2">"no_multi_key"</span><span class="p">,</span> <span class="nt">"desc"</span><span class="p">:</span> <span class="s2">"module has no methods that operate on multiple keys"</span><span class="p">}</span>
</span></span><span class="line"><span class="cl"> <span class="s2">"// additional capabilities..."</span>
</span></span><span class="line"><span class="cl"> <span class="p">]</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span></code></pre>
</div>
<h3 id="get-status-codes">
Status codes
</h3>
<table>
<thead>
<tr>
<th>
Code
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1">
200 OK
</a>
</td>
<td>
No error
</td>
</tr>
</tbody>
</table>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/7.4/references/rest-api/requests/cluster/module-capabilities/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/7.4/references/rest-api/objects/node/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Node object
</h1>
<p class="text-lg -mt-5 mb-10">
An object that represents a node in the cluster
</p>
<p>
An API object that represents a node in the cluster.
</p>
<table>
<thead>
<tr>
<th>
Name
</th>
<th>
Type/Value
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
uid
</td>
<td>
integer
</td>
<td>
Cluster unique ID of node (read-only)
</td>
</tr>
<tr>
<td>
accept_servers
</td>
<td>
boolean (default:Β true)
</td>
<td>
The node only accepts new shards if
<code>
accept_servers
</code>
is
<code>
true
</code>
</td>
</tr>
<tr>
<td>
addr
</td>
<td>
string
</td>
<td>
Internal IP address of node
</td>
</tr>
<tr>
<td>
architecture
</td>
<td>
string
</td>
<td>
Hardware architecture (read-only)
</td>
</tr>
<tr>
<td>
bigredis_storage_path
</td>
<td>
string
</td>
<td>
Flash storage path (read-only)
</td>
</tr>
<tr>
<td>
bigstore_driver
</td>
<td>
'ibm-capi-ga1'
<br/>
'ibm-capi-ga2'
<br/>
'ibm-capi-ga4'
<br/>
'speedb'
<br/>
'rocksdb'
</td>
<td>
Bigstore driver name or none (deprecated as of Redis Enterprise v7.2, use the
<a href="/docs/latest/operate/rs/7.4/references/rest-api/objects/cluster/">
cluster object
</a>
's bigstore_driver instead)
</td>
</tr>
<tr>
<td>
bigstore_size
</td>
<td>
integer
</td>
<td>
Storage size of bigstore storage (read-only)
</td>
</tr>
<tr>
<td>
cores
</td>
<td>
integer
</td>
<td>
Total number of CPU cores (read-only)
</td>
</tr>
<tr>
<td>
ephemeral_storage_path
</td>
<td>
string
</td>
<td>
Ephemeral storage path (read-only)
</td>
</tr>
<tr>
<td>
ephemeral_storage_size
</td>
<td>
number
</td>
<td>
Ephemeral storage size (bytes) (read-only)
</td>
</tr>
<tr>
<td>
external_addr
</td>
<td>
complex object
</td>
<td>
External IP addresses of node.
<code>
GET
</code>
<code>
/jsonschema
</code>
to retrieve the object's structure.
</td>
</tr>
<tr>
<td>
max_listeners
</td>
<td>
integer
</td>
<td>
Maximum number of listeners on the node
</td>
</tr>
<tr>
<td>
max_redis_servers
</td>
<td>
integer
</td>
<td>
Maximum number of shards on the node
</td>
</tr>
<tr>
<td>
os_family
</td>
<td>
'rhel'
<br/>
'ubuntu'
<br/>
'amzn'
</td>
<td>
Operating system family (read-only)
</td>
</tr>
<tr>
<td>
os_name
</td>
<td>
string
</td>
<td>
Operating system name (read-only)
</td>
</tr>
<tr>
<td>
os_semantic_version
</td>
<td>
string
</td>
<td>
Full version number (read-only)
</td>
</tr>
<tr>
<td>
os_version
</td>
<td>
string
</td>
<td>
Installed OS version (human-readable) (read-only)
</td>
</tr>
<tr>
<td>
persistent_storage_path
</td>
<td>
string
</td>
<td>
Persistent storage path (read-only)
</td>
</tr>
<tr>
<td>
persistent_storage_size
</td>
<td>
number
</td>
<td>
Persistent storage size (bytes) (read- only)
</td>
</tr>
<tr>
<td>
public_addr
</td>
<td>
string
</td>
<td>
Public IP address of node (deprecated as of Redis Enterprise v4.3.3, use external_addr instead)
</td>
</tr>
<tr>
<td>
rack_id
</td>
<td>
string
</td>
<td>
Rack ID where node is installed
</td>
</tr>
<tr>
<td>
recovery_path
</td>
<td>
string
</td>
<td>
Recovery files path
</td>
</tr>
<tr>
<td>
shard_count
</td>
<td>
integer
</td>
<td>
Number of shards on the node (read-only)
</td>
</tr>
<tr>
<td>
shard_list
</td>
<td>
array of integers
</td>
<td>
Cluster unique IDs of all node shards
</td>
</tr>
<tr>
<td>
software_version
</td>
<td>
string
</td>
<td>
Installed Redis Enterprise cluster software version (read-only)
</td>
</tr>
<tr>
<td>
status
</td>
<td>
'active'
<br/>
'decommissioning'
<br/>
'down'
<br/>
'provisioning'
</td>
<td>
Node status (read-only)
</td>
</tr>
<tr>
<td>
supported_database_versions
</td>
<td>
<pre><code>
[{
"db_type": string,
"version": string
}, ...]
</code></pre>
</td>
<td>
Versions of Redis Community Edition databases supported by Redis Enterprise Software on the node (read-only)
<br/>
<strong>
db_type
</strong>
: Type of database
<br/>
<strong>
version
</strong>
: Version of database
</td>
</tr>
<tr>
<td>
system_time
</td>
<td>
string
</td>
<td>
System time (UTC) (read-only)
</td>
</tr>
<tr>
<td>
total_memory
</td>
<td>
integer
</td>
<td>
Total memory of node (bytes) (read-only)
</td>
</tr>
<tr>
<td>
uptime
</td>
<td>
integer
</td>
<td>
System uptime (seconds) (read-only)
</td>
</tr>
<tr>
<td>
use_internal_ipv6
</td>
<td>
boolean (default:Β false)
</td>
<td>
Node uses IPv6 for internal communication. Value is taken from bootstrap identity (read-only)
</td>
</tr>
</tbody>
</table>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/7.4/references/rest-api/objects/node/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/oss_and_stack/stack-with-enterprise/deprecated-features/triggers-and-functions/concepts/cluster_support/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Cluster support
</h1>
<p class="text-lg -mt-5 mb-10">
Cluster support for triggers and functions
</p>
<div class="banner-article rounded-md">
<p>
The Redis Stack triggers and functions feature preview has ended and it will not be promoted to GA.
</p>
</div>
<p>
<strong>
Notice
</strong>
: On a Redis Community Edition cluster, before executing any gears function, you must send a
<code>
REDISGEARS_2.REFRESHCLUSTER
</code>
command to all the shards so that they will be aware of the cluster topology. Without this step, each shard will act as a single Redis Community Edition instance.
</p>
<p>
Triggers and functions support cross-shard operation on Redis clusters. This means that it is possible to call a function that will be invoked on another shard. We call such a function a remote function.
</p>
<p>
Just like local functions, remote function must be declared on library load time using
<code>
redis.registerClusterFunction
</code>
API. The following example declares a remote function that returns the number of keys on the shard:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-js" data-lang="js"><span class="line"><span class="cl"><span class="nx">redis</span><span class="p">.</span><span class="nx">registerClusterFunction</span><span class="p">(</span><span class="s2">"dbsize"</span><span class="p">,</span> <span class="kr">async</span><span class="p">(</span><span class="nx">async_client</span><span class="p">)</span> <span class="p">=></span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="nx">client</span><span class="p">.</span><span class="nx">block</span><span class="p">((</span><span class="nx">async_client</span><span class="p">)</span> <span class="p">=></span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="nx">client</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="s2">"dbsize"</span><span class="p">).</span><span class="nx">toString</span><span class="p">();</span>
</span></span><span class="line"><span class="cl"> <span class="p">});</span>
</span></span><span class="line"><span class="cl"><span class="p">});</span>
</span></span></code></pre>
</div>
<p>
<code>
redis.registerClusterFunction
</code>
is passed the remote function name, which will be used later to call the remote function, and the remote function code. The remote function must be a Coroutine (async function) and it is executed in the background on the remote shard. For more information about async function, please refer to
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/deprecated-features/triggers-and-functions/concepts/sync_async/">
sync and async
</a>
page.
</p>
<p>
We have couple of options for calling a remote function. These options are exposed through the async client that is given to a Coroutine:
</p>
<ul>
<li>
<code>
async_client.runOnShards
</code>
- run the remote function on all the shards (including the current shard). Returns a promise that, once resolved, will give two nested arrays, the first contains another array with the results from all the shards and the other contains an array of errors (
<code>
[[res1, res2, ...],[err1, err2, ..]]
</code>
).
</li>
<li>
<code>
async_client.runOnKey
</code>
- run the remote function on the shard responsible for a given key. Returns a promise that, once resolved, will give the result from the remote function execution or raise an exception in the case of an error.
</li>
</ul>
<p>
The following example registers a function that will return the total number of keys on the cluster. The function will use the remote function defined above:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-js" data-lang="js"><span class="line"><span class="cl"><span class="nx">redis</span><span class="p">.</span><span class="nx">registerAsyncFunction</span><span class="p">(</span><span class="s2">"my_dbsize"</span><span class="p">,</span> <span class="kr">async</span><span class="p">(</span><span class="nx">async_client</span><span class="p">)</span> <span class="p">=></span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="kd">let</span> <span class="nx">res</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">async_client</span><span class="p">.</span><span class="nx">runOnShards</span><span class="p">(</span><span class="s2">"dbsize"</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kd">let</span> <span class="nx">results</span> <span class="o">=</span> <span class="nx">res</span><span class="p">[</span><span class="mi">0</span><span class="p">];</span>
</span></span><span class="line"><span class="cl"> <span class="kd">let</span> <span class="nx">errors</span> <span class="o">=</span> <span class="nx">res</span><span class="p">[</span><span class="mi">1</span><span class="p">];</span>
</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="p">(</span><span class="nx">errors</span><span class="p">.</span><span class="nx">length</span> <span class="o">></span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="nx">errors</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl"> <span class="kd">let</span> <span class="nx">sum</span> <span class="o">=</span> <span class="nx">BigInt</span><span class="p">(</span><span class="mi">0</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="nx">results</span><span class="p">.</span><span class="nx">forEach</span><span class="p">((</span><span class="nx">element</span><span class="p">)</span> <span class="p">=></span> <span class="nx">sum</span><span class="o">+=</span><span class="nx">BigInt</span><span class="p">(</span><span class="nx">element</span><span class="p">));</span>
</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="nx">sum</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="p">});</span>
</span></span></code></pre>
</div>
<p>
First, the function executes a remote function on all shards that returns the number of keys on each shard, then the function adds all the results and returns total number of keys for all shards.
</p>
<p>
Here's the complete example:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-js" data-lang="js"><span class="line"><span class="cl"><span class="err">#</span><span class="o">!</span><span class="nx">js</span> <span class="nx">name</span><span class="o">=</span><span class="nx">lib</span> <span class="nx">api_version</span><span class="o">=</span><span class="mf">1.0</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="nx">redis</span><span class="p">.</span><span class="nx">registerClusterFunction</span><span class="p">(</span><span class="s2">"dbsize"</span><span class="p">,</span> <span class="kr">async</span><span class="p">(</span><span class="nx">client</span><span class="p">)</span> <span class="p">=></span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="nx">client</span><span class="p">.</span><span class="nx">block</span><span class="p">((</span><span class="nx">client</span><span class="p">)</span> <span class="p">=></span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="nx">client</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="s2">"dbsize"</span><span class="p">).</span><span class="nx">toString</span><span class="p">();</span>
</span></span><span class="line"><span class="cl"> <span class="p">});</span>
</span></span><span class="line"><span class="cl"><span class="p">});</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="nx">redis</span><span class="p">.</span><span class="nx">registerAsyncFunction</span><span class="p">(</span><span class="s2">"test"</span><span class="p">,</span> <span class="kr">async</span><span class="p">(</span><span class="nx">async_client</span><span class="p">)</span> <span class="p">=></span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="kd">let</span> <span class="nx">res</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">async_client</span><span class="p">.</span><span class="nx">runOnShards</span><span class="p">(</span><span class="s2">"dbsize"</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kd">let</span> <span class="nx">results</span> <span class="o">=</span> <span class="nx">res</span><span class="p">[</span><span class="mi">0</span><span class="p">];</span>
</span></span><span class="line"><span class="cl"> <span class="kd">let</span> <span class="nx">errors</span> <span class="o">=</span> <span class="nx">res</span><span class="p">[</span><span class="mi">1</span><span class="p">];</span>
</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="p">(</span><span class="nx">errors</span><span class="p">.</span><span class="nx">length</span> <span class="o">></span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="nx">errors</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl"> <span class="kd">let</span> <span class="nx">sum</span> <span class="o">=</span> <span class="nx">BigInt</span><span class="p">(</span><span class="mi">0</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="nx">results</span><span class="p">.</span><span class="nx">forEach</span><span class="p">((</span><span class="nx">element</span><span class="p">)</span> <span class="p">=></span> <span class="nx">sum</span><span class="o">+=</span><span class="nx">BigInt</span><span class="p">(</span><span class="nx">element</span><span class="p">));</span>
</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="nx">sum</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="p">});</span>
</span></span></code></pre>
</div>
<h2 id="arguments-and-results-serialization">
Arguments and results serialization
</h2>
<p>
It is possible to pass arguments to the remote function. The arguments will be given to the remote function after the
<code>
async_client
</code>
. The following example shows how to get a value of a key from any shard in the cluster:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-js" data-lang="js"><span class="line"><span class="cl"><span class="err">#</span><span class="o">!</span><span class="nx">js</span> <span class="nx">name</span><span class="o">=</span><span class="nx">lib</span> <span class="nx">api_version</span><span class="o">=</span><span class="mf">1.0</span>
</span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">remote_get</span> <span class="o">=</span> <span class="s2">"remote_get"</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="nx">redis</span><span class="p">.</span><span class="nx">registerClusterFunction</span><span class="p">(</span><span class="nx">remote_get</span><span class="p">,</span> <span class="kr">async</span><span class="p">(</span><span class="nx">client</span><span class="p">,</span> <span class="nx">key</span><span class="p">)</span> <span class="p">=></span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="kd">let</span> <span class="nx">res</span> <span class="o">=</span> <span class="nx">client</span><span class="p">.</span><span class="nx">block</span><span class="p">((</span><span class="nx">client</span><span class="p">)</span> <span class="p">=></span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="nx">client</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="s2">"get"</span><span class="p">,</span> <span class="nx">key</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="p">});</span>
</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="nx">res</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="p">});</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="nx">redis</span><span class="p">.</span><span class="nx">registerAsyncFunction</span><span class="p">(</span><span class="s2">"test"</span><span class="p">,</span> <span class="kr">async</span> <span class="p">(</span><span class="nx">async_client</span><span class="p">)</span> <span class="p">=></span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="kr">await</span> <span class="nx">async_client</span><span class="p">.</span><span class="nx">runOnKey</span><span class="p">(</span><span class="s2">"x"</span><span class="p">,</span> <span class="nx">remote_get</span><span class="p">,</span> <span class="s2">"x"</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="p">});</span>
</span></span></code></pre>
</div>
<p>
The function
<code>
test
</code>
will return the value of
<code>
x
</code>
regardless of which shard the function was executed on.
</p>
<p>
The remote function arguments and results are serialized in the following way:
</p>
<ol>
<li>
If the argument is of type
<code>
ArrayBuffer
</code>
, the data will be sent as is.
</li>
<li>
Otherwise, RedisGears will try to serialize the give arguments (or the return value) as JSON using
<code>
JSON.stringify
</code>
. A serialization failure will cause an error to be raised.
</li>
</ol>
<h2 id="execution-timeout">
Execution timeout
</h2>
<p>
Remote functions will not be permitted to run forever and will timeout. The timeout period can be configured using
<a href="/docs/latest/develop/interact/programmability/triggers-and-functions/configuration/#remote-task-default-timeout">
remote-task-default-timeout
</a>
.
When using
<code>
async_client.runOnShards
</code>
API, the timeout will be added as error to the error array. When using
<code>
async_client.runOnKey
</code>
, a timeout will cause an exception to be raised.
</p>
<h2 id="remote-function-limitations">
Remote function limitations
</h2>
<p>
All the limitations listed on
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/deprecated-features/triggers-and-functions/concepts/sync_async/">
coroutines
</a>
also apply to remote functions. Remote function also come with some extra limitations:
</p>
<ul>
<li>
Remote functions can only perform read operations. An attempt to perform a write operation will result in an error.
</li>
<li>
Remote function are not guaranteed to succeed (if the shard crashed for example). In such cases a timeout error will be given.
</li>
</ul>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/oss_and_stack/stack-with-enterprise/deprecated-features/triggers-and-functions/concepts/cluster_support/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/commands/groupjson.html | <section class="prose w-full py-12">
<h1>
Commands
</h1>
</section>
|
https://redis.io/docs/latest/operate/redisinsight/proxy/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Subpath proxy
</h1>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Note:
</div>
Subpath proxy is available only on the Docker version.
</div>
</div>
<p>
You can enable the subpath proxy by setting the
<code>
RI_PROXY_PATH
</code>
environment variable.
</p>
<p>
When
<code>
RI_PROXY_PATH
</code>
is being set with a path, Redis Insight is
accessible only on that subpath. The default routes are given the
provided prefix subpath. There isnβt any way to add another proxy behind
this one unless the same subpath is used for the new one.
</p>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Note:
</div>
Once you set the static subpath environment variable, Redis Insight is only reachable on the provided subpath. The default endpoint won't work.
</div>
</div>
<h2 id="using-redis-insight-behind-a-reverse-proxy">
Using Redis Insight behind a reverse proxy
</h2>
<p>
When you configure Redis Insight to run behind a reverse proxy like NGINX, set the request timeout to over 30 seconds on the reverse proxy because some requests can be long-running.
</p>
<p>
Redis Insight also allows you to manage its connection timeout on the form to configure the connection details. The default timeout is 30 seconds.
</p>
<p>
Hosting Redis Insight behind a prefix path (path-rewriting) is not supported.
</p>
<h2 id="example">
Example
</h2>
<h3 id="docker-compose-file">
Docker compose file
</h3>
<div class="highlight">
<pre class="chroma"><code class="language-yaml" data-lang="yaml"><span class="line"><span class="cl"><span class="nt">version</span><span class="p">:</span><span class="w"> </span><span class="s2">"3.7"</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">services</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">redis-stack</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">image</span><span class="p">:</span><span class="w"> </span><span class="l">redis/redis-stack-server</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">networks</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="l">redis-network</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">redisinsight</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">image</span><span class="p">:</span><span class="w"> </span><span class="l">redis/redisinsight</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">environment</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="l">RIPORT=${RIPORT:-5540}</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="l">RITRUSTEDORIGINS=http://localhost:9000</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">depends_on</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="l">redis-stack</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">networks</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="l">redis-network</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">nginx-basicauth</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">image</span><span class="p">:</span><span class="w"> </span><span class="l">nginx</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">volumes</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="l">./nginx-basic-auth.conf.template:/etc/nginx/templates/nginx-basic-auth.conf.template</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">ports</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="s2">"${NGINX_PORT:-9000}:${NGINX_PORT:-9000}"</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">environment</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="l">FORWARD_HOST=redisinsight</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="l">FORWARD_PORT=${RIPORT:-5540}</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="l">NGINX_PORT=${NGINX_PORT:-9000}</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="l">BASIC_USERNAME=${BASIC_USERNAME:-redis}</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="l">BASIC_PASSWORD=${BASIC_PASSWORD:-password}</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">command</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="l">bash</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span>- -<span class="l">c</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="p">|</span><span class="sd">
</span></span></span><span class="line"><span class="cl"><span class="sd"> printf "$$BASIC_USERNAME:$$(openssl passwd -1 $$BASIC_PASSWORD)\n" >> /etc/nginx/.htpasswd
</span></span></span><span class="line"><span class="cl"><span class="sd"> /docker-entrypoint.sh nginx -g "daemon off;"</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">depends_on</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="l">redisinsight</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">networks</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="l">redis-network</span><span class="w">
</span></span></span></code></pre>
</div>
<h3 id="nginx-config">
nginx config
</h3>
<pre tabindex="0"><code>server {
listen ${NGINX_PORT} default_server;
location / {
auth_basic "redisinsight";
auth_basic_user_file .htpasswd;
proxy_pass http://${FORWARD_HOST}:${FORWARD_PORT};
proxy_read_timeout 900;
}
}
</code></pre>
<h3 id="login-page">
Login page
</h3>
<a href="/docs/latest/images/ri/ri-reverse-proxy-login.png" sdata-lightbox="/images/ri/ri-reverse-proxy-login.png">
<img alt="RedisInsight login page" src="/docs/latest/images/ri/ri-reverse-proxy-login.png"/>
</a>
<h3 id="after-login">
After login
</h3>
<a href="/docs/latest/images/ri/ri-reverse-proxy-post-login.png" sdata-lightbox="/images/ri/ri-reverse-proxy-post-login.png">
<img alt="RedisInsight after login" src="/docs/latest/images/ri/ri-reverse-proxy-post-login.png"/>
</a>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/redisinsight/proxy/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/commands/cms.merge/.html | <section class="prose w-full py-12">
<h1 class="command-name">
CMS.MERGE
</h1>
<div class="font-semibold text-redis-ink-900">
Syntax
</div>
<pre class="command-syntax">CMS.MERGE destination numKeys source [source ...] [WEIGHTS weight
[weight ...]]</pre>
<dl class="grid grid-cols-[auto,1fr] gap-2 mb-12">
<dt class="font-semibold text-redis-ink-900 m-0">
Available in:
</dt>
<dd class="m-0">
<a href="/docs/stack">
Redis Stack
</a>
/
<a href="/docs/data-types/probabilistic">
Bloom 2.0.0
</a>
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
Time complexity:
</dt>
<dd class="m-0">
O(n) where n is the number of sketches
</dd>
</dl>
<p>
Merges several sketches into one sketch. All sketches must have identical width and depth. Weights can be used to multiply certain sketches. Default weight is 1.
</p>
<h3 id="parameters">
Parameters:
</h3>
<ul>
<li>
<strong>
dest
</strong>
: The name of destination sketch. Must be initialized.
</li>
<li>
<strong>
numKeys
</strong>
: Number of sketches to be merged.
</li>
<li>
<strong>
src
</strong>
: Names of source sketches to be merged.
</li>
<li>
<strong>
weight
</strong>
: Multiple of each sketch. Default =1.
</li>
</ul>
<h2 id="return">
Return
</h2>
<p>
<a href="/docs/latest/develop/reference/protocol-spec/#simple-strings">
Simple string reply
</a>
-
<code>
OK
</code>
if executed correctly, or [] otherwise.
</p>
<h2 id="examples">
Examples
</h2>
<pre tabindex="0"><code>redis> CMS.MERGE dest 2 test1 test2 WEIGHTS 1 3
OK
</code></pre>
<br/>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/commands/cms.merge/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/commands/expireat/.html | <section class="prose w-full py-12">
<h1 class="command-name">
EXPIREAT
</h1>
<div class="font-semibold text-redis-ink-900">
Syntax
</div>
<pre class="command-syntax">EXPIREAT key unix-time-seconds [NX | XX | GT | LT]</pre>
<dl class="grid grid-cols-[auto,1fr] gap-2 mb-12">
<dt class="font-semibold text-redis-ink-900 m-0">
Available since:
</dt>
<dd class="m-0">
1.2.0
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
Time complexity:
</dt>
<dd class="m-0">
O(1)
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
ACL categories:
</dt>
<dd class="m-0">
<code>
@keyspace
</code>
<span class="mr-1 last:hidden">
,
</span>
<code>
@write
</code>
<span class="mr-1 last:hidden">
,
</span>
<code>
@fast
</code>
<span class="mr-1 last:hidden">
,
</span>
</dd>
</dl>
<p>
<code>
EXPIREAT
</code>
has the same effect and semantic as
<a href="/docs/latest/commands/expire/">
<code>
EXPIRE
</code>
</a>
, but instead of
specifying the number of seconds representing the TTL (time to live), it takes
an absolute
<a href="http://en.wikipedia.org/wiki/Unix_time">
Unix timestamp
</a>
(seconds since January 1, 1970). A
timestamp in the past will delete the key immediately.
</p>
<p>
Please for the specific semantics of the command refer to the documentation of
<a href="/docs/latest/commands/expire/">
<code>
EXPIRE
</code>
</a>
.
</p>
<h2 id="background">
Background
</h2>
<p>
<code>
EXPIREAT
</code>
was introduced in order to convert relative timeouts to absolute
timeouts for the AOF persistence mode.
Of course, it can be used directly to specify that a given key should expire at
a given time in the future.
</p>
<h2 id="options">
Options
</h2>
<p>
The
<code>
EXPIREAT
</code>
command supports a set of options:
</p>
<ul>
<li>
<code>
NX
</code>
-- Set expiry only when the key has no expiry
</li>
<li>
<code>
XX
</code>
-- Set expiry only when the key has an existing expiry
</li>
<li>
<code>
GT
</code>
-- Set expiry only when the new expiry is greater than current one
</li>
<li>
<code>
LT
</code>
-- Set expiry only when the new expiry is less than current one
</li>
</ul>
<p>
A non-volatile key is treated as an infinite TTL for the purpose of
<code>
GT
</code>
and
<code>
LT
</code>
.
The
<code>
GT
</code>
,
<code>
LT
</code>
and
<code>
NX
</code>
options are mutually exclusive.
</p>
<h2 id="examples">
Examples
</h2>
<div class="bg-slate-900 border-b border-slate-700 rounded-t-xl px-4 py-3 w-full flex">
<svg class="shrink-0 h-[1.0625rem] w-[1.0625rem] fill-slate-50" fill="currentColor" viewbox="0 0 20 20">
<path d="M2.5 10C2.5 5.85786 5.85786 2.5 10 2.5C14.1421 2.5 17.5 5.85786 17.5 10C17.5 14.1421 14.1421 17.5 10 17.5C5.85786 17.5 2.5 14.1421 2.5 10Z">
</path>
</svg>
<svg class="shrink-0 h-[1.0625rem] w-[1.0625rem] fill-slate-50" fill="currentColor" viewbox="0 0 20 20">
<path d="M10 2.5L18.6603 17.5L1.33975 17.5L10 2.5Z">
</path>
</svg>
<svg class="shrink-0 h-[1.0625rem] w-[1.0625rem] fill-slate-50" fill="currentColor" viewbox="0 0 20 20">
<path d="M10 2.5L12.0776 7.9322L17.886 8.22949L13.3617 11.8841L14.8738 17.5L10 14.3264L5.1262 17.5L6.63834 11.8841L2.11403 8.22949L7.92238 7.9322L10 2.5Z">
</path>
</svg>
</div>
<form class="redis-cli overflow-y-auto max-h-80">
<pre tabindex="0">redis> SET mykey "Hello"
"OK"
redis> EXISTS mykey
(integer) 1
redis> EXPIREAT mykey 1293840000
(integer) 1
redis> EXISTS mykey
(integer) 0
</pre>
<div class="prompt" style="">
<span>
redis>
</span>
<input autocomplete="off" name="prompt" spellcheck="false" type="text"/>
</div>
</form>
<h2 id="resp2resp3-reply">
RESP2/RESP3 Reply
</h2>
<p>
One of the following:
</p>
<ul>
<li>
<a href="../../develop/reference/protocol-spec#integers">
Integer reply
</a>
:
<code>
0
</code>
if the timeout was not set; for example, the key doesn't exist, or the operation was skipped because of the provided arguments.
</li>
<li>
<a href="../../develop/reference/protocol-spec#integers">
Integer reply
</a>
:
<code>
1
</code>
if the timeout was set.
</li>
</ul>
<br/>
<h2>
History
</h2>
<ul>
<li>
Starting with Redis version 7.0.0: Added options:
<code>
NX
</code>
,
<code>
XX
</code>
,
<code>
GT
</code>
and
<code>
LT
</code>
.
</li>
</ul>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/commands/expireat/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/7.4/references/rest-api/objects/job_scheduler/log_rotation_job_settings/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Log rotation job settings object
</h1>
<p class="text-lg -mt-5 mb-10">
Documents the log_rotation_job_settings object used with Redis Enterprise Software REST API calls.
</p>
<table>
<thead>
<tr>
<th>
Name
</th>
<th>
Type/Value
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
cron_expression
</td>
<td>
string
</td>
<td>
<a href="https://en.wikipedia.org/wiki/Cron#CRON_expression">
CRON expression
</a>
that defines the log rotation schedule
</td>
</tr>
</tbody>
</table>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/7.4/references/rest-api/objects/job_scheduler/log_rotation_job_settings/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/7.4/databases/import-export/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Import and export data
</h1>
<p class="text-lg -mt-5 mb-10">
How to import, export, flush, and migrate your data.
</p>
<nav>
<a href="/docs/latest/operate/rs/7.4/databases/import-export/import-data/">
Import data into a database
</a>
<p>
You can import export or backup files of a specific Redis Enterprise Software database to restore data. You can either import from a single file or from multiple files, such as when you want to import from a backup of a clustered database.
</p>
<a href="/docs/latest/operate/rs/7.4/databases/import-export/export-data/">
Export data from a database
</a>
<p>
You can export data to import it into a new database or to make a backup. This article shows how to do so.
</p>
<a href="/docs/latest/operate/rs/7.4/databases/import-export/flush/">
Flush database data
</a>
<p>
To delete the data in a database without deleting the database, you can use Redis CLI to flush it from the database. You can also use Redis CLI, the admin console, and the Redis Software REST API to flush data from Active-Active databases.
</p>
<a href="/docs/latest/operate/rs/7.4/databases/import-export/schedule-backups/">
Schedule periodic backups
</a>
<p>
Schedule backups of your databases to make sure you always have valid backups.
</p>
<a href="/docs/latest/operate/rs/7.4/databases/import-export/migrate-to-active-active/">
Migrate a database to Active-Active
</a>
<p>
Use Replica Of to migrate your database to an Active-Active database.
</p>
<a href="/docs/latest/operate/rs/7.4/databases/import-export/replica-of/">
Replica Of geo-distributed Redis
</a>
<p>
Replica Of provides read-only access to replicas of the dataset from different geographical locations.
</p>
</nav>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/7.4/databases/import-export/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/oss_and_stack/stack-with-enterprise/gears-v1/jvm/classes/readers/commandoverrider/.html | <section class="prose w-full py-12 max-w-none">
<h1>
CommandOverrider
</h1>
<p class="text-lg -mt-5 mb-10">
Override a Redis command.
</p>
<p>
The
<code>
CommandOverrider
</code>
allows you to override and customize Redis commands.
</p>
<ol>
<li>
Pass the
<code>
CommandOverrider
</code>
to the
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/gears-v1/jvm/classes/gearsbuilder/creategearsbuilder/">
<code>
GearsBuilder.CreateGearsBuilder()
</code>
</a>
function in your Java code.
</li>
<li>
Call the
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/gears-v1/jvm/classes/gearsbuilder/register/">
<code>
register()
</code>
</a>
function.
</li>
<li>
Run
<code>
RG.JEXECUTE
</code>
to register your code.
</li>
</ol>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Note:
</div>
If you register code that uses
<code>
CommandOverrider
</code>
, its
<code>
reader
</code>
value is
<code>
"CommandReader"
</code>
when you run the
<code>
RG.DUMPREGISTRATIONS
</code>
command, not
<code>
"CommandOverrider"
</code>
.
</div>
</div>
<h2 id="parameters">
Parameters
</h2>
<table>
<thead>
<tr>
<th>
Name
</th>
<th>
Type
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
command
</td>
<td>
string
</td>
<td>
The command to override
</td>
</tr>
<tr>
<td>
prefix
</td>
<td>
string
</td>
<td>
Only override the command for keys that start with this string
</td>
</tr>
</tbody>
</table>
<h2 id="output-records">
Output records
</h2>
<p>
Outputs a record with the command's name and arguments.
</p>
<h2 id="example">
Example
</h2>
<p>
The following example shows how to override the
<code>
HSET
</code>
command so that it also adds a
<code>
last_modified
</code>
timestamp for "user:" hashes.
</p>
<p>
Add some user data as a hash:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">redis> HSET user:1 name <span class="s2">"morgan"</span> posts <span class="m">201</span>
</span></span><span class="line"><span class="cl"><span class="o">(</span>integer<span class="o">)</span> <span class="m">2</span>
</span></span></code></pre>
</div>
<p>
Example code:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-java" data-lang="java"><span class="line"><span class="cl"><span class="c1">// Create the reader that will pass data to the pipe
</span></span></span><span class="line"><span class="cl"><span class="c1"></span><span class="n">CommandOverrider</span> <span class="n">overrider</span> <span class="o">=</span> <span class="k">new</span> <span class="n">CommandOverrider</span><span class="o">();</span>
</span></span><span class="line"><span class="cl"><span class="c1">// Override the HSET command
</span></span></span><span class="line"><span class="cl"><span class="c1"></span><span class="n">overrider</span><span class="o">.</span><span class="na">setCommand</span><span class="o">(</span><span class="s">"HSET"</span><span class="o">);</span>
</span></span><span class="line"><span class="cl"><span class="c1">// Only override HSET for keys that start with "user:"
</span></span></span><span class="line"><span class="cl"><span class="c1"></span><span class="n">overrider</span><span class="o">.</span><span class="na">setPrefix</span><span class="o">(</span><span class="s">"user:"</span><span class="o">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1">// Create the data pipe builder
</span></span></span><span class="line"><span class="cl"><span class="c1"></span><span class="n">GearsBuilder</span><span class="o">.</span><span class="na">CreateGearsBuilder</span><span class="o">(</span><span class="n">overrider</span><span class="o">).</span><span class="na">map</span><span class="o">(</span><span class="n">r</span><span class="o">-></span> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="c1">// Get the operation arguments
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="n">ArrayList</span><span class="o"><</span><span class="n">String</span><span class="o">></span> <span class="n">operationArguments</span> <span class="o">=</span> <span class="k">new</span> <span class="n">ArrayList</span><span class="o"><</span><span class="n">String</span><span class="o">>();</span>
</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="o">(</span><span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">1</span><span class="o">;</span> <span class="n">i</span> <span class="o"><</span> <span class="n">r</span><span class="o">.</span><span class="na">length</span><span class="o">;</span> <span class="n">i</span><span class="o">++)</span> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">operationArguments</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="k">new</span> <span class="n">String</span><span class="o">((</span><span class="kt">byte</span><span class="o">[])</span> <span class="n">r</span><span class="o">[</span><span class="n">i</span><span class="o">],</span> <span class="n">StandardCharsets</span><span class="o">.</span><span class="na">UTF_8</span><span class="o">));</span>
</span></span><span class="line"><span class="cl"> <span class="o">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Add a last-modified field and a corresponding timestamp to the operation arguments
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="n">operationArguments</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="s">"last-modified"</span><span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">operationArguments</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="n">Long</span><span class="o">.</span><span class="na">toString</span><span class="o">(</span><span class="n">System</span><span class="o">.</span><span class="na">currentTimeMillis</span><span class="o">()));</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Run the enriched HSET operation
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="n">Object</span> <span class="n">reply</span> <span class="o">=</span> <span class="n">GearsBuilder</span><span class="o">.</span><span class="na">callNext</span><span class="o">(</span><span class="n">operationArguments</span><span class="o">.</span><span class="na">toArray</span><span class="o">(</span><span class="k">new</span> <span class="n">String</span><span class="o">[</span><span class="mi">0</span><span class="o">]));</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">reply</span><span class="o">.</span><span class="na">toString</span><span class="o">();</span>
</span></span><span class="line"><span class="cl"><span class="o">}).</span><span class="na">register</span><span class="o">(</span><span class="n">ExecutionMode</span><span class="o">.</span><span class="na">SYNC</span><span class="o">);</span>
</span></span></code></pre>
</div>
<p>
After you register the previous code with the
<code>
RG.JEXECUTE
</code>
command, try to update the user's data with
<code>
HSET
</code>
to test it:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">redis> HSET user:1 posts <span class="m">234</span>
</span></span><span class="line"><span class="cl"><span class="s2">"OK"</span>
</span></span></code></pre>
</div>
<p>
Now the user's profile should have the updated value for
<code>
posts
</code>
and a
<code>
last_modified
</code>
timestamp:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">redis> HGETALL user:1
</span></span><span class="line"><span class="cl">1<span class="o">)</span> <span class="s2">"name"</span>
</span></span><span class="line"><span class="cl">2<span class="o">)</span> <span class="s2">"morgan"</span>
</span></span><span class="line"><span class="cl">3<span class="o">)</span> <span class="s2">"posts"</span>
</span></span><span class="line"><span class="cl">4<span class="o">)</span> <span class="s2">"234"</span>
</span></span><span class="line"><span class="cl">5<span class="o">)</span> <span class="s2">"last_modified"</span>
</span></span><span class="line"><span class="cl">6<span class="o">)</span> <span class="s2">"1643237927663"</span>
</span></span></code></pre>
</div>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/oss_and_stack/stack-with-enterprise/gears-v1/jvm/classes/readers/commandoverrider/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/references/rest-api/requests/shards/stats/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Shards stats requests
</h1>
<p class="text-lg -mt-5 mb-10">
Shard statistics requests
</p>
<table>
<thead>
<tr>
<th>
Method
</th>
<th>
Path
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="#get-all-shards-stats">
GET
</a>
</td>
<td>
<code>
/v1/shards/stats
</code>
</td>
<td>
Get stats for all shards
</td>
</tr>
<tr>
<td>
<a href="#get-shard-stats">
GET
</a>
</td>
<td>
<code>
/v1/shards/stats/{uid}
</code>
</td>
<td>
Get stats for a specific shard
</td>
</tr>
</tbody>
</table>
<h2 id="get-all-shards-stats">
Get all shards stats
</h2>
<pre><code>GET /v1/shards/stats
</code></pre>
<p>
Get statistics for all shards.
</p>
<h4 id="required-permissions">
Required permissions
</h4>
<table>
<thead>
<tr>
<th>
Permission name
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="/docs/latest/operate/rs/references/rest-api/permissions/#view_all_shard_stats">
view_all_shard_stats
</a>
</td>
</tr>
</tbody>
</table>
<h3 id="get-all-request">
Request
</h3>
<h4 id="example-http-request">
Example HTTP request
</h4>
<pre><code>GET /shards/stats?interval=1hour&stime=2014-08-28T10:00:00Z
</code></pre>
<h4 id="request-headers">
Request headers
</h4>
<table>
<thead>
<tr>
<th>
Key
</th>
<th>
Value
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
Host
</td>
<td>
cnm.cluster.fqdn
</td>
<td>
Domain name
</td>
</tr>
<tr>
<td>
Accept
</td>
<td>
application/json
</td>
<td>
Accepted media type
</td>
</tr>
</tbody>
</table>
<h4 id="query-parameters">
Query parameters
</h4>
<table>
<thead>
<tr>
<th>
Field
</th>
<th>
Type
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
parent_uid
</td>
<td>
integer
</td>
<td>
Only return shard from the given BDB ID (optional)
</td>
</tr>
<tr>
<td>
interval
</td>
<td>
string
</td>
<td>
Time interval for which we want stats: 1sec/10sec/5min/15min/1hour/12hour/1week (optional)
</td>
</tr>
<tr>
<td>
stime
</td>
<td>
ISO_8601
</td>
<td>
Start time from which we want the stats. Should comply with the
<a href="https://en.wikipedia.org/wiki/ISO_8601">
ISO_8601
</a>
format (optional)
</td>
</tr>
<tr>
<td>
etime
</td>
<td>
ISO_8601
</td>
<td>
End time after which we don't want the stats. Should comply with the
<a href="https://en.wikipedia.org/wiki/ISO_8601">
ISO_8601
</a>
format (optional)
</td>
</tr>
<tr>
<td>
metrics
</td>
<td>
list
</td>
<td>
Comma-separated list of
<a href="/docs/latest/operate/rs/references/rest-api/objects/statistics/shard-metrics/">
metric names
</a>
for which we want statistics (default is all) (optional)
</td>
</tr>
</tbody>
</table>
<h3 id="get-all-response">
Response
</h3>
<p>
Returns a JSON array of
<a href="/docs/latest/operate/rs/references/rest-api/objects/statistics/">
statistics
</a>
for all shards.
</p>
<h4 id="example-json-body">
Example JSON body
</h4>
<div class="highlight">
<pre class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">[</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"status"</span><span class="p">:</span> <span class="s2">"active"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"uid"</span><span class="p">:</span> <span class="s2">"1"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"node_uid"</span><span class="p">:</span> <span class="s2">"1"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"assigned_slots"</span><span class="p">:</span> <span class="s2">"0-8191"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"intervals"</span><span class="p">:</span> <span class="p">[</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"interval"</span><span class="p">:</span> <span class="s2">"1sec"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"stime"</span><span class="p">:</span> <span class="s2">"2015-05-28T08:27:35Z"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"etime"</span><span class="p">:</span> <span class="s2">"2015-05-28T08:27:40Z"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"used_memory_peak"</span><span class="p">:</span> <span class="mf">5888264.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"used_memory_rss"</span><span class="p">:</span> <span class="mf">5888264.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"read_hits"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"pubsub_patterns"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"no_of_keys"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"mem_size_lua"</span><span class="p">:</span> <span class="mf">35840.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"last_save_time"</span><span class="p">:</span> <span class="mf">1432541051.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"sync_partial_ok"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"connected_clients"</span><span class="p">:</span> <span class="mf">9.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"avg_ttl"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"write_misses"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"used_memory"</span><span class="p">:</span> <span class="mf">5651440.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"sync_full"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"expired_objects"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"total_req"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"blocked_clients"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"pubsub_channels"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"evicted_objects"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"no_of_expires"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"interval"</span><span class="p">:</span> <span class="s2">"1sec"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"write_hits"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"read_misses"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"sync_partial_err"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"rdb_changes_since_last_save"</span><span class="p">:</span> <span class="mf">0.0</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"interval"</span><span class="p">:</span> <span class="s2">"1sec"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"stime"</span><span class="p">:</span> <span class="s2">"2015-05-28T08:27:40Z"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"etime"</span><span class="p">:</span> <span class="s2">"2015-05-28T08:27:45Z"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"// additional fields..."</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl"> <span class="p">]</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"uid"</span><span class="p">:</span> <span class="s2">"2"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"status"</span><span class="p">:</span> <span class="s2">"active"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"node_uid"</span><span class="p">:</span> <span class="s2">"1"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"assigned_slots"</span><span class="p">:</span> <span class="s2">"8192-16383"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"intervals"</span><span class="p">:</span> <span class="p">[</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"interval"</span><span class="p">:</span> <span class="s2">"1sec"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"stime"</span><span class="p">:</span> <span class="s2">"2015-05-28T08:27:35Z"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"etime"</span><span class="p">:</span> <span class="s2">"2015-05-28T08:27:40Z"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"// additional fields..."</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"interval"</span><span class="p">:</span> <span class="s2">"1sec"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"stime"</span><span class="p">:</span> <span class="s2">"2015-05-28T08:27:40Z"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"etime"</span><span class="p">:</span> <span class="s2">"2015-05-28T08:27:45Z"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"// additional fields..."</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl"> <span class="p">]</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl"><span class="p">]</span>
</span></span></code></pre>
</div>
<h3 id="get-all-status-codes">
Status codes
</h3>
<table>
<thead>
<tr>
<th>
Code
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="https://www.rfc-editor.org/rfc/rfc9110.html#name-200-ok">
200 OK
</a>
</td>
<td>
No error
</td>
</tr>
<tr>
<td>
<a href="https://www.rfc-editor.org/rfc/rfc9110.html#name-404-not-found">
404 Not Found
</a>
</td>
<td>
No shards exist
</td>
</tr>
</tbody>
</table>
<h2 id="get-shard-stats">
Get shard stats
</h2>
<pre><code>GET /v1/shards/stats/{int: uid}
</code></pre>
<p>
Get statistics for a specific shard.
</p>
<h4 id="required-permissions-1">
Required permissions
</h4>
<table>
<thead>
<tr>
<th>
Permission name
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="/docs/latest/operate/rs/references/rest-api/permissions/#view_shard_stats">
view_shard_stats
</a>
</td>
</tr>
</tbody>
</table>
<h3 id="get-request">
Request
</h3>
<h4 id="example-http-request-1">
Example HTTP request
</h4>
<pre><code>GET /shards/stats/1?interval=1hour&stime=2014-08-28T10:00:00Z
</code></pre>
<h4 id="request-headers-1">
Request headers
</h4>
<table>
<thead>
<tr>
<th>
Key
</th>
<th>
Value
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
Host
</td>
<td>
cnm.cluster.fqdn
</td>
<td>
Domain name
</td>
</tr>
<tr>
<td>
Accept
</td>
<td>
application/json
</td>
<td>
Accepted media type
</td>
</tr>
</tbody>
</table>
<h4 id="url-parameters">
URL parameters
</h4>
<table>
<thead>
<tr>
<th>
Field
</th>
<th>
Type
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
uid
</td>
<td>
integer
</td>
<td>
The unique ID of the shard requested.
</td>
</tr>
</tbody>
</table>
<h4 id="query-parameters-1">
Query parameters
</h4>
<table>
<thead>
<tr>
<th>
Field
</th>
<th>
Type
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
interval
</td>
<td>
string
</td>
<td>
Time interval for which we want stats: 1sec/10sec/5min/15min/1hour/12hour/1week (optional)
</td>
</tr>
<tr>
<td>
stime
</td>
<td>
ISO_8601
</td>
<td>
Start time from which we want the stats. Should comply with the
<a href="https://en.wikipedia.org/wiki/ISO_8601">
ISO_8601
</a>
format (optional)
</td>
</tr>
<tr>
<td>
etime
</td>
<td>
ISO_8601
</td>
<td>
End time after which we don't want the stats. Should comply with the
<a href="https://en.wikipedia.org/wiki/ISO_8601">
ISO_8601
</a>
format (optional)
</td>
</tr>
</tbody>
</table>
<h3 id="get-response">
Response
</h3>
<p>
Returns
<a href="/docs/latest/operate/rs/references/rest-api/objects/statistics/">
statistics
</a>
for the specified shard.
</p>
<h4 id="example-json-body-1">
Example JSON body
</h4>
<div class="highlight">
<pre class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"uid"</span><span class="p">:</span> <span class="s2">"1"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"status"</span><span class="p">:</span> <span class="s2">"active"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"node_uid"</span><span class="p">:</span> <span class="s2">"1"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"role"</span><span class="p">:</span> <span class="s2">"master"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"intervals"</span><span class="p">:</span> <span class="p">[</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"interval"</span><span class="p">:</span> <span class="s2">"1sec"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"stime"</span><span class="p">:</span> <span class="s2">"2015-05-28T08:24:13Z"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"etime"</span><span class="p">:</span> <span class="s2">"2015-05-28T08:24:18Z"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"avg_ttl"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"blocked_clients"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"connected_clients"</span><span class="p">:</span> <span class="mf">9.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"etime"</span><span class="p">:</span> <span class="s2">"2015-05-28T08:24:18Z"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"evicted_objects"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"expired_objects"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"last_save_time"</span><span class="p">:</span> <span class="mf">1432541051.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"used_memory"</span><span class="p">:</span> <span class="mf">5651440.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"mem_size_lua"</span><span class="p">:</span> <span class="mf">35840.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"used_memory_peak"</span><span class="p">:</span> <span class="mf">5888264.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"used_memory_rss"</span><span class="p">:</span> <span class="mf">5888264.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"no_of_expires"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"no_of_keys"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"pubsub_channels"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"pubsub_patterns"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"rdb_changes_since_last_save"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"read_hits"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"read_misses"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"stime"</span><span class="p">:</span> <span class="s2">"2015-05-28T08:24:13Z"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"sync_full"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"sync_partial_err"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"sync_partial_ok"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"total_req"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"write_hits"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"write_misses"</span><span class="p">:</span> <span class="mf">0.0</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"interval"</span><span class="p">:</span> <span class="s2">"1sec"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"stime"</span><span class="p">:</span> <span class="s2">"2015-05-28T08:24:18Z"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"etime"</span><span class="p">:</span> <span class="s2">"2015-05-28T08:24:23Z"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="nt">"// additional fields..."</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl"> <span class="p">]</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span></code></pre>
</div>
<h3 id="get-status-codes">
Status codes
</h3>
<table>
<thead>
<tr>
<th>
Code
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="https://www.rfc-editor.org/rfc/rfc9110.html#name-200-ok">
200 OK
</a>
</td>
<td>
No error
</td>
</tr>
<tr>
<td>
<a href="https://www.rfc-editor.org/rfc/rfc9110.html#name-404-not-found">
404 Not Found
</a>
</td>
<td>
Shard does not exist
</td>
</tr>
<tr>
<td>
<a href="https://www.rfc-editor.org/rfc/rfc9110.html#name-406-not-acceptable">
406 Not Acceptable
</a>
</td>
<td>
Shard isn't currently active
</td>
</tr>
</tbody>
</table>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/references/rest-api/requests/shards/stats/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/7.4/references/rest-api/requests/nodes/debuginfo/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Node debug info requests
</h1>
<p class="text-lg -mt-5 mb-10">
Documents the Redis Enterprise Software REST API /nodes/debuginfo requests.
</p>
<table>
<thead>
<tr>
<th>
Method
</th>
<th>
Path
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="#get-debuginfo-all-nodes">
GET
</a>
</td>
<td>
<code>
/v1/nodes/debuginfo
</code>
</td>
<td>
Get debug info from all nodes
</td>
</tr>
<tr>
<td>
<a href="#get-debuginfo-node">
GET
</a>
</td>
<td>
<code>
/v1/nodes/{node_uid}/debuginfo
</code>
</td>
<td>
Get debug info from a specific node
</td>
</tr>
</tbody>
</table>
<h2 id="get-debuginfo-all-nodes">
Get debug info from all nodes
</h2>
<pre><code>GET /v1/nodes/debuginfo
</code></pre>
<p>
Downloads a tar file that contains debug info from all nodes.
</p>
<h4 id="required-permissions">
Required permissions
</h4>
<table>
<thead>
<tr>
<th>
Permission name
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="/docs/latest/operate/rs/7.4/references/rest-api/permissions/#view_debugging_info">
view_debugging_info
</a>
</td>
</tr>
</tbody>
</table>
<h3 id="get-all-request">
Request
</h3>
<h4 id="example-http-request">
Example HTTP request
</h4>
<pre><code>GET /nodes/debuginfo
</code></pre>
<h3 id="get-all-response">
Response
</h3>
<p>
Downloads the debug info in a tar file called
<code>
filename.tar.gz
</code>
. Extract the files from the tar file to access the debug info.
</p>
<h4 id="response-headers">
Response headers
</h4>
<table>
<thead>
<tr>
<th>
Key
</th>
<th>
Value
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
Content-Type
</td>
<td>
application/x-gzip
</td>
<td>
Media type of request/response body
</td>
</tr>
<tr>
<td>
Content-Length
</td>
<td>
653350
</td>
<td>
Length of the response body in octets
</td>
</tr>
<tr>
<td>
Content-Disposition
</td>
<td>
attachment; filename=debuginfo.tar.gz
</td>
<td>
Display response in browser or download as attachment
</td>
</tr>
</tbody>
</table>
<h3 id="get-all-status-codes">
Status codes
</h3>
<table>
<thead>
<tr>
<th>
Code
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1">
200 OK
</a>
</td>
<td>
Success.
</td>
</tr>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.1">
500 Internal Server Error
</a>
</td>
<td>
Failed to get debug info.
</td>
</tr>
</tbody>
</table>
<h2 id="get-debuginfo-node">
Get node debug info
</h2>
<pre><code>GET /v1/nodes/{int: node_uid}/debuginfo
</code></pre>
<p>
Downloads a tar file that contains debug info from a specific node.
</p>
<h4 id="required-permissions-1">
Required permissions
</h4>
<table>
<thead>
<tr>
<th>
Permission name
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="/docs/latest/operate/rs/7.4/references/rest-api/permissions/#view_debugging_info">
view_debugging_info
</a>
</td>
</tr>
</tbody>
</table>
<h3 id="get-request">
Request
</h3>
<h4 id="example-http-request-1">
Example HTTP request
</h4>
<pre><code>GET /nodes/1/debuginfo
</code></pre>
<h3 id="get-response">
Response
</h3>
<p>
Downloads the debug info in a tar file called
<code>
filename.tar.gz
</code>
. Extract the files from the tar file to access the debug info.
</p>
<h4 id="response-headers-1">
Response headers
</h4>
<table>
<thead>
<tr>
<th>
Key
</th>
<th>
Value
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
Content-Type
</td>
<td>
application/x-gzip
</td>
<td>
Media type of request/response body
</td>
</tr>
<tr>
<td>
Content-Length
</td>
<td>
653350
</td>
<td>
Length of the response body in octets
</td>
</tr>
<tr>
<td>
Content-Disposition
</td>
<td>
attachment; filename=debuginfo.tar.gz
</td>
<td>
Display response in browser or download as attachment
</td>
</tr>
</tbody>
</table>
<h3 id="get-status-codes">
Status codes
</h3>
<table>
<thead>
<tr>
<th>
Code
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1">
200 OK
</a>
</td>
<td>
Success.
</td>
</tr>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.1">
500 Internal Server Error
</a>
</td>
<td>
Failed to get debug info.
</td>
</tr>
</tbody>
</table>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/7.4/references/rest-api/requests/nodes/debuginfo/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/7.4/databases/active-active/create/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Create an Active-Active geo-replicated database
</h1>
<p class="text-lg -mt-5 mb-10">
How to create an Active-Active database and things to consider when setting it up.
</p>
<p>
<a href="/docs/latest/operate/rs/7.4/databases/active-active/">
Active-Active geo-replicated databases
</a>
(formerly known as CRDBs) give applications write access
to replicas of the dataset in different geographical locations.
</p>
<p>
The participating Redis Enterprise Software clusters that host the instances can be distributed in different geographic locations.
Every instance of an Active-Active database can receive write operations, and all operations are
<a href="/docs/latest/operate/rs/7.4/databases/active-active/develop/#example-of-synchronization">
synchronized
</a>
to all instances without conflict.
</p>
<h2 id="steps-to-create-an-active-active-database">
Steps to create an Active-Active database
</h2>
<ol>
<li>
<strong>
Create a service account
</strong>
- On each participating cluster, create a dedicated user account with the Admin role.
</li>
<li>
<strong>
Confirm connectivity
</strong>
- Confirm network connectivity between the participating clusters.
</li>
<li>
<strong>
Create Active-Active database
</strong>
- Connect to one of your clusters and create a new Active-Active database.
</li>
<li>
<strong>
Add participating clusters
</strong>
- Add the participating clusters to the Active-Active database with the user credentials for the service account.
</li>
<li>
<strong>
Verify creation
</strong>
- Log in to each of the participating clusters and verify your Active-Active database was created on them.
</li>
<li>
<strong>
Confirm Active-Active database synchronization
</strong>
- Test writing to one cluster and reading from a different cluster.
</li>
</ol>
<h2 id="prerequisites">
Prerequisites
</h2>
<ul>
<li>
Two or more machines with the same version of Redis Enterprise Software installed
</li>
<li>
Network connectivity and cluster FQDN name resolution between all participating clusters
</li>
<li>
<a href="/docs/latest/operate/rs/7.4/databases/active-active/#network-time-service-ntp-or-chrony">
Network time service
</a>
listener (ntpd) configured and running on each node in all clusters
</li>
</ul>
<h2 id="create-an-active-active-database">
Create an Active-Active database
</h2>
<ol>
<li>
<p>
Create service accounts on each participating cluster:
</p>
<ol>
<li>
<p>
In a browser, open the Cluster Manager UI for the participating cluster.
</p>
<p>
The default address is:
<code>
https://<RS_address>:8443
</code>
</p>
</li>
<li>
<p>
Go to the
<strong>
Access Control > Users
</strong>
tab:
</p>
<a href="/docs/latest/images/rs/access-control-user-panel.png" sdata-lightbox="/images/rs/access-control-user-panel.png">
<img alt="Add role with name" src="/docs/latest/images/rs/access-control-user-panel.png"/>
</a>
</li>
<li>
<p>
Click
<strong>
+ Add user
</strong>
.
</p>
</li>
<li>
<p>
Enter the username, email, and password for the user.
</p>
</li>
<li>
<p>
Select the
<strong>
Admin
</strong>
role.
</p>
</li>
<li>
<p>
Click
<strong>
Save
</strong>
.
</p>
</li>
</ol>
</li>
<li>
<p>
To verify network connectivity between participating clusters,
run the following
<code>
telnet
</code>
command from each participating cluster to all other participating clusters:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">telnet <target FQDN> <span class="m">9443</span>
</span></span></code></pre>
</div>
</li>
<li>
<p>
In a browser, open the Cluster Manager UI of the cluster where you want to create the Active-Active database.
</p>
<p>
The default address is:
<code>
https://<RS_address>:8443
</code>
</p>
</li>
<li>
<p>
Open the
<strong>
Create database
</strong>
menu with one of the following methods:
</p>
<ul>
<li>
<p>
Click the
<strong>
+
</strong>
button next to
<strong>
Databases
</strong>
in the navigation menu:
</p>
<a href="/docs/latest/images/rs/screenshots/databases/create-db-plus-drop-down.png" sdata-lightbox="/images/rs/screenshots/databases/create-db-plus-drop-down.png">
<img alt="Create database menu has two options: Single Region and Active-Active database." src="/docs/latest/images/rs/screenshots/databases/create-db-plus-drop-down.png" width="350px"/>
</a>
</li>
<li>
<p>
Go to the
<strong>
Databases
</strong>
screen and select
<strong>
Create database
</strong>
:
</p>
<a href="/docs/latest/images/rs/screenshots/databases/create-db-button-drop-down.png" sdata-lightbox="/images/rs/screenshots/databases/create-db-button-drop-down.png">
<img alt="Create database menu has two options: Single Region and Active-Active database." src="/docs/latest/images/rs/screenshots/databases/create-db-button-drop-down.png" width="350px"/>
</a>
</li>
</ul>
</li>
<li>
<p>
Select
<strong>
Active-Active database
</strong>
.
</p>
</li>
<li>
<p>
Enter the cluster's local admin credentials, then click
<strong>
Save
</strong>
:
</p>
<a href="/docs/latest/images/rs/screenshots/databases/active-active-databases/enter-local-admin-credentials.png" sdata-lightbox="/images/rs/screenshots/databases/active-active-databases/enter-local-admin-credentials.png">
<img alt="Enter the cluster's admin username and password." src="/docs/latest/images/rs/screenshots/databases/active-active-databases/enter-local-admin-credentials.png"/>
</a>
</li>
<li>
<p>
Add participating clusters that will host instances of the Active-Active database:
</p>
<ol>
<li>
<p>
In the
<strong>
Participating clusters
</strong>
section, go to
<strong>
Other participating clusters
</strong>
and click
<strong>
+ Add cluster
</strong>
.
</p>
</li>
<li>
<p>
In the
<strong>
Add cluster
</strong>
configuration panel, enter the new cluster's URL, port number, and the admin username and password for the new participating cluster:
</p>
<a href="/docs/latest/images/rs/screenshots/databases/active-active-databases/create-db-add-participating-clusters.png" sdata-lightbox="/images/rs/screenshots/databases/active-active-databases/create-db-add-participating-clusters.png">
<img alt="Add cluster panel." src="/docs/latest/images/rs/screenshots/databases/active-active-databases/create-db-add-participating-clusters.png"/>
</a>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Note:
</div>
If an Active-Active database
<a href="/docs/latest/operate/rs/7.4/databases/auto-tiering/">
runs on flash memory
</a>
, you cannot add participating clusters that run on RAM only.
</div>
</div>
</li>
<li>
<p>
Click
<strong>
Join cluster
</strong>
to add the cluster to the list of participating clusters.
</p>
</li>
</ol>
</li>
<li>
<p>
Enter a
<strong>
Database name
</strong>
.
</p>
</li>
<li>
<p>
If your cluster supports
<a href="/docs/latest/operate/rs/7.4/databases/auto-tiering/">
Auto Tiering
</a>
, in
<strong>
Runs on
</strong>
you can select
<strong>
Flash
</strong>
so that your database uses Flash memory. We recommend that you use AOF every 1 sec for the best performance during the initial Active-Active database sync of a new replica.
</p>
</li>
<li>
<p>
To configure additional database settings, expand each relevant section to make changes.
</p>
<p>
See
<a href="#configuration-settings">
Configuration settings
</a>
for more information about each setting.
</p>
</li>
<li>
<p>
Click
<strong>
Create
</strong>
.
</p>
</li>
</ol>
<h2 id="configuration-settings">
Configuration settings
</h2>
<ul>
<li>
<p>
<strong>
Database version
</strong>
- The Redis version used by your database.
</p>
</li>
<li>
<p>
<strong>
Database name
</strong>
- The database name requirements are:
</p>
<ul>
<li>
<p>
Maximum of 63 characters
</p>
</li>
<li>
<p>
Only letters, numbers, or hyphens (-) are valid characters
</p>
</li>
<li>
<p>
Must start and end with a letter or digit
</p>
</li>
<li>
<p>
Case-sensitive
</p>
</li>
</ul>
</li>
<li>
<p>
<strong>
Port
</strong>
- You can define the port number that clients use to connect to the database. Otherwise, a port is randomly selected.
</p>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Note:
</div>
You cannot change the
<a href="/docs/latest/operate/rs/7.4/networking/port-configurations/">
port number
</a>
after the database is created.
</div>
</div>
</li>
<li>
<p>
<strong>
Memory limit
</strong>
-
<a href="/docs/latest/operate/rs/7.4/databases/memory-performance/memory-limit/">
Database memory limits
</a>
include all database replicas and shards, including replica shards in database replication and database shards in database clustering.
</p>
<p>
If the total size of the database in the cluster reaches the memory limit, the data eviction policy for the database is enforced.
</p>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Note:
</div>
If you create a database with Auto Tiering enabled, you also need to set the RAM-to-Flash ratio
for this database. Minimum RAM is 10%. Maximum RAM is 50%.
</div>
</div>
</li>
<li>
<p>
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/">
<strong>
Capabilities
</strong>
</a>
(previously
<strong>
Modules
</strong>
) - When you create a new in-memory database, you can enable multiple Redis Stack capabilities in the database. For Auto Tiering databases, you can enable capabilities that support Auto Tiering. See
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/enterprise-capabilities/">
Redis Enterprise and Redis Stack feature compatibility
</a>
for compatibility details.
</p>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Note:
</div>
To use Redis Stack capabilities, enable them when you create a new database.
You cannot enable them after database creation.
</div>
</div>
<p>
To add capabilities to the database:
</p>
<ol>
<li>
<p>
In the
<strong>
Capabilities
</strong>
section, select one or more capabilities.
</p>
</li>
<li>
<p>
To customize capabilities, select
<strong>
Parameters
</strong>
and enter the optional custom configuration.
</p>
</li>
<li>
<p>
Select
<strong>
Done
</strong>
.
</p>
</li>
</ol>
</li>
</ul>
<h3 id="tls">
TLS
</h3>
<p>
If you enable TLS when you create the Active-Active database, the nodes use the TLS mode
<strong>
Require TLS for CRDB communication only
</strong>
to require TLS authentication and encryption for communications between participating clusters.
</p>
<p>
After you create the Active-Active database, you can set the TLS mode to
<strong>
Require TLS for all communications
</strong>
so client communication from applications are also authenticated and encryption.
</p>
<h3 id="high-availability--durability">
High availability & durability
</h3>
<ul>
<li>
<p>
<a href="/docs/latest/operate/rs/7.4/databases/durability-ha/replication/">
<strong>
Replication
</strong>
</a>
- We recommend that all Active-Active database use replication for best intercluster synchronization performance.
</p>
<p>
When replication is enabled, every Active-Active database master shard is replicated to a corresponding replica shard. The replica shards are then used to synchronize data between the instances, and the master shards are dedicated to handling client requests.
</p>
<p>
We also recommend that you enable
<a href="/docs/latest/operate/rs/7.4/databases/configure/replica-ha/">
replica HA
</a>
to ensure that the replica shards are highly-available for this synchronization.
</p>
</li>
<li>
<p>
<a href="/docs/latest/operate/rs/7.4/databases/configure/database-persistence/">
<strong>
Data persistence
</strong>
</a>
- To protect against loss of data stored in RAM, you can enable data persistence to store a copy of the data on disk.
</p>
<p>
Active-Active databases support append-only file (AOF) persistence only. Snapshot persistence is not supported for Active-Active databases.
</p>
</li>
<li>
<p>
<strong>
Eviction policy
</strong>
- The default eviction policy for Active-Active databases is
<code>
noeviction
</code>
. Redis Enterprise version 6.0.20 and later support all eviction policies for Active-Active databases, unless
<a href="/docs/latest/operate/rs/7.4/databases/auto-tiering/">
Auto Tiering
</a>
is enabled.
</p>
</li>
</ul>
<h3 id="clustering">
Clustering
</h3>
<ul>
<li>
<p>
In the
<strong>
Database clustering
</strong>
option, you can either:
</p>
<ul>
<li>
<p>
Make sure the Database clustering is enabled and select the number of shards
that you want to have in the database. When database clustering is enabled,
databases are subject to limitations on
<a href="/docs/latest/operate/rs/7.4/databases/durability-ha/clustering/">
Multi-key commands
</a>
.
You can increase the number of shards in the database at any time.
</p>
</li>
<li>
<p>
Clear the
<strong>
Database clustering
</strong>
option to use only one shard so that you
can use
<a href="/docs/latest/operate/rs/7.4/databases/durability-ha/clustering/">
Multi-key commands
</a>
without the limitations.
</p>
</li>
</ul>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Note:
</div>
You cannot enable or turn off database clustering after the Active-Active database is created.
</div>
</div>
</li>
<li>
<p>
<a href="/docs/latest/operate/rs/7.4/databases/configure/oss-cluster-api/">
<strong>
OSS Cluster API
</strong>
</a>
-
</p>
<p>
OSS Cluster API reduces access times and latency with near-linear scalability.
The OSS Cluster API provides a simple mechanism for Redis clients to know the cluster topology.
</p>
<p>
Clients must first connect to the master node to get the cluster topology,
and then they connect directly to the Redis proxy on each node that hosts a master shard.
</p>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Note:
</div>
You must use a client that supports the cluster API to connect to a database
that has the cluster API enabled.
</div>
</div>
<p>
</p>
</li>
</ul>
<h3 id="access-control">
Access control
</h3>
<ul>
<li>
<p>
<strong>
Unauthenticated access
</strong>
- You can access the database as the default user without providing credentials.
</p>
</li>
<li>
<p>
<strong>
Password-only authentication
</strong>
- When you configure a password for your database's default user, all connections to the database must authenticate with the [AUTH command](/docs/latest/commands/auth/.
</p>
<p>
If you also configure an access control list, connections can specify other users for authentication, and requests are allowed according to the Redis ACLs specified for that user.
</p>
<p>
Creating a database without ACLs enables a
<em>
default
</em>
user with full access to the database. You can secure default user access by requiring a password.
</p>
</li>
<li>
<p>
<strong>
Access Control List
</strong>
- You can specify the
<a href="/docs/latest/operate/rs/7.4/security/access-control/create-db-roles/">
user roles
</a>
that have access to the database and the
<a href="/docs/latest/operate/rs/7.4/security/access-control/redis-acl-overview/">
Redis ACLs
</a>
that apply to those connections.
</p>
<p>
You can only configure access control after the Active-Active database is created. In each participating cluster, add ACLs after database creation.
</p>
<p>
To define an access control list for a database:
</p>
<ol>
<li>
<p>
In
<strong>
Security > Access Control > Access Control List
</strong>
, select
<strong>
+ Add ACL
</strong>
.
</p>
</li>
<li>
<p>
Select a
<a href="/docs/latest/operate/rs/7.4/security/access-control/create-db-roles/">
role
</a>
to grant database access.
</p>
</li>
<li>
<p>
Associate a
<a href="/docs/latest/operate/rs/7.4/security/access-control/create-db-roles/">
Redis ACL
</a>
with the role and database.
</p>
</li>
<li>
<p>
Select the check mark to add the ACL.
</p>
</li>
</ol>
</li>
</ul>
<h3 id="causal-consistency">
Causal consistency
</h3>
<p>
<a href="/docs/latest/operate/rs/7.4/databases/active-active/causal-consistency/">
<strong>
Causal consistency
</strong>
</a>
in an Active-Active databaseΒ guarantees that the order of operations on a specific key is maintained across all instances of an Active-Active database.
</p>
<p>
To enable causal consistency for an existing Active-Active database, use the REST API.
</p>
<!-- Also in getting-started-crdbs.md -->
<h2 id="test-active-active-database-connections">
Test Active-Active database connections
</h2>
<p>
With the Redis database created, you are ready to connect to your database. See
<a href="/docs/latest/operate/rs/7.4/databases/active-active/connect/">
Connect to Active-Active databases
</a>
for tutorials and examples of multiple connection methods.
</p>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/7.4/databases/active-active/create/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/commands/xgroup-create/.html | <section class="prose w-full py-12">
<h1 class="command-name">
XGROUP CREATE
</h1>
<div class="font-semibold text-redis-ink-900">
Syntax
</div>
<pre class="command-syntax">XGROUP CREATE key group <id | $> [MKSTREAM]
[ENTRIESREADΒ entries-read]</pre>
<dl class="grid grid-cols-[auto,1fr] gap-2 mb-12">
<dt class="font-semibold text-redis-ink-900 m-0">
Available since:
</dt>
<dd class="m-0">
5.0.0
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
Time complexity:
</dt>
<dd class="m-0">
O(1)
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
ACL categories:
</dt>
<dd class="m-0">
<code>
@write
</code>
<span class="mr-1 last:hidden">
,
</span>
<code>
@stream
</code>
<span class="mr-1 last:hidden">
,
</span>
<code>
@slow
</code>
<span class="mr-1 last:hidden">
,
</span>
</dd>
</dl>
<p>
Create a new consumer group uniquely identified by
<code>
<groupname>
</code>
for the stream stored at
<code>
<key>
</code>
</p>
<p>
Every group has a unique name in a given stream.
When a consumer group with the same name already exists, the command returns a
<code>
-BUSYGROUP
</code>
error.
</p>
<p>
The command's
<code>
<id>
</code>
argument specifies the last delivered entry in the stream from the new group's perspective.
The special ID
<code>
$
</code>
is the ID of the last entry in the stream, but you can substitute it with any valid ID.
</p>
<p>
For example, if you want the group's consumers to fetch the entire stream from the beginning, use zero as the starting ID for the consumer group:
</p>
<pre><code>XGROUP CREATE mystream mygroup 0
</code></pre>
<p>
By default, the
<code>
XGROUP CREATE
</code>
command expects that the target stream exists, and returns an error when it doesn't.
If a stream does not exist, you can create it automatically with length of 0 by using the optional
<code>
MKSTREAM
</code>
subcommand as the last argument after the
<code>
<id>
</code>
:
</p>
<pre><code>XGROUP CREATE mystream mygroup $ MKSTREAM
</code></pre>
<p>
To enable consumer group lag tracking, specify the optional
<code>
entries_read
</code>
named argument with an arbitrary ID.
An arbitrary ID is any ID that isn't the ID of the stream's first entry, last entry, or zero ("0-0") ID.
Use it to find out how many entries are between the arbitrary ID (excluding it) and the stream's last entry.
Set the
<code>
entries_read
</code>
the stream's
<code>
entries_added
</code>
subtracted by the number of entries.
</p>
<h2 id="resp2resp3-reply">
RESP2/RESP3 Reply
</h2>
<a href="../../develop/reference/protocol-spec#simple-strings">
Simple string reply
</a>
:
<code>
OK
</code>
.
<br/>
<h2>
History
</h2>
<ul>
<li>
Starting with Redis version 7.0.0: Added the
<code>
entries_read
</code>
named argument.
</li>
</ul>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/commands/xgroup-create/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rc/changelog/july-2024/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Redis Cloud changelog (July 2024)
</h1>
<p class="text-lg -mt-5 mb-10">
New features, enhancements, and other changes added to Redis Cloud during July 2024.
</p>
<h2 id="new-features">
New Features
</h2>
<h3 id="query-performance-factor-preview">
Query performance factor preview
</h3>
<p>
When you create a Pro database with
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/search/">
Search and query
</a>
capabilities, you can now choose to boost your query capabilities with the Query performance factor. The query performance factor adds dedicated power specifically for Search and query. For more information, see
<a href="/docs/latest/operate/rc/databases/configuration/advanced-capabilities/#search-and-query-sizing">
Search and query sizing
</a>
.
</p>
<p>
You can take advantage of extra query speed for free during the preview period.
</p>
<h3 id="redis-74-preview">
Redis 7.4 Preview
</h3>
<p>
A preview of Redis 7.4 is now available on
<a href="/docs/latest/operate/rc/databases/create-database/create-essentials-database/">
Redis Cloud Essentials databases
</a>
in select regions on Amazon Web Services and Google Cloud.
</p>
<p>
Redis 7.4 offers hash field expiration and other feature set improvements. For more information on the changes in Redis 7.4, see the
<a href="https://redis.io/blog/announcing-redis-community-edition-and-redis-stack-74">
Redis 7.4 release blog post
</a>
.
</p>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rc/changelog/july-2024/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/commands/ft.aliasupdate.html | <section class="prose w-full py-12">
<h1 class="command-name">
FT.ALIASUPDATE
</h1>
<div class="font-semibold text-redis-ink-900">
Syntax
</div>
<pre class="command-syntax">FT.ALIASUPDATE alias index
</pre>
<dl class="grid grid-cols-[auto,1fr] gap-2 mb-12">
<dt class="font-semibold text-redis-ink-900 m-0">
Available in:
</dt>
<dd class="m-0">
<a href="/docs/stack">
Redis Stack
</a>
/
<a href="/docs/interact/search-and-query">
Search 1.0.0
</a>
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
Time complexity:
</dt>
<dd class="m-0">
O(1)
</dd>
</dl>
<p>
Add an alias to an index. If the alias is already associated with another
index, FT.ALIASUPDATE removes the alias association with the previous index.
</p>
<p>
<a href="#examples">
Examples
</a>
</p>
<h2 id="required-arguments">
Required arguments
</h2>
<details open="">
<summary>
<code>
alias index
</code>
</summary>
<p>
is alias to be added to an index.
</p>
</details>
<h2 id="return">
Return
</h2>
<p>
FT.ALIASUPDATE returns a simple string reply
<code>
OK
</code>
if executed correctly, or an error reply otherwise.
</p>
<h2 id="examples">
Examples
</h2>
<details open="">
<summary>
<b>
Update an index alias
</b>
</summary>
<p>
Update the alias of an index.
</p>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">127.0.0.1:6379> FT.ALIASUPDATE <span class="nb">alias</span> idx
</span></span><span class="line"><span class="cl">OK</span></span></code></pre>
</div>
<h2 id="see-also">
See also
</h2>
<p>
<a href="/docs/latest/commands/ft.aliasadd/">
<code>
FT.ALIASADD
</code>
</a>
|
<a href="/docs/latest/commands/ft.aliasdel/">
<code>
FT.ALIASDEL
</code>
</a>
</p>
<h2 id="related-topics">
Related topics
</h2>
<p>
<a href="/docs/latest/develop/interact/search-and-query/">
RediSearch
</a>
</p>
<br/>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/commands/ft.aliasupdate/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</details>
</section>
|
https://redis.io/docs/latest/develop/commands/ft.create.html | <section class="prose w-full py-12">
<h1 class="command-name">
FT.CREATE
</h1>
<div class="font-semibold text-redis-ink-900">
Syntax
</div>
<pre class="command-syntax">FT.CREATE index
[ON HASH | JSON]
[PREFIX count prefix [prefix ...]]
[FILTER {filter}]
[LANGUAGE default_lang]
[LANGUAGE_FIELD lang_attribute]
[SCORE default_score]
[SCORE_FIELD score_attribute]
[PAYLOAD_FIELD payload_attribute]
[MAXTEXTFIELDS]
[TEMPORARY seconds]
[NOOFFSETS]
[NOHL]
[NOFIELDS]
[NOFREQS]
[STOPWORDS count [stopword ...]]
[SKIPINITIALSCAN]
SCHEMA field_name [AS alias] TEXT | TAG | NUMERIC | GEO | VECTOR | GEOSHAPE [ SORTABLE [UNF]]
[NOINDEX] [ field_name [AS alias] TEXT | TAG | NUMERIC | GEO | VECTOR | GEOSHAPE [ SORTABLE [UNF]] [NOINDEX] ...]
</pre>
<dl class="grid grid-cols-[auto,1fr] gap-2 mb-12">
<dt class="font-semibold text-redis-ink-900 m-0">
Available in:
</dt>
<dd class="m-0">
<a href="/docs/stack">
Redis Stack
</a>
/
<a href="/docs/interact/search-and-query">
Search 1.0.0
</a>
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
Time complexity:
</dt>
<dd class="m-0">
O(K) at creation where K is the number of fields, O(N) if scanning the keyspace is triggered, where N is the number of keys in the keyspace
</dd>
</dl>
<h2 id="description">
Description
</h2>
<p>
Create an index with the given specification. For usage, see
<a href="#examples">
Examples
</a>
.
</p>
<h2 id="required-arguments">
Required arguments
</h2>
<p>
<a name="index">
</a>
</p>
<details open="">
<p>
</p>
<summary>
<code>
index
</code>
</summary>
<p>
is index name to create.
If such index already exists, returns an error reply
<code>
(error) Index already exists
</code>
.
</p>
</details>
<p>
<a name="SCHEMA">
</a>
</p>
<details open="">
<p>
</p>
<summary>
<code>
SCHEMA {identifier} AS {attribute} {attribute type} {options...
</code>
</summary>
<p>
after the SCHEMA keyword, declares which fields to index:
</p>
<ul>
<li>
<p>
<code>
{identifier}
</code>
for hashes, is a field name within the hash.
For JSON, the identifier is a JSON Path expression.
</p>
</li>
<li>
<p>
<code>
AS {attribute}
</code>
defines the attribute associated to the identifier. For example, you can use this feature to alias a complex JSONPath expression with more memorable (and easier to type) name.
</p>
</li>
</ul>
<p>
Field types are:
</p>
<ul>
<li>
<p>
<code>
TEXT
</code>
- Allows full-text search queries against the value in this attribute.
</p>
</li>
<li>
<p>
<code>
TAG
</code>
- Allows exact-match queries, such as categories or primary keys, against the value in this attribute. For more information, see
<a href="/docs/latest/develop/interact/search-and-query/advanced-concepts/tags/">
Tag Fields
</a>
.
</p>
</li>
<li>
<p>
<code>
NUMERIC
</code>
- Allows numeric range queries against the value in this attribute. See
<a href="/docs/latest/develop/interact/search-and-query/query/">
query syntax docs
</a>
for details on how to use numeric ranges.
</p>
</li>
<li>
<p>
<code>
GEO
</code>
- Allows radius range queries against the value (point) in this attribute. The value of the attribute must be a string containing a longitude (first) and latitude separated by a comma.
</p>
</li>
<li>
<p>
<code>
VECTOR
</code>
- Allows vector queries against the value in this attribute. This requires
<a href="/docs/latest/develop/interact/search-and-query/advanced-concepts/dialects/#dialect-2">
query dialect 2
</a>
or above (introduced in
<a href="https://github.com/RediSearch/RediSearch/releases/tag/v2.4.3">
RediSearch v2.4
</a>
). For more information, see
<a href="/docs/latest/develop/interact/search-and-query/advanced-concepts/vectors/">
Vector Fields
</a>
.
</p>
</li>
<li>
<p>
<code>
GEOSHAPE
</code>
- Allows polygon queries against the value in this attribute. The value of the attribute must follow a
<a href="https://en.wikipedia.org/wiki/Well-known_text_representation_of_geometry">
WKT notation
</a>
list of 2D points representing the polygon edges
<code>
POLYGON((x1 y1, x2 y2, ...)
</code>
separated by a comma. A
<code>
GEOSHAPE
</code>
field type can be followed by one of the following coordinate systems:
</p>
<ul>
<li>
<code>
SPHERICAL
</code>
for Geographic longitude and latitude coordinates
</li>
<li>
<code>
FLAT
</code>
for Cartesian X Y coordinates
</li>
</ul>
<p>
The default coordinate system is
<code>
SPHERICAL
</code>
.
</p>
<p>
Currently
<code>
GEOSHAPE
</code>
doesn't support JSON multi-value and
<code>
SORTABLE
</code>
option.
</p>
</li>
</ul>
<p>
Field options are:
</p>
<ul>
<li>
<p>
<code>
SORTABLE
</code>
-
<code>
NUMERIC
</code>
,
<code>
TAG
</code>
,
<code>
TEXT
</code>
, or
<code>
GEO
</code>
attributes can have an optional
<strong>
SORTABLE
</strong>
argument. As the user
<a href="/docs/latest/develop/interact/search-and-query/advanced-concepts/sorting/">
sorts the results by the value of this attribute
</a>
, the results are available with very low latency. Note that his adds memory overhead, so consider not declaring it on large text attributes. You can sort an attribute without the
<code>
SORTABLE
</code>
option, but the latency is not as good as with
<code>
SORTABLE
</code>
.
</p>
</li>
<li>
<p>
<code>
UNF
</code>
- By default, for hashes (not with JSON)
<code>
SORTABLE
</code>
applies a normalization to the indexed value (characters set to lowercase, removal of diacritics). When using the unnormalized form (UNF), you can disable the normalization and keep the original form of the value. With JSON,
<code>
UNF
</code>
is implicit with
<code>
SORTABLE
</code>
(normalization is disabled).
</p>
</li>
<li>
<p>
<code>
NOSTEM
</code>
- Text attributes can have the NOSTEM argument that disables stemming when indexing its values. This may be ideal for things like proper names.
</p>
</li>
<li>
<p>
<code>
NOINDEX
</code>
- Attributes can have the
<code>
NOINDEX
</code>
option, which means they will not be indexed. This is useful in conjunction with
<code>
SORTABLE
</code>
, to create attributes whose update using PARTIAL will not cause full reindexing of the document. If an attribute has NOINDEX and doesn't have SORTABLE, it will just be ignored by the index.
</p>
</li>
<li>
<p>
<code>
PHONETIC {matcher}
</code>
- Declaring a text attribute as
<code>
PHONETIC
</code>
will perform phonetic matching on it in searches by default. The obligatory {matcher} argument specifies the phonetic algorithm and language used. The following matchers are supported:
</p>
<ul>
<li>
<code>
dm:en
</code>
- Double metaphone for English
</li>
<li>
<code>
dm:fr
</code>
- Double metaphone for French
</li>
<li>
<code>
dm:pt
</code>
- Double metaphone for Portuguese
</li>
<li>
<code>
dm:es
</code>
- Double metaphone for Spanish
</li>
</ul>
<p>
For more information, see
<a href="/docs/latest/develop/interact/search-and-query/advanced-concepts/phonetic_matching/">
Phonetic Matching
</a>
.
</p>
</li>
<li>
<p>
<code>
WEIGHT {weight}
</code>
for
<code>
TEXT
</code>
attributes, declares the importance of this attribute when calculating result accuracy. This is a multiplication factor, and defaults to 1 if not specified.
</p>
</li>
<li>
<p>
<code>
SEPARATOR {sep}
</code>
for
<code>
TAG
</code>
attributes, indicates how the text contained in the attribute is to be split into individual tags. The default is
<code>
,
</code>
. The value must be a single character.
</p>
</li>
<li>
<p>
<code>
CASESENSITIVE
</code>
for
<code>
TAG
</code>
attributes, keeps the original letter cases of the tags. If not specified, the characters are converted to lowercase.
</p>
</li>
<li>
<p>
<code>
WITHSUFFIXTRIE
</code>
for
<code>
TEXT
</code>
and
<code>
TAG
</code>
attributes, keeps a suffix trie with all terms which match the suffix. It is used to optimize
<code>
contains
</code>
(
<em>
foo
</em>
) and
<code>
suffix
</code>
(*foo) queries. Otherwise, a brute-force search on the trie is performed. If suffix trie exists for some fields, these queries will be disabled for other fields.
</p>
</li>
<li>
<p>
<code>
INDEXEMPTY
</code>
for
<code>
TEXT
</code>
and
<code>
TAG
</code>
attributes, introduced in v2.10, allows you to index and search for empty strings. By default, empty strings are not indexed.
</p>
</li>
<li>
<p>
<code>
INDEXMISSING
</code>
for all field types, introduced in v2.10, allows you to search for missing values, that is, documents that do not contain a specific field. Note the difference between a field with an empty value and a document with a missing value. By default, missing values are not indexed.
</p>
</li>
</ul>
</details>
<h2 id="optional-arguments">
Optional arguments
</h2>
<p>
<a name="ON">
</a>
</p>
<details open="">
<p>
</p>
<summary>
<code>
ON {data_type}
</code>
</summary>
<p>
currently supports HASH (default) and JSON. To index JSON, you must have the
<a href="/docs/latest/develop/data-types/json/">
RedisJSON
</a>
module installed.
</p>
</details>
<p>
<a name="PREFIX">
</a>
</p>
<details open="">
<p>
</p>
<summary>
<code>
PREFIX {count} {prefix}
</code>
</summary>
<p>
tells the index which keys it should index. You can add several prefixes to index. Because the argument is optional, the default is
<code>
*
</code>
(all keys).
</p>
</details>
<p>
<a name="FILTER">
</a>
</p>
<details open="">
<p>
</p>
<summary>
<code>
FILTER {filter}
</code>
</summary>
<p>
is a filter expression with the full RediSearch aggregation expression language. It is possible to use
<code>
@__key
</code>
to access the key that was just added/changed. A field can be used to set field name by passing
<code>
'FILTER @indexName=="myindexname"'
</code>
.
</p>
</details>
<p>
<a name="LANGUAGE">
</a>
</p>
<details open="">
<p>
</p>
<summary>
<code>
LANGUAGE {default_lang}
</code>
</summary>
<p>
if set, indicates the default language for documents in the index. Default is English.
</p>
</details>
<p>
<a name="LANGUAGE_FIELD">
</a>
</p>
<details open="">
<p>
</p>
<summary>
<code>
LANGUAGE_FIELD {lang_attribute}
</code>
</summary>
<p>
is a document attribute set as the document language.
</p>
<p>
A stemmer is used for the supplied language during indexing. If an unsupported language is sent, the command returns an error. The supported languages are Arabic, Basque, Catalan, Danish, Dutch, English, Finnish, French, German, Greek, Hungarian,
Indonesian, Irish, Italian, Lithuanian, Nepali, Norwegian, Portuguese, Romanian, Russian,
Spanish, Swedish, Tamil, Turkish, and Chinese.
</p>
<p>
When adding Chinese language documents, set
<code>
LANGUAGE chinese
</code>
for the indexer to properly tokenize the terms. If you use the default language, then search terms are extracted based on punctuation characters and whitespace. The Chinese language tokenizer makes use of a segmentation algorithm (via
<a href="https://github.com/lionsoul2014/friso">
Friso
</a>
), which segments text and checks it against a predefined dictionary. See
<a href="/docs/latest/develop/interact/search-and-query/advanced-concepts/stemming/">
Stemming
</a>
for more information.
</p>
</details>
<p>
<a name="SCORE">
</a>
</p>
<details open="">
<p>
</p>
<summary>
<code>
SCORE {default_score}
</code>
</summary>
<p>
is default score for documents in the index. Default score is 1.0.
</p>
</details>
<p>
<a name="SCORE_FIELD">
</a>
</p>
<details open="">
<p>
</p>
<summary>
<code>
SCORE_FIELD {score_attribute}
</code>
</summary>
<p>
is document attribute that you use as the document rank based on the user ranking. Ranking must be between 0.0 and 1.0. If not set, the default score is 1.
</p>
</details>
<p>
<a name="PAYLOAD_FIELD">
</a>
</p>
<details open="">
<p>
</p>
<summary>
<code>
PAYLOAD_FIELD {payload_attribute}
</code>
</summary>
<p>
is document attribute that you use as a binary safe payload string to the document that can be evaluated at query time by a custom scoring function or retrieved to the client.
</p>
</details>
<p>
<a name="MAXTEXTFIELDS">
</a>
</p>
<details open="">
<p>
</p>
<summary>
<code>
MAXTEXTFIELDS
</code>
</summary>
<p>
forces RediSearch to encode indexes as if there were more than 32 text attributes, which allows you to add additional attributes (beyond 32) using
<a href="/docs/latest/commands/ft.alter/">
<code>
FT.ALTER
</code>
</a>
. For efficiency, RediSearch encodes indexes differently if they are created with less than 32 text attributes.
</p>
</details>
<p>
<a name="NOOFFSETS">
</a>
</p>
<details open="">
<p>
</p>
<summary>
<code>
NOOFFSETS
</code>
</summary>
<p>
does not store term offsets for documents. It saves memory, but does not allow exact searches or highlighting. It implies
<code>
NOHL
</code>
.
</p>
</details>
<p>
<a name="TEMPORARY">
</a>
</p>
<details open="">
<p>
</p>
<summary>
<code>
TEMPORARY {seconds}
</code>
</summary>
<p>
creates a lightweight temporary index that expires after a specified period of inactivity, in seconds. The internal idle timer is reset whenever the index is searched or added to. Because such indexes are lightweight, you can create thousands of such indexes without negative performance implications and, therefore, you should consider using
<code>
SKIPINITIALSCAN
</code>
to avoid costly scanning.
</p>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Warning:
</div>
When temporary indexes expire, they drop all the records associated with them.
<a href="/docs/latest/commands/ft.dropindex/">
<code>
FT.DROPINDEX
</code>
</a>
was introduced with a default of not deleting docs and a
<code>
DD
</code>
flag that enforced deletion.
However, for temporary indexes, documents are deleted along with the index.
Historically, RediSearch used an FT.ADD command, which made a connection between the document and the index. Then, FT.DROP, also a hystoric command, deleted documents by default.
In version 2.x, RediSearch indexes hashes and JSONs, and the dependency between the index and documents no longer exists.
</div>
</div>
</details>
<p>
<a name="NOHL">
</a>
</p>
<details open="">
<p>
</p>
<summary>
<code>
NOHL
</code>
</summary>
<p>
conserves storage space and memory by disabling highlighting support. If set, the corresponding byte offsets for term positions are not stored.
<code>
NOHL
</code>
is also implied by
<code>
NOOFFSETS
</code>
.
</p>
</details>
<p>
<a name="NOFIELDS">
</a>
</p>
<details open="">
<p>
</p>
<summary>
<code>
NOFIELDS
</code>
</summary>
<p>
does not store attribute bits for each term. It saves memory, but it does not allow
filtering by specific attributes.
</p>
</details>
<p>
<a name="NOFREQS">
</a>
</p>
<details open="">
<p>
</p>
<summary>
<code>
NOFREQS
</code>
</summary>
<p>
avoids saving the term frequencies in the index. It saves memory, but does not allow sorting based on the frequencies of a given term within the document.
</p>
</details>
<p>
<a name="STOPWORDS">
</a>
</p>
<details open="">
<p>
</p>
<summary>
<code>
STOPWORDS {count}
</code>
</summary>
<p>
sets the index with a custom stopword list, to be ignored during indexing and search time.
<code>
{count}
</code>
is the number of stopwords, followed by a list of stopword arguments exactly the length of
<code>
{count}
</code>
.
</p>
<p>
If not set, FT.CREATE takes the default list of stopwords. If
<code>
{count}
</code>
is set to 0, the index does not have stopwords.
</p>
</details>
<p>
<a name="SKIPINITIALSCAN">
</a>
</p>
<details open="">
<p>
</p>
<summary>
<code>
SKIPINITIALSCAN
</code>
</summary>
<p>
if set, does not scan and index.
</p>
</details>
<p>
<note>
<b>
Notes:
</b>
</note>
</p>
<ul>
<li>
<p>
<strong>
Attribute number limits:
</strong>
RediSearch supports up to 1024 attributes per schema, out of which at most 128 can be TEXT attributes. On 32 bit builds, at most 64 attributes can be TEXT attributes. The more attributes you have, the larger your index, as each additional 8 attributes require one extra byte per index record to encode. You can always use the
<code>
NOFIELDS
</code>
option and not encode attribute information into the index, for saving space, if you do not need filtering by text attributes. This will still allow filtering by numeric and geo attributes.
</p>
</li>
<li>
<p>
<strong>
Running in clustered databases:
</strong>
When having several indices in a clustered database, you need to make sure the documents you want to index reside on the same shard as the index. You can achieve this by having your documents tagged by the index name.
</p>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">127.0.0.1:6379> HSET doc:1<span class="o">{</span>idx<span class="o">}</span> ...
</span></span><span class="line"><span class="cl">127.0.0.1:6379> FT.CREATE idx ... PREFIX <span class="m">1</span> doc: ...</span></span></code></pre>
</div>
<p>
When Running RediSearch in a clustered database, you can span the index across shards using
<a href="https://github.com/RedisLabsModules/RSCoordinator">
RSCoordinator
</a>
. In this case the above does not apply.
</p>
</li>
</ul>
<h2 id="return">
Return
</h2>
<p>
FT.CREATE returns a simple string reply
<code>
OK
</code>
if executed correctly, or an error reply otherwise.
</p>
<h2 id="examples">
Examples
</h2>
<details open="">
<summary>
<b>
Create an index
</b>
</summary>
<p>
Create an index that stores the title, publication date, and categories of blog post hashes whose keys start with
<code>
blog:post:
</code>
(for example,
<code>
blog:post:1
</code>
).
</p>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">127.0.0.1:6379> FT.CREATE idx ON HASH PREFIX <span class="m">1</span> blog:post: SCHEMA title TEXT SORTABLE published_at NUMERIC SORTABLE category TAG SORTABLE
</span></span><span class="line"><span class="cl">OK</span></span></code></pre>
</div>
<p>
Index the
<code>
sku
</code>
attribute from a hash as both a
<code>
TAG
</code>
and as
<code>
TEXT
</code>
:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">127.0.0.1:6379> FT.CREATE idx ON HASH PREFIX <span class="m">1</span> blog:post: SCHEMA sku AS sku_text TEXT sku AS sku_tag TAG SORTABLE</span></span></code></pre>
</div>
<p>
Index two different hashes, one containing author data and one containing books, in the same index:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">127.0.0.1:6379> FT.CREATE author-books-idx ON HASH PREFIX <span class="m">2</span> author:details: book:details: SCHEMA
</span></span><span class="line"><span class="cl">author_id TAG SORTABLE author_ids TAG title TEXT name TEXT</span></span></code></pre>
</div>
<p>
In this example, keys for author data use the key pattern
<code>
author:details:<id>
</code>
while keys for book data use the pattern
<code>
book:details:<id>
</code>
.
</p>
<p>
Index authors whose names start with G.
</p>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">127.0.0.1:6379> FT.CREATE g-authors-idx ON HASH PREFIX <span class="m">1</span> author:details FILTER <span class="s1">'startswith(@name, "G")'</span> SCHEMA name TEXT</span></span></code></pre>
</div>
<p>
Index only books that have a subtitle.
</p>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">127.0.0.1:6379> FT.CREATE subtitled-books-idx ON HASH PREFIX <span class="m">1</span> book:details FILTER <span class="s1">'@subtitle != ""'</span> SCHEMA title TEXT</span></span></code></pre>
</div>
<p>
Index books that have a "categories" attribute where each category is separated by a
<code>
;
</code>
character.
</p>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">127.0.0.1:6379> FT.CREATE books-idx ON HASH PREFIX <span class="m">1</span> book:details SCHEMA title TEXT categories TAG SEPARATOR <span class="s2">";"</span></span></span></code></pre>
</div>
</details>
<details open="">
<summary>
<b>
Index a JSON document using a JSON Path expression
</b>
</summary>
<p>
The following example uses data similar to the hash examples above but uses JSON instead.
</p>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">127.0.0.1:6379> FT.CREATE idx ON JSON SCHEMA $.title AS title TEXT $.categories AS categories TAG</span></span></code></pre>
</div>
</details>
<h2 id="see-also">
See also
</h2>
<p>
<a href="/docs/latest/commands/ft.alter/">
<code>
FT.ALTER
</code>
</a>
|
<a href="/docs/latest/commands/ft.dropindex/">
<code>
FT.DROPINDEX
</code>
</a>
</p>
<h2 id="related-topics">
Related topics
</h2>
<ul>
<li>
<a href="/docs/latest/develop/interact/search-and-query/">
RediSearch
</a>
</li>
<li>
<a href="/docs/latest/develop/data-types/json/">
RedisJSON
</a>
</li>
<li>
<a href="https://github.com/lionsoul2014/friso">
Friso
</a>
</li>
<li>
<a href="/docs/latest/develop/interact/search-and-query/advanced-concepts/stemming/">
Stemming
</a>
</li>
<li>
<a href="/docs/latest/develop/interact/search-and-query/advanced-concepts/phonetic_matching/">
Phonetic Matching
</a>
</li>
<li>
<a href="https://github.com/RedisLabsModules/RSCoordinator">
RSCoordinator
</a>
</li>
</ul>
<br/>
<h2>
History
</h2>
<ul>
<li>
Starting with Redis version 2.0.0: Added
<code>
PAYLOAD_FIELD
</code>
argument for backward support of
<code>
FT.SEARCH
</code>
deprecated
<code>
WITHPAYLOADS
</code>
argument
</li>
<li>
Starting with Redis version 2.0.0: Deprecated
<code>
PAYLOAD_FIELD
</code>
argument
</li>
</ul>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/commands/ft.create/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/release-notes/rs-7-4-2-releases/rs-7-4-6-77/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Redis Enterprise Software release notes 7.4.6-77 (September 2024)
</h1>
<p class="text-lg -mt-5 mb-10">
Updated module feature sets. Bug fixes.
</p>
<p>
This is a maintenance release for β
<a href="https://redis.com/redis-enterprise-software/download-center/software/">
βRedis Enterprise Software version 7.4.6
</a>
.
</p>
<h2 id="highlights">
Highlights
</h2>
<p>
This version offers:
</p>
<ul>
<li>
<p>
Updated module feature sets
</p>
</li>
<li>
<p>
Bug fixes
</p>
</li>
</ul>
<h2 id="new-in-this-release">
New in this release
</h2>
<h4 id="redis-module-feature-sets">
Redis module feature sets
</h4>
<p>
Redis Enterprise comes packaged with several modules. As of version 7.4.2, Redis Enterprise includes two feature sets, compatible with different Redis database versions.
</p>
<p>
Bundled Redis modules compatible with Redis database version 7.2:
</p>
<ul>
<li>
<p>
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redisearch/redisearch-2.8-release-notes/">
RediSearch 2.8.18
</a>
</p>
</li>
<li>
<p>
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redisjson/redisjson-2.6-release-notes/">
RedisJSON 2.6.13
</a>
</p>
</li>
<li>
<p>
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redistimeseries/redistimeseries-1.10-release-notes/">
RedisTimeSeries 1.10.14
</a>
</p>
</li>
<li>
<p>
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redisbloom/redisbloom-2.6-release-notes/">
RedisBloom 2.6.15
</a>
</p>
</li>
<li>
<p>
<a href="https://github.com/RedisGears/RedisGears/releases/tag/v2.0.20-m21">
RedisGears 2.0.20 preview
</a>
: The RedisGears preview will not be promoted to GA and will be removed in a future release.
</p>
</li>
</ul>
<p>
Bundled Redis modules compatible with Redis database versions 6.0 and 6.2:
</p>
<ul>
<li>
<p>
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redisearch/redisearch-2.6-release-notes/">
RediSearch 2.6.22
</a>
</p>
</li>
<li>
<p>
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redisjson/redisjson-2.4-release-notes/">
RedisJSON 2.4.9
</a>
</p>
</li>
<li>
<p>
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redistimeseries/redistimeseries-1.8-release-notes/">
RedisTimeSeries 1.8.14
</a>
</p>
</li>
<li>
<p>
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redisbloom/redisbloom-2.4-release-notes/">
RedisBloom 2.4.12
</a>
</p>
</li>
<li>
<p>
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redisgraph/redisgraph-2.10-release-notes/">
RedisGraph v2.10.15
</a>
: RedisGraph end-of-life has been announced and will be removed in a future release. See the
<a href="https://redis.io/blog/redisgraph-eol/">
RedisGraph end-of-life announcement
</a>
for more details.
</p>
</li>
</ul>
<h3 id="resolved-issues">
Resolved issues
</h3>
<ul>
<li>
<p>
RS133928: Updated LDAP URI validation to allow escape characters.
</p>
</li>
<li>
<p>
RS128184: Fixed an issue that sometimes prevented a new node from joining the cluster after removing a node.
</p>
</li>
<li>
<p>
RS132653: Fixed an issue that caused shard crashes when resharding Active-Active databases with Redis version 6.0.
</p>
</li>
<li>
<p>
RS131360: Changed key eviction for Active-Active databases to delete a key instead of expiring it.
</p>
</li>
</ul>
<h2 id="version-changes">
Version changes
</h2>
<h3 id="product-lifecycle-updates">
Product lifecycle updates
</h3>
<h4 id="end-of-life-policy-extension">
End-of-life policy extension
</h4>
<p>
The end-of-life policy for Redis Enterprise Software versions 6.2 and later has been extended to 24 months after the formal release of the subsequent major version. For the updated end-of-life schedule, see the
<a href="/docs/latest/operate/rs/installing-upgrading/product-lifecycle/">
Redis Enterprise Software product lifecycle
</a>
.
</p>
<h4 id="supported-upgrade-paths">
Supported upgrade paths
</h4>
<p>
Redis Enterprise Software versions 6.2.4 and 6.2.8 do not support direct upgrades beyond version 7.4.x. Versions 6.2.10, 6.2.12, and 6.2.18 are part of the
<a href="/docs/latest/operate/rs/installing-upgrading/upgrading/upgrade-cluster/#supported-upgrade-paths">
upgrade path
</a>
. To upgrade from 6.2.4 or 6.2.8 to versions later than 7.4.x, an intermediate upgrade is required.
</p>
<p>
The next major Redis Enterprise Software release will still bundle Redis database version 6.2 and allow database upgrades from Redis database version 6.2 to 7.x.
</p>
<p>
See the
<a href="/docs/latest/operate/rs/installing-upgrading/product-lifecycle/">
Redis Enterprise Software product lifecycle
</a>
for more information about release numbers.
</p>
<h3 id="deprecations">
Deprecations
</h3>
<h4 id="legacy-ui-deprecation">
Legacy UI deprecation
</h4>
<p>
The legacy UI is deprecated in favor of the new Cluster Manager UI and will be removed in a future release.
</p>
<h4 id="redis-60-database-deprecation">
Redis 6.0 database deprecation
</h4>
<p>
Redis database version 6.0 is deprecated as of Redis Enterprise Software version 7.4.2 and will be removed in a future release.
</p>
<p>
To prepare for the future removal of Redis 6.0:
</p>
<ul>
<li>
<p>
For Redis Enterprise 6.2.* clusters, upgrade Redis 6.0 databases to Redis 6.2. See the
<a href="https://raw.githubusercontent.com/redis/redis/6.2/00-RELEASENOTES">
Redis 6.2 release notes
</a>
for the list of changes.
</p>
</li>
<li>
<p>
For Redis Enterprise 7.2.4 and 7.4.x clusters, upgrade Redis 6.0 databases to Redis 7.2. Before you upgrade your databases, see the list of
<a href="/docs/latest/operate/rs/release-notes/rs-7-2-4-releases/rs-7-2-4-52/#redis-72-breaking-changes">
Redis 7.2 breaking changes
</a>
and update any applications that connect to your database to handle these changes.
</p>
</li>
</ul>
<h4 id="end-of-triggers-and-functions-preview">
End of triggers and functions preview
</h4>
<p>
The
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/deprecated-features/triggers-and-functions/">
triggers and functions
</a>
(RedisGears) preview has been discontinued.
</p>
<ul>
<li>
<p>
Commands such as
<code>
TFCALL
</code>
,
<code>
TFCALLASYNC
</code>
, and
<code>
TFUNCTION
</code>
will be deprecated and will return error messages.
</p>
</li>
<li>
<p>
Any JavaScript functions stored in Redis will be removed.
</p>
</li>
<li>
<p>
JavaScript-based triggers will be blocked.
</p>
</li>
<li>
<p>
Lua functions and scripts will not be affected.
</p>
</li>
</ul>
<p>
If your database currently uses triggers and functions, you need to:
</p>
<ol>
<li>
<p>
Adjust your applications to accommodate these changes.
</p>
</li>
<li>
<p>
Delete all triggers and functions libraries from your existing database:
</p>
<ol>
<li>
<p>
Run
<code>
TFUNCTION LIST
</code>
.
</p>
</li>
<li>
<p>
Copy all library names.
</p>
</li>
<li>
<p>
Run
<code>
TFUNCTION DELETE
</code>
for each library in the list.
</p>
</li>
</ol>
<p>
If any triggers and functions libraries remain in the database, the RDB snapshot won't load on a cluster without RedisGears.
</p>
</li>
<li>
<p>
Migrate your database to a new database without the RedisGears module.
</p>
</li>
</ol>
<h4 id="redisgraph-end-of-life">
RedisGraph end of life
</h4>
<p>
Redis has announced the end of life for RedisGraph. Redis will continue to support all RedisGraph customers, including releasing patch versions until January 31, 2025.
</p>
<p>
See the
<a href="https://redis.com/blog/redisgraph-eol/">
RedisGraph end-of-life announcement
</a>
for more details.
</p>
<h3 id="upcoming-changes">
Upcoming changes
</h3>
<h4 id="default-image-change-for-redis-enterprise-software-containers">
Default image change for Redis Enterprise Software containers
</h4>
<p>
Starting with the next major version, Redis Enterprise Software containers with the image tag
<code>
x.y.z-build
</code>
will be based on RHEL instead of Ubuntu.
</p>
<p>
This change will only affect you if you use containers outside the official
<a href="/docs/latest/operate/kubernetes/">
Redis Enterprise for Kubernetes
</a>
product and use Ubuntu-specific commands.
</p>
<p>
To use Ubuntu-based images after this change, you can specify the operating system suffix in the image tag. For example, use the image tag
<code>
7.4.2-216.focal
</code>
instead of
<code>
7.4.2-216
</code>
.
</p>
<h3 id="supported-platforms">
Supported platforms
</h3>
<p>
The following table provides a snapshot of supported platforms as of this Redis Enterprise Software release. See the
<a href="/docs/latest/operate/rs/references/supported-platforms/">
supported platforms reference
</a>
for more details about operating system compatibility.
</p>
<p>
<span title="Check mark icon">
β
</span>
Supported β The platform is supported for this version of Redis Enterprise Software and Redis Stack modules.
</p>
<p>
<span class="font-serif" title="Warning icon">
β οΈ
</span>
Deprecation warning β The platform is still supported for this version of Redis Enterprise Software, but support will be removed in a future release.
</p>
<table>
<thead>
<tr>
<th>
Redis Enterprise
<br/>
major versions
</th>
<th style="text-align:center">
7.4
</th>
<th style="text-align:center">
7.2
</th>
<th style="text-align:center">
6.4
</th>
<th style="text-align:center">
6.2
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<strong>
Release date
</strong>
</td>
<td style="text-align:center">
Feb 2024
</td>
<td style="text-align:center">
Aug 2023
</td>
<td style="text-align:center">
Feb 2023
</td>
<td style="text-align:center">
Aug 2021
</td>
</tr>
<tr>
<td>
<a href="/docs/latest/operate/rs/installing-upgrading/product-lifecycle/#endoflife-schedule">
<strong>
End-of-life date
</strong>
</a>
</td>
<td style="text-align:center">
Determined after
<br/>
next major release
</td>
<td style="text-align:center">
Feb 2026
</td>
<td style="text-align:center">
Aug 2025
</td>
<td style="text-align:center">
Feb 2025
</td>
</tr>
<tr>
<td>
<strong>
Platforms
</strong>
</td>
<td style="text-align:center">
</td>
<td style="text-align:center">
</td>
<td style="text-align:center">
</td>
<td style="text-align:center">
</td>
</tr>
<tr>
<td>
RHEL 9 &
<br/>
compatible distros
<sup>
<a href="#table-note-1">
1
</a>
</sup>
</td>
<td style="text-align:center">
<span title="Supported">
β
</span>
</td>
<td style="text-align:center">
β
</td>
<td style="text-align:center">
β
</td>
<td style="text-align:center">
β
</td>
</tr>
<tr>
<td>
RHEL 8 &
<br/>
compatible distros
<sup>
<a href="#table-note-1">
1
</a>
</sup>
</td>
<td style="text-align:center">
<span title="Supported">
β
</span>
</td>
<td style="text-align:center">
<span title="Supported">
β
</span>
</td>
<td style="text-align:center">
<span title="Supported">
β
</span>
</td>
<td style="text-align:center">
<span title="Supported">
β
</span>
</td>
</tr>
<tr>
<td>
RHEL 7 &
<br/>
compatible distros
<sup>
<a href="#table-note-1">
1
</a>
</sup>
</td>
<td style="text-align:center">
β
</td>
<td style="text-align:center">
<span class="font-serif" title="Deprecated">
β οΈ
</span>
</td>
<td style="text-align:center">
<span title="Supported">
β
</span>
</td>
<td style="text-align:center">
<span title="Supported">
β
</span>
</td>
</tr>
<tr>
<td>
Ubuntu 20.04
<sup>
<a href="#table-note-2">
2
</a>
</sup>
</td>
<td style="text-align:center">
<span title="Supported">
β
</span>
</td>
<td style="text-align:center">
<span title="Supported">
β
</span>
</td>
<td style="text-align:center">
<span title="Supported">
β
</span>
</td>
<td style="text-align:center">
β
</td>
</tr>
<tr>
<td>
Ubuntu 18.04
<sup>
<a href="#table-note-2">
2
</a>
</sup>
</td>
<td style="text-align:center">
<span class="font-serif" title="Deprecated">
β οΈ
</span>
</td>
<td style="text-align:center">
<span class="font-serif" title="Deprecated">
β οΈ
</span>
</td>
<td style="text-align:center">
<span title="Supported">
β
</span>
</td>
<td style="text-align:center">
<span title="Supported">
β
</span>
</td>
</tr>
<tr>
<td>
Ubuntu 16.04
<sup>
<a href="#table-note-2">
2
</a>
</sup>
</td>
<td style="text-align:center">
β
</td>
<td style="text-align:center">
<span class="font-serif" title="Deprecated">
β οΈ
</span>
</td>
<td style="text-align:center">
<span title="Supported">
β
</span>
</td>
<td style="text-align:center">
<span title="Supported">
β
</span>
</td>
</tr>
<tr>
<td>
Amazon Linux 2
</td>
<td style="text-align:center">
<span title="Supported">
β
</span>
</td>
<td style="text-align:center">
<span title="Supported">
β
</span>
</td>
<td style="text-align:center">
<span title="Supported">
β
</span>
</td>
<td style="text-align:center">
β
</td>
</tr>
<tr>
<td>
Amazon Linux 1
</td>
<td style="text-align:center">
β
</td>
<td style="text-align:center">
<span title="Supported">
β
</span>
</td>
<td style="text-align:center">
<span title="Supported">
β
</span>
</td>
<td style="text-align:center">
<span title="Supported">
β
</span>
</td>
</tr>
<tr>
<td>
Kubernetes
<sup>
<a href="#table-note-3">
3
</a>
</sup>
</td>
<td style="text-align:center">
<span title="Supported">
β
</span>
</td>
<td style="text-align:center">
<span title="Supported">
β
</span>
</td>
<td style="text-align:center">
<span title="Supported">
β
</span>
</td>
<td style="text-align:center">
<span title="Supported">
β
</span>
</td>
</tr>
<tr>
<td>
Docker
<sup>
<a href="#table-note-4">
4
</a>
</sup>
</td>
<td style="text-align:center">
<span title="Supported">
β
</span>
</td>
<td style="text-align:center">
<span title="Supported">
β
</span>
</td>
<td style="text-align:center">
<span title="Supported">
β
</span>
</td>
<td style="text-align:center">
<span title="Supported">
β
</span>
</td>
</tr>
</tbody>
</table>
<ol>
<li>
<p>
<a name="table-note-1" style="display: block; height: 80px; margin-top: -80px;">
</a>
The RHEL-compatible distributions CentOS, CentOS Stream, Alma, and Rocky are supported if they have full RHEL compatibility. Oracle Linux running the Red Hat Compatible Kernel (RHCK) is supported, but the Unbreakable Enterprise Kernel (UEK) is not supported.
</p>
</li>
<li>
<p>
<a name="table-note-2" style="display: block; height: 80px; margin-top: -80px;">
</a>
The server version of Ubuntu is recommended for production installations. The desktop version is only recommended for development deployments.
</p>
</li>
<li>
<p>
<a name="table-note-3" style="display: block; height: 80px; margin-top: -80px;">
</a>
See the
<a href="/docs/latest/operate/kubernetes/reference/supported_k8s_distributions/">
Redis Enterprise for Kubernetes documentation
</a>
for details about support per version and Kubernetes distribution.
</p>
</li>
<li>
<p>
<a name="table-note-4" style="display: block; height: 80px; margin-top: -80px;">
</a>
<a href="/docs/latest/operate/rs/installing-upgrading/quickstarts/docker-quickstart/">
Docker images
</a>
of Redis Enterprise Software are certified for development and testing only.
</p>
</li>
</ol>
<h2 id="downloads">
Downloads
</h2>
<p>
The following table shows the SHA256 checksums for the available packages:
</p>
<table>
<thead>
<tr>
<th>
Package
</th>
<th>
SHA256 checksum (7.4.6-77 September release)
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
Ubuntu 18
</td>
<td>
<span class="break-all">
2a1c5b9a1efcf2be79e8485171b50b948b7ff10da36ca7bd95aeb572770e6862
</span>
</td>
</tr>
<tr>
<td>
Ubuntu 20
</td>
<td>
<span class="break-all">
816f13736ef774d77745279817aa792d64d6375f3b0c8313717a46f339e733d2
</span>
</td>
</tr>
<tr>
<td>
Red Hat Enterprise Linux (RHEL) 8
</td>
<td>
<span class="break-all">
c22979928937ae08f65e83cc459cde98340ffae1eb0f414b8ed111a047feb5f1
</span>
</td>
</tr>
<tr>
<td>
Red Hat Enterprise Linux (RHEL) 9
</td>
<td>
<span class="break-all">
e794d0a973b150449e532cd21280f920d8eba1eb47fba39157f5b10bb3842cd1
</span>
</td>
</tr>
<tr>
<td>
Amazon Linux 2
</td>
<td>
<span class="break-all">
d5f55646a0356e3844c42eabda855f220a9f38ccfd839397709a41864e1a4470
</span>
</td>
</tr>
</tbody>
</table>
<h2 id="known-issues">
Known issues
</h2>
<ul>
<li>
<p>
RS131972: Creating an ACL that contains a line break in the Cluster Manager UI can cause shard migration to fail due to ACL errors.
</p>
</li>
<li>
<p>
RS61676: Full chain certificate update fails if any certificate in the chain does not have a Common Name (CN).
</p>
</li>
<li>
<p>
RS119958: The
<code>
debuginfo
</code>
script fails with the error
<code>
/bin/tar: Argument list too long
</code>
if there are too many RocksDB log files. This issue only affects clusters with Auto Tiering.
</p>
</li>
</ul>
<h2 id="known-limitations">
Known limitations
</h2>
<h4 id="new-cluster-manager-ui-limitations">
New Cluster Manager UI limitations
</h4>
<p>
The following legacy UI features are not yet available in the new Cluster Manager UI:
</p>
<ul>
<li>
<p>
Remove a node.
</p>
<p>
Use the REST API or legacy UI instead. See
<a href="/docs/latest/operate/rs/clusters/remove-node/">
Remove a cluster node
</a>
for instructions.
</p>
</li>
<li>
<p>
Purge an Active-Active instance.
</p>
<p>
Use
<a href="/docs/latest/operate/rs/references/cli-utilities/crdb-cli/crdb/purge-instance/">
<code>
crdb-cli crdb purge-instance
</code>
</a>
instead.
</p>
</li>
<li>
<p>
Search and export the log.
</p>
</li>
</ul>
<h4 id="openssl-compatibility-issue-for-742-modules-on-amazon-linux-2">
OpenSSL compatibility issue for 7.4.2 modules on Amazon Linux 2
</h4>
<p>
Due to an OpenSSL 1.1 compatibility issue between modules and clusters, Redis Enterprise Software version 7.4.2-54 is not fully supported on Amazon Linux 2 clusters with databases that use the following modules: RedisGears, RediSearch, or RedisTimeSeries.
</p>
<p>
This issue will be fixed in a future maintenance release.
</p>
<h4 id="redisgraph-prevents-upgrade-to-rhel-9">
RedisGraph prevents upgrade to RHEL 9
</h4>
<p>
You cannot upgrade from a prior RHEL version to RHEL 9 if the Redis Enterprise cluster contains a RedisGraph module, even if unused by any database. The
<a href="https://redis.com/blog/redisgraph-eol/">
RedisGraph module has reached End-of-Life
</a>
and is completely unavailable in RHEL 9.
</p>
<h2 id="security">
Security
</h2>
<h4 id="open-source-redis-security-fixes-compatibility">
Open source Redis security fixes compatibility
</h4>
<p>
As part of Redis's commitment to security, Redis Enterprise Software implements the latest
<a href="https://github.com/redis/redis/releases">
security fixes
</a>
available with
<a href="https://github.com/redis/redis">
open source Redis
</a>
. Redis Enterprise has already included the fixes for the relevant CVEs.
</p>
<p>
Some CVEs announced for open source Redis do not affect Redis Enterprise due to different or additional functionality available in Redis Enterprise that is not available in open source Redis.
</p>
<p>
Redis Enterprise 7.4.6-77 supports open source Redis 7.2, 6.2, and 6.0. Below is the list of open source Redis CVEs fixed by version.
</p>
<p>
Redis 7.2.x:
</p>
<ul>
<li>
<p>
(CVE-2024-31449) An authenticated user may use a specially crafted Lua script to trigger a stack buffer overflow in the bit library, which may potentially lead to remote code execution.
</p>
</li>
<li>
<p>
(CVE-2024-31228) An authenticated user can trigger a denial-of-service by using specially crafted, long string match patterns on supported commands such as
<code>
KEYS
</code>
,
<code>
SCAN
</code>
,
<code>
PSUBSCRIBE
</code>
,
<code>
FUNCTION LIST
</code>
,
<code>
COMMAND LIST
</code>
, and ACL definitions. Matching of extremely long patterns may result in unbounded recursion, leading to stack overflow and process crashes.
</p>
</li>
<li>
<p>
(CVE-2023-41056) In some cases, Redis may incorrectly handle resizing of memory buffers, which can result in incorrect accounting of buffer sizes and lead to heap overflow and potential remote code execution.
</p>
</li>
<li>
<p>
(CVE-2023-41053) Redis does not correctly identify keys accessed by
<code>
SORT_RO
</code>
and, as a result, may grant users executing this command access to keys that are not explicitly authorized by the ACL configuration. (Redis 7.2.1)
</p>
</li>
</ul>
<p>
Redis 7.0.x:
</p>
<ul>
<li>
<p>
(CVE-2024-31449) An authenticated user may use a specially crafted Lua script to trigger a stack buffer overflow in the bit library, which may potentially lead to remote code execution.
</p>
</li>
<li>
<p>
(CVE-2024-31228) An authenticated user can trigger a denial-of-service by using specially crafted, long string match patterns on supported commands such as
<code>
KEYS
</code>
,
<code>
SCAN
</code>
,
<code>
PSUBSCRIBE
</code>
,
<code>
FUNCTION LIST
</code>
,
<code>
COMMAND LIST
</code>
, and ACL definitions. Matching of extremely long patterns may result in unbounded recursion, leading to stack overflow and process crashes.
</p>
</li>
<li>
<p>
(CVE-2023-41056) In some cases, Redis may incorrectly handle resizing of memory buffers, which can result in incorrect accounting of buffer sizes and lead to heap overflow and potential remote code execution.
</p>
</li>
<li>
<p>
(CVE-2023-41053) Redis does not correctly identify keys accessed by
<code>
SORT_RO
</code>
and, as a result, may grant users executing this command access to keys that are not explicitly authorized by the ACL configuration. (Redis 7.0.13)
</p>
</li>
<li>
<p>
(CVE-2023-36824) Extracting key names from a command and a list of arguments may, in some cases, trigger a heap overflow and result in reading random heap memory, heap corruption, and potentially remote code execution. Specifically: using
<code>
COMMAND GETKEYS*
</code>
and validation of key names in ACL rules. (Redis 7.0.12)
</p>
</li>
<li>
<p>
(CVE-2023-28856) Authenticated users can use the
<code>
HINCRBYFLOAT
</code>
command to create an invalid hash field that will crash Redis on access. (Redis 7.0.11)
</p>
</li>
<li>
<p>
(CVE-2023-28425) Specially crafted
<code>
MSETNX
</code>
commands can lead to assertion and denial-of-service. (Redis 7.0.10)
</p>
</li>
<li>
<p>
(CVE-2023-25155) Specially crafted
<code>
SRANDMEMBER
</code>
,
<code>
ZRANDMEMBER
</code>
, and
<code>
HRANDFIELD
</code>
commands can trigger an integer overflow, resulting in a runtime assertion and termination of the Redis server process. (Redis 7.0.9)
</p>
</li>
<li>
<p>
(CVE-2023-22458) Integer overflow in the Redis
<code>
HRANDFIELD
</code>
and
<code>
ZRANDMEMBER
</code>
commands can lead to denial-of-service. (Redis 7.0.8)
</p>
</li>
<li>
<p>
(CVE-2022-36021) String matching commands (like
<code>
SCAN
</code>
or
<code>
KEYS
</code>
) with a specially crafted pattern to trigger a denial-of-service attack on Redis can cause it to hang and consume 100% CPU time. (Redis 7.0.9)
</p>
</li>
<li>
<p>
(CVE-2022-35977) Integer overflow in the Redis
<code>
SETRANGE
</code>
and
<code>
SORT
</code>
/
<code>
SORT_RO
</code>
commands can drive Redis to OOM panic. (Redis 7.0.8)
</p>
</li>
<li>
<p>
(CVE-2022-35951) Executing an
<code>
XAUTOCLAIM
</code>
command on a stream key in a specific state, with a specially crafted
<code>
COUNT
</code>
argument, may cause an integer overflow, a subsequent heap overflow, and potentially lead to remote code execution. The problem affects Redis versions 7.0.0 or newer. (Redis 7.0.5)
</p>
</li>
<li>
<p>
(CVE-2022-31144) A specially crafted
<code>
XAUTOCLAIM
</code>
command on a stream key in a specific state may result in heap overflow and potentially remote code execution. The problem affects Redis versions 7.0.0 or newer. (Redis 7.0.4)
</p>
</li>
<li>
<p>
(CVE-2022-24834) A specially crafted Lua script executing in Redis can trigger a heap overflow in the cjson and cmsgpack libraries, and result in heap corruption and potentially remote code execution. The problem exists in all versions of Redis with Lua scripting support, starting from 2.6, and affects only authenticated and authorized users. (Redis 7.0.12)
</p>
</li>
<li>
<p>
(CVE-2022-24736) An attacker attempting to load a specially crafted Lua script can cause NULL pointer dereference which will result in a crash of the
<code>
redis-server
</code>
process. This issue affects all versions of Redis. (Redis 7.0.0)
</p>
</li>
<li>
<p>
(CVE-2022-24735) By exploiting weaknesses in the Lua script execution environment, an attacker with access to Redis can inject Lua code that will execute with the (potentially higher) privileges of another Redis user. (Redis 7.0.0)
</p>
</li>
</ul>
<p>
Redis 6.2.x:
</p>
<ul>
<li>
<p>
(CVE-2024-31449) An authenticated user may use a specially crafted Lua script to trigger a stack buffer overflow in the bit library, which may potentially lead to remote code execution.
</p>
</li>
<li>
<p>
(CVE-2024-31228) An authenticated user can trigger a denial-of-service by using specially crafted, long string match patterns on supported commands such as
<code>
KEYS
</code>
,
<code>
SCAN
</code>
,
<code>
PSUBSCRIBE
</code>
,
<code>
FUNCTION LIST
</code>
,
<code>
COMMAND LIST
</code>
, and ACL definitions. Matching of extremely long patterns may result in unbounded recursion, leading to stack overflow and process crashes.
</p>
</li>
<li>
<p>
(CVE-2023-28856) Authenticated users can use the
<code>
HINCRBYFLOAT
</code>
command to create an invalid hash field that will crash Redis on access. (Redis 6.2.12)
</p>
</li>
<li>
<p>
(CVE-2023-25155) Specially crafted
<code>
SRANDMEMBER
</code>
,
<code>
ZRANDMEMBER
</code>
, and
<code>
HRANDFIELD
</code>
commands can trigger an integer overflow, resulting in a runtime assertion and termination of the Redis server process. (Redis 6.2.11)
</p>
</li>
<li>
<p>
(CVE-2023-22458) Integer overflow in the Redis
<code>
HRANDFIELD
</code>
and
<code>
ZRANDMEMBER
</code>
commands can lead to denial-of-service. (Redis 6.2.9)
</p>
</li>
<li>
<p>
(CVE-2022-36021) String matching commands (like
<code>
SCAN
</code>
or
<code>
KEYS
</code>
) with a specially crafted pattern to trigger a denial-of-service attack on Redis can cause it to hang and consume 100% CPU time. (Redis 6.2.11)
</p>
</li>
<li>
<p>
(CVE-2022-35977) Integer overflow in the Redis
<code>
SETRANGE
</code>
and
<code>
SORT
</code>
/
<code>
SORT_RO
</code>
commands can drive Redis to OOM panic. (Redis 6.2.9)
</p>
</li>
<li>
<p>
(CVE-2022-24834) A specially crafted Lua script executing in Redis can trigger a heap overflow in the cjson and cmsgpack libraries, and result in heap corruption and potentially remote code execution. The problem exists in all versions of Redis with Lua scripting support, starting from 2.6, and affects only authenticated and authorized users. (Redis 6.2.13)
</p>
</li>
<li>
<p>
(CVE-2022-24736) An attacker attempting to load a specially crafted Lua script can cause NULL pointer dereference which will result in a crash of the
<code>
redis-server
</code>
process. This issue affects all versions of Redis. (Redis 6.2.7)
</p>
</li>
<li>
<p>
(CVE-2022-24735) By exploiting weaknesses in the Lua script execution environment, an attacker with access to Redis can inject Lua code that will execute with the (potentially higher) privileges of another Redis user. (Redis 6.2.7)
</p>
</li>
<li>
<p>
(CVE-2021-41099) Integer to heap buffer overflow handling certain string commands and network payloads, when
<code>
proto-max-bulk-len
</code>
is manually configured to a non-default, very large value. (Redis 6.2.6)
</p>
</li>
<li>
<p>
(CVE-2021-32762) Integer to heap buffer overflow issue in
<code>
redis-cli
</code>
and
<code>
redis-sentinel
</code>
parsing large multi-bulk replies on some older and less common platforms. (Redis 6.2.6)
</p>
</li>
<li>
<p>
(CVE-2021-32761) An integer overflow bug in Redis version 2.2 or newer can be exploited using the
<code>
BITFIELD
</code>
command to corrupt the heap and potentially result with remote code execution. (Redis 6.2.5)
</p>
</li>
<li>
<p>
(CVE-2021-32687) Integer to heap buffer overflow with intsets, when
<code>
set-max-intset-entries
</code>
is manually configured to a non-default, very large value. (Redis 6.2.6)
</p>
</li>
<li>
<p>
(CVE-2021-32675) Denial Of Service when processing RESP request payloads with a large number of elements on many connections. (Redis 6.2.6)
</p>
</li>
<li>
<p>
(CVE-2021-32672) Random heap reading issue with Lua Debugger. (Redis 6.2.6)
</p>
</li>
<li>
<p>
(CVE-2021-32628) Integer to heap buffer overflow handling ziplist-encoded data types, when configuring a large, non-default value for
<code>
hash-max-ziplist-entries
</code>
,
<code>
hash-max-ziplist-value
</code>
,
<code>
zset-max-ziplist-entries
</code>
or
<code>
zset-max-ziplist-value
</code>
. (Redis 6.2.6)
</p>
</li>
<li>
<p>
(CVE-2021-32627) Integer to heap buffer overflow issue with streams, when configuring a non-default, large value for
<code>
proto-max-bulk-len
</code>
and
<code>
client-query-buffer-limit
</code>
. (Redis 6.2.6)
</p>
</li>
<li>
<p>
(CVE-2021-32626) Specially crafted Lua scripts may result with Heap buffer overflow. (Redis 6.2.6)
</p>
</li>
<li>
<p>
(CVE-2021-32625) An integer overflow bug in Redis version 6.0 or newer can be exploited using the STRALGO LCS command to corrupt the heap and potentially result with remote code execution. This is a result of an incomplete fix by CVE-2021-29477. (Redis 6.2.4)
</p>
</li>
<li>
<p>
(CVE-2021-29478) An integer overflow bug in Redis 6.2 could be exploited to corrupt the heap and potentially result with remote code execution. The vulnerability involves changing the default set-max-intset-entries configuration value, creating a large set key that consists of integer values and using the COPY command to duplicate it. The integer overflow bug exists in all versions of Redis starting with 2.6, where it could result with a corrupted RDB or DUMP payload, but not exploited through COPY (which did not exist before 6.2). (Redis 6.2.3)
</p>
</li>
<li>
<p>
(CVE-2021-29477) An integer overflow bug in Redis version 6.0 or newer could be exploited using the STRALGO LCS command to corrupt the heap and potentially result in remote code execution. The integer overflow bug exists in all versions of Redis starting with 6.0. (Redis 6.2.3)
</p>
</li>
</ul>
<p>
Redis 6.0.x:
</p>
<ul>
<li>
<p>
(CVE-2022-24834) A specially crafted Lua script executing in Redis can trigger a heap overflow in the cjson and cmsgpack libraries, and result in heap corruption and potentially remote code execution. The problem exists in all versions of Redis with Lua scripting support, starting from 2.6, and affects only authenticated and authorized users. (Redis 6.0.20)
</p>
</li>
<li>
<p>
(CVE-2023-28856) Authenticated users can use the
<code>
HINCRBYFLOAT
</code>
command to create an invalid hash field that will crash Redis on access. (Redis 6.0.19)
</p>
</li>
<li>
<p>
(CVE-2023-25155) Specially crafted
<code>
SRANDMEMBER
</code>
,
<code>
ZRANDMEMBER
</code>
, and
<code>
HRANDFIELD
</code>
commands can trigger an integer overflow, resulting in a runtime assertion and termination of the Redis server process. (Redis 6.0.18)
</p>
</li>
<li>
<p>
(CVE-2022-36021) String matching commands (like
<code>
SCAN
</code>
or
<code>
KEYS
</code>
) with a specially crafted pattern to trigger a denial-of-service attack on Redis can cause it to hang and consume 100% CPU time. (Redis 6.0.18)
</p>
</li>
<li>
<p>
(CVE-2022-35977) Integer overflow in the Redis
<code>
SETRANGE
</code>
and
<code>
SORT
</code>
/
<code>
SORT_RO
</code>
commands can drive Redis to OOM panic. (Redis 6.0.17)
</p>
</li>
</ul>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/release-notes/rs-7-4-2-releases/rs-7-4-6-77/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/7.4/references/rest-api/objects/bdb/snapshot_policy/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Snapshot policy object
</h1>
<p class="text-lg -mt-5 mb-10">
Documents the snapshot_policy object used with Redis Enterprise Software REST API calls.
</p>
<table>
<thead>
<tr>
<th>
Name
</th>
<th>
Type/Value
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
secs
</td>
<td>
integer
</td>
<td>
Interval in seconds between snapshots
</td>
</tr>
<tr>
<td>
writes
</td>
<td>
integer
</td>
<td>
Number of write changes required to trigger a snapshot
</td>
</tr>
</tbody>
</table>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/7.4/references/rest-api/objects/bdb/snapshot_policy/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/commands/acl-help/.html | <section class="prose w-full py-12">
<h1 class="command-name">
ACL HELP
</h1>
<div class="font-semibold text-redis-ink-900">
Syntax
</div>
<pre class="command-syntax">ACL HELP</pre>
<dl class="grid grid-cols-[auto,1fr] gap-2 mb-12">
<dt class="font-semibold text-redis-ink-900 m-0">
Available since:
</dt>
<dd class="m-0">
6.0.0
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
Time complexity:
</dt>
<dd class="m-0">
O(1)
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
ACL categories:
</dt>
<dd class="m-0">
<code>
@slow
</code>
<span class="mr-1 last:hidden">
,
</span>
</dd>
</dl>
<p>
The
<code>
ACL HELP
</code>
command returns a helpful text describing the different subcommands.
</p>
<h2 id="resp2resp3-reply">
RESP2/RESP3 Reply
</h2>
<a href="../../develop/reference/protocol-spec#arrays">
Array reply
</a>
: a list of subcommands and their descriptions.
<br/>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/commands/acl-help/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate.html | <section class="prose w-full py-12 max-w-none">
<h1>
Redis products
</h1>
<p class="text-lg -mt-5 mb-10">
Operate any Redis, from Redis Enterprise to Redis Cloud
</p>
<nav>
<a href="/docs/latest/operate/rc/">
Redis Cloud
</a>
<p>
The fastest way to set up Redis - a fully managed Redis database on major public cloud services.
</p>
<a href="/docs/latest/operate/rs/">
Redis Enterprise Software
</a>
<p>
The self-managed, enterprise-grade version of Redis.
</p>
<a href="/docs/latest/operate/kubernetes/">
Redis Enterprise for Kubernetes
</a>
<p>
The Redis Enterprise operators allows you to use Redis Enterprise for Kubernetes.
</p>
<a href="/docs/latest/operate/oss_and_stack/">
Redis Community Edition and Stack
</a>
<p>
Operate Redis Community Edition and Redis Stack. Redis OSS was renamed Redis Community Edition (CE) with the v7.4 release.
</p>
<a href="/docs/latest/operate/redisinsight/">
Redis Insight
</a>
<p>
Install and manage Redis Insight
</p>
</nav>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/develop/tools/insight/release-notes/v2.10.0/.html | <section class="prose w-full py-12">
<h1>
RedisInsight v2.10.0, September 2022
</h1>
<p class="text-lg -mt-5 mb-10">
RedisInsight v2.10.0
</p>
<h2 id="2100-september-2022">
2.10.0 (September 2022)
</h2>
<p>
This is the General Availability (GA) release of RedisInsight 2.10.
</p>
<h3 id="highlights">
Highlights
</h3>
<ul>
<li>
Formatters: Additional support for values of keys with Protobuf, Binary, PHP unserialize (view and edit serialized PHP values as JSON), and Java serialized objects, save formatters selected when viewing other keys
</li>
<li>
New overview for cluster databases displays memory and key allocation as well as database information per shards
</li>
<li>
Configure Workbench to persist the Editor after commands have been run and group the results
</li>
<li>
Complete an optional user survey
</li>
</ul>
<h3 id="details">
Details
</h3>
<p>
<strong>
Features and improvements
</strong>
</p>
<ul>
<li>
<a href="https://github.com/RedisInsight/RedisInsight/pull/1159">
#1159
</a>
,
<a href="https://github.com/RedisInsight/RedisInsight/pull/1160">
#1160
</a>
,
<a href="https://github.com/RedisInsight/RedisInsight/pull/1068">
#1068
</a>
,
<a href="https://github.com/RedisInsight/RedisInsight/pull/1071">
#1071
</a>
,
<a href="https://github.com/RedisInsight/RedisInsight/pull/1095">
#1095
</a>
,
<a href="https://github.com/RedisInsight/RedisInsight/pull/1097">
#1097
</a>
,
<a href="https://github.com/RedisInsight/RedisInsight/pull/1098">
#1098
</a>
A dedicated
<strong>
Analysis Tools
</strong>
page displays memory and key allocation in cluster databases as well as database information per shards
</li>
<li>
<a href="https://github.com/RedisInsight/RedisInsight/pull/1017">
#1017
</a>
,
<a href="https://github.com/RedisInsight/RedisInsight/pull/1025">
#1025
</a>
,
<a href="https://github.com/RedisInsight/RedisInsight/pull/1029">
#1029
</a>
,
<a href="https://github.com/RedisInsight/RedisInsight/pull/1059">
#1059
</a>
,
<a href="https://github.com/RedisInsight/RedisInsight/pull/1092">
#1092
</a>
Added support for additional data formats in Browser/Tree view, including Protobuf, Binary, Pickle, PHP unserialize (view and edit serialized PHP values as JSON), and Java serialized objects
</li>
<li>
<a href="https://github.com/RedisInsight/RedisInsight/pull/1130">
#1130
</a>
Save formatters selected when viewing other keys
</li>
<li>
<a href="https://github.com/RedisInsight/RedisInsight/pull/1177">
#1177
</a>
Add a validation when edited value is not valid in the selected format in Browser/Tree view
</li>
<li>
<a href="https://github.com/RedisInsight/RedisInsight/pull/1048">
#1048
</a>
Configure Workbench to persist the Editor after commands have been run
</li>
<li>
<a href="https://github.com/RedisInsight/RedisInsight/pull/1119">
#1119
</a>
Pipeline mode configuration for Workbench moved to Settings > Workbench
</li>
<li>
<a href="https://github.com/RedisInsight/RedisInsight/pull/1149">
#1149
</a>
Save Workbench space by grouping results
</li>
<li>
<a href="https://github.com/RedisInsight/RedisInsight/pull/1162">
#1162
</a>
Complete an optional user survey
</li>
<li>
<a href="https://github.com/RedisInsight/RedisInsight/pull/1037">
#1037
</a>
Added tooltip to display long fields in
<a href="https://redis.io/docs/data-types/streams/">
Redis Streams
</a>
</li>
<li>
<a href="https://github.com/RedisInsight/RedisInsight/pull/1202">
#1202
</a>
Removed format validations from the admin username in the Redis Enterprise Cluster autodiscovery process
</li>
</ul>
<p>
<strong>
Bugs
</strong>
</p>
<ul>
<li>
<a href="https://github.com/RedisInsight/RedisInsight/pull/1180">
#1180
</a>
Fix to display full values for truncated TTL in munutes
</li>
<li>
<a href="https://github.com/RedisInsight/RedisInsight/pull/1197">
#1197
</a>
Workbench is now available even when encryption failed
</li>
<li>
<a href="https://github.com/RedisInsight/RedisInsight/pull/1176">
#1176
</a>
Save the refresh value in Browser/Tree view
</li>
<li>
<a href="https://github.com/RedisInsight/RedisInsight/pull/1101">
#1101
</a>
Fixed an issue when key names are not displayed
</li>
</ul>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/develop/tools/insight/release-notes/v2.10.0/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
β
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
β
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
β
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
β
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
β
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top β
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
Subsets and Splits