url
stringlengths
38
157
content
stringlengths
72
15.1M
https://redis.io/docs/latest/integrate/redisom-for-node-js/.html
<section class="prose w-full py-12 max-w-none"> <h1> RedisOM for Node.js </h1> <p class="text-lg -mt-5 mb-10"> Learn how to build with Redis Stack and Node.js </p> <p> This tutorial will show you how to build an API using Node.js and Redis Stack. </p> <p> We'll be using <a href="https://expressjs.com/"> Express </a> and <a href="https://github.com/redis/redis-om-node"> Redis OM </a> to do this, and we assume that you have a basic understanding of Express. </p> <p> The API we'll be building is a simple and relatively RESTful API that reads, writes, and finds data on persons: first name, last name, age, etc. We'll also add a simple location tracking feature just for a bit of extra interest. </p> <p> But before we start with the coding, let's start with a description of what Redis OM <em> is </em> . </p> <h2 id="prerequisites"> Prerequisites </h2> <p> Like anything software-related, you need to have some dependencies installed before you can get started: </p> <ul> <li> <a href="https://nodejs.org/en/"> Node.js 14.8+ </a> : In this tutorial, we're using JavaScript's top-level <code> await </code> feature which was introduced in Node 14.8. So, make sure you are using that version or later. </li> <li> <a href="/download"> Redis Stack </a> : You need a version of Redis Stack, either running locally on your machine or <a href="https://redis.com/try-free/?utm_source=redisio&amp;utm_medium=referral&amp;utm_campaign=2023-09-try_free&amp;utm_content=cu-redis_cloud_users"> in the cloud </a> . </li> <li> <a href="https://redis.com/redis-enterprise/redis-insight/"> Redis Insight </a> : We'll use this to look inside Redis and make sure our code is doing what we think it's doing. </li> </ul> <h2 id="starter-code"> Starter code </h2> <p> We're not going to code this completely from scratch. Instead, we've provided some starter code for you. Go ahead and clone it to a folder of your convenience: </p> <pre><code>git clone [email protected]:redis-developer/express-redis-om-workshop.git </code></pre> <p> Now that you have the starter code, let's explore it a bit. Opening up <code> server.js </code> in the root we see that we have a simple Express app that uses <a href="https://www.npmjs.com/package/dotenv"> <em> Dotenv </em> </a> for configuration and <a href="https://www.npmjs.com/package/swagger-ui-express"> Swagger UI Express </a> for testing our API: </p> <div class="highlight"> <pre class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl"><span class="kr">import</span> <span class="s1">'dotenv/config'</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="kr">import</span> <span class="nx">express</span> <span class="nx">from</span> <span class="s1">'express'</span> </span></span><span class="line"><span class="cl"><span class="kr">import</span> <span class="nx">swaggerUi</span> <span class="nx">from</span> <span class="s1">'swagger-ui-express'</span> </span></span><span class="line"><span class="cl"><span class="kr">import</span> <span class="nx">YAML</span> <span class="nx">from</span> <span class="s1">'yamljs'</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="cm">/* create an express app and use JSON */</span> </span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">app</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">express</span><span class="p">()</span> </span></span><span class="line"><span class="cl"><span class="nx">app</span><span class="p">.</span><span class="nx">use</span><span class="p">(</span><span class="nx">express</span><span class="p">.</span><span class="nx">json</span><span class="p">())</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="cm">/* set up swagger in the root */</span> </span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">swaggerDocument</span> <span class="o">=</span> <span class="nx">YAML</span><span class="p">.</span><span class="nx">load</span><span class="p">(</span><span class="s1">'api.yaml'</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="nx">app</span><span class="p">.</span><span class="nx">use</span><span class="p">(</span><span class="s1">'/'</span><span class="p">,</span> <span class="nx">swaggerUi</span><span class="p">.</span><span class="nx">serve</span><span class="p">,</span> <span class="nx">swaggerUi</span><span class="p">.</span><span class="nx">setup</span><span class="p">(</span><span class="nx">swaggerDocument</span><span class="p">))</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="cm">/* start the server */</span> </span></span><span class="line"><span class="cl"><span class="nx">app</span><span class="p">.</span><span class="nx">listen</span><span class="p">(</span><span class="mi">8080</span><span class="p">)</span></span></span></code></pre> </div> <p> Alongside this is <code> api.yaml </code> , which defines the API we're going to build and provides the information Swagger UI Express needs to render its UI. You don't need to mess with it unless you want to add some additional routes. </p> <p> The <code> persons </code> folder has some JSON files and a shell script. The JSON files are sample persons—all musicians because fun—that you can load into the API to test it. The shell script— <code> load-data.sh </code> —will load all the JSON files into the API using <code> curl </code> . </p> <p> There are two empty folders, <code> om </code> and <code> routers </code> . The <code> om </code> folder is where all the Redis OM code will go. The <code> routers </code> folder will hold code for all of our Express routes. </p> <h2 id="configure-and-run"> Configure and run </h2> <p> The starter code is perfectly runnable if a bit thin. Let's configure and run it to make sure it works before we move on to writing actual code. First, get all the dependencies: </p> <pre><code>npm install </code></pre> <p> Then, set up a <code> .env </code> file in the root that Dotenv can make use of. There's a <code> sample.env </code> file in the root that you can copy and modify: </p> <pre><code>cp sample.env .env </code></pre> <p> The contents of <code> .env </code> looks like this: </p> <div class="highlight"> <pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="c1"># Put your local Redis Stack URL here. Want to run in the</span> </span></span><span class="line"><span class="cl"><span class="c1"># cloud instead? Sign up at https://redis.com/try-free/.</span> </span></span><span class="line"><span class="cl"><span class="nv">REDIS_URL</span><span class="o">=</span>redis://localhost:6379</span></span></code></pre> </div> <p> There's a good chance this is already correct. However, if you need to change the <code> REDIS_URL </code> for your particular environment (e.g., you're running Redis Stack in the cloud), this is the time to do it. Once done, you should be able to run the app: </p> <pre><code>npm start </code></pre> <p> Navigate to <code> http://localhost:8080 </code> and check out the client that Swagger UI Express has created. None of it <em> works </em> yet because we haven't implemented any of the routes. But, you can try them out and watch them fail! </p> <p> The starter code runs. Let's add some Redis OM to it so it actually <em> does </em> something! </p> <h2 id="setting-up-a-client"> Setting up a Client </h2> <p> First things first, let's set up a <strong> client </strong> . The <code> Client </code> class is the thing that knows how to talk to Redis on behalf of Redis OM. One option is to put our client in its own file and export it. This ensures that the application has one and only one instance of <code> Client </code> and thus only one connection to Redis Stack. Since Redis and JavaScript are both (more or less) single-threaded, this works neatly. </p> <p> Let's create our first file. In the <code> om </code> folder add a file called <code> client.js </code> and add the following code: </p> <div class="highlight"> <pre class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl"><span class="kr">import</span> <span class="p">{</span> <span class="nx">Client</span> <span class="p">}</span> <span class="nx">from</span> <span class="s1">'redis-om'</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="cm">/* pulls the Redis URL from .env */</span> </span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">url</span> <span class="o">=</span> <span class="nx">process</span><span class="p">.</span><span class="nx">env</span><span class="p">.</span><span class="nx">REDIS_URL</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="cm">/* create and open the Redis OM Client */</span> </span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">client</span> <span class="o">=</span> <span class="kr">await</span> <span class="k">new</span> <span class="nx">Client</span><span class="p">().</span><span class="nx">open</span><span class="p">(</span><span class="nx">url</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="kr">export</span> <span class="k">default</span> <span class="nx">client</span></span></span></code></pre> </div> <blockquote> <p> Remember that <em> top-level await </em> stuff we mentioned earlier? There it is! </p> </blockquote> <p> Note that we are getting our Redis URL from an environment variable. It was put there by Dotenv and read from our <code> .env </code> file. If we didn't have the <code> .env </code> file or have a <code> REDIS_URL </code> property in our <code> .env </code> file, this code would gladly read this value from the <em> actual </em> environment variables. </p> <p> Also note that the <code> .open() </code> method conveniently returns <code> this </code> . This <code> this </code> (can I say <em> this </em> again? I just did!) lets us chain the instantiation of the client with the opening of the client. If this isn't to your liking, you could always write it like this: </p> <div class="highlight"> <pre class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl"><span class="cm">/* create and open the Redis OM Client */</span> </span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">client</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Client</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">open</span><span class="p">(</span><span class="nx">url</span><span class="p">)</span></span></span></code></pre> </div> <h2 id="entity-schema-and-repository"> Entity, Schema, and Repository </h2> <p> Now that we have a client that's connected to Redis, we need to start mapping some persons. To do that, we need to define an <code> Entity </code> and a <code> Schema </code> . Let's start by creating a file named <code> person.js </code> in the <code> om </code> folder and importing <code> client </code> from <code> client.js </code> and the <code> Entity </code> and <code> Schema </code> classes from Redis OM: </p> <div class="highlight"> <pre class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl"><span class="kr">import</span> <span class="p">{</span> <span class="nx">Entity</span><span class="p">,</span> <span class="nx">Schema</span> <span class="p">}</span> <span class="nx">from</span> <span class="s1">'redis-om'</span> </span></span><span class="line"><span class="cl"><span class="kr">import</span> <span class="nx">client</span> <span class="nx">from</span> <span class="s1">'./client.js'</span></span></span></code></pre> </div> <h3 id="entity"> Entity </h3> <p> Next, we need to define an <strong> entity </strong> . An <code> Entity </code> is the class that holds you data when you work with it—the thing being mapped to. It is what you create, read, update, and delete. Any class that extends <code> Entity </code> is an entity. We'll define our <code> Person </code> entity with a single line: </p> <div class="highlight"> <pre class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl"><span class="cm">/* our entity */</span> </span></span><span class="line"><span class="cl"><span class="kr">class</span> <span class="nx">Person</span> <span class="kr">extends</span> <span class="nx">Entity</span> <span class="p">{}</span></span></span></code></pre> </div> <h3 id="schema"> Schema </h3> <p> A <strong> schema </strong> defines the fields on your entity, their types, and how they are mapped internally to Redis. By default, entities map to JSON documents. Let's create our <code> Schema </code> in <code> person.js </code> : </p> <div class="highlight"> <pre class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl"><span class="cm">/* create a Schema for Person */</span> </span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">personSchema</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Schema</span><span class="p">(</span><span class="nx">Person</span><span class="p">,</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="nx">firstName</span><span class="o">:</span> <span class="p">{</span> <span class="nx">type</span><span class="o">:</span> <span class="s1">'string'</span> <span class="p">},</span> </span></span><span class="line"><span class="cl"> <span class="nx">lastName</span><span class="o">:</span> <span class="p">{</span> <span class="nx">type</span><span class="o">:</span> <span class="s1">'string'</span> <span class="p">},</span> </span></span><span class="line"><span class="cl"> <span class="nx">age</span><span class="o">:</span> <span class="p">{</span> <span class="nx">type</span><span class="o">:</span> <span class="s1">'number'</span> <span class="p">},</span> </span></span><span class="line"><span class="cl"> <span class="nx">verified</span><span class="o">:</span> <span class="p">{</span> <span class="nx">type</span><span class="o">:</span> <span class="s1">'boolean'</span> <span class="p">},</span> </span></span><span class="line"><span class="cl"> <span class="nx">location</span><span class="o">:</span> <span class="p">{</span> <span class="nx">type</span><span class="o">:</span> <span class="s1">'point'</span> <span class="p">},</span> </span></span><span class="line"><span class="cl"> <span class="nx">locationUpdated</span><span class="o">:</span> <span class="p">{</span> <span class="nx">type</span><span class="o">:</span> <span class="s1">'date'</span> <span class="p">},</span> </span></span><span class="line"><span class="cl"> <span class="nx">skills</span><span class="o">:</span> <span class="p">{</span> <span class="nx">type</span><span class="o">:</span> <span class="s1">'string[]'</span> <span class="p">},</span> </span></span><span class="line"><span class="cl"> <span class="nx">personalStatement</span><span class="o">:</span> <span class="p">{</span> <span class="nx">type</span><span class="o">:</span> <span class="s1">'text'</span> <span class="p">}</span> </span></span><span class="line"><span class="cl"><span class="p">})</span></span></span></code></pre> </div> <p> When you create a <code> Schema </code> , it modifies the <code> Entity </code> class you handed it ( <code> Person </code> in our case) adding getters and setters for the properties you define. The type those getters and setters accept and return are defined with the type parameter as shown above. Valid values are: <code> string </code> , <code> number </code> , <code> boolean </code> , <code> string[] </code> , <code> date </code> , <code> point </code> , and <code> text </code> . </p> <p> The first three do exactly what you think—they define a property that is a <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String"> <code> String </code> </a> , a <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number"> <code> Number </code> </a> , or a <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean"> <code> Boolean </code> </a> . <code> string[] </code> does what you'd think as well, specifically defining an <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array"> <code> Array </code> </a> of strings. </p> <p> <code> date </code> is a little different, but still more or less what you'd expect. It defines a property that returns a <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date"> <code> Date </code> </a> and can be set using not only a <code> Date </code> but also a <code> String </code> containing an <a href="https://en.wikipedia.org/wiki/ISO_8601"> ISO 8601 </a> date or a <code> Number </code> with the <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#the_ecmascript_epoch_and_timestamps"> UNIX epoch time </a> in <em> milliseconds </em> . </p> <p> A <code> point </code> defines a point somewhere on the globe as a longitude and a latitude. It creates a property that returns and accepts a simple object with the properties of <code> longitude </code> and <code> latitude </code> . Like this: </p> <div class="highlight"> <pre class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl"><span class="kd">let</span> <span class="nx">point</span> <span class="o">=</span> <span class="p">{</span> <span class="nx">longitude</span><span class="o">:</span> <span class="mf">12.34</span><span class="p">,</span> <span class="nx">latitude</span><span class="o">:</span> <span class="mf">56.78</span> <span class="p">}</span></span></span></code></pre> </div> <p> A <code> text </code> field is a lot like a <code> string </code> . If you're just reading and writing objects, they are identical. But if you want to <em> search </em> on them, they are very, very different. We'll talk about search more later, but the tl;dr is that <code> string </code> fields can only be matched on their whole value—no partial matches—and are best for keys while <code> text </code> fields have full-text search enabled on them and are optimized for human-readable text. </p> <h3 id="repository"> Repository </h3> <p> Now we have all the pieces that we need to create a <strong> repository </strong> . A <code> Repository </code> is the main interface into Redis OM. It gives us the methods to read, write, and remove a specific <code> Entity </code> . Create a <code> Repository </code> in <code> person.js </code> and make sure it's exported as you'll need it when we start implementing out API: </p> <div class="highlight"> <pre class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl"><span class="cm">/* use the client to create a Repository just for Persons */</span> </span></span><span class="line"><span class="cl"><span class="kr">export</span> <span class="kr">const</span> <span class="nx">personRepository</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Repository</span><span class="p">(</span><span class="nx">personSchema</span><span class="p">,</span> <span class="nx">client</span><span class="p">)</span></span></span></code></pre> </div> <p> We're almost done with setting up our repository. But we still need to create an index or we won't be able to search. We do that by calling <code> .createIndex() </code> . If an index already exists and it's identical, this function won't do anything. If it's different, it'll drop it and create a new one. Add a call to <code> .createIndex() </code> to <code> person.js </code> : </p> <div class="highlight"> <pre class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl"><span class="cm">/* create the index for Person */</span> </span></span><span class="line"><span class="cl"><span class="kr">await</span> <span class="nx">personRepository</span><span class="p">.</span><span class="nx">createIndex</span><span class="p">()</span></span></span></code></pre> </div> <p> That's all we need for <code> person.js </code> and all we need to start talking to Redis using Redis OM. Here's the code in its entirety: </p> <div class="highlight"> <pre class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl"><span class="kr">import</span> <span class="p">{</span> <span class="nx">Entity</span><span class="p">,</span> <span class="nx">Schema</span> <span class="p">}</span> <span class="nx">from</span> <span class="s1">'redis-om'</span> </span></span><span class="line"><span class="cl"><span class="kr">import</span> <span class="nx">client</span> <span class="nx">from</span> <span class="s1">'./client.js'</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="cm">/* our entity */</span> </span></span><span class="line"><span class="cl"><span class="kr">class</span> <span class="nx">Person</span> <span class="kr">extends</span> <span class="nx">Entity</span> <span class="p">{}</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="cm">/* create a Schema for Person */</span> </span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">personSchema</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Schema</span><span class="p">(</span><span class="nx">Person</span><span class="p">,</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="nx">firstName</span><span class="o">:</span> <span class="p">{</span> <span class="nx">type</span><span class="o">:</span> <span class="s1">'string'</span> <span class="p">},</span> </span></span><span class="line"><span class="cl"> <span class="nx">lastName</span><span class="o">:</span> <span class="p">{</span> <span class="nx">type</span><span class="o">:</span> <span class="s1">'string'</span> <span class="p">},</span> </span></span><span class="line"><span class="cl"> <span class="nx">age</span><span class="o">:</span> <span class="p">{</span> <span class="nx">type</span><span class="o">:</span> <span class="s1">'number'</span> <span class="p">},</span> </span></span><span class="line"><span class="cl"> <span class="nx">verified</span><span class="o">:</span> <span class="p">{</span> <span class="nx">type</span><span class="o">:</span> <span class="s1">'boolean'</span> <span class="p">},</span> </span></span><span class="line"><span class="cl"> <span class="nx">location</span><span class="o">:</span> <span class="p">{</span> <span class="nx">type</span><span class="o">:</span> <span class="s1">'point'</span> <span class="p">},</span> </span></span><span class="line"><span class="cl"> <span class="nx">locationUpdated</span><span class="o">:</span> <span class="p">{</span> <span class="nx">type</span><span class="o">:</span> <span class="s1">'date'</span> <span class="p">},</span> </span></span><span class="line"><span class="cl"> <span class="nx">skills</span><span class="o">:</span> <span class="p">{</span> <span class="nx">type</span><span class="o">:</span> <span class="s1">'string[]'</span> <span class="p">},</span> </span></span><span class="line"><span class="cl"> <span class="nx">personalStatement</span><span class="o">:</span> <span class="p">{</span> <span class="nx">type</span><span class="o">:</span> <span class="s1">'text'</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="cm">/* use the client to create a Repository just for Persons */</span> </span></span><span class="line"><span class="cl"><span class="kr">export</span> <span class="kr">const</span> <span class="nx">personRepository</span> <span class="o">=</span> <span class="nx">client</span><span class="p">.</span><span class="nx">fetchRepository</span><span class="p">(</span><span class="nx">personSchema</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="cm">/* create the index for Person */</span> </span></span><span class="line"><span class="cl"><span class="kr">await</span> <span class="nx">personRepository</span><span class="p">.</span><span class="nx">createIndex</span><span class="p">()</span></span></span></code></pre> </div> <p> Now, let's add some routes in Express. </p> <h2 id="set-up-the-person-router"> Set up the Person Router </h2> <p> Let's create a truly RESTful API with the CRUD operations mapping to PUT, GET, POST, and DELETE respectively. We're going to do this using <a href="https://expressjs.com/en/4x/api.html#router"> Express Routers </a> as this makes our code nice and tidy. Create a file called <code> person-router.js </code> in the <code> routers </code> folder and in it import <code> Router </code> from Express and <code> personRepository </code> from <code> person.js </code> . Then create and export a <code> Router </code> : </p> <div class="highlight"> <pre class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl"><span class="kr">import</span> <span class="p">{</span> <span class="nx">Router</span> <span class="p">}</span> <span class="nx">from</span> <span class="s1">'express'</span> </span></span><span class="line"><span class="cl"><span class="kr">import</span> <span class="p">{</span> <span class="nx">personRepository</span> <span class="p">}</span> <span class="nx">from</span> <span class="s1">'../om/person.js'</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="kr">export</span> <span class="kr">const</span> <span class="nx">router</span> <span class="o">=</span> <span class="nx">Router</span><span class="p">()</span></span></span></code></pre> </div> <p> Imports and exports done, let's bind the router to our Express app. Open up <code> server.js </code> and import the <code> Router </code> we just created: </p> <div class="highlight"> <pre class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl"><span class="cm">/* import routers */</span> </span></span><span class="line"><span class="cl"><span class="kr">import</span> <span class="p">{</span> <span class="nx">router</span> <span class="nx">as</span> <span class="nx">personRouter</span> <span class="p">}</span> <span class="nx">from</span> <span class="s1">'./routers/person-router.js'</span></span></span></code></pre> </div> <p> Then add the <code> personRouter </code> to the Express app: </p> <div class="highlight"> <pre class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl"><span class="cm">/* bring in some routers */</span> </span></span><span class="line"><span class="cl"><span class="nx">app</span><span class="p">.</span><span class="nx">use</span><span class="p">(</span><span class="s1">'/person'</span><span class="p">,</span> <span class="nx">personRouter</span><span class="p">)</span></span></span></code></pre> </div> <p> Your <code> server.js </code> should now look like this: </p> <div class="highlight"> <pre class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl"><span class="kr">import</span> <span class="s1">'dotenv/config'</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="kr">import</span> <span class="nx">express</span> <span class="nx">from</span> <span class="s1">'express'</span> </span></span><span class="line"><span class="cl"><span class="kr">import</span> <span class="nx">swaggerUi</span> <span class="nx">from</span> <span class="s1">'swagger-ui-express'</span> </span></span><span class="line"><span class="cl"><span class="kr">import</span> <span class="nx">YAML</span> <span class="nx">from</span> <span class="s1">'yamljs'</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="cm">/* import routers */</span> </span></span><span class="line"><span class="cl"><span class="kr">import</span> <span class="p">{</span> <span class="nx">router</span> <span class="nx">as</span> <span class="nx">personRouter</span> <span class="p">}</span> <span class="nx">from</span> <span class="s1">'./routers/person-router.js'</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="cm">/* create an express app and use JSON */</span> </span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">app</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">express</span><span class="p">()</span> </span></span><span class="line"><span class="cl"><span class="nx">app</span><span class="p">.</span><span class="nx">use</span><span class="p">(</span><span class="nx">express</span><span class="p">.</span><span class="nx">json</span><span class="p">())</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="cm">/* bring in some routers */</span> </span></span><span class="line"><span class="cl"><span class="nx">app</span><span class="p">.</span><span class="nx">use</span><span class="p">(</span><span class="s1">'/person'</span><span class="p">,</span> <span class="nx">personRouter</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="cm">/* set up swagger in the root */</span> </span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">swaggerDocument</span> <span class="o">=</span> <span class="nx">YAML</span><span class="p">.</span><span class="nx">load</span><span class="p">(</span><span class="s1">'api.yaml'</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="nx">app</span><span class="p">.</span><span class="nx">use</span><span class="p">(</span><span class="s1">'/'</span><span class="p">,</span> <span class="nx">swaggerUi</span><span class="p">.</span><span class="nx">serve</span><span class="p">,</span> <span class="nx">swaggerUi</span><span class="p">.</span><span class="nx">setup</span><span class="p">(</span><span class="nx">swaggerDocument</span><span class="p">))</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="cm">/* start the server */</span> </span></span><span class="line"><span class="cl"><span class="nx">app</span><span class="p">.</span><span class="nx">listen</span><span class="p">(</span><span class="mi">8080</span><span class="p">)</span></span></span></code></pre> </div> <p> Now we can add our routes to create, read, update, and delete persons. Head back to the <code> person-router.js </code> file so we can do just that. </p> <h3 id="creating-a-person"> Creating a Person </h3> <p> We'll create a person first as you need to have persons in Redis before you can do any of the reading, writing, or removing of them. Add the PUT route below. This route will call <code> .createAndSave() </code> to create a <code> Person </code> from the request body and immediately save it to the Redis: </p> <div class="highlight"> <pre class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl"><span class="nx">router</span><span class="p">.</span><span class="nx">put</span><span class="p">(</span><span class="s1">'/'</span><span class="p">,</span> <span class="kr">async</span> <span class="p">(</span><span class="nx">req</span><span class="p">,</span> <span class="nx">res</span><span class="p">)</span> <span class="p">=&gt;</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="kr">const</span> <span class="nx">person</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">personRepository</span><span class="p">.</span><span class="nx">createAndSave</span><span class="p">(</span><span class="nx">req</span><span class="p">.</span><span class="nx">body</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> <span class="nx">res</span><span class="p">.</span><span class="nx">send</span><span class="p">(</span><span class="nx">person</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="p">})</span></span></span></code></pre> </div> <p> Note that we are also returning the newly created <code> Person </code> . Let's see what that looks like by actually calling our API using the Swagger UI. Go to http://localhost:8080 in your browser and try it out. The default request body in Swagger will be fine for testing. You should see a response that looks like this: </p> <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">"entityId"</span><span class="p">:</span> <span class="s2">"01FY9MWDTWW4XQNTPJ9XY9FPMN"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"firstName"</span><span class="p">:</span> <span class="s2">"Rupert"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"lastName"</span><span class="p">:</span> <span class="s2">"Holmes"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"age"</span><span class="p">:</span> <span class="mi">75</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"verified"</span><span class="p">:</span> <span class="kc">false</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"location"</span><span class="p">:</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="nt">"longitude"</span><span class="p">:</span> <span class="mf">45.678</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"latitude"</span><span class="p">:</span> <span class="mf">45.678</span> </span></span><span class="line"><span class="cl"> <span class="p">},</span> </span></span><span class="line"><span class="cl"> <span class="nt">"locationUpdated"</span><span class="p">:</span> <span class="s2">"2022-03-01T12:34:56.123Z"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"skills"</span><span class="p">:</span> <span class="p">[</span> </span></span><span class="line"><span class="cl"> <span class="s2">"singing"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s2">"songwriting"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s2">"playwriting"</span> </span></span><span class="line"><span class="cl"> <span class="p">],</span> </span></span><span class="line"><span class="cl"> <span class="nt">"personalStatement"</span><span class="p">:</span> <span class="s2">"I like piña coladas and walks in the rain"</span> </span></span><span class="line"><span class="cl"><span class="p">}</span></span></span></code></pre> </div> <p> This is exactly what we handed it with one exception: the <code> entityId </code> . Every entity in Redis OM has an entity ID which is—as you've probably guessed—the unique ID of that entity. It was randomly generated when we called <code> .createAndSave() </code> . Yours will be different, so make note of it. </p> <p> You can see this newly created JSON document in Redis with Redis Insight. Go ahead and launch Redis Insight and you should see a key with a name like <code> Person:01FY9MWDTWW4XQNTPJ9XY9FPMN </code> . The <code> Person </code> bit of the key was derived from the class name of our entity and the sequence of letters and numbers is our generated entity ID. Click on it to take a look at the JSON document you've created. </p> <p> You'll also see a key named <code> Person:index:hash </code> . That's a unique value that Redis OM uses to see if it needs to recreate the index or not when <code> .createIndex() </code> is called. You can safely ignore it. </p> <h3 id="reading-a-person"> Reading a Person </h3> <p> Create down, let's add a GET route to read this newly created <code> Person </code> : </p> <div class="highlight"> <pre class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl"><span class="nx">router</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s1">'/:id'</span><span class="p">,</span> <span class="kr">async</span> <span class="p">(</span><span class="nx">req</span><span class="p">,</span> <span class="nx">res</span><span class="p">)</span> <span class="p">=&gt;</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="kr">const</span> <span class="nx">person</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">personRepository</span><span class="p">.</span><span class="nx">fetch</span><span class="p">(</span><span class="nx">req</span><span class="p">.</span><span class="nx">params</span><span class="p">.</span><span class="nx">id</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> <span class="nx">res</span><span class="p">.</span><span class="nx">send</span><span class="p">(</span><span class="nx">person</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="p">})</span></span></span></code></pre> </div> <p> This code extracts a parameter from the URL used in the route—the <code> entityId </code> that we received previously. It uses the <code> .fetch() </code> method on the <code> personRepository </code> to retrieve a <code> Person </code> using that <code> entityId </code> . Then, it returns that <code> Person </code> . </p> <p> Let's go ahead and test that in Swagger as well. You should get back exactly the same response. In fact, since this is a simple GET, we should be able to just load the URL into our browser. Test that out too by navigating to http://localhost:8080/person/01FY9MWDTWW4XQNTPJ9XY9FPMN, replacing the entity ID with your own. </p> <p> Now that we can read and write, let's implement the <em> REST </em> of the HTTP verbs. REST... get it? </p> <h3 id="updating-a-person"> Updating a Person </h3> <p> Let's add the code to update a person using a POST route: </p> <div class="highlight"> <pre class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl"><span class="nx">router</span><span class="p">.</span><span class="nx">post</span><span class="p">(</span><span class="s1">'/:id'</span><span class="p">,</span> <span class="kr">async</span> <span class="p">(</span><span class="nx">req</span><span class="p">,</span> <span class="nx">res</span><span class="p">)</span> <span class="p">=&gt;</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">person</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">personRepository</span><span class="p">.</span><span class="nx">fetch</span><span class="p">(</span><span class="nx">req</span><span class="p">.</span><span class="nx">params</span><span class="p">.</span><span class="nx">id</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="nx">person</span><span class="p">.</span><span class="nx">firstName</span> <span class="o">=</span> <span class="nx">req</span><span class="p">.</span><span class="nx">body</span><span class="p">.</span><span class="nx">firstName</span> <span class="o">??</span> <span class="kc">null</span> </span></span><span class="line"><span class="cl"> <span class="nx">person</span><span class="p">.</span><span class="nx">lastName</span> <span class="o">=</span> <span class="nx">req</span><span class="p">.</span><span class="nx">body</span><span class="p">.</span><span class="nx">lastName</span> <span class="o">??</span> <span class="kc">null</span> </span></span><span class="line"><span class="cl"> <span class="nx">person</span><span class="p">.</span><span class="nx">age</span> <span class="o">=</span> <span class="nx">req</span><span class="p">.</span><span class="nx">body</span><span class="p">.</span><span class="nx">age</span> <span class="o">??</span> <span class="kc">null</span> </span></span><span class="line"><span class="cl"> <span class="nx">person</span><span class="p">.</span><span class="nx">verified</span> <span class="o">=</span> <span class="nx">req</span><span class="p">.</span><span class="nx">body</span><span class="p">.</span><span class="nx">verified</span> <span class="o">??</span> <span class="kc">null</span> </span></span><span class="line"><span class="cl"> <span class="nx">person</span><span class="p">.</span><span class="nx">location</span> <span class="o">=</span> <span class="nx">req</span><span class="p">.</span><span class="nx">body</span><span class="p">.</span><span class="nx">location</span> <span class="o">??</span> <span class="kc">null</span> </span></span><span class="line"><span class="cl"> <span class="nx">person</span><span class="p">.</span><span class="nx">locationUpdated</span> <span class="o">=</span> <span class="nx">req</span><span class="p">.</span><span class="nx">body</span><span class="p">.</span><span class="nx">locationUpdated</span> <span class="o">??</span> <span class="kc">null</span> </span></span><span class="line"><span class="cl"> <span class="nx">person</span><span class="p">.</span><span class="nx">skills</span> <span class="o">=</span> <span class="nx">req</span><span class="p">.</span><span class="nx">body</span><span class="p">.</span><span class="nx">skills</span> <span class="o">??</span> <span class="kc">null</span> </span></span><span class="line"><span class="cl"> <span class="nx">person</span><span class="p">.</span><span class="nx">personalStatement</span> <span class="o">=</span> <span class="nx">req</span><span class="p">.</span><span class="nx">body</span><span class="p">.</span><span class="nx">personalStatement</span> <span class="o">??</span> <span class="kc">null</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="kr">await</span> <span class="nx">personRepository</span><span class="p">.</span><span class="nx">save</span><span class="p">(</span><span class="nx">person</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="nx">res</span><span class="p">.</span><span class="nx">send</span><span class="p">(</span><span class="nx">person</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="p">})</span></span></span></code></pre> </div> <p> This code fetches the <code> Person </code> from the <code> personRepository </code> using the <code> entityId </code> just like our previous route did. However, now we change all the properties based on the properties in the request body. If any of them are missing, we set them to <code> null </code> . Then, we call <code> .save() </code> and return the changed <code> Person </code> . </p> <p> Let's test this in Swagger too, why not? Make some changes. Try removing some of the fields. What do you get back when you read it after you've changed it? </p> <h3 id="deleting-a-person"> Deleting a Person </h3> <p> Deletion—my favorite! Remember kids, deletion is 100% compression. The route that deletes is just as straightforward as the one that reads, but much more destructive: </p> <div class="highlight"> <pre class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl"><span class="nx">router</span><span class="p">.</span><span class="k">delete</span><span class="p">(</span><span class="s1">'/:id'</span><span class="p">,</span> <span class="kr">async</span> <span class="p">(</span><span class="nx">req</span><span class="p">,</span> <span class="nx">res</span><span class="p">)</span> <span class="p">=&gt;</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="kr">await</span> <span class="nx">personRepository</span><span class="p">.</span><span class="nx">remove</span><span class="p">(</span><span class="nx">req</span><span class="p">.</span><span class="nx">params</span><span class="p">.</span><span class="nx">id</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> <span class="nx">res</span><span class="p">.</span><span class="nx">send</span><span class="p">({</span> <span class="nx">entityId</span><span class="o">:</span> <span class="nx">req</span><span class="p">.</span><span class="nx">params</span><span class="p">.</span><span class="nx">id</span> <span class="p">})</span> </span></span><span class="line"><span class="cl"><span class="p">})</span></span></span></code></pre> </div> <p> I guess we should probably test this one out too. Load up Swagger and exercise the route. You should get back JSON with the entity ID you just removed: </p> <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">"entityId"</span><span class="p">:</span> <span class="s2">"01FY9MWDTWW4XQNTPJ9XY9FPMN"</span> </span></span><span class="line"><span class="cl"><span class="p">}</span></span></span></code></pre> </div> <p> And just like that, it's gone! </p> <h3 id="all-the-crud"> All the CRUD </h3> <p> Do a quick check with what you've written so far. Here's what should be the totality of your <code> person-router.js </code> file: </p> <div class="highlight"> <pre class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl"><span class="kr">import</span> <span class="p">{</span> <span class="nx">Router</span> <span class="p">}</span> <span class="nx">from</span> <span class="s1">'express'</span> </span></span><span class="line"><span class="cl"><span class="kr">import</span> <span class="p">{</span> <span class="nx">personRepository</span> <span class="p">}</span> <span class="nx">from</span> <span class="s1">'../om/person.js'</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="kr">export</span> <span class="kr">const</span> <span class="nx">router</span> <span class="o">=</span> <span class="nx">Router</span><span class="p">()</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="nx">router</span><span class="p">.</span><span class="nx">put</span><span class="p">(</span><span class="s1">'/'</span><span class="p">,</span> <span class="kr">async</span> <span class="p">(</span><span class="nx">req</span><span class="p">,</span> <span class="nx">res</span><span class="p">)</span> <span class="p">=&gt;</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="kr">const</span> <span class="nx">person</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">personRepository</span><span class="p">.</span><span class="nx">createAndSave</span><span class="p">(</span><span class="nx">req</span><span class="p">.</span><span class="nx">body</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> <span class="nx">res</span><span class="p">.</span><span class="nx">send</span><span class="p">(</span><span class="nx">person</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">router</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s1">'/:id'</span><span class="p">,</span> <span class="kr">async</span> <span class="p">(</span><span class="nx">req</span><span class="p">,</span> <span class="nx">res</span><span class="p">)</span> <span class="p">=&gt;</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="kr">const</span> <span class="nx">person</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">personRepository</span><span class="p">.</span><span class="nx">fetch</span><span class="p">(</span><span class="nx">req</span><span class="p">.</span><span class="nx">params</span><span class="p">.</span><span class="nx">id</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> <span class="nx">res</span><span class="p">.</span><span class="nx">send</span><span class="p">(</span><span class="nx">person</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">router</span><span class="p">.</span><span class="nx">post</span><span class="p">(</span><span class="s1">'/:id'</span><span class="p">,</span> <span class="kr">async</span> <span class="p">(</span><span class="nx">req</span><span class="p">,</span> <span class="nx">res</span><span class="p">)</span> <span class="p">=&gt;</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">person</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">personRepository</span><span class="p">.</span><span class="nx">fetch</span><span class="p">(</span><span class="nx">req</span><span class="p">.</span><span class="nx">params</span><span class="p">.</span><span class="nx">id</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="nx">person</span><span class="p">.</span><span class="nx">firstName</span> <span class="o">=</span> <span class="nx">req</span><span class="p">.</span><span class="nx">body</span><span class="p">.</span><span class="nx">firstName</span> <span class="o">??</span> <span class="kc">null</span> </span></span><span class="line"><span class="cl"> <span class="nx">person</span><span class="p">.</span><span class="nx">lastName</span> <span class="o">=</span> <span class="nx">req</span><span class="p">.</span><span class="nx">body</span><span class="p">.</span><span class="nx">lastName</span> <span class="o">??</span> <span class="kc">null</span> </span></span><span class="line"><span class="cl"> <span class="nx">person</span><span class="p">.</span><span class="nx">age</span> <span class="o">=</span> <span class="nx">req</span><span class="p">.</span><span class="nx">body</span><span class="p">.</span><span class="nx">age</span> <span class="o">??</span> <span class="kc">null</span> </span></span><span class="line"><span class="cl"> <span class="nx">person</span><span class="p">.</span><span class="nx">verified</span> <span class="o">=</span> <span class="nx">req</span><span class="p">.</span><span class="nx">body</span><span class="p">.</span><span class="nx">verified</span> <span class="o">??</span> <span class="kc">null</span> </span></span><span class="line"><span class="cl"> <span class="nx">person</span><span class="p">.</span><span class="nx">location</span> <span class="o">=</span> <span class="nx">req</span><span class="p">.</span><span class="nx">body</span><span class="p">.</span><span class="nx">location</span> <span class="o">??</span> <span class="kc">null</span> </span></span><span class="line"><span class="cl"> <span class="nx">person</span><span class="p">.</span><span class="nx">locationUpdated</span> <span class="o">=</span> <span class="nx">req</span><span class="p">.</span><span class="nx">body</span><span class="p">.</span><span class="nx">locationUpdated</span> <span class="o">??</span> <span class="kc">null</span> </span></span><span class="line"><span class="cl"> <span class="nx">person</span><span class="p">.</span><span class="nx">skills</span> <span class="o">=</span> <span class="nx">req</span><span class="p">.</span><span class="nx">body</span><span class="p">.</span><span class="nx">skills</span> <span class="o">??</span> <span class="kc">null</span> </span></span><span class="line"><span class="cl"> <span class="nx">person</span><span class="p">.</span><span class="nx">personalStatement</span> <span class="o">=</span> <span class="nx">req</span><span class="p">.</span><span class="nx">body</span><span class="p">.</span><span class="nx">personalStatement</span> <span class="o">??</span> <span class="kc">null</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="kr">await</span> <span class="nx">personRepository</span><span class="p">.</span><span class="nx">save</span><span class="p">(</span><span class="nx">person</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="nx">res</span><span class="p">.</span><span class="nx">send</span><span class="p">(</span><span class="nx">person</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">router</span><span class="p">.</span><span class="k">delete</span><span class="p">(</span><span class="s1">'/:id'</span><span class="p">,</span> <span class="kr">async</span> <span class="p">(</span><span class="nx">req</span><span class="p">,</span> <span class="nx">res</span><span class="p">)</span> <span class="p">=&gt;</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="kr">await</span> <span class="nx">personRepository</span><span class="p">.</span><span class="nx">remove</span><span class="p">(</span><span class="nx">req</span><span class="p">.</span><span class="nx">params</span><span class="p">.</span><span class="nx">id</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> <span class="nx">res</span><span class="p">.</span><span class="nx">send</span><span class="p">({</span> <span class="nx">entityId</span><span class="o">:</span> <span class="nx">req</span><span class="p">.</span><span class="nx">params</span><span class="p">.</span><span class="nx">id</span> <span class="p">})</span> </span></span><span class="line"><span class="cl"><span class="p">})</span></span></span></code></pre> </div> <h2 id="preparing-to-search"> Preparing to search </h2> <p> CRUD completed, let's do some searching. In order to search, we need data to search over. Remember that <code> persons </code> folder with all the JSON documents and the <code> load-data.sh </code> shell script? Its time has arrived. Go into that folder and run the script: </p> <pre><code>cd persons ./load-data.sh </code></pre> <p> You should get a rather verbose response containing the JSON response from the API and the names of the files you loaded. Like this: </p> <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">"entityId"</span><span class="p">:</span><span class="s2">"01FY9Z4RRPKF4K9H78JQ3K3CP3"</span><span class="p">,</span><span class="nt">"firstName"</span><span class="p">:</span><span class="s2">"Chris"</span><span class="p">,</span><span class="nt">"lastName"</span><span class="p">:</span><span class="s2">"Stapleton"</span><span class="p">,</span><span class="nt">"age"</span><span class="p">:</span><span class="mi">43</span><span class="p">,</span><span class="nt">"verified"</span><span class="p">:</span><span class="kc">true</span><span class="p">,</span><span class="nt">"location"</span><span class="p">:{</span><span class="nt">"longitude"</span><span class="p">:</span><span class="mf">-84.495</span><span class="p">,</span><span class="nt">"latitude"</span><span class="p">:</span><span class="mf">38.03</span><span class="p">},</span><span class="nt">"locationUpdated"</span><span class="p">:</span><span class="s2">"2022-01-01T12:00:00.000Z"</span><span class="p">,</span><span class="nt">"skills"</span><span class="p">:[</span><span class="s2">"singing"</span><span class="p">,</span><span class="s2">"football"</span><span class="p">,</span><span class="s2">"coal mining"</span><span class="p">],</span><span class="nt">"personalStatement"</span><span class="p">:</span><span class="s2">"There are days that I can walk around like I'm alright. And I pretend to wear a smile on my face. And I could keep the pain from comin' out of my eyes. But sometimes, sometimes, sometimes I cry."</span><span class="p">}</span> <span class="err">&lt;-</span> <span class="err">chris-stapleton.json</span> </span></span><span class="line"><span class="cl"><span class="p">{</span><span class="nt">"entityId"</span><span class="p">:</span><span class="s2">"01FY9Z4RS2QQVN4XFYSNPKH6B2"</span><span class="p">,</span><span class="nt">"firstName"</span><span class="p">:</span><span class="s2">"David"</span><span class="p">,</span><span class="nt">"lastName"</span><span class="p">:</span><span class="s2">"Paich"</span><span class="p">,</span><span class="nt">"age"</span><span class="p">:</span><span class="mi">67</span><span class="p">,</span><span class="nt">"verified"</span><span class="p">:</span><span class="kc">false</span><span class="p">,</span><span class="nt">"location"</span><span class="p">:{</span><span class="nt">"longitude"</span><span class="p">:</span><span class="mf">-118.25</span><span class="p">,</span><span class="nt">"latitude"</span><span class="p">:</span><span class="mf">34.05</span><span class="p">},</span><span class="nt">"locationUpdated"</span><span class="p">:</span><span class="s2">"2022-01-01T12:00:00.000Z"</span><span class="p">,</span><span class="nt">"skills"</span><span class="p">:[</span><span class="s2">"singing"</span><span class="p">,</span><span class="s2">"keyboard"</span><span class="p">,</span><span class="s2">"blessing"</span><span class="p">],</span><span class="nt">"personalStatement"</span><span class="p">:</span><span class="s2">"I seek to cure what's deep inside frightened of this thing that I've become"</span><span class="p">}</span> <span class="err">&lt;-</span> <span class="err">david-paich.json</span> </span></span><span class="line"><span class="cl"><span class="p">{</span><span class="nt">"entityId"</span><span class="p">:</span><span class="s2">"01FY9Z4RSD7SQMSWDFZ6S4M5MJ"</span><span class="p">,</span><span class="nt">"firstName"</span><span class="p">:</span><span class="s2">"Ivan"</span><span class="p">,</span><span class="nt">"lastName"</span><span class="p">:</span><span class="s2">"Doroschuk"</span><span class="p">,</span><span class="nt">"age"</span><span class="p">:</span><span class="mi">64</span><span class="p">,</span><span class="nt">"verified"</span><span class="p">:</span><span class="kc">true</span><span class="p">,</span><span class="nt">"location"</span><span class="p">:{</span><span class="nt">"longitude"</span><span class="p">:</span><span class="mf">-88.273</span><span class="p">,</span><span class="nt">"latitude"</span><span class="p">:</span><span class="mf">40.115</span><span class="p">},</span><span class="nt">"locationUpdated"</span><span class="p">:</span><span class="s2">"2022-01-01T12:00:00.000Z"</span><span class="p">,</span><span class="nt">"skills"</span><span class="p">:[</span><span class="s2">"singing"</span><span class="p">,</span><span class="s2">"dancing"</span><span class="p">,</span><span class="s2">"friendship"</span><span class="p">],</span><span class="nt">"personalStatement"</span><span class="p">:</span><span class="s2">"We can dance if we want to. We can leave your friends behind. 'Cause your friends don't dance and if they don't dance well they're no friends of mine."</span><span class="p">}</span> <span class="err">&lt;-</span> <span class="err">ivan-doroschuk.json</span> </span></span><span class="line"><span class="cl"><span class="p">{</span><span class="nt">"entityId"</span><span class="p">:</span><span class="s2">"01FY9Z4RSRZFGQ21BMEKYHEVK6"</span><span class="p">,</span><span class="nt">"firstName"</span><span class="p">:</span><span class="s2">"Joan"</span><span class="p">,</span><span class="nt">"lastName"</span><span class="p">:</span><span class="s2">"Jett"</span><span class="p">,</span><span class="nt">"age"</span><span class="p">:</span><span class="mi">63</span><span class="p">,</span><span class="nt">"verified"</span><span class="p">:</span><span class="kc">false</span><span class="p">,</span><span class="nt">"location"</span><span class="p">:{</span><span class="nt">"longitude"</span><span class="p">:</span><span class="mf">-75.273</span><span class="p">,</span><span class="nt">"latitude"</span><span class="p">:</span><span class="mf">40.003</span><span class="p">},</span><span class="nt">"locationUpdated"</span><span class="p">:</span><span class="s2">"2022-01-01T12:00:00.000Z"</span><span class="p">,</span><span class="nt">"skills"</span><span class="p">:[</span><span class="s2">"singing"</span><span class="p">,</span><span class="s2">"guitar"</span><span class="p">,</span><span class="s2">"black eyeliner"</span><span class="p">],</span><span class="nt">"personalStatement"</span><span class="p">:</span><span class="s2">"I love rock n' roll so put another dime in the jukebox, baby."</span><span class="p">}</span> <span class="err">&lt;-</span> <span class="err">joan-jett.json</span> </span></span><span class="line"><span class="cl"><span class="p">{</span><span class="nt">"entityId"</span><span class="p">:</span><span class="s2">"01FY9Z4RT25ABWYTW6ZG7R79V4"</span><span class="p">,</span><span class="nt">"firstName"</span><span class="p">:</span><span class="s2">"Justin"</span><span class="p">,</span><span class="nt">"lastName"</span><span class="p">:</span><span class="s2">"Timberlake"</span><span class="p">,</span><span class="nt">"age"</span><span class="p">:</span><span class="mi">41</span><span class="p">,</span><span class="nt">"verified"</span><span class="p">:</span><span class="kc">true</span><span class="p">,</span><span class="nt">"location"</span><span class="p">:{</span><span class="nt">"longitude"</span><span class="p">:</span><span class="mf">-89.971</span><span class="p">,</span><span class="nt">"latitude"</span><span class="p">:</span><span class="mf">35.118</span><span class="p">},</span><span class="nt">"locationUpdated"</span><span class="p">:</span><span class="s2">"2022-01-01T12:00:00.000Z"</span><span class="p">,</span><span class="nt">"skills"</span><span class="p">:[</span><span class="s2">"singing"</span><span class="p">,</span><span class="s2">"dancing"</span><span class="p">,</span><span class="s2">"half-time shows"</span><span class="p">],</span><span class="nt">"personalStatement"</span><span class="p">:</span><span class="s2">"What goes around comes all the way back around."</span><span class="p">}</span> <span class="err">&lt;-</span> <span class="err">justin-timberlake.json</span> </span></span><span class="line"><span class="cl"><span class="p">{</span><span class="nt">"entityId"</span><span class="p">:</span><span class="s2">"01FY9Z4RTD9EKBDS2YN9CRMG1D"</span><span class="p">,</span><span class="nt">"firstName"</span><span class="p">:</span><span class="s2">"Kerry"</span><span class="p">,</span><span class="nt">"lastName"</span><span class="p">:</span><span class="s2">"Livgren"</span><span class="p">,</span><span class="nt">"age"</span><span class="p">:</span><span class="mi">72</span><span class="p">,</span><span class="nt">"verified"</span><span class="p">:</span><span class="kc">false</span><span class="p">,</span><span class="nt">"location"</span><span class="p">:{</span><span class="nt">"longitude"</span><span class="p">:</span><span class="mf">-95.689</span><span class="p">,</span><span class="nt">"latitude"</span><span class="p">:</span><span class="mf">39.056</span><span class="p">},</span><span class="nt">"locationUpdated"</span><span class="p">:</span><span class="s2">"2022-01-01T12:00:00.000Z"</span><span class="p">,</span><span class="nt">"skills"</span><span class="p">:[</span><span class="s2">"poetry"</span><span class="p">,</span><span class="s2">"philosophy"</span><span class="p">,</span><span class="s2">"songwriting"</span><span class="p">,</span><span class="s2">"guitar"</span><span class="p">],</span><span class="nt">"personalStatement"</span><span class="p">:</span><span class="s2">"All we are is dust in the wind."</span><span class="p">}</span> <span class="err">&lt;-</span> <span class="err">kerry-livgren.json</span> </span></span><span class="line"><span class="cl"><span class="p">{</span><span class="nt">"entityId"</span><span class="p">:</span><span class="s2">"01FY9Z4RTR73HZQXK83JP94NWR"</span><span class="p">,</span><span class="nt">"firstName"</span><span class="p">:</span><span class="s2">"Marshal"</span><span class="p">,</span><span class="nt">"lastName"</span><span class="p">:</span><span class="s2">"Mathers"</span><span class="p">,</span><span class="nt">"age"</span><span class="p">:</span><span class="mi">49</span><span class="p">,</span><span class="nt">"verified"</span><span class="p">:</span><span class="kc">false</span><span class="p">,</span><span class="nt">"location"</span><span class="p">:{</span><span class="nt">"longitude"</span><span class="p">:</span><span class="mf">-83.046</span><span class="p">,</span><span class="nt">"latitude"</span><span class="p">:</span><span class="mf">42.331</span><span class="p">},</span><span class="nt">"locationUpdated"</span><span class="p">:</span><span class="s2">"2022-01-01T12:00:00.000Z"</span><span class="p">,</span><span class="nt">"skills"</span><span class="p">:[</span><span class="s2">"rapping"</span><span class="p">,</span><span class="s2">"songwriting"</span><span class="p">,</span><span class="s2">"comics"</span><span class="p">],</span><span class="nt">"personalStatement"</span><span class="p">:</span><span class="s2">"Look, if you had, one shot, or one opportunity to seize everything you ever wanted, in one moment, would you capture it, or just let it slip?"</span><span class="p">}</span> <span class="err">&lt;-</span> <span class="err">marshal-mathers.json</span> </span></span><span class="line"><span class="cl"><span class="p">{</span><span class="nt">"entityId"</span><span class="p">:</span><span class="s2">"01FY9Z4RV2QHH0Z1GJM5ND15JE"</span><span class="p">,</span><span class="nt">"firstName"</span><span class="p">:</span><span class="s2">"Rupert"</span><span class="p">,</span><span class="nt">"lastName"</span><span class="p">:</span><span class="s2">"Holmes"</span><span class="p">,</span><span class="nt">"age"</span><span class="p">:</span><span class="mi">75</span><span class="p">,</span><span class="nt">"verified"</span><span class="p">:</span><span class="kc">true</span><span class="p">,</span><span class="nt">"location"</span><span class="p">:{</span><span class="nt">"longitude"</span><span class="p">:</span><span class="mf">-2.518</span><span class="p">,</span><span class="nt">"latitude"</span><span class="p">:</span><span class="mf">53.259</span><span class="p">},</span><span class="nt">"locationUpdated"</span><span class="p">:</span><span class="s2">"2022-01-01T12:00:00.000Z"</span><span class="p">,</span><span class="nt">"skills"</span><span class="p">:[</span><span class="s2">"singing"</span><span class="p">,</span><span class="s2">"songwriting"</span><span class="p">,</span><span class="s2">"playwriting"</span><span class="p">],</span><span class="nt">"personalStatement"</span><span class="p">:</span><span class="s2">"I like piña coladas and taking walks in the rain."</span><span class="p">}</span> <span class="err">&lt;-</span> <span class="err">rupert-holmes.json</span></span></span></code></pre> </div> <p> A little messy, but if you don't see this, then it didn't work! </p> <p> Now that we have some data, let's add another router to hold the search routes we want to add. Create a file named <code> search-router.js </code> in the routers folder and set it up with imports and exports just like we did in <code> person-router.js </code> : </p> <div class="highlight"> <pre class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl"><span class="kr">import</span> <span class="p">{</span> <span class="nx">Router</span> <span class="p">}</span> <span class="nx">from</span> <span class="s1">'express'</span> </span></span><span class="line"><span class="cl"><span class="kr">import</span> <span class="p">{</span> <span class="nx">personRepository</span> <span class="p">}</span> <span class="nx">from</span> <span class="s1">'../om/person.js'</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="kr">export</span> <span class="kr">const</span> <span class="nx">router</span> <span class="o">=</span> <span class="nx">Router</span><span class="p">()</span></span></span></code></pre> </div> <p> Import the <code> Router </code> into <code> server.js </code> the same way we did for the <code> personRouter </code> : </p> <div class="highlight"> <pre class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl"><span class="cm">/* import routers */</span> </span></span><span class="line"><span class="cl"><span class="kr">import</span> <span class="p">{</span> <span class="nx">router</span> <span class="nx">as</span> <span class="nx">personRouter</span> <span class="p">}</span> <span class="nx">from</span> <span class="s1">'./routers/person-router.js'</span> </span></span><span class="line"><span class="cl"><span class="kr">import</span> <span class="p">{</span> <span class="nx">router</span> <span class="nx">as</span> <span class="nx">searchRouter</span> <span class="p">}</span> <span class="nx">from</span> <span class="s1">'./routers/search-router.js'</span></span></span></code></pre> </div> <p> Then add the <code> searchRouter </code> to the Express app: </p> <div class="highlight"> <pre class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl"><span class="cm">/* bring in some routers */</span> </span></span><span class="line"><span class="cl"><span class="nx">app</span><span class="p">.</span><span class="nx">use</span><span class="p">(</span><span class="s1">'/person'</span><span class="p">,</span> <span class="nx">personRouter</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="nx">app</span><span class="p">.</span><span class="nx">use</span><span class="p">(</span><span class="s1">'/persons'</span><span class="p">,</span> <span class="nx">searchRouter</span><span class="p">)</span></span></span></code></pre> </div> <p> Router bound, we can now add some routes. </p> <h3 id="search-all-the-things"> Search all the things </h3> <p> We're going to add a plethora of searches to our new <code> Router </code> . But the first will be the easiest as it's just going to return everything. Go ahead and add the following code to <code> search-router.js </code> : </p> <div class="highlight"> <pre class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl"><span class="nx">router</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s1">'/all'</span><span class="p">,</span> <span class="kr">async</span> <span class="p">(</span><span class="nx">req</span><span class="p">,</span> <span class="nx">res</span><span class="p">)</span> <span class="p">=&gt;</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="kr">const</span> <span class="nx">persons</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">personRepository</span><span class="p">.</span><span class="nx">search</span><span class="p">().</span><span class="k">return</span><span class="p">.</span><span class="nx">all</span><span class="p">()</span> </span></span><span class="line"><span class="cl"> <span class="nx">res</span><span class="p">.</span><span class="nx">send</span><span class="p">(</span><span class="nx">persons</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="p">})</span></span></span></code></pre> </div> <p> Here we see how to start and finish a search. Searches start just like CRUD operations start—on a <code> Repository </code> . But instead of calling <code> .createAndSave() </code> , <code> .fetch() </code> , <code> .save() </code> , or <code> .remove() </code> , we call <code> .search() </code> . And unlike all those other methods, <code> .search() </code> doesn't end there. Instead, it allows you to build up a query (which you'll see in the next example) and then resolve it with a call to <code> .return.all() </code> . </p> <p> With this new route in place, go into the Swagger UI and exercise the <code> /persons/all </code> route. You should see all of the folks you added with the shell script as a JSON array. </p> <p> In the example above, the query is not specified—we didn't build anything up. If you do this, you'll just get everything. Which is what you want sometimes. But not most of the time. It's not really searching if you just return everything. So let's add a route that lets us find persons by their last name. Add the following code: </p> <div class="highlight"> <pre class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl"><span class="nx">router</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s1">'/by-last-name/:lastName'</span><span class="p">,</span> <span class="kr">async</span> <span class="p">(</span><span class="nx">req</span><span class="p">,</span> <span class="nx">res</span><span class="p">)</span> <span class="p">=&gt;</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="kr">const</span> <span class="nx">lastName</span> <span class="o">=</span> <span class="nx">req</span><span class="p">.</span><span class="nx">params</span><span class="p">.</span><span class="nx">lastName</span> </span></span><span class="line"><span class="cl"> <span class="kr">const</span> <span class="nx">persons</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">personRepository</span><span class="p">.</span><span class="nx">search</span><span class="p">()</span> </span></span><span class="line"><span class="cl"> <span class="p">.</span><span class="nx">where</span><span class="p">(</span><span class="s1">'lastName'</span><span class="p">).</span><span class="nx">equals</span><span class="p">(</span><span class="nx">lastName</span><span class="p">).</span><span class="k">return</span><span class="p">.</span><span class="nx">all</span><span class="p">()</span> </span></span><span class="line"><span class="cl"> <span class="nx">res</span><span class="p">.</span><span class="nx">send</span><span class="p">(</span><span class="nx">persons</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="p">})</span></span></span></code></pre> </div> <p> In this route, we're specifying a field we want to filter on and a value that it needs to equal. The field name in the call to <code> .where() </code> is the name of the field specified in our schema. This field was defined as a <code> string </code> , which matters because the type of the field determines the methods that are available query it. </p> <p> In the case of a <code> string </code> , there's just <code> .equals() </code> , which will query against the value of the entire string. This is aliased as <code> .eq() </code> , <code> .equal() </code> , and <code> .equalTo() </code> for your convenience. You can even add a little more syntactic sugar with calls to <code> .is </code> and <code> .does </code> that really don't do anything but make your code pretty. Like this: </p> <div class="highlight"> <pre class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">persons</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">personRepository</span><span class="p">.</span><span class="nx">search</span><span class="p">().</span><span class="nx">where</span><span class="p">(</span><span class="s1">'lastName'</span><span class="p">).</span><span class="nx">is</span><span class="p">.</span><span class="nx">equalTo</span><span class="p">(</span><span class="nx">lastName</span><span class="p">).</span><span class="k">return</span><span class="p">.</span><span class="nx">all</span><span class="p">()</span> </span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">persons</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">personRepository</span><span class="p">.</span><span class="nx">search</span><span class="p">().</span><span class="nx">where</span><span class="p">(</span><span class="s1">'lastName'</span><span class="p">).</span><span class="nx">does</span><span class="p">.</span><span class="nx">equal</span><span class="p">(</span><span class="nx">lastName</span><span class="p">).</span><span class="k">return</span><span class="p">.</span><span class="nx">all</span><span class="p">()</span></span></span></code></pre> </div> <p> You can also invert the query with a call to <code> .not </code> : </p> <div class="highlight"> <pre class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">persons</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">personRepository</span><span class="p">.</span><span class="nx">search</span><span class="p">().</span><span class="nx">where</span><span class="p">(</span><span class="s1">'lastName'</span><span class="p">).</span><span class="nx">is</span><span class="p">.</span><span class="nx">not</span><span class="p">.</span><span class="nx">equalTo</span><span class="p">(</span><span class="nx">lastName</span><span class="p">).</span><span class="k">return</span><span class="p">.</span><span class="nx">all</span><span class="p">()</span> </span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">persons</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">personRepository</span><span class="p">.</span><span class="nx">search</span><span class="p">().</span><span class="nx">where</span><span class="p">(</span><span class="s1">'lastName'</span><span class="p">).</span><span class="nx">does</span><span class="p">.</span><span class="nx">not</span><span class="p">.</span><span class="nx">equal</span><span class="p">(</span><span class="nx">lastName</span><span class="p">).</span><span class="k">return</span><span class="p">.</span><span class="nx">all</span><span class="p">()</span></span></span></code></pre> </div> <p> In all these cases, the call to <code> .return.all() </code> executes the query we build between it and the call to <code> .search() </code> . We can search on other field types as well. Let's add some routes to search on a <code> number </code> and a <code> boolean </code> field: </p> <div class="highlight"> <pre class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl"><span class="nx">router</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s1">'/old-enough-to-drink-in-america'</span><span class="p">,</span> <span class="kr">async</span> <span class="p">(</span><span class="nx">req</span><span class="p">,</span> <span class="nx">res</span><span class="p">)</span> <span class="p">=&gt;</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="kr">const</span> <span class="nx">persons</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">personRepository</span><span class="p">.</span><span class="nx">search</span><span class="p">()</span> </span></span><span class="line"><span class="cl"> <span class="p">.</span><span class="nx">where</span><span class="p">(</span><span class="s1">'age'</span><span class="p">).</span><span class="nx">gte</span><span class="p">(</span><span class="mi">21</span><span class="p">).</span><span class="k">return</span><span class="p">.</span><span class="nx">all</span><span class="p">()</span> </span></span><span class="line"><span class="cl"> <span class="nx">res</span><span class="p">.</span><span class="nx">send</span><span class="p">(</span><span class="nx">persons</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">router</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s1">'/non-verified'</span><span class="p">,</span> <span class="kr">async</span> <span class="p">(</span><span class="nx">req</span><span class="p">,</span> <span class="nx">res</span><span class="p">)</span> <span class="p">=&gt;</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="kr">const</span> <span class="nx">persons</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">personRepository</span><span class="p">.</span><span class="nx">search</span><span class="p">()</span> </span></span><span class="line"><span class="cl"> <span class="p">.</span><span class="nx">where</span><span class="p">(</span><span class="s1">'verified'</span><span class="p">).</span><span class="nx">is</span><span class="p">.</span><span class="nx">not</span><span class="p">.</span><span class="kc">true</span><span class="p">().</span><span class="k">return</span><span class="p">.</span><span class="nx">all</span><span class="p">()</span> </span></span><span class="line"><span class="cl"> <span class="nx">res</span><span class="p">.</span><span class="nx">send</span><span class="p">(</span><span class="nx">persons</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="p">})</span></span></span></code></pre> </div> <p> The <code> number </code> field is filtering persons by age where the age is great than or equal to 21. Again, there are aliases and syntactic sugar: </p> <div class="highlight"> <pre class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">persons</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">personRepository</span><span class="p">.</span><span class="nx">search</span><span class="p">().</span><span class="nx">where</span><span class="p">(</span><span class="s1">'age'</span><span class="p">).</span><span class="nx">is</span><span class="p">.</span><span class="nx">greaterThanOrEqualTo</span><span class="p">(</span><span class="mi">21</span><span class="p">).</span><span class="k">return</span><span class="p">.</span><span class="nx">all</span><span class="p">()</span></span></span></code></pre> </div> <p> But there are also more ways to query: </p> <div class="highlight"> <pre class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">persons</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">personRepository</span><span class="p">.</span><span class="nx">search</span><span class="p">().</span><span class="nx">where</span><span class="p">(</span><span class="s1">'age'</span><span class="p">).</span><span class="nx">eq</span><span class="p">(</span><span class="mi">21</span><span class="p">).</span><span class="k">return</span><span class="p">.</span><span class="nx">all</span><span class="p">()</span> </span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">persons</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">personRepository</span><span class="p">.</span><span class="nx">search</span><span class="p">().</span><span class="nx">where</span><span class="p">(</span><span class="s1">'age'</span><span class="p">).</span><span class="nx">gt</span><span class="p">(</span><span class="mi">21</span><span class="p">).</span><span class="k">return</span><span class="p">.</span><span class="nx">all</span><span class="p">()</span> </span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">persons</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">personRepository</span><span class="p">.</span><span class="nx">search</span><span class="p">().</span><span class="nx">where</span><span class="p">(</span><span class="s1">'age'</span><span class="p">).</span><span class="nx">gte</span><span class="p">(</span><span class="mi">21</span><span class="p">).</span><span class="k">return</span><span class="p">.</span><span class="nx">all</span><span class="p">()</span> </span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">persons</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">personRepository</span><span class="p">.</span><span class="nx">search</span><span class="p">().</span><span class="nx">where</span><span class="p">(</span><span class="s1">'age'</span><span class="p">).</span><span class="nx">lt</span><span class="p">(</span><span class="mi">21</span><span class="p">).</span><span class="k">return</span><span class="p">.</span><span class="nx">all</span><span class="p">()</span> </span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">persons</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">personRepository</span><span class="p">.</span><span class="nx">search</span><span class="p">().</span><span class="nx">where</span><span class="p">(</span><span class="s1">'age'</span><span class="p">).</span><span class="nx">lte</span><span class="p">(</span><span class="mi">21</span><span class="p">).</span><span class="k">return</span><span class="p">.</span><span class="nx">all</span><span class="p">()</span> </span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">persons</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">personRepository</span><span class="p">.</span><span class="nx">search</span><span class="p">().</span><span class="nx">where</span><span class="p">(</span><span class="s1">'age'</span><span class="p">).</span><span class="nx">between</span><span class="p">(</span><span class="mi">21</span><span class="p">,</span> <span class="mi">65</span><span class="p">).</span><span class="k">return</span><span class="p">.</span><span class="nx">all</span><span class="p">()</span></span></span></code></pre> </div> <p> The <code> boolean </code> field is searching for persons by their verification status. It already has some of our syntactic sugar in it. Note that this query will match a missing value or a false value. That's why I specified <code> .not.true() </code> . You can also call <code> .false() </code> on boolean fields as well as all the variations of <code> .equals </code> . </p> <div class="highlight"> <pre class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">persons</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">personRepository</span><span class="p">.</span><span class="nx">search</span><span class="p">().</span><span class="nx">where</span><span class="p">(</span><span class="s1">'verified'</span><span class="p">).</span><span class="kc">true</span><span class="p">().</span><span class="k">return</span><span class="p">.</span><span class="nx">all</span><span class="p">()</span> </span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">persons</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">personRepository</span><span class="p">.</span><span class="nx">search</span><span class="p">().</span><span class="nx">where</span><span class="p">(</span><span class="s1">'verified'</span><span class="p">).</span><span class="kc">false</span><span class="p">().</span><span class="k">return</span><span class="p">.</span><span class="nx">all</span><span class="p">()</span> </span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">persons</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">personRepository</span><span class="p">.</span><span class="nx">search</span><span class="p">().</span><span class="nx">where</span><span class="p">(</span><span class="s1">'verified'</span><span class="p">).</span><span class="nx">equals</span><span class="p">(</span><span class="kc">true</span><span class="p">).</span><span class="k">return</span><span class="p">.</span><span class="nx">all</span><span class="p">()</span></span></span></code></pre> </div> <blockquote> <p> So, we've created a few routes and I haven't told you to test them. Maybe you have anyhow. If so, good for you, you rebel. For the rest of you, why don't you go ahead and test them now with Swagger? And, going forward, just test them when you want. Heck, create some routes of your own using the provided syntax and try those out too. Don't let me tell you how to live your life. </p> </blockquote> <p> Of course, querying on just one field is never enough. Not a problem, Redis OM can handle <code> .and() </code> and <code> .or() </code> like in this route: </p> <div class="highlight"> <pre class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl"><span class="nx">router</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s1">'/verified-drinkers-with-last-name/:lastName'</span><span class="p">,</span> <span class="kr">async</span> <span class="p">(</span><span class="nx">req</span><span class="p">,</span> <span class="nx">res</span><span class="p">)</span> <span class="p">=&gt;</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="kr">const</span> <span class="nx">lastName</span> <span class="o">=</span> <span class="nx">req</span><span class="p">.</span><span class="nx">params</span><span class="p">.</span><span class="nx">lastName</span> </span></span><span class="line"><span class="cl"> <span class="kr">const</span> <span class="nx">persons</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">personRepository</span><span class="p">.</span><span class="nx">search</span><span class="p">()</span> </span></span><span class="line"><span class="cl"> <span class="p">.</span><span class="nx">where</span><span class="p">(</span><span class="s1">'verified'</span><span class="p">).</span><span class="nx">is</span><span class="p">.</span><span class="kc">true</span><span class="p">()</span> </span></span><span class="line"><span class="cl"> <span class="p">.</span><span class="nx">and</span><span class="p">(</span><span class="s1">'age'</span><span class="p">).</span><span class="nx">gte</span><span class="p">(</span><span class="mi">21</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> <span class="p">.</span><span class="nx">and</span><span class="p">(</span><span class="s1">'lastName'</span><span class="p">).</span><span class="nx">equals</span><span class="p">(</span><span class="nx">lastName</span><span class="p">).</span><span class="k">return</span><span class="p">.</span><span class="nx">all</span><span class="p">()</span> </span></span><span class="line"><span class="cl"> <span class="nx">res</span><span class="p">.</span><span class="nx">send</span><span class="p">(</span><span class="nx">persons</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="p">})</span></span></span></code></pre> </div> <p> Here, I'm just showing the syntax for <code> .and() </code> but, of course, you can also use <code> .or() </code> . </p> <h3 id="full-text-search"> Full-text search </h3> <p> If you've defined a field with a type of <code> text </code> in your schema, you can perform full-text searches against it. The way a <code> text </code> field is searched is different from how a <code> string </code> is searched. A <code> string </code> can only be compared with <code> .equals() </code> and must match the entire string. With a <code> text </code> field, you can look for words within the string. </p> <p> A <code> text </code> field is optimized for human-readable text, like an essay or song lyrics. It's pretty clever. It understands that certain words (like <em> a </em> , <em> an </em> , or <em> the </em> ) are common and ignores them. It understands how words are grammatically similar and so if you search for <em> give </em> , it matches <em> gives </em> , <em> given </em> , <em> giving </em> , and <em> gave </em> too. And it ignores punctuation. </p> <p> Let's add a route that does full-text search against our <code> personalStatement </code> field: </p> <div class="highlight"> <pre class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl"><span class="nx">router</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s1">'/with-statement-containing/:text'</span><span class="p">,</span> <span class="kr">async</span> <span class="p">(</span><span class="nx">req</span><span class="p">,</span> <span class="nx">res</span><span class="p">)</span> <span class="p">=&gt;</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="kr">const</span> <span class="nx">text</span> <span class="o">=</span> <span class="nx">req</span><span class="p">.</span><span class="nx">params</span><span class="p">.</span><span class="nx">text</span> </span></span><span class="line"><span class="cl"> <span class="kr">const</span> <span class="nx">persons</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">personRepository</span><span class="p">.</span><span class="nx">search</span><span class="p">()</span> </span></span><span class="line"><span class="cl"> <span class="p">.</span><span class="nx">where</span><span class="p">(</span><span class="s1">'personalStatement'</span><span class="p">).</span><span class="nx">matches</span><span class="p">(</span><span class="nx">text</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> <span class="p">.</span><span class="k">return</span><span class="p">.</span><span class="nx">all</span><span class="p">()</span> </span></span><span class="line"><span class="cl"> <span class="nx">res</span><span class="p">.</span><span class="nx">send</span><span class="p">(</span><span class="nx">persons</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="p">})</span></span></span></code></pre> </div> <p> Note the use of the <code> .matches() </code> function. This is the only one that works with <code> text </code> fields. It takes a string that can be one or more words—space-delimited—that you want to query for. Let's try it out. In Swagger, use this route to search for the word "walk". You should get the following results: </p> <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">"entityId"</span><span class="p">:</span> <span class="s2">"01FYC7CTR027F219455PS76247"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"firstName"</span><span class="p">:</span> <span class="s2">"Rupert"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"lastName"</span><span class="p">:</span> <span class="s2">"Holmes"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"age"</span><span class="p">:</span> <span class="mi">75</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"verified"</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">"location"</span><span class="p">:</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="nt">"longitude"</span><span class="p">:</span> <span class="mf">-2.518</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"latitude"</span><span class="p">:</span> <span class="mf">53.259</span> </span></span><span class="line"><span class="cl"> <span class="p">},</span> </span></span><span class="line"><span class="cl"> <span class="nt">"locationUpdated"</span><span class="p">:</span> <span class="s2">"2022-01-01T12:00:00.000Z"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"skills"</span><span class="p">:</span> <span class="p">[</span> </span></span><span class="line"><span class="cl"> <span class="s2">"singing"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s2">"songwriting"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s2">"playwriting"</span> </span></span><span class="line"><span class="cl"> <span class="p">],</span> </span></span><span class="line"><span class="cl"> <span class="nt">"personalStatement"</span><span class="p">:</span> <span class="s2">"I like piña coladas and taking walks in the rain."</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">"entityId"</span><span class="p">:</span> <span class="s2">"01FYC7CTNBJD9CZKKWPQEZEW14"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"firstName"</span><span class="p">:</span> <span class="s2">"Chris"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"lastName"</span><span class="p">:</span> <span class="s2">"Stapleton"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"age"</span><span class="p">:</span> <span class="mi">43</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"verified"</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">"location"</span><span class="p">:</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="nt">"longitude"</span><span class="p">:</span> <span class="mf">-84.495</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"latitude"</span><span class="p">:</span> <span class="mf">38.03</span> </span></span><span class="line"><span class="cl"> <span class="p">},</span> </span></span><span class="line"><span class="cl"> <span class="nt">"locationUpdated"</span><span class="p">:</span> <span class="s2">"2022-01-01T12:00:00.000Z"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"skills"</span><span class="p">:</span> <span class="p">[</span> </span></span><span class="line"><span class="cl"> <span class="s2">"singing"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s2">"football"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s2">"coal mining"</span> </span></span><span class="line"><span class="cl"> <span class="p">],</span> </span></span><span class="line"><span class="cl"> <span class="nt">"personalStatement"</span><span class="p">:</span> <span class="s2">"There are days that I can walk around like I'm alright. And I pretend to wear a smile on my face. And I could keep the pain from comin' out of my eyes. But sometimes, sometimes, sometimes I cry."</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> Notice how the word "walk" is matched for Rupert Holmes' personal statement that contains "walks" <em> and </em> matched for Chris Stapleton's that contains "walk". Now search "walk raining". You'll see that this returns Rupert's entry only even though the exact text of neither of these words is found in his personal statement. But they are <em> grammatically </em> related so it matched them. This is called stemming and it's a pretty cool feature of Redis Stack that Redis OM exploits. </p> <p> And if you search for "a rain walk" you'll <em> still </em> match Rupert's entry even though the word "a" is not in the text. Why? Because it's a common word that's not very helpful with searching. These common words are called stop words and this is another cool feature of Redis Stack that Redis OM just gets for free. </p> <h3 id="searching-the-globe"> Searching the globe </h3> <p> Redis Stack, and therefore Redis OM, both support searching by geographic location. You specify a point in the globe, a radius, and the units for that radius and it'll gleefully return all the entities therein. Let's add a route to do just that: </p> <div class="highlight"> <pre class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl"><span class="nx">router</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s1">'/near/:lng,:lat/radius/:radius'</span><span class="p">,</span> <span class="kr">async</span> <span class="p">(</span><span class="nx">req</span><span class="p">,</span> <span class="nx">res</span><span class="p">)</span> <span class="p">=&gt;</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="kr">const</span> <span class="nx">longitude</span> <span class="o">=</span> <span class="nb">Number</span><span class="p">(</span><span class="nx">req</span><span class="p">.</span><span class="nx">params</span><span class="p">.</span><span class="nx">lng</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> <span class="kr">const</span> <span class="nx">latitude</span> <span class="o">=</span> <span class="nb">Number</span><span class="p">(</span><span class="nx">req</span><span class="p">.</span><span class="nx">params</span><span class="p">.</span><span class="nx">lat</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> <span class="kr">const</span> <span class="nx">radius</span> <span class="o">=</span> <span class="nb">Number</span><span class="p">(</span><span class="nx">req</span><span class="p">.</span><span class="nx">params</span><span class="p">.</span><span class="nx">radius</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">persons</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">personRepository</span><span class="p">.</span><span class="nx">search</span><span class="p">()</span> </span></span><span class="line"><span class="cl"> <span class="p">.</span><span class="nx">where</span><span class="p">(</span><span class="s1">'location'</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> <span class="p">.</span><span class="nx">inRadius</span><span class="p">(</span><span class="nx">circle</span> <span class="p">=&gt;</span> <span class="nx">circle</span> </span></span><span class="line"><span class="cl"> <span class="p">.</span><span class="nx">longitude</span><span class="p">(</span><span class="nx">longitude</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> <span class="p">.</span><span class="nx">latitude</span><span class="p">(</span><span class="nx">latitude</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> <span class="p">.</span><span class="nx">radius</span><span class="p">(</span><span class="nx">radius</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> <span class="p">.</span><span class="nx">miles</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> <span class="p">.</span><span class="k">return</span><span class="p">.</span><span class="nx">all</span><span class="p">()</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="nx">res</span><span class="p">.</span><span class="nx">send</span><span class="p">(</span><span class="nx">persons</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="p">})</span></span></span></code></pre> </div> <p> This code looks a little different than the others because the way we define the circle we want to search is done with a function that is passed into the <code> .inRadius </code> method: </p> <div class="highlight"> <pre class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl"><span class="nx">circle</span> <span class="p">=&gt;</span> <span class="nx">circle</span><span class="p">.</span><span class="nx">longitude</span><span class="p">(</span><span class="nx">longitude</span><span class="p">).</span><span class="nx">latitude</span><span class="p">(</span><span class="nx">latitude</span><span class="p">).</span><span class="nx">radius</span><span class="p">(</span><span class="nx">radius</span><span class="p">).</span><span class="nx">miles</span></span></span></code></pre> </div> <p> All this function does is accept an instance of a <a href="https://github.com/redis/redis-om-node/blob/main/docs/classes/Circle.md"> <code> Circle </code> </a> that has been initialized with default values. We override those values by calling various builder methods to define the origin of our search (i.e. the longitude and latitude), the radius, and the units that radius is measured in. Valid units are <code> miles </code> , <code> meters </code> , <code> feet </code> , and <code> kilometers </code> . </p> <p> Let's try the route out. I know we can find Joan Jett at around longitude -75.0 and latitude 40.0, which is in eastern Pennsylvania. So use those coordinates with a radius of 20 miles. You should receive in response: </p> <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">"entityId"</span><span class="p">:</span> <span class="s2">"01FYC7CTPKYNXQ98JSTBC37AS1"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"firstName"</span><span class="p">:</span> <span class="s2">"Joan"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"lastName"</span><span class="p">:</span> <span class="s2">"Jett"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"age"</span><span class="p">:</span> <span class="mi">63</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"verified"</span><span class="p">:</span> <span class="kc">false</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"location"</span><span class="p">:</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="nt">"longitude"</span><span class="p">:</span> <span class="mf">-75.273</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"latitude"</span><span class="p">:</span> <span class="mf">40.003</span> </span></span><span class="line"><span class="cl"> <span class="p">},</span> </span></span><span class="line"><span class="cl"> <span class="nt">"locationUpdated"</span><span class="p">:</span> <span class="s2">"2022-01-01T12:00:00.000Z"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"skills"</span><span class="p">:</span> <span class="p">[</span> </span></span><span class="line"><span class="cl"> <span class="s2">"singing"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s2">"guitar"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s2">"black eyeliner"</span> </span></span><span class="line"><span class="cl"> <span class="p">],</span> </span></span><span class="line"><span class="cl"> <span class="nt">"personalStatement"</span><span class="p">:</span> <span class="s2">"I love rock n' roll so put another dime in the jukebox, baby."</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> Try widening the radius and see who else you can find. </p> <h2 id="adding-location-tracking"> Adding location tracking </h2> <p> We're getting toward the end of the tutorial here, but before we go, I'd like to add that location tracking piece that I mentioned way back in the beginning. This next bit of code should be easily understood if you've gotten this far as it's not really doing anything I haven't talked about already. </p> <p> Add a new file called <code> location-router.js </code> in the <code> routers </code> folder: </p> <div class="highlight"> <pre class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl"><span class="kr">import</span> <span class="p">{</span> <span class="nx">Router</span> <span class="p">}</span> <span class="nx">from</span> <span class="s1">'express'</span> </span></span><span class="line"><span class="cl"><span class="kr">import</span> <span class="p">{</span> <span class="nx">personRepository</span> <span class="p">}</span> <span class="nx">from</span> <span class="s1">'../om/person.js'</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="kr">export</span> <span class="kr">const</span> <span class="nx">router</span> <span class="o">=</span> <span class="nx">Router</span><span class="p">()</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="nx">router</span><span class="p">.</span><span class="nx">patch</span><span class="p">(</span><span class="s1">'/:id/location/:lng,:lat'</span><span class="p">,</span> <span class="kr">async</span> <span class="p">(</span><span class="nx">req</span><span class="p">,</span> <span class="nx">res</span><span class="p">)</span> <span class="p">=&gt;</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">id</span> <span class="o">=</span> <span class="nx">req</span><span class="p">.</span><span class="nx">params</span><span class="p">.</span><span class="nx">id</span> </span></span><span class="line"><span class="cl"> <span class="kr">const</span> <span class="nx">longitude</span> <span class="o">=</span> <span class="nb">Number</span><span class="p">(</span><span class="nx">req</span><span class="p">.</span><span class="nx">params</span><span class="p">.</span><span class="nx">lng</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> <span class="kr">const</span> <span class="nx">latitude</span> <span class="o">=</span> <span class="nb">Number</span><span class="p">(</span><span class="nx">req</span><span class="p">.</span><span class="nx">params</span><span class="p">.</span><span class="nx">lat</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">locationUpdated</span> <span class="o">=</span> <span class="k">new</span> <span class="nb">Date</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">person</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">personRepository</span><span class="p">.</span><span class="nx">fetch</span><span class="p">(</span><span class="nx">id</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> <span class="nx">person</span><span class="p">.</span><span class="nx">location</span> <span class="o">=</span> <span class="p">{</span> <span class="nx">longitude</span><span class="p">,</span> <span class="nx">latitude</span> <span class="p">}</span> </span></span><span class="line"><span class="cl"> <span class="nx">person</span><span class="p">.</span><span class="nx">locationUpdated</span> <span class="o">=</span> <span class="nx">locationUpdated</span> </span></span><span class="line"><span class="cl"> <span class="kr">await</span> <span class="nx">personRepository</span><span class="p">.</span><span class="nx">save</span><span class="p">(</span><span class="nx">person</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="nx">res</span><span class="p">.</span><span class="nx">send</span><span class="p">({</span> <span class="nx">id</span><span class="p">,</span> <span class="nx">locationUpdated</span><span class="p">,</span> <span class="nx">location</span><span class="o">:</span> <span class="p">{</span> <span class="nx">longitude</span><span class="p">,</span> <span class="nx">latitude</span> <span class="p">}</span> <span class="p">})</span> </span></span><span class="line"><span class="cl"><span class="p">})</span></span></span></code></pre> </div> <p> Here we're calling <code> .fetch() </code> to fetch a person, we're updating some values for that person—the <code> .location </code> property with our longitude and latitude and the <code> .locationUpdated </code> property with the current date and time. Easy stuff. </p> <p> To use this <code> Router </code> , import it in <code> server.js </code> : </p> <div class="highlight"> <pre class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl"><span class="cm">/* import routers */</span> </span></span><span class="line"><span class="cl"><span class="kr">import</span> <span class="p">{</span> <span class="nx">router</span> <span class="nx">as</span> <span class="nx">personRouter</span> <span class="p">}</span> <span class="nx">from</span> <span class="s1">'./routers/person-router.js'</span> </span></span><span class="line"><span class="cl"><span class="kr">import</span> <span class="p">{</span> <span class="nx">router</span> <span class="nx">as</span> <span class="nx">searchRouter</span> <span class="p">}</span> <span class="nx">from</span> <span class="s1">'./routers/search-router.js'</span> </span></span><span class="line"><span class="cl"><span class="kr">import</span> <span class="p">{</span> <span class="nx">router</span> <span class="nx">as</span> <span class="nx">locationRouter</span> <span class="p">}</span> <span class="nx">from</span> <span class="s1">'./routers/location-router.js'</span></span></span></code></pre> </div> <p> And bind the router to a path: </p> <div class="highlight"> <pre class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl"><span class="cm">/* bring in some routers */</span> </span></span><span class="line"><span class="cl"><span class="nx">app</span><span class="p">.</span><span class="nx">use</span><span class="p">(</span><span class="s1">'/person'</span><span class="p">,</span> <span class="nx">personRouter</span><span class="p">,</span> <span class="nx">locationRouter</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="nx">app</span><span class="p">.</span><span class="nx">use</span><span class="p">(</span><span class="s1">'/persons'</span><span class="p">,</span> <span class="nx">searchRouter</span><span class="p">)</span></span></span></code></pre> </div> <p> And that's that. But this just isn't enough to satisfy. It doesn't show you anything new, except maybe the usage of a <code> date </code> field. And, it's not really location <em> tracking </em> . It just shows where these people last were, no history. So let's add some!. </p> <p> To add some history, we're going to use a <a href="/docs/latest/develop/data-types/streams/"> Redis Stream </a> . Streams are a big topic but don't worry if you’re not familiar with them, you can think of them as being sort of like a log file stored in a Redis key where each entry represents an event. In our case, the event would be the person moving about or checking in or whatever. </p> <p> But there's a problem. Redis OM doesn’t support Streams even though Redis Stack does. So how do we take advantage of them in our application? By using <a href="https://github.com/redis/node-redis"> Node Redis </a> . Node Redis is a low-level Redis client for Node.js that gives you access to all the Redis commands and data types. Internally, Redis OM is creating and using a Node Redis connection. You can use that connection too. Or rather, Redis OM can be <em> told </em> to use the connection you are using. Let me show you how. </p> <h2 id="using-node-redis"> Using Node Redis </h2> <p> Open up <code> client.js </code> in the <code> om </code> folder. Remember how we created a Redis OM <code> Client </code> and then called <code> .open() </code> on it? </p> <div class="highlight"> <pre class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">client</span> <span class="o">=</span> <span class="kr">await</span> <span class="k">new</span> <span class="nx">Client</span><span class="p">().</span><span class="nx">open</span><span class="p">(</span><span class="nx">url</span><span class="p">)</span></span></span></code></pre> </div> <p> Well, the <code> Client </code> class also has a <code> .use() </code> method that takes a Node Redis connection. Modify <code> client.js </code> to open a connection to Redis using Node Redis and then <code> .use() </code> it: </p> <div class="highlight"> <pre class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl"><span class="kr">import</span> <span class="p">{</span> <span class="nx">Client</span> <span class="p">}</span> <span class="nx">from</span> <span class="s1">'redis-om'</span> </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></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="cm">/* pulls the Redis URL from .env */</span> </span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">url</span> <span class="o">=</span> <span class="nx">process</span><span class="p">.</span><span class="nx">env</span><span class="p">.</span><span class="nx">REDIS_URL</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="cm">/* create a connection to Redis with Node Redis */</span> </span></span><span class="line"><span class="cl"><span class="kr">export</span> <span class="kr">const</span> <span class="nx">connection</span> <span class="o">=</span> <span class="nx">createClient</span><span class="p">({</span> <span class="nx">url</span> <span class="p">})</span> </span></span><span class="line"><span class="cl"><span class="kr">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">connect</span><span class="p">()</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="cm">/* create a Client and bind it to the Node Redis connection */</span> </span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">client</span> <span class="o">=</span> <span class="kr">await</span> <span class="k">new</span> <span class="nx">Client</span><span class="p">().</span><span class="nx">use</span><span class="p">(</span><span class="nx">connection</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="kr">export</span> <span class="k">default</span> <span class="nx">client</span></span></span></code></pre> </div> <p> And that's it. Redis OM is now using the <code> connection </code> you created. Note that we are exporting both the <code> client </code> <em> and </em> the <code> connection </code> . Got to export the <code> connection </code> if we want to use it in our newest route. </p> <h2 id="storing-location-history-with-streams"> Storing location history with Streams </h2> <p> To add an event to a Stream we need to use the <a href="/docs/latest/commands/xadd/"> XADD </a> command. Node Redis exposes that as <code> .xAdd() </code> . So, we need to add a call to <code> .xAdd() </code> in our route. Modify <code> location-router.js </code> to import our <code> connection </code> : </p> <div class="highlight"> <pre class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl"><span class="kr">import</span> <span class="p">{</span> <span class="nx">connection</span> <span class="p">}</span> <span class="nx">from</span> <span class="s1">'../om/client.js'</span></span></span></code></pre> </div> <p> And then in the route itself add a call to <code> .xAdd() </code> : </p> <div class="highlight"> <pre class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl"> <span class="p">...</span><span class="nx">snip</span><span class="p">...</span> </span></span><span class="line"><span class="cl"> <span class="kr">const</span> <span class="nx">person</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">personRepository</span><span class="p">.</span><span class="nx">fetch</span><span class="p">(</span><span class="nx">id</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> <span class="nx">person</span><span class="p">.</span><span class="nx">location</span> <span class="o">=</span> <span class="p">{</span> <span class="nx">longitude</span><span class="p">,</span> <span class="nx">latitude</span> <span class="p">}</span> </span></span><span class="line"><span class="cl"> <span class="nx">person</span><span class="p">.</span><span class="nx">locationUpdated</span> <span class="o">=</span> <span class="nx">locationUpdated</span> </span></span><span class="line"><span class="cl"> <span class="kr">await</span> <span class="nx">personRepository</span><span class="p">.</span><span class="nx">save</span><span class="p">(</span><span class="nx">person</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="kd">let</span> <span class="nx">keyName</span> <span class="o">=</span> <span class="sb">`</span><span class="si">${</span><span class="nx">person</span><span class="p">.</span><span class="nx">keyName</span><span class="si">}</span><span class="sb">:locationHistory`</span> </span></span><span class="line"><span class="cl"> <span class="kr">await</span> <span class="nx">connection</span><span class="p">.</span><span class="nx">xAdd</span><span class="p">(</span><span class="nx">keyName</span><span class="p">,</span> <span class="s1">'*'</span><span class="p">,</span> <span class="nx">person</span><span class="p">.</span><span class="nx">location</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> <span class="p">...</span><span class="nx">snip</span><span class="p">...</span></span></span></code></pre> </div> <p> <code> .xAdd() </code> takes a key name, an event ID, and a JavaScript object containing the keys and values that make up the event, i.e. the event data. For the key name, we're building a string using the <code> .keyName </code> property that <code> Person </code> inherited from <code> Entity </code> (which will return something like <code> Person:01FYC7CTPKYNXQ98JSTBC37AS1 </code> ) combined with a hard-coded value. We're passing in <code> * </code> for our event ID, which tells Redis to just generate it based on the current time and previous event ID. And we're passing in the location—with properties of longitude and latitude—as our event data. </p> <p> Now, whenever this route is exercised, the longitude and latitude will be logged and the event ID will encode the time. Go ahead and use Swagger to move Joan Jett around a few times. </p> <p> Now, go into Redis Insight and take a look at the Stream. You'll see it there in the list of keys but if you click on it, you'll get a message saying that "This data type is coming soon!". If you don't get this message, congratulations, you live in the future! For us here in the past, we'll just issue the raw command instead: </p> <pre><code>XRANGE Person:01FYC7CTPKYNXQ98JSTBC37AS1:locationHistory - + </code></pre> <p> This tells Redis to get a range of values from a Stream stored in the given the key name— <code> Person:01FYC7CTPKYNXQ98JSTBC37AS1:locationHistory </code> in our example. The next values are the starting event ID and the ending event ID. <code> - </code> is the beginning of the Stream. <code> + </code> is the end. So this returns everything in the Stream: </p> <pre><code>1) 1) "1647536562911-0" 2) 1) "longitude" 2) "45.678" 3) "latitude" 4) "45.678" 2) 1) "1647536564189-0" 2) 1) "longitude" 2) "45.679" 3) "latitude" 4) "45.679" 3) 1) "1647536565278-0" 2) 1) "longitude" 2) "45.680" 3) "latitude" 4) "45.680" </code></pre> <p> And just like that, we're tracking Joan Jett. </p> <h2 id="wrap-up"> Wrap-up </h2> <p> So, now you know how to use Express + Redis OM to build an API backed by Redis Stack. And, you've got yourself some pretty decent started code in the process. Good deal! If you want to learn more, you can check out the <a href="https://github.com/redis/redis-om-node"> documentation </a> for Redis OM. It covers the full breadth of Redis OM's features. </p> <p> And thanks for taking the time to work through this. I sincerely hope you found it useful. If you have any questions, the <a href="https://discord.gg/redis"> Redis Discord server </a> is by far the best place to get them answered. Join the server and ask away! </p> <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/redisom-for-node-js/"/> <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.12.0/.html
<section class="prose w-full py-12"> <h1> RedisInsight v2.12.0, October 2022 </h1> <p class="text-lg -mt-5 mb-10"> RedisInsight v2.12.0 </p> <h2 id="2120-october-2022"> 2.12.0 (October 2022) </h2> <p> This is the General Availability (GA) release of RedisInsight 2.12. </p> <h3 id="highlights"> Highlights </h3> <ul> <li> Database Analysis: Get insights and optimize the usage and performance of your Redis or Redis Stack based on the overview of the memory and data type distribution, big or complicated keys, and namespaces used </li> <li> Faster initial loading of the list of keys in Browser and Tree views </li> <li> Performance optimizations for large results in Workbench </li> </ul> <h3 id="details"> Details </h3> <p> <strong> Features and improvements </strong> </p> <ul> <li> <a href="https://github.com/RedisInsight/RedisInsight/pull/1207"> #1207 </a> , <a href="https://github.com/RedisInsight/RedisInsight/pull/1222"> #1222 </a> , <a href="https://github.com/RedisInsight/RedisInsight/pull/1295"> #1295 </a> , <a href="https://github.com/RedisInsight/RedisInsight/pull/1159"> #1159 </a> , <a href="https://github.com/RedisInsight/RedisInsight/pull/1231"> #1231 </a> , <a href="https://github.com/RedisInsight/RedisInsight/pull/1155"> #1155 </a> Get insights and optimize the usage and performance of your Redis or Redis Stack with Database Analysis. Navigate to Analysis Tools and scan up to 10,000 keys in the database to see the summary of memory allocation and the number of keys per Redis data type, memory likely to be freed over time, top 15 key namespaces, and the biggest keys found. You can extrapolate results based on the total number of keys or see the exact results for the number of keys scanned. </li> <li> <a href="https://github.com/RedisInsight/RedisInsight/pull/1280"> #1280 </a> Speed up the initial load of the key list in Browser and Tree views </li> <li> <a href="https://github.com/RedisInsight/RedisInsight/pull/1285"> #1285 </a> Support for infinite floating point numbers in sorted sets </li> <li> <a href="https://github.com/RedisInsight/RedisInsight/pull/1290"> #1290 </a> Performance optimizations to process large results of Redis commands in Workbench </li> </ul> <p> <strong> Bugs </strong> </p> <ul> <li> <a href="https://github.com/RedisInsight/RedisInsight/pull/1293"> #1293 </a> Fixed Workbench visualizations in Redis Stack </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.12.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/operate/kubernetes/deployment/quick-start/.html
<section class="prose w-full py-12 max-w-none"> <h1> Deploy Redis Enterprise Software for Kubernetes </h1> <p class="text-lg -mt-5 mb-10"> How to install Redis Enterprise Software for Kubernetes. </p> <p> To deploy Redis Enterprise Software for Kubernetes and start your Redis Enterprise cluster (REC), you need to do the following: </p> <ul> <li> Create a new namespace in your Kubernetes cluster. </li> <li> Download the operator bundle. </li> <li> Apply the operator bundle and verify it's running. </li> <li> Create a Redis Enterprise cluster (REC). </li> </ul> <p> This guide works with most supported Kubernetes distributions. If you're using OpenShift, see <a href="/docs/latest/operate/kubernetes/deployment/openshift/"> Redis Enterprise on OpenShift </a> . For details on what is currently supported, see <a href="/docs/latest/operate/kubernetes/reference/supported_k8s_distributions/"> supported distributions </a> . </p> <h2 id="prerequisites"> Prerequisites </h2> <p> To deploy Redis Enterprise for Kubernetes, you'll need: </p> <ul> <li> Kubernetes cluster in a <a href="/docs/latest/operate/kubernetes/reference/supported_k8s_distributions/"> supported distribution </a> </li> <li> minimum of three worker nodes </li> <li> Kubernetes client (kubectl) </li> <li> access to DockerHub, RedHat Container Catalog, or a private repository that can hold the required images. </li> </ul> <h3 id="create-a-new-namespace"> Create a new namespace </h3> <p> <strong> Important: </strong> Each namespace can only contain one Redis Enterprise cluster. Multiple RECs with different operator versions can coexist on the same Kubernetes cluster, as long as they are in separate namespaces. </p> <p> Throughout this guide, each command is applied to the namespace in which the Redis Enterprise cluster operates. </p> <ol> <li> <p> Create a new namespace </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">kubectl create namespace &lt;rec-namespace&gt; </span></span></code></pre> </div> </li> <li> <p> Change the namespace context to make the newly created namespace default for future commands. </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">kubectl config set-context --current --namespace<span class="o">=</span>&lt;rec-namespace&gt; </span></span></code></pre> </div> </li> </ol> <p> You can use an existing namespace as long as it does not contain any existing Redis Enterprise cluster resources. It's best practice to create a new namespace to make sure there are no Redis Enterprise resources that could interfere with the deployment. </p> <h2 id="install-the-operator"> Install the operator </h2> <p> Redis Enterprise for Kubernetes bundle is published as a container image. A list of required images is available in the <a href="/docs/latest/operate/kubernetes/release-notes/"> release notes </a> for each version. </p> <p> The operator <a href="https://github.com/RedisLabs/redis-enterprise-k8s-docs"> definition and reference materials </a> are available on GitHub. The operator definitions are <a href="https://github.com/RedisLabs/redis-enterprise-k8s-docs/blob/master/bundle.yaml"> packaged as a single generic YAML file </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"> Note: </div> If you do not pull images from DockerHub or another public registry, you need to use a <a href="/docs/latest/operate/kubernetes/deployment/container-images/#manage-image-sources"> private container registry </a> . </div> </div> <h3 id="download-the-operator-bundle"> Download the operator bundle </h3> <p> Pull the latest version of the operator bundle: </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl"><span class="nv">VERSION</span><span class="o">=</span><span class="sb">`</span>curl --silent https://api.github.com/repos/RedisLabs/redis-enterprise-k8s-docs/releases/latest <span class="p">|</span> grep tag_name <span class="p">|</span> awk -F<span class="s1">'"'</span> <span class="s1">'{print $4}'</span><span class="sb">`</span> </span></span></code></pre> </div> <p> If you need a different release, replace <code> VERSION </code> with a specific release tag. </p> <p> Check version tags listed with the <a href="https://github.com/RedisLabs/redis-enterprise-k8s-docs/releases"> operator releases on GitHub </a> or by <a href="https://docs.github.com/en/rest/reference/repos#releases"> using the GitHub API </a> to ensure the version of the bundle is correct. </p> <h3 id="deploy-the-operator-bundle"> Deploy the operator bundle </h3> <p> Apply the operator bundle in your REC namespace: </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">kubectl apply -f https://raw.githubusercontent.com/RedisLabs/redis-enterprise-k8s-docs/<span class="nv">$VERSION</span>/bundle.yaml </span></span></code></pre> </div> <p> You should see a result similar to this: </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">role.rbac.authorization.k8s.io/redis-enterprise-operator created </span></span><span class="line"><span class="cl">serviceaccount/redis-enterprise-operator created </span></span><span class="line"><span class="cl">rolebinding.rbac.authorization.k8s.io/redis-enterprise-operator created </span></span><span class="line"><span class="cl">customresourcedefinition.apiextensions.k8s.io/redisenterpriseclusters.app.redislabs.com configured </span></span><span class="line"><span class="cl">customresourcedefinition.apiextensions.k8s.io/redisenterprisedatabases.app.redislabs.com configured </span></span><span class="line"><span class="cl">deployment.apps/redis-enterprise-operator created </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> DO NOT modify or delete the StatefulSet created during the deployment process. Doing so could destroy your Redis Enterprise cluster (REC). </div> </div> <h4 id="verify-the-operator-is-running"> Verify the operator is running </h4> <p> Check the operator deployment to verify it's running in your namespace: </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">kubectl get deployment redis-enterprise-operator </span></span></code></pre> </div> <p> You should see a result similar to this: </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">NAME READY UP-TO-DATE AVAILABLE AGE </span></span><span class="line"><span class="cl">redis-enterprise-operator 1/1 <span class="m">1</span> <span class="m">1</span> 0m36s </span></span></code></pre> </div> <h2 id="create-a-redis-enterprise-cluster-rec"> Create a Redis Enterprise cluster (REC) </h2> <p> A Redis Enterprise cluster (REC) is created from a <code> RedisEnterpriseCluster </code> custom resource that contains cluster specifications. </p> <p> The following example creates a minimal Redis Enterprise cluster. See the <a href="/docs/latest/operate/kubernetes/reference/redis_enterprise_cluster_api/"> RedisEnterpriseCluster API reference </a> for more information on the various options available. </p> <ol> <li> <p> Create a file that defines a Redis Enterprise cluster with three nodes. </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 REC name ( <code> my-rec </code> in this example) cannot be changed after cluster creation. </div> </div> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">cat <span class="s">&lt;&lt;EOF &gt; my-rec.yaml </span></span></span><span class="line"><span class="cl"><span class="s">apiVersion: "app.redislabs.com/v1" </span></span></span><span class="line"><span class="cl"><span class="s">kind: "RedisEnterpriseCluster" </span></span></span><span class="line"><span class="cl"><span class="s">metadata: </span></span></span><span class="line"><span class="cl"><span class="s"> name: my-rec </span></span></span><span class="line"><span class="cl"><span class="s">spec: </span></span></span><span class="line"><span class="cl"><span class="s"> nodes: 3 </span></span></span><span class="line"><span class="cl"><span class="s">EOF</span> </span></span></code></pre> </div> <p> This will request a cluster with three Redis Enterprise nodes using the default requests (i.e., 2 CPUs and 4GB of memory per node). </p> <p> To test with a larger configuration, use the example below to add node resources to the <code> spec </code> section of your test cluster ( <code> my-rec.yaml </code> ). </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">redisEnterpriseNodeResources: </span></span><span class="line"><span class="cl"> limits: </span></span><span class="line"><span class="cl"> cpu: 2000m </span></span><span class="line"><span class="cl"> memory: 16Gi </span></span><span class="line"><span class="cl"> requests: </span></span><span class="line"><span class="cl"> cpu: 2000m </span></span><span class="line"><span class="cl"> memory: 16Gi </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> Each cluster must have at least 3 nodes. Single-node RECs are not supported. </div> </div> <p> See the <a href="/docs/latest/operate/rs/installing-upgrading/install/plan-deployment/hardware-requirements/"> Redis Enterprise hardware requirements </a> for more information on sizing Redis Enterprise node resource requests. </p> </li> <li> <p> Apply your custom resource file in the same namespace as <code> my-rec.yaml </code> . </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">kubectl apply -f my-rec.yaml </span></span></code></pre> </div> <p> You should see a result similar to this: </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">redisenterprisecluster.app.redislabs.com/my-rec created </span></span></code></pre> </div> </li> <li> <p> You can verify the creation of the cluster with: </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">kubectl get rec </span></span></code></pre> </div> <p> You should see a result similar to this: </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">NAME AGE </span></span><span class="line"><span class="cl">my-rec 1m </span></span></code></pre> </div> <p> At this point, the operator will go through the process of creating various services and pod deployments. </p> <p> You can track the progress by examining the StatefulSet associated with the cluster: </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">kubectl rollout status sts/my-rec </span></span></code></pre> </div> <p> or by looking at the status of all of the resources in your namespace: </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">kubectl get all </span></span></code></pre> </div> </li> </ol> <h2 id="enable-the-admission-controller"> Enable the admission controller </h2> <p> The admission controller dynamically validates REDB resources configured by the operator. It is strongly recommended that you use the admission controller on your Redis Enterprise Cluster (REC). The admission controller only needs to be configured once per operator deployment. </p> <p> As part of the REC creation process, the operator stores the admission controller certificate in a Kubernetes secret called <code> admission-tls </code> . You may have to wait a few minutes after creating your REC to see the secret has been created. </p> <ol> <li> <p> Verify the <code> admission-tls </code> secret exists. </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">kubectl get secret admission-tls </span></span></code></pre> </div> <p> The output should look similar to </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">NAME TYPE DATA AGE </span></span><span class="line"><span class="cl">admission-tls Opaque <span class="m">2</span> 2m43s </span></span></code></pre> </div> </li> <li> <p> Save the certificate to a local environment variable. </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl"><span class="nv">CERT</span><span class="o">=</span><span class="sb">`</span>kubectl get secret admission-tls -o <span class="nv">jsonpath</span><span class="o">=</span><span class="s1">'{.data.cert}'</span><span class="sb">`</span> </span></span></code></pre> </div> </li> <li> <p> Create a Kubernetes validating webhook, replacing <code> &lt;namespace&gt; </code> with the namespace where the REC was installed. </p> <p> The <code> webhook.yaml </code> template can be found in <a href="https://github.com/RedisLabs/redis-enterprise-k8s-docs/tree/master/admission"> redis-enterprise-k8s-docs/admission </a> </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">sed <span class="s1">'s/OPERATOR_NAMESPACE/&lt;namespace&gt;/g'</span> webhook.yaml <span class="p">|</span> kubectl create -f - </span></span></code></pre> </div> </li> <li> <p> Create a patch file for the Kubernetes validating webhook. </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">cat &gt; modified-webhook.yaml <span class="s">&lt;&lt;EOF </span></span></span><span class="line"><span class="cl"><span class="s">webhooks: </span></span></span><span class="line"><span class="cl"><span class="s">- name: redisenterprise.admission.redislabs </span></span></span><span class="line"><span class="cl"><span class="s"> clientConfig: </span></span></span><span class="line"><span class="cl"><span class="s"> caBundle: $CERT </span></span></span><span class="line"><span class="cl"><span class="s">EOF</span> </span></span></code></pre> </div> </li> <li> <p> Patch the webhook with the certificate. </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">kubectl patch ValidatingWebhookConfiguration <span class="se">\ </span></span></span><span class="line"><span class="cl"><span class="se"></span> redis-enterprise-admission --patch <span class="s2">"</span><span class="k">$(</span>cat modified-webhook.yaml<span class="k">)</span><span class="s2">"</span> </span></span></code></pre> </div> </li> </ol> <h3 id="webhook"> Limit the webhook to the relevant namespaces </h3> <p> The operator bundle includes a webhook file. The webhook will intercept requests from all namespaces unless you edit it to target a specific namespace. You can do this by adding the <code> namespaceSelector </code> section to the webhook spec to target a label on the namespace. </p> <ol> <li> <p> Make sure the namespace has a unique <code> namespace-name </code> label. </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">apiVersion: v1 </span></span><span class="line"><span class="cl">kind: Namespace </span></span><span class="line"><span class="cl">metadata: </span></span><span class="line"><span class="cl"> labels: </span></span><span class="line"><span class="cl"> namespace-name: example-ns </span></span><span class="line"><span class="cl">name: example-ns </span></span></code></pre> </div> </li> <li> <p> Patch the webhook to add the <code> namespaceSelector </code> section. </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">cat &gt; modified-webhook.yaml <span class="s">&lt;&lt;EOF </span></span></span><span class="line"><span class="cl"><span class="s">webhooks: </span></span></span><span class="line"><span class="cl"><span class="s">- name: redisenterprise.admission.redislabs </span></span></span><span class="line"><span class="cl"><span class="s"> namespaceSelector: </span></span></span><span class="line"><span class="cl"><span class="s"> matchLabels: </span></span></span><span class="line"><span class="cl"><span class="s"> namespace-name: staging </span></span></span><span class="line"><span class="cl"><span class="s">EOF</span> </span></span></code></pre> </div> </li> <li> <p> Apply the patch. </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">kubectl patch ValidatingWebhookConfiguration <span class="se">\ </span></span></span><span class="line"><span class="cl"><span class="se"></span> redis-enterprise-admission --patch <span class="s2">"</span><span class="k">$(</span>cat modified-webhook.yaml<span class="k">)</span><span class="s2">"</span> </span></span></code></pre> </div> </li> </ol> <h2 id="verify-the-admission-controller-is-working"> Verify the admission controller is working </h2> <ol> <li> <p> Verify the admission controller is installed correctly by applying an invalid resource. This should force the admission controller to correct it. </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">kubectl apply -f - <span class="s">&lt;&lt; EOF </span></span></span><span class="line"><span class="cl"><span class="s">apiVersion: app.redislabs.com/v1alpha1 </span></span></span><span class="line"><span class="cl"><span class="s">kind: RedisEnterpriseDatabase </span></span></span><span class="line"><span class="cl"><span class="s">metadata: </span></span></span><span class="line"><span class="cl"><span class="s"> name: redis-enterprise-database </span></span></span><span class="line"><span class="cl"><span class="s">spec: </span></span></span><span class="line"><span class="cl"><span class="s"> evictionPolicy: illegal </span></span></span><span class="line"><span class="cl"><span class="s">EOF</span> </span></span></code></pre> </div> <p> You should see your request was denied by the <code> admission webhook "redisenterprise.admission.redislabs" </code> . </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">Error from server: error when creating <span class="s2">"STDIN"</span>: admission webhook <span class="s2">"redisenterprise.admission.redislabs"</span> denied the request: eviction_policy: u<span class="s1">'illegal'</span> is not one of <span class="o">[</span>u<span class="s1">'volatile-lru'</span>, u<span class="s1">'volatile-ttl'</span>, u<span class="s1">'volatile-random'</span>, u<span class="s1">'allkeys-lru'</span>, u<span class="s1">'allkeys-random'</span>, u<span class="s1">'noeviction'</span>, u<span class="s1">'volatile-lfu'</span>, u<span class="s1">'allkeys-lfu'</span><span class="o">]</span> </span></span></code></pre> </div> </li> </ol> <h2 id="create-a-redis-enterprise-database-redb"> Create a Redis Enterprise Database (REDB) </h2> <p> You can create multiple databases within the same namespace as your REC or in other namespaces. </p> <p> See <a href="/docs/latest/operate/kubernetes/re-databases/db-controller/"> manage Redis Enterprise databases for Kubernetes </a> to create a new REDB. </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/kubernetes/deployment/quick-start/"/> <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/clients/jedis/.html
<section class="prose w-full py-12 max-w-none"> <h1> Jedis guide (Java) </h1> <p class="text-lg -mt-5 mb-10"> Connect your Java application to a Redis database </p> <p> <a href="https://github.com/redis/jedis"> Jedis </a> is a synchronous Java client for Redis. Use <a href="/docs/latest/develop/clients/lettuce/"> Lettuce </a> if you need a more advanced Java client that also supports asynchronous and reactive connections. The sections below explain how to install <code> Jedis </code> and connect your application to a Redis database. </p> <p> <code> Jedis </code> requires a running Redis or <a href="/docs/latest/operate/oss_and_stack/install/install-stack/"> Redis Stack </a> server. See <a href="/docs/latest/operate/oss_and_stack/install/"> Getting started </a> for Redis installation instructions. </p> <h2 id="install"> Install </h2> <p> To include <code> Jedis </code> as a dependency in your application, edit the dependency file, as follows. </p> <ul> <li> <p> If you use <strong> Maven </strong> : </p> <div class="highlight"> <pre class="chroma"><code class="language-xml" data-lang="xml"><span class="line"><span class="cl"><span class="nt">&lt;dependency&gt;</span> </span></span><span class="line"><span class="cl"> <span class="nt">&lt;groupId&gt;</span>redis.clients<span class="nt">&lt;/groupId&gt;</span> </span></span><span class="line"><span class="cl"> <span class="nt">&lt;artifactId&gt;</span>jedis<span class="nt">&lt;/artifactId&gt;</span> </span></span><span class="line"><span class="cl"> <span class="nt">&lt;version&gt;</span>5.2.0<span class="nt">&lt;/version&gt;</span> </span></span><span class="line"><span class="cl"><span class="nt">&lt;/dependency&gt;</span> </span></span></code></pre> </div> </li> <li> <p> If you use <strong> Gradle </strong> : </p> <pre tabindex="0"><code>repositories { mavenCentral() } //... dependencies { implementation 'redis.clients:jedis:5.2.0' //... } </code></pre> </li> <li> <p> If you use the JAR files, download the latest Jedis and Apache Commons Pool2 JAR files from <a href="https://central.sonatype.com/"> Maven Central </a> or any other Maven repository. </p> </li> <li> <p> Build from <a href="https://github.com/redis/jedis"> source </a> </p> </li> </ul> <h2 id="connect-and-test"> Connect and test </h2> <p> The following code opens a basic connection to a local Redis server: </p> <div class="highlight"> <pre class="chroma"><code class="language-java" data-lang="java"><span class="line"><span class="cl"><span class="kn">package</span> <span class="nn">org.example</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></span><span class="line"><span class="cl"><span class="kd">public</span> <span class="kd">class</span> <span class="nc">Main</span> <span class="o">{</span> </span></span><span class="line"><span class="cl"> <span class="kd">public</span> <span class="kd">static</span> <span class="kt">void</span> <span class="nf">main</span><span class="o">(</span><span class="n">String</span><span class="o">[]</span> <span class="n">args</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 class="c1">// Code that interacts with Redis... </span></span></span><span class="line"><span class="cl"><span class="c1"></span> </span></span><span class="line"><span class="cl"> <span class="n">jedis</span><span class="o">.</span><span class="na">close</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="o">}</span> </span></span></code></pre> </div> <p> After you have connected, you can check the connection by storing and retrieving a simple string value: </p> <div class="highlight"> <pre class="chroma"><code class="language-java" data-lang="java"><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="n">String</span> <span class="n">res1</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">set</span><span class="o">(</span><span class="s">"bike:1"</span><span class="o">,</span> <span class="s">"Deimos"</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">res1</span><span class="o">);</span> <span class="c1">// OK </span></span></span><span class="line"><span class="cl"><span class="c1"></span> </span></span><span class="line"><span class="cl"><span class="n">String</span> <span class="n">res2</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">get</span><span class="o">(</span><span class="s">"bike: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">res2</span><span class="o">);</span> <span class="c1">// Deimos </span></span></span><span class="line"><span class="cl"><span class="c1"></span> </span></span><span class="line"><span class="cl"><span class="o">...</span> </span></span></code></pre> </div> <h2 id="more-information"> More information </h2> <p> <code> Jedis </code> has a complete <a href="https://www.javadoc.io/doc/redis.clients/jedis/latest/index.html"> API reference </a> available on <a href="https://javadoc.io/"> javadoc.io/ </a> . The <code> Jedis </code> <a href="https://github.com/redis/jedis"> GitHub repository </a> also has useful docs and examples including a page about handling <a href="https://github.com/redis/jedis/blob/master/docs/failover.md"> failover with Jedis </a> </p> <p> See also the other pages in this section for more information and examples: </p> <nav> <a href="/docs/latest/develop/clients/jedis/connect/"> Connect to the server </a> <p> Connect your Java application to a Redis database </p> <a href="/docs/latest/develop/clients/jedis/produsage/"> Production usage </a> <p> Get your Jedis app ready for production </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/develop/clients/jedis/"/> <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-passwords/password-expiration/.html
<section class="prose w-full py-12 max-w-none"> <h1> Configure password expiration </h1> <p class="text-lg -mt-5 mb-10"> Configure password expiration to enforce expiration of a user's password after a specified number of days. </p> <h2 id="enable-password-expiration"> Enable password expiration </h2> <p> To enforce an expiration of a user's password after a specified number of days: </p> <ul> <li> <p> Use the Cluster Manager UI: </p> <ol> <li> <p> Go to <strong> Cluster &gt; Security &gt; Preferences </strong> , then select <strong> Edit </strong> . </p> </li> <li> <p> In the <strong> Password </strong> section, turn on <strong> Expiration </strong> . </p> </li> <li> <p> Enter the number of days before passwords expire. </p> </li> <li> <p> Select <strong> Save </strong> . </p> </li> </ol> </li> <li> <p> Use the <code> cluster </code> endpoint of the REST API </p> <div class="highlight"> <pre class="chroma"><code class="language-REST" data-lang="REST"><span class="line"><span class="cl">PUT https://[host][:port]/v1/cluster<span class="err"> </span></span></span><span class="line"><span class="cl"><span class="err"></span>{"password_expiration_duration":<span class="nt">&lt;number_of_days&gt;</span>}<span class="err"> </span></span></span></code></pre> </div> </li> </ul> <h2 id="deactivate-password-expiration"> Deactivate password expiration </h2> <p> To deactivate password expiration: </p> <ul> <li> <p> Use the Cluster Manager UI: </p> <ol> <li> <p> Go to <strong> Cluster &gt; Security &gt; Preferences </strong> , then select <strong> Edit </strong> . </p> </li> <li> <p> In the <strong> Password </strong> section, turn off <strong> Expiration </strong> . </p> </li> <li> <p> Select <strong> Save </strong> . </p> </li> </ol> </li> <li> <p> Use the <code> cluster </code> REST API endpoint to set <code> password_expiration_duration </code> to <code> 0 </code> (zero). </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/access-control/manage-passwords/password-expiration/"/> <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/credentials/.html
<section class="prose w-full py-12 max-w-none"> <h1> Credentials object </h1> <p class="text-lg -mt-5 mb-10"> Documents the credentials 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> password </td> <td> string </td> <td> Admin password </td> </tr> <tr> <td> username </td> <td> string </td> <td> Admin username (pattern does not allow special characters &amp;,&lt;,&gt;,") </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/credentials/"/> <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/reference/key-specs/HAHAHUGOSHORTCODE-s25-HBHB.html
<section class="prose w-full py-12"> <h1> Command key specifications </h1> <p class="text-lg -mt-5 mb-10"> What are command key specification and how to use them in your client </p> <p> Many of the commands in Redis accept key names as input arguments. The 9th element in the reply of <a href="/docs/latest/commands/command/"> <code> COMMAND </code> </a> (and <a href="/docs/latest/commands/command-info/"> <code> COMMAND INFO </code> </a> ) is an array that consists of the command's key specifications. </p> <p> A <em> key specification </em> describes a rule for extracting the names of one or more keys from the arguments of a given command. Key specifications provide a robust and flexible mechanism, compared to the <em> first key </em> , <em> last key </em> and <em> step </em> scheme employed until Redis 7.0. Before introducing these specifications, Redis clients had no trivial programmatic means to extract key names for all commands. </p> <p> Cluster-aware Redis clients had to have the keys' extraction logic hard-coded in the cases of commands such as <a href="/docs/latest/commands/eval/"> <code> EVAL </code> </a> and <a href="/docs/latest/commands/zunionstore/"> <code> ZUNIONSTORE </code> </a> that rely on a <em> numkeys </em> argument or <a href="/docs/latest/commands/sort/"> <code> SORT </code> </a> and its many clauses. Alternatively, the <a href="/docs/latest/commands/command-getkeys/"> <code> COMMAND GETKEYS </code> </a> can be used to achieve a similar extraction effect but at a higher latency. </p> <p> A Redis client isn't obligated to support key specifications. It can continue using the legacy <em> first key </em> , <em> last key </em> and <em> step </em> scheme along with the <a href="/docs/latest/commands/command/#flags"> <em> movablekeys </em> flag </a> that remain unchanged. </p> <p> However, a Redis client that implements key specifications support can consolidate most of its keys' extraction logic. Even if the client encounters an unfamiliar type of key specification, it can always revert to the <a href="/docs/latest/commands/command-getkeys/"> <code> COMMAND GETKEYS </code> </a> command. </p> <p> That said, most cluster-aware clients only require a single key name to perform correct command routing, so it is possible that although a command features one unfamiliar specification, its other specification may still be usable by the client. </p> <p> Key specifications are maps with the following keys: </p> <ol> <li> <strong> begin_search: </strong> : the starting index for keys' extraction. </li> <li> <strong> find_keys: </strong> the rule for identifying the keys relative to the BS. </li> <li> <strong> notes </strong> : notes about this key spec, if there are any. </li> <li> <strong> flags </strong> : indicate the type of data access. </li> </ol> <h2 id="begin_search"> begin_search </h2> <p> The <em> begin_search </em> value of a specification informs the client of the extraction's beginning. The value is a map. There are three types of <code> begin_search </code> : </p> <ol> <li> <strong> index: </strong> key name arguments begin at a constant index. </li> <li> <strong> keyword: </strong> key names start after a specific keyword (token). </li> <li> <strong> unknown: </strong> an unknown type of specification - see the <a href="#incomplete"> incomplete flag section </a> for more details. </li> </ol> <h3 id="index"> index </h3> <p> The <em> index </em> type of <code> begin_search </code> indicates that input keys appear at a constant index. It is a map under the <em> spec </em> key with a single key: </p> <ol> <li> <strong> index: </strong> the 0-based index from which the client should start extracting key names. </li> </ol> <h3 id="keyword"> keyword </h3> <p> The <em> keyword </em> type of <code> begin_search </code> means a literal token precedes key name arguments. It is a map under the <em> spec </em> with two keys: </p> <ol> <li> <strong> keyword: </strong> the keyword (token) that marks the beginning of key name arguments. </li> <li> <strong> startfrom: </strong> an index to the arguments array from which the client should begin searching. This can be a negative value, which means the search should start from the end of the arguments' array, in reverse order. For example, <em> -2 </em> 's meaning is to search reverse from the penultimate argument. </li> </ol> <p> More examples of the <em> keyword </em> search type include: </p> <ul> <li> <a href="/docs/latest/commands/set/"> <code> SET </code> </a> has a <code> begin_search </code> specification of type <em> index </em> with a value of <em> 1 </em> . </li> <li> <a href="/docs/latest/commands/xread/"> <code> XREAD </code> </a> has a <code> begin_search </code> specification of type <em> keyword </em> with the values <em> "STREAMS" </em> and <em> 1 </em> as <em> keyword </em> and <em> startfrom </em> , respectively. </li> <li> <a href="/docs/latest/commands/migrate/"> <code> MIGRATE </code> </a> has a <em> start_search </em> specification of type <em> keyword </em> with the values of <em> "KEYS" </em> and <em> -2 </em> . </li> </ul> <h2 id="find_keys"> find_keys </h2> <p> The <code> find_keys </code> value of a key specification tells the client how to continue the search for key names. <code> find_keys </code> has three possible types: </p> <ol> <li> <strong> range: </strong> keys stop at a specific index or relative to the last argument. </li> <li> <strong> keynum: </strong> an additional argument specifies the number of input keys. </li> <li> <strong> unknown: </strong> an unknown type of specification - see the <a href="#incomplete"> incomplete flag section </a> for more details. </li> </ol> <h3 id="range"> range </h3> <p> The <em> range </em> type of <code> find_keys </code> is a map under the <em> spec </em> key with three keys: </p> <ol> <li> <strong> lastkey: </strong> the index, relative to <code> begin_search </code> , of the last key argument. This can be a negative value, in which case it isn't relative. For example, <em> -1 </em> indicates to keep extracting keys until the last argument, <em> -2 </em> until one before the last, and so on. </li> <li> <strong> keystep: </strong> the number of arguments that should be skipped, after finding a key, to find the next one. </li> <li> <strong> limit: </strong> if <em> lastkey </em> is has the value of <em> -1 </em> , we use the <em> limit </em> to stop the search by a factor. <em> 0 </em> and <em> 1 </em> mean no limit. <em> 2 </em> means half of the remaining arguments, 3 means a third, and so on. </li> </ol> <h3 id="keynum"> keynum </h3> <p> The <em> keynum </em> type of <code> find_keys </code> is a map under the <em> spec </em> key with three keys: </p> <ul> <li> <strong> keynumidx: </strong> the index, relative to <code> begin_search </code> , of the argument containing the number of keys. </li> <li> <strong> firstkey: </strong> the index, relative to <code> begin_search </code> , of the first key. This is usually the next argument after <em> keynumidx </em> , and its value, in this case, is greater by one. </li> <li> <strong> keystep: </strong> Tthe number of arguments that should be skipped, after finding a key, to find the next one. </li> </ul> <p> Examples: </p> <ul> <li> The <a href="/docs/latest/commands/set/"> <code> SET </code> </a> command has a <em> range </em> of <em> 0 </em> , <em> 1 </em> and <em> 0 </em> . </li> <li> The <a href="/docs/latest/commands/mset/"> <code> MSET </code> </a> command has a <em> range </em> of <em> -1 </em> , <em> 2 </em> and <em> 0 </em> . </li> <li> The <a href="/docs/latest/commands/xread/"> <code> XREAD </code> </a> command has a <em> range </em> of <em> -1 </em> , <em> 1 </em> and <em> 2 </em> . </li> <li> The <a href="/docs/latest/commands/zunion/"> <code> ZUNION </code> </a> command has a <em> start_search </em> type <em> index </em> with the value <em> 1 </em> , and <code> find_keys </code> of type <em> keynum </em> with values of <em> 0 </em> , <em> 1 </em> and <em> 1 </em> . </li> <li> The <a href="https://oss.redislabs.com/redisai/master/commands/#aidagrun"> <code> AI.DAGRUN </code> </a> command has a <em> start_search </em> of type <em> keyword </em> with values of <em> "LOAD" </em> and <em> 1 </em> , and <code> find_keys </code> of type <em> keynum </em> with values of <em> 0 </em> , <em> 1 </em> and <em> 1 </em> . </li> </ul> <p> <strong> Note: </strong> this isn't a perfect solution as the module writers can come up with anything. However, this mechanism should allow the extraction of key name arguments for the vast majority of commands. </p> <h2 id="notes"> notes </h2> <p> Notes about non-obvious key specs considerations, if applicable. </p> <h2 id="flags"> flags </h2> <p> A key specification can have additional flags that provide more details about the key. These flags are divided into three groups, as described below. </p> <h3 id="access-type-flags"> Access type flags </h3> <p> The following flags declare the type of access the command uses to a key's value or its metadata. A key's metadata includes LRU/LFU counters, type, and cardinality. These flags do not relate to the reply sent back to the client. </p> <p> Every key specification has precisely one of the following flags: </p> <ul> <li> <strong> RW: </strong> the read-write flag. The command modifies the data stored in the value of the key or its metadata. This flag marks every operation that isn't distinctly a delete, an overwrite, or read-only. </li> <li> <strong> RO: </strong> the read-only flag. The command only reads the value of the key (although it doesn't necessarily return it). </li> <li> <strong> OW: </strong> the overwrite flag. The command overwrites the data stored in the value of the key. </li> <li> <strong> RM: </strong> the remove flag. The command deletes the key. </li> </ul> <h3 id="logical-operation-flags"> Logical operation flags </h3> <p> The following flags declare the type of operations performed on the data stored as the key's value and its TTL (if any), not the metadata. These flags describe the logical operation that the command executes on data, driven by the input arguments. The flags do not relate to modifying or returning metadata (such as a key's type, cardinality, or existence). </p> <p> Every key specification may include the following flag: </p> <ul> <li> <strong> access: </strong> the access flag. This flag indicates that the command returns, copies, or somehow uses the user's data that's stored in the key. </li> </ul> <p> In addition, the specification may include precisely one of the following: </p> <ul> <li> <strong> update: </strong> the update flag. The command updates the data stored in the key's value. The new value may depend on the old value. This flag marks every operation that isn't distinctly an insert or a delete. </li> <li> <strong> insert: </strong> the insert flag. The command only adds data to the value; existing data isn't modified or deleted. </li> <li> <strong> delete: </strong> the delete flag. The command explicitly deletes data from the value stored at the key. </li> </ul> <h3 id="miscellaneous-flags"> Miscellaneous flags </h3> <p> Key specifications may have the following flags: </p> <ul> <li> <strong> not_key: </strong> this flag indicates that the specified argument isn't a key. This argument is treated the same as a key when computing which slot a command should be assigned to for Redis cluster. For all other purposes this argument should not be considered a key. </li> <li> <strong> incomplete: </strong> this flag is explained below. </li> <li> <strong> variable_flags: </strong> this flag is explained below. </li> </ul> <h3 id="incomplete"> incomplete </h3> <p> Some commands feature exotic approaches when it comes to specifying their keys, which makes extraction difficult. Consider, for example, what would happen with a call to <a href="/docs/latest/commands/migrate/"> <code> MIGRATE </code> </a> that includes the literal string <em> "KEYS" </em> as an argument to its <em> AUTH </em> clause. Our key specifications would miss the mark, and extraction would begin at the wrong index. </p> <p> Thus, we recognize that key specifications are incomplete and may fail to extract all keys. However, we assure that even incomplete specifications never yield the wrong names of keys, providing that the command is syntactically correct. </p> <p> In the case of <a href="/docs/latest/commands/migrate/"> <code> MIGRATE </code> </a> , the search begins at the end ( <em> startfrom </em> has the value of <em> -1 </em> ). If and when we encounter a key named <em> "KEYS" </em> , we'll only extract the subset of the key name arguments after it. That's why <a href="/docs/latest/commands/migrate/"> <code> MIGRATE </code> </a> has the <em> incomplete </em> flag in its key specification. </p> <p> Another case of incompleteness is the <a href="/docs/latest/commands/sort/"> <code> SORT </code> </a> command. Here, the <code> begin_search </code> and <code> find_keys </code> are of type <em> unknown </em> . The client should revert to calling the <a href="/docs/latest/commands/command-getkeys/"> <code> COMMAND GETKEYS </code> </a> command to extract key names from the arguments, short of implementing it natively. The difficulty arises, for example, because the string <em> "STORE" </em> is both a keyword (token) and a valid literal argument for <a href="/docs/latest/commands/sort/"> <code> SORT </code> </a> . </p> <p> <strong> Note: </strong> the only commands with <em> incomplete </em> key specifications are <a href="/docs/latest/commands/sort/"> <code> SORT </code> </a> and <a href="/docs/latest/commands/migrate/"> <code> MIGRATE </code> </a> . We don't expect the addition of such commands in the future. </p> <h3 id="variable_flags"> variable_flags </h3> <p> In some commands, the flags for the same key name argument can depend on other arguments. For example, consider the <a href="/docs/latest/commands/set/"> <code> SET </code> </a> command and its optional <em> GET </em> argument. Without the <em> GET </em> argument, <a href="/docs/latest/commands/set/"> <code> SET </code> </a> is write-only, but it becomes a read and write command with it. When this flag is present, it means that the key specification flags cover all possible options, but the effective flags depend on other arguments. </p> <h2 id="examples"> Examples </h2> <h3 id="sethahahugoshortcode-s25-hbhbs-key-specifications"> <a href="/docs/latest/commands/set/"> <code> SET </code> </a> 's key specifications </h3> <pre tabindex="0"><code> 1) 1) "flags" 2) 1) RW 2) access 3) update 3) "begin_search" 4) 1) "type" 2) "index" 3) "spec" 4) 1) "index" 2) (integer) 1 5) "find_keys" 6) 1) "type" 2) "range" 3) "spec" 4) 1) "lastkey" 2) (integer) 0 3) "keystep" 4) (integer) 1 5) "limit" 6) (integer) 0 </code></pre> <h3 id="zunionhahahugoshortcode-s26-hbhbs-key-specifications"> <a href="/docs/latest/commands/zunion/"> <code> ZUNION </code> </a> 's key specifications </h3> <pre tabindex="0"><code> 1) 1) "flags" 2) 1) RO 2) access 3) "begin_search" 4) 1) "type" 2) "index" 3) "spec" 4) 1) "index" 2) (integer) 1 5) "find_keys" 6) 1) "type" 2) "keynum" 3) "spec" 4) 1) "keynumidx" 2) (integer) 0 3) "firstkey" 4) (integer) 1 5) "keystep" 6) (integer) 1 </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/reference/key-specs/"/> <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/ocsp_status/.html
<section class="prose w-full py-12 max-w-none"> <h1> OCSP status object </h1> <p class="text-lg -mt-5 mb-10"> An object that represents the cluster's OCSP status </p> <p> An API object that represents the cluster's OCSP status. </p> <table> <thead> <tr> <th> Name </th> <th> Type/Value </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> cert_status </td> <td> string </td> <td> Indicates the proxy certificate's status: GOOD/REVOKED/UNKNOWN (read-only) </td> </tr> <tr> <td> responder_url </td> <td> string </td> <td> The OCSP responder URL this status came from (read-only) </td> </tr> <tr> <td> next_update </td> <td> string </td> <td> The expected date and time of the next certificate status update (read-only) </td> </tr> <tr> <td> produced_at </td> <td> string </td> <td> The date and time when the OCSP responder signed this response (read-only) </td> </tr> <tr> <td> revocation_time </td> <td> string </td> <td> The date and time when the certificate was revoked or placed on hold (read-only) </td> </tr> <tr> <td> this_update </td> <td> string </td> <td> The most recent time that the responder confirmed the current status (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/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/oss_and_stack/stack-with-enterprise/search/query-performance-factor/.html
<section class="prose w-full py-12 max-w-none"> <h1> Configure the query performance factor for Redis Query Engine in Redis Enterprise </h1> <p class="text-lg -mt-5 mb-10"> Configure the query performance factor for Redis Query Engine in Redis Enterprise to increase the performance of queries. </p> <p> Query performance factors are intended to increase the performance of queries, including <a href="/docs/latest/develop/interact/search-and-query/query/vector-search/"> vector search </a> . When enabled, it allows you to increase a database's compute capacity and throughput by allocating more virtual CPUs per shard in addition to horizontal scaling with more shards. This document describes how to configure the query performance factor. </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> Some use cases might not scale effectively. Redis experts can help determine if vertical scaling with the Redis Query Engine will boost performance for your use case and guide you on whether to use vertical scaling, horizontal scaling, or both. </div> </div> <h2 id="prerequisites"> Prerequisites </h2> <p> Redis Query Engine requires a cluster running Redis Enterprise Software version 7.4.2-54 or later. </p> <p> If you do not have a cluster that supports Redis Query Engine, <a href="/docs/latest/operate/rs/installing-upgrading/install/install-on-linux/"> install Redis Enterprise Software </a> version 7.4.2-54 or later on a new cluster, or <a href="/docs/latest/operate/rs/installing-upgrading/upgrading/upgrade-cluster/"> upgrade an existing cluster </a> . </p> <h2 id="sizing"> Sizing </h2> <ol> <li> <p> Calculate the hardware requirements for your Redis database: </p> <ol> <li> <p> Use the <a href="/docs/latest/operate/rs/installing-upgrading/install/plan-deployment/hardware-requirements/"> hardware requirements documentation </a> to derive the overall cluster architecture. </p> </li> <li> <p> Calculate the RAM requirements using the <a href="https://redis.io/redisearch-sizing-calculator/"> Index Size Calculator </a> . The total RAM required is the sum of the dataset and index sizes. </p> </li> </ol> </li> <li> <p> <a href="#calculate-performance-factor"> Determine the query performance factor </a> you want and the required number of CPUs. Unused CPUs, above the 20% necessary for Redis, can be used for the scalable Redis Query Engine. </p> </li> <li> <p> Create a new Redis database with the number of CPUs configured for the query performance factor. </p> </li> </ol> <h2 id="calculate-query-performance-factor"> Calculate query performance factor </h2> <h3 id="cpus-for-query-performance-factor"> CPUs for query performance factor </h3> <p> Vertical scaling of the Redis Query Engine is achieved by provisioning additional CPUs for the search module. At least 20% of the available CPUs must be reserved for Redis internal processing. Use the following formula to define the maximum number of CPUs that can be allocated to search. </p> <table> <thead> <tr> <th> Variable </th> <th> Value </th> </tr> </thead> <tbody> <tr> <td> CPUs per node </td> <td> x </td> </tr> <tr> <td> Redis internals </td> <td> 20% </td> </tr> <tr> <td> Available CPUs for Redis Query Engine </td> <td> floor(0.8 * x) </td> </tr> </tbody> </table> <h3 id="query-performance-factor-versus-cpus"> Query performance factor versus CPUs </h3> <p> The following table shows the number of CPUs required for each performance factor. This calculation is sensitive to how the search index and queries are defined. Certain scenarios might yield less throughput than the ratios in the following table. </p> <table> <thead> <tr> <th> Scale factor </th> <th> Minimum CPUs required for Redis Query Engine </th> </tr> </thead> <tbody> <tr> <td> None (default) </td> <td> 1 </td> </tr> <tr> <td> 2 </td> <td> 3 </td> </tr> <tr> <td> 4 </td> <td> 6 </td> </tr> <tr> <td> 6 </td> <td> 9 </td> </tr> <tr> <td> 8 </td> <td> 12 </td> </tr> <tr> <td> 10 </td> <td> 15 </td> </tr> <tr> <td> 12 </td> <td> 18 </td> </tr> <tr> <td> 14 </td> <td> 21 </td> </tr> <tr> <td> 16 </td> <td> 24 </td> </tr> </tbody> </table> <h3 id="example-performance-factor-calculation"> Example performance factor calculation </h3> <table> <thead> <tr> <th> Variable </th> <th> Value </th> </tr> </thead> <tbody> <tr> <td> CPUs per node </td> <td> 8 </td> </tr> <tr> <td> Available CPUs </td> <td> floor(0.8 * 8)=6 </td> </tr> <tr> <td> Scale factor </td> <td> 4x </td> </tr> <tr> <td> Minimum CPUs required for scale factor </td> <td> 6 </td> </tr> </tbody> </table> <h2 id="configure-query-performance-factor-manually"> Configure query performance factor manually </h2> <p> To manually configure the query performance factor in Redis Enterprise Software: </p> <ol> <li> <p> <a href="#config-db-ui"> Configure query performance factor parameters </a> when you create a new database or edit an existing database's configuration in the Cluster Manager UI. </p> </li> <li> <p> If you configure the query performance factor for an existing database, you also need to <a href="#restart-shards"> restart shards </a> . Newly created databases can skip this step. </p> </li> </ol> <h3 id="config-db-ui"> Configure query performance factor parameters in the Cluster Manager UI </h3> <p> You can use the Cluster Manager UI to configure the query performance factor when you <a href="/docs/latest/operate/rs/databases/create/"> create a new database </a> or <a href="/docs/latest/operate/rs/databases/configure/#edit-database-settings"> edit an existing database </a> with search enabled. </p> <ol> <li> <p> In the <strong> Capabilities </strong> section of the database configuration screen, click <strong> Parameters </strong> . </p> </li> <li> <p> If you are creating a new database, select <strong> Search and query </strong> . </p> </li> <li> <p> Adjust the <strong> RediSearch </strong> parameters to include: </p> <p> <code> MT_MODE MT_MODE_FULL WORKER_THREADS &lt;NUMBER_OF_THREADS&gt; </code> </p> <p> See <a href="#calculate-query-performance-factor"> Calculate query performance factor </a> to determine the minimum CPUs required to use for <code> &lt;NUMBER_OF_THREADS&gt; </code> . </p> </li> <li> <p> Expand the <strong> Query Performance Factor </strong> section and enter the following values: </p> <ul> <li> <p> <code> mnp </code> for <strong> Connections routing </strong> </p> </li> <li> <p> <code> 32 </code> for <strong> Connections limit </strong> </p> </li> </ul> <a href="/docs/latest/images/rs/screenshots/databases/rs-config-query-performance-factor.png" sdata-lightbox="/images/rs/screenshots/databases/rs-config-query-performance-factor.png"> <img alt="Configure search parameters and query performance factor." src="/docs/latest/images/rs/screenshots/databases/rs-config-query-performance-factor.png"/> </a> </li> <li> <p> Click <strong> Done </strong> to close the parameter editor. </p> </li> <li> <p> Click <strong> Create </strong> or <strong> Save </strong> . </p> </li> </ol> <h3 id="restart-shards"> Restart shards </h3> <p> After you update the query performance factor for an existing database, restart all shards to apply the new settings. You can migrate shards to restart them. Newly created databases can skip this step. </p> <ol> <li> <p> Use <a href="/docs/latest/operate/rs/references/cli-utilities/rladmin/status/#status-shards"> <code> rladmin status shards db &lt;db-name&gt; </code> </a> to list all shards for your database: </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">rladmin status shards db db-name </span></span></code></pre> </div> <p> Example output: </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">SHARDS: </span></span><span class="line"><span class="cl">DB:ID NAME ID NODE ROLE SLOTS USED_MEMORY STATUS </span></span><span class="line"><span class="cl">db:2 db-name redis:1 node:1 master 0-16383 1.95MB OK </span></span><span class="line"><span class="cl">db:2 db-name redis:2 node:2 slave 0-16383 1.95MB OK </span></span></code></pre> </div> <p> Note the following fields for the next steps: </p> <ul> <li> <code> ID </code> : the Redis shard's ID. </li> <li> <code> NODE </code> : the node on which the shard currently resides. </li> <li> <code> ROLE </code> : <code> master </code> is a primary shard; <code> slave </code> is a replica shard. </li> </ul> </li> <li> <p> For each replica shard, use <a href="/docs/latest/operate/rs/references/cli-utilities/rladmin/migrate/"> <code> rladmin migrate shard </code> </a> to move it to a different node and restart it: </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">rladmin migrate shard &lt;shard_id&gt; target_node &lt;node_id&gt; </span></span></code></pre> </div> </li> <li> <p> After you migrate the replica shards, migrate the original primary shards. </p> </li> <li> <p> Rerun <code> rladmin status shards db &lt;db-name&gt; </code> to verify the shards migrated to different nodes: </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">rladmin status shards db db-name </span></span></code></pre> </div> <p> Example output: </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">SHARDS: </span></span><span class="line"><span class="cl">DB:ID NAME ID NODE ROLE SLOTS USED_MEMORY STATUS </span></span><span class="line"><span class="cl">db:2 db-name redis:1 node:2 master 0-16383 1.95MB OK </span></span><span class="line"><span class="cl">db:2 db-name redis:2 node:1 slave 0-16383 1.95MB OK </span></span></code></pre> </div> </li> </ol> <h2 id="configure-query-performance-factor-with-the-rest-api"> Configure query performance factor with the REST API </h2> <p> You can configure the query performance factor when you <a href="#create-db-rest-api"> create a new database </a> or <a href="#update-db-rest-api"> update an existing database </a> using the Redis Enterprise Software <a href="/docs/latest/operate/rs/references/rest-api/"> REST API </a> . </p> <h3 id="create-db-rest-api"> Create new database with the REST API </h3> <p> To create a database and configure the query performance factor, use the <a href="/docs/latest/operate/rs/references/rest-api/requests/bdbs/#post-bdbs-v1"> create database REST API endpoint </a> with a <a href="/docs/latest/operate/rs/references/rest-api/objects/bdb/"> BDB object </a> that includes the following parameters: </p> <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">"sched_policy"</span><span class="p">:</span> <span class="s2">"mnp"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"conns"</span><span class="p">:</span> <span class="mi">32</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"module_list"</span><span class="p">:</span> <span class="p">[{</span> </span></span><span class="line"><span class="cl"> <span class="nt">"module_name"</span><span class="p">:</span> <span class="s2">"search"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"module_args"</span><span class="p">:</span> <span class="s2">"MT_MODE MT_MODE_FULL WORKER_THREADS &lt;NUMBER_OF_CPUS&gt;"</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> See <a href="#calculate-performance-factor"> Calculate performance factor </a> to determine the value to use for <code> &lt;NUMBER_OF_CPUS&gt; </code> . </p> <h4 id="example-rest-api-request-for-a-new-database"> Example REST API request for a new database </h4> <p> The following JSON is an example request body used to create a new database with a 4x query performance factor configured: </p> <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">"name"</span><span class="p">:</span> <span class="s2">"scalable-search-db"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"type"</span><span class="p">:</span> <span class="s2">"redis"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"memory_size"</span><span class="p">:</span> <span class="mi">10000000</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"port"</span><span class="p">:</span> <span class="mi">13000</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"authentication_redis_pass"</span><span class="p">:</span> <span class="s2">"&lt;your default db pwd&gt;"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"proxy_policy"</span><span class="p">:</span> <span class="s2">"all-master-shards"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"sched_policy"</span><span class="p">:</span> <span class="s2">"mnp"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"conns"</span><span class="p">:</span> <span class="mi">32</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"sharding"</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">"shards_count"</span><span class="p">:</span> <span class="mi">3</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"shards_placement"</span><span class="p">:</span> <span class="s2">"sparse"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"shard_key_regex"</span><span class="p">:</span> <span class="p">[{</span><span class="nt">"regex"</span><span class="p">:</span> <span class="s2">".*\\{(?&lt;tag&gt;.*)\\}.*"</span><span class="p">},</span> <span class="p">{</span><span class="nt">"regex"</span><span class="p">:</span> <span class="s2">"(?&lt;tag&gt;.*)"</span><span class="p">}],</span> </span></span><span class="line"><span class="cl"> <span class="nt">"replication"</span><span class="p">:</span> <span class="kc">false</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"module_list"</span><span class="p">:</span> <span class="p">[{</span> </span></span><span class="line"><span class="cl"> <span class="nt">"module_name"</span><span class="p">:</span> <span class="s2">"search"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"module_args"</span><span class="p">:</span> <span class="s2">"MT_MODE MT_MODE_FULL WORKER_THREADS 6"</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 following <a href="https://curl.se/docs/"> cURL </a> request creates a new database from the JSON example: </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">curl -k -u <span class="s2">"&lt;user&gt;:&lt;password&gt;"</span> https://&lt;host&gt;:9443/v1/bdbs -H <span class="s2">"Content-Type:application/json"</span> -d @scalable-search-db.json </span></span></code></pre> </div> <h3 id="update-db-rest-api"> Update existing database with the REST API </h3> <p> To configure the query performance factor for an existing database, use the following REST API requests: </p> <ul> <li> <p> <a href="/docs/latest/operate/rs/references/rest-api/requests/bdbs/#put-bdbs"> Update database configuration </a> to modify the DMC proxy. </p> </li> <li> <p> <a href="/docs/latest/operate/rs/references/rest-api/requests/bdbs/modules/upgrade/#post-bdb-modules-upgrade"> Upgrade module </a> to set the search module’s query performance factor. </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> <ul> <li> Because this procedure also restarts the database shards, you should perform it during a maintenance period. </li> <li> This procedure overwrites any existing module configuration parameters. </li> </ul> </div> </div> <p> The following example script uses both endpoints to configure a 4x query performance factor: </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl"><span class="cp">#!/bin/bash </span></span></span><span class="line"><span class="cl"><span class="cp"></span><span class="nb">export</span> <span class="nv">DB_ID</span><span class="o">=</span><span class="m">1</span> </span></span><span class="line"><span class="cl"><span class="nb">export</span> <span class="nv">CPU</span><span class="o">=</span><span class="m">6</span> </span></span><span class="line"><span class="cl"><span class="nb">export</span> <span class="nv">MODULE_ID</span><span class="o">=</span><span class="sb">`</span>curl -s -k -u <span class="s2">"&lt;user&gt;:&lt;password&gt;"</span> https://&lt;host&gt;:9443/v1/bdbs/<span class="nv">$DB_ID</span> <span class="p">|</span> jq <span class="s1">'.module_list[] | select(.module_name=="search").module_id'</span> <span class="p">|</span> tr -d <span class="s1">'"'</span><span class="sb">`</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl">curl -o /dev/null -s -k -u <span class="s2">"&lt;user&gt;:&lt;password&gt;"</span> -X PUT https://&lt;host&gt;:9443/v1/bdbs/<span class="nv">$DB_ID</span> -H <span class="s2">"Content-Type:application/json"</span> -d <span class="s1">'{ </span></span></span><span class="line"><span class="cl"><span class="s1"> "sched_policy": "mnp", </span></span></span><span class="line"><span class="cl"><span class="s1"> "conns": 32 </span></span></span><span class="line"><span class="cl"><span class="s1">}'</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl">sleep <span class="m">1</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl">curl -o /dev/null -s -k -u <span class="s2">"&lt;user&gt;:&lt;password&gt;"</span> https://&lt;host&gt;:9443/v1/bdbs/<span class="nv">$DB_ID</span>/modules/upgrade -H <span class="s2">"Content-Type:application/json"</span> -d <span class="s1">'{ </span></span></span><span class="line"><span class="cl"><span class="s1"> "modules": [ </span></span></span><span class="line"><span class="cl"><span class="s1"> { </span></span></span><span class="line"><span class="cl"><span class="s1"> "module_name": "search", </span></span></span><span class="line"><span class="cl"><span class="s1"> "new_module_args": "MT_MODE MT_MODE_FULL WORKER_THREADS '</span><span class="nv">$CPU</span><span class="s1">'", </span></span></span><span class="line"><span class="cl"><span class="s1"> "current_module": "'</span><span class="nv">$MODULE_ID</span><span class="s1">'", </span></span></span><span class="line"><span class="cl"><span class="s1"> "new_module": "'</span><span class="nv">$MODULE_ID</span><span class="s1">'" </span></span></span><span class="line"><span class="cl"><span class="s1"> } </span></span></span><span class="line"><span class="cl"><span class="s1"> ] </span></span></span><span class="line"><span class="cl"><span class="s1">}'</span> </span></span></code></pre> </div> <h2 id="monitoring-redis-query-engine"> Monitoring Redis Query Engine </h2> <p> To monitor a database with a query performance factor configured: </p> <ol> <li> <p> Integrate your Redis Enterprise deployment with Prometheus. See <a href="/docs/latest/integrate/prometheus-with-redis-enterprise/"> Prometheus and Grafana with Redis Enterprise </a> for instructions. </p> </li> <li> <p> Monitor the <code> redis_process_cpu_usage_percent </code> shard metric. </p> <p> The following Prometheus UI screenshot shows <code> redis_process_cpu_usage_percent </code> spikes for a database with two shards: </p> <ul> <li> <p> 1st 100% spike: <a href="https://github.com/RedisLabs/memtier_benchmark"> <code> memtier_benchmark </code> </a> search test at the default (no additional CPUs for search). </p> </li> <li> <p> 2nd 100% spike: reconfiguration and shard restart for a 4x query performance factor. </p> </li> <li> <p> 3rd 600% spike: <code> memtier_benchmark </code> search test with threading at a 4x query performance factor (6 CPUs per shard). </p> </li> </ul> <a href="/docs/latest/images/rs/screenshots/monitor-rs-scalable-search-cpu-usage.png" sdata-lightbox="/images/rs/screenshots/monitor-rs-scalable-search-cpu-usage.png"> <img alt="The Prometheus graph shows three spikes for redis_process_cpu_usage_percent: 100%, another 100%, then 600%." src="/docs/latest/images/rs/screenshots/monitor-rs-scalable-search-cpu-usage.png"/> </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/oss_and_stack/stack-with-enterprise/search/query-performance-factor/"/> <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/clusters/change-node-role/.html
<section class="prose w-full py-12 max-w-none"> <h1> Change node roles </h1> <p class="text-lg -mt-5 mb-10"> Change node roles to demote the primary node to a secondary node or promote a secondary node to become the primary node. </p> <p> A Redis Software cluster contains a primary node, which coordinates cluster-wide management operations, and multiple secondary nodes. Nodes with either role can host database shards. </p> <h2 id="demote-primary-node"> Demote primary node </h2> <p> To demote the primary node to a secondary node using the Cluster Manager UI: </p> <ol> <li> <p> On the <strong> Nodes </strong> screen, click <a href="/docs/latest/images/rs/buttons/button-toggle-actions-vertical.png#no-click" sdata-lightbox="/images/rs/buttons/button-toggle-actions-vertical.png#no-click"> <img alt="More actions button" class="inline" src="/docs/latest/images/rs/buttons/button-toggle-actions-vertical.png#no-click" width="22px"/> </a> for the node you want to promote. </p> <a href="/docs/latest/images/rs/screenshots/nodes/primary-node-more-actions.png" sdata-lightbox="/images/rs/screenshots/nodes/primary-node-more-actions.png"> <img alt="Click the more actions button for a node to access node actions." src="/docs/latest/images/rs/screenshots/nodes/primary-node-more-actions.png"/> </a> </li> <li> <p> Select <strong> Set as a secondary node </strong> from the list. </p> </li> <li> <p> Select one of the options to determine the new primary node: </p> <ul> <li> <p> <strong> Automatically </strong> : The cluster decides which node becomes the new primary node. </p> </li> <li> <p> <strong> Choose specific node </strong> : You can manually select which node becomes the new primary node. </p> </li> </ul> <a href="/docs/latest/images/rs/screenshots/nodes/primary-node-set-as-secondary-dialog.png" sdata-lightbox="/images/rs/screenshots/nodes/primary-node-set-as-secondary-dialog.png"> <img alt="The Set as a secondary node dialog has two options to select the new primary node, either automatically or manually." src="/docs/latest/images/rs/screenshots/nodes/primary-node-set-as-secondary-dialog.png"/> </a> </li> <li> <p> Click <strong> Confirm </strong> . </p> </li> </ol> <h2 id="promote-secondary-node"> Promote secondary node </h2> <p> To promote a secondary node to become the primary node using the Cluster Manager UI: </p> <ol> <li> <p> On the <strong> Nodes </strong> screen, click <a href="/docs/latest/images/rs/buttons/button-toggle-actions-vertical.png#no-click" sdata-lightbox="/images/rs/buttons/button-toggle-actions-vertical.png#no-click"> <img alt="More actions button" class="inline" src="/docs/latest/images/rs/buttons/button-toggle-actions-vertical.png#no-click" width="22px"/> </a> for the node you want to promote. </p> <a href="/docs/latest/images/rs/screenshots/nodes/secondary-nodes-more-actions.png" sdata-lightbox="/images/rs/screenshots/nodes/secondary-nodes-more-actions.png"> <img alt="Click the more actions button for a node to access node actions." src="/docs/latest/images/rs/screenshots/nodes/secondary-nodes-more-actions.png"/> </a> </li> <li> <p> Select <strong> Set as the primary node </strong> from the list. </p> </li> <li> <p> Click <strong> Confirm </strong> . </p> </li> </ol> <p> After this node becomes the primary node, all cluster management traffic is directed to it. </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/change-node-role/"/> <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-6-4-2-releases/.html
<section class="prose w-full py-12 max-w-none"> <h1> Redis Enterprise Software release notes 6.4.2 </h1> <p class="text-lg -mt-5 mb-10"> Pub/sub ACLs &amp; default permissions. Validate client certificates by subject attributes. Ubuntu 20.04 support. </p> <p> ​ <a href="https://redis.com/redis-enterprise-software/download-center/software/"> ​Redis Enterprise Software version 6.4.2 </a> is now available! </p> <p> This version offers: </p> <ul> <li> <p> Extended validation of client certificates via mTLS (mutual TLS) full subject support </p> </li> <li> <p> Support for default restrictive permissions when using publish/subscribe commands and access control lists (ACLs) </p> </li> <li> <p> Enhanced TLS performance when Redis returns large arrays in responses </p> </li> <li> <p> Compatibility with <a href="https://github.com/redis/redis"> open source Redis </a> 6.2.7 and 6.2.10. </p> </li> <li> <p> Additional enhancements and bug fixes </p> </li> </ul> <h2 id="detailed-release-notes"> Detailed release notes </h2> <p> For more detailed release notes, select a build version from the following table: </p> <table> <thead> <tr> <th style="text-align:left"> Version (Release date) </th> <th style="text-align:left"> Major changes </th> <th style="text-align:left"> OSS Redis compatibility </th> </tr> </thead> <tbody> <tr> <td style="text-align:left"> <a href="/docs/latest/operate/rs/release-notes/rs-6-4-2-releases/rs-6-4-2-115/"> 6.4.2-115 (Oct 2024) </a> </td> <td style="text-align:left"> RediSearch v2.6.23. RedisBloom v2.4.12. RedisTimeSeries v1.8.15. </td> <td style="text-align:left"> Redis 6.2.10 </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/operate/rs/release-notes/rs-6-4-2-releases/rs-6-4-2-110/"> 6.4.2-110 (May 2024) </a> </td> <td style="text-align:left"> RedisGraph v2.10.15. RedisBloom v2.4.8. Bug fixes. </td> <td style="text-align:left"> Redis 6.2.10 </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/operate/rs/release-notes/rs-6-4-2-releases/rs-6-4-2-103/"> 6.4.2-103 (October 2023) </a> </td> <td style="text-align:left"> RHEL 8.8 support. RediSearch v2.6.12. RedisGraph v2.10.12. RedisTimeSeries v1.8.11 Log when CCS schema changes. Bug fixes. </td> <td style="text-align:left"> Redis 6.2.10 </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/operate/rs/release-notes/rs-6-4-2-releases/rs-6-4-2-94/"> 6.4.2-94 (July 2023) </a> </td> <td style="text-align:left"> Look-ahead mechanism for planner attempts. Package OS compatibility validation. </td> <td style="text-align:left"> Redis 6.2.10 </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/operate/rs/release-notes/rs-6-4-2-releases/rs-6-4-2-81/"> 6.4.2-81 (June 2023) </a> </td> <td style="text-align:left"> Email alerts for database backup failures and replica high availability shard relocation failures. </td> <td style="text-align:left"> Redis 6.2.10 </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/operate/rs/release-notes/rs-6-4-2-releases/rs-6-4-2-69/"> 6.4.2-69 (May 2023) </a> </td> <td style="text-align:left"> Amazon Linux 2 support. Configure envoy ports using rladmin. Added option to avoid specific nodes when using the optimized shards placement API. Added failure_detection_sensitivity to replace watchdog_profile. </td> <td style="text-align:left"> Redis 6.2.10 </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/operate/rs/release-notes/rs-6-4-2-releases/rs-6-4-2-61/"> 6.4.2-61 (April 2023) </a> </td> <td style="text-align:left"> Amazon Linux 2 support. Fixed known limitations for custom installation on RHEL 7 and RHEL 8, running rl_rdbconvert manually, and resharding rack-aware databases with no replication. </td> <td style="text-align:left"> Redis 6.2.10 </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/operate/rs/release-notes/rs-6-4-2-releases/rs-6-4-2-43/"> 6.4.2-43 (March 2023) </a> </td> <td style="text-align:left"> Ubuntu 20.04 support. Safe node removal. Allow gossip_envoy port configuration. </td> <td style="text-align:left"> Redis 6.2.10 </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/operate/rs/release-notes/rs-6-4-2-releases/rs-6-4-2-30/"> 6.4.2-30 (February 2023) </a> </td> <td style="text-align:left"> Pub/sub ACLs &amp; default permissions. Validate client certificates by subject attributes. </td> <td style="text-align:left"> Redis 6.2.7 </td> </tr> </tbody> </table> <h2 id="deprecations"> Deprecations </h2> <h3 id="ubuntu-1604"> Ubuntu 16.04 </h3> <p> Ubuntu 16 support is considered deprecated and will be removed in a future release. Ubuntu 16.04 LTS (Xenial) has reached the end of its free initial five-year security maintenance period as of April 30, 2021. </p> <h3 id="active-active-database-persistence"> Active-Active database persistence </h3> <p> The RDB snapshot option for <a href="/docs/latest/operate/rs/databases/active-active/manage/#data-persistence"> Active-Active database persistence </a> is deprecated and will be removed in a future release. </p> <p> Please plan to reconfigure any Active-Active databases to use append-only file (AOF) persistence with the following command: </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">crdb-cli crdb update --crdb-guid &lt;CRDB_GUID&gt; <span class="se">\ </span></span></span><span class="line"><span class="cl"><span class="se"></span> --default-db-config <span class="s1">'{"data_persistence": "aof", "aof_policy":"appendfsync-every-sec"}'</span> </span></span></code></pre> </div> <h3 id="tls-10-and-tls-11"> TLS 1.0 and TLS 1.1 </h3> <p> TLS 1.0 and TLS 1.1 connections are considered deprecated in favor of TLS 1.2 or later. Please verify that all clients, apps, and connections support TLS 1.2. Support for the earlier protocols will be removed in a future release. Certain operating systems, such as RHEL 8, have already removed support for the earlier protocols. Redis Enterprise Software cannot support connection protocols that are not supported by the underlying operating system. </p> <h3 id="3des-encryption-cipher"> 3DES encryption cipher </h3> <p> The 3DES encryption cipher is considered deprecated in favor of stronger ciphers like AES. Please verify that all clients, apps, and connections support the AES cipher. Support for 3DES will be removed in a future release. Certain operating systems, such as RHEL 8, have already removed support for 3DES. Redis Enterprise Software cannot support cipher suites that are not supported by the underlying operating system. </p> <h2 id="known-limitations"> Known limitations </h2> <h3 id="feature-limitations"> Feature limitations </h3> <ul> <li> <p> RS97971 - <a href="#resharding-fails-for-rack-aware-databases-with-no-replication"> Resharding fails for rack-aware databases with no replication </a> (fixed and resolved as part of <a href="/docs/latest/operate/rs/release-notes/rs-6-4-2-releases/rs-6-4-2-61/"> v6.4.2-61 </a> ). </p> </li> <li> <p> RS101204 - High memory consumption caused by the <code> persistence_mgr </code> service when AOF persistence is configured for every second (fixed and resolved as part of <a href="/docs/latest/operate/rs/release-notes/rs-6-4-2-releases/rs-6-4-2-81/"> v6.4.2-81 </a> ). </p> </li> <li> <p> RS40641 - API requests are redirected to an internal IP in case the request arrives from a node which is not the master. To avoid this issue, use <a href="/docs/latest/operate/rs/references/cli-utilities/rladmin/cluster/config/"> <code> rladmin cluster config </code> </a> to configure <code> handle_redirects </code> or <code> handle_metrics_redirects </code> . </p> </li> <li> <p> RS51144, RS102128 - Active-Active: To start successfully, the syncer ( <code> crdt-syncer </code> ) must connect to all sources. In multi-cluster configurations (more than 2 A-A clusters participating), in some cases, if one or more of the clusters is not available, A-A replication will be down. </p> </li> <li> <p> RS123142 - In an Active-Active setup with at least three participating clusters, removing and re-adding a cluster after removing older clusters without re-adding them can cause missing keys and potentially lead to data loss or data inconsistency. </p> <p> This issue will be fixed in a future maintenance release. To prevent this issue, avoid adding clusters until you upgrade to the upcoming maintenance release when available. </p> </li> </ul> <h4 id="resharding-fails-for-rack-aware-databases-with-no-replication"> Resharding fails for rack-aware databases with no replication </h4> <p> When a database is configured as <a href="/docs/latest/operate/rs/clusters/configure/rack-zone-awareness/"> rack-aware </a> and replication is turned off, the resharding operation fails. </p> <p> RS97971 - This limitation was fixed and resolved as part of <a href="/docs/latest/operate/rs/release-notes/rs-6-4-2-releases/rs-6-4-2-61/"> v6.4.2-61 </a> . </p> <p> Workaround: </p> <p> Before resharding your database, turn off rack awareness: </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">curl -k -u <span class="s2">"&lt;user&gt;:&lt;password&gt;"</span> -H <span class="s2">"Content-type: application/json"</span> -d <span class="s1">'{"rack_aware": false}'</span> -X PUT <span class="s2">"https://localhost:9443/v1/bdbs/&lt;bdb_uid&gt;"</span> </span></span></code></pre> </div> <p> After the resharding process is complete, you can re-enable rack awareness: </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">curl -k -u <span class="s2">"&lt;user&gt;:&lt;password&gt;"</span> -H <span class="s2">"Content-type: application/json"</span> -d <span class="s1">'{"rack_aware": true}'</span> -X PUT <span class="s2">"https://localhost:9443/v1/bdbs/&lt;bdb_uid&gt;"</span> </span></span></code></pre> </div> <h3 id="installation-limitations"> Installation limitations </h3> <p> Several Redis Enterprise Software installation reference files are installed to the directory <code> /etc/opt/redislabs/ </code> even if you use <a href="/docs/latest/operate/rs/installing-upgrading/install/customize-install-directories/"> custom installation directories </a> . </p> <p> As a workaround to install Redis Enterprise Software without using any root directories, do the following before installing Redis Enterprise Software: </p> <ol> <li> <p> Create all custom, non-root directories you want to use with Redis Enterprise Software. </p> </li> <li> <p> Mount <code> /etc/opt/redislabs </code> to one of the custom, non-root directories. </p> </li> </ol> <h3 id="upgrade-limitations"> Upgrade limitations </h3> <p> Before you upgrade a cluster that hosts Active-Active databases with modules to v6.4.2-30, perform the following steps: </p> <ol> <li> <p> Use <code> crdb-cli </code> to verify that the modules ( <code> modules </code> ) and their versions (in <code> module_list </code> ) are as they appear in the database configuration and in the default database configuration: </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">crdb-cli crdb get --crdb-guid &lt;crdb-guid&gt; </span></span></code></pre> </div> </li> <li> <p> From the admin console's <strong> redis modules </strong> tab, validate that these modules with their specific versions are loaded to the cluster. </p> </li> <li> <p> If one or more of the modules/versions are missing or if you need help, <a href="https://redis.com/company/support/"> contact Redis support </a> before taking additional steps. </p> </li> </ol> <p> This limitation has been fixed and resolved as of <a href="/docs/latest/operate/rs/release-notes/rs-6-4-2-releases/rs-6-4-2-43/"> v6.4.2-43 </a> . </p> <h3 id="operating-system-limitations"> Operating system limitations </h3> <h4 id="rhel-7-and-rhel-8"> RHEL 7 and RHEL 8 </h4> <p> RS95344 - CRDB database will not start on Redis Enterprise v6.4.2 with a custom installation path. </p> <p> For a workaround, use the following commands to add the relevant CRDB files to the Redis library: </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">$ yum install -y chrpath </span></span><span class="line"><span class="cl">$ find <span class="nv">$installdir</span> -name <span class="s2">"crdt.so"</span> <span class="p">|</span> xargs -n1 -I <span class="o">{}</span> /bin/bash -c <span class="s1">'chrpath -r ${libdir} {}'</span> </span></span></code></pre> </div> <p> This limitation has been fixed and resolved as of <a href="/docs/latest/operate/rs/release-notes/rs-6-4-2-releases/rs-6-4-2-61/"> v6.4.2-61 </a> . </p> <h4 id="rhel-8"> RHEL 8 </h4> <p> Due to module binary differences between RHEL 7 and RHEL 8, you cannot upgrade RHEL 7 clusters to RHEL 8 when they host databases using modules. Instead, you need to create a new cluster on RHEL 8 and then migrate existing data from your RHEL 7 cluster. This does not apply to clusters that do not use modules. </p> <h4 id="ubuntu-2004"> Ubuntu 20.04 </h4> <p> By default, you cannot use the SHA1 hash algorithm ( <a href="https://manpages.ubuntu.com/manpages/focal/man3/SSL_CTX_set_security_level.3ssl.html#notes"> OpenSSL’s default security level is set to 2 </a> ). The operating system will reject SHA1 certificates even if the <code> mtls_allow_weak_hashing </code> option is enabled. You need to replace SHA1 certificates with newer certificates that use SHA-256. Note that the certificates provided with Redis Enterprise Software use SHA-256. </p> <h4 id="modules-not-supported-for-amazon-linux-2-release-candidate"> Modules not supported for Amazon Linux 2 release candidate </h4> <p> A database with modules cannot reside on an Amazon Linux 2 (release candidate) node. Support was added as part of <a href="/docs/latest/operate/rs/release-notes/rs-6-4-2-releases/rs-6-4-2-69/"> v6.4.2-69 </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/release-notes/rs-6-4-2-releases/"/> <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/select/.html
<section class="prose w-full py-12"> <h1 class="command-name"> SELECT </h1> <div class="font-semibold text-redis-ink-900"> Syntax </div> <pre class="command-syntax">SELECT index</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.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> @fast </code> <span class="mr-1 last:hidden"> , </span> <code> @connection </code> <span class="mr-1 last:hidden"> , </span> </dd> </dl> <p> Select the Redis logical database having the specified zero-based numeric index. New connections always use the database 0. </p> <p> Selectable Redis databases are a form of namespacing: all databases are still persisted in the same RDB / AOF file. However different databases can have keys with the same name, and commands like <a href="/docs/latest/commands/flushdb/"> <code> FLUSHDB </code> </a> , <a href="/docs/latest/commands/swapdb/"> <code> SWAPDB </code> </a> or <a href="/docs/latest/commands/randomkey/"> <code> RANDOMKEY </code> </a> work on specific databases. </p> <p> In practical terms, Redis databases should be used to separate different keys belonging to the same application (if needed), and not to use a single Redis instance for multiple unrelated applications. </p> <p> When using Redis Cluster, the <code> SELECT </code> command cannot be used, since Redis Cluster only supports database zero. In the case of a Redis Cluster, having multiple databases would be useless and an unnecessary source of complexity. Commands operating atomically on a single database would not be possible with the Redis Cluster design and goals. </p> <p> Since the currently selected database is a property of the connection, clients should track the currently selected database and re-select it on reconnection. While there is no command in order to query the selected database in the current connection, the <a href="/docs/latest/commands/client-list/"> <code> CLIENT LIST </code> </a> output shows, for each client, the currently selected database. </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/select/"/> <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/ocsp/.html
<section class="prose w-full py-12 max-w-none"> <h1> OCSP requests </h1> <p class="text-lg -mt-5 mb-10"> OCSP requests </p> <table> <thead> <tr> <th> Method </th> <th> Path </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> <a href="#get-ocsp"> GET </a> </td> <td> <code> /v1/ocsp </code> </td> <td> Get OCSP configuration </td> </tr> <tr> <td> <a href="#put-ocsp"> PUT </a> </td> <td> <code> /v1/ocsp </code> </td> <td> Update OCSP configuration </td> </tr> </tbody> </table> <h2 id="get-ocsp"> Get OCSP configuration </h2> <pre><code>GET /v1/ocsp </code></pre> <p> Gets the cluster's OCSP configuration. </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_ocsp_config"> view_ocsp_config </a> </td> </tr> </tbody> </table> <h3 id="get-request"> Request </h3> <h4 id="example-http-request"> Example HTTP request </h4> <pre><code>GET /ocsp </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/references/rest-api/objects/ocsp/"> OCSP configuration 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">"ocsp_functionality"</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">"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">"query_frequency"</span><span class="p">:</span> <span class="mi">3800</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"response_timeout"</span><span class="p">:</span> <span class="mi">2</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"recovery_frequency"</span><span class="p">:</span> <span class="mi">80</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"recovery_max_tries"</span><span class="p">:</span> <span class="mi">20</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> </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> <h2 id="put-ocsp"> Update OCSP configuration </h2> <pre><code>PUT /v1/ocsp </code></pre> <p> Updates the cluster's OCSP configuration. </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/#config_ocsp"> config_ocsp </a> </td> </tr> </tbody> </table> <h3 id="put-request"> Request </h3> <h4 id="example-http-request-1"> Example HTTP request </h4> <pre><code>PUT /ocsp </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">"ocsp_functionality"</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">"query_frequency"</span><span class="p">:</span> <span class="mi">3800</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"response_timeout"</span><span class="p">:</span> <span class="mi">2</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"recovery_frequency"</span><span class="p">:</span> <span class="mi">80</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"recovery_max_tries"</span><span class="p">:</span> <span class="mi">20</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"> Request body </h4> <p> Include an <a href="/docs/latest/operate/rs/references/rest-api/objects/ocsp/"> OCSP configuration object </a> with updated fields in the request body. </p> <h3 id="put-response"> Response </h3> <p> Returns the updated <a href="/docs/latest/operate/rs/references/rest-api/objects/ocsp/"> OCSP configuration object </a> . </p> <h3 id="put-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> invalid_schema </td> <td> An illegal parameter or a parameter with an illegal value </td> </tr> <tr> <td> no_responder_url </td> <td> Tried to enable OCSP with no responder URL configured </td> </tr> <tr> <td> ocsp_unsupported_by_capability </td> <td> Not all nodes support OCSP capability </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, OCSP config has been set </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 configuration parameters </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/references/rest-api/requests/ocsp/"/> <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/nredisstack/.html
<section class="prose w-full py-12 max-w-none"> <h1> C#/.NET client for Redis </h1> <p class="text-lg -mt-5 mb-10"> Learn how to build with Redis and C#/.NET </p> <p> Connect your C#/.NET application to a Redis database using the NRedisStack client library. </p> <p> Refer to the complete <a href="/docs/latest/develop/clients/dotnet/"> C#/.NET guide </a> to install, connect, and use NRedisStack. </p> <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/nredisstack/"/> <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/configuration/high-availability/.html
<section class="prose w-full py-12 max-w-none"> <h1> High availability and replication </h1> <p class="text-lg -mt-5 mb-10"> Describes database replication and high availability as it affects Redis Cloud. </p> <p> Database replication helps ensure high availability. </p> <p> When replication is enabled, your dataset is duplicated to create a replica that is synchronized with the primary dataset. </p> <p> Replication allows for automatic failover and greater fault tolerance. It can prevent data loss in the event of a hardware or zone failure. </p> <h2 id="options-and-plan-support"> Options and plan support </h2> <p> Redis Cloud supports three levels of replication: </p> <ul> <li> <p> <em> No replication </em> means that you will have a single copy of your database. </p> </li> <li> <p> <em> Single-zone replication </em> means that your database will have a primary and a replica located in the same cloud zone. If anything happens to the primary, the replica takes over and becomes the new primary. </p> </li> <li> <p> <em> Multi-zone replication </em> means that the primary and its replicas are stored in different zones. This means that your database can remain online even if an entire zone becomes unavailable. </p> </li> </ul> <p> Your replication options depend on your <a href="/docs/latest/operate/rc/subscriptions/"> subscription plan </a> : </p> <ul> <li> Free Redis Cloud Essentials plans do not support replication. </li> <li> Paid Redis Cloud Essentials plans and Redis Cloud Pro plans let you choose between multi-zone or single-zone replication when creating a subscription. You can also turn off replication. </li> </ul> <p> After database creation, you can still enable or turn off replication. However, <a href="/docs/latest/operate/rc/databases/configuration/high-availability/#zone-setting-maintenance"> zone settings </a> are only configurable during database creation. </p> <h2 id="performance-impact"> Performance impact </h2> <p> Replication can affect performance as traffic increases to synchronize all copies. </p> <h2 id="dataset-size"> Dataset size </h2> <p> For both Redis Cloud Essentials and Redis Cloud Pro, replication requires a memory limit that is double the dataset size of your database. </p> <p> For Redis Cloud Essentials, the size of the plan you choose includes replication. Therefore, if you choose replication, the dataset size you can use is half of the stated plan size. For example, if you choose a 1 GB plan, Redis allocates 512 MB for the dataset size, and the other 512 MB for replication. </p> <p> For Redis Cloud Pro, you select your dataset size when you create your database, and we calculate your memory limit based on the replication settings you choose. </p> <h2 id="zone-setting-maintenance"> Zone setting maintenance </h2> <p> Zone settings can only be defined when a subscription is created. You cannot change these settings once the subscription becomes active. </p> <p> This means you can't convert a multi-zone subscription to a single zone (or vice-versa). </p> <p> To use different zone settings, create a new subscription with the preferred settings and then <a href="/docs/latest/operate/rc/databases/migrate-databases/"> migrate data </a> from the original subscription. </p> <h2 id="availability-zones"> Availability zones </h2> <p> You can reduce network transfer costs and network latency by ensuring your Redis Cloud cluster and your application are located in the same availability zone. </p> <p> To specify the availability zone for your cluster, select <em> Manual Selection </em> under <strong> Allowed Availability Zones </strong> . </p> <p> For Google Cloud clusters and <a href="/docs/latest/operate/rc/cloud-integrations/aws-cloud-accounts/"> self-managed AWS cloud accounts </a> , select an availability zone from the <strong> Zone name </strong> list. </p> <a href="/docs/latest/images/rc/availability-zones-no-multi-az.png" sdata-lightbox="/images/rc/availability-zones-no-multi-az.png"> <img alt="Select one availability zone when Multi-AZ is turned off." src="/docs/latest/images/rc/availability-zones-no-multi-az.png" width="95%"/> </a> <p> For all other AWS clusters, select an availability zone ID from the <strong> Zone IDs </strong> list. For more information on how to find an availability zone ID, see the <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html#concepts-availability-zones"> AWS docs </a> . </p> <a href="/docs/latest/images/rc/availability-zones-aws-hosted-no-multi-az.png" sdata-lightbox="/images/rc/availability-zones-aws-hosted-no-multi-az.png"> <img alt="For hosted AWS clusters, select availability zone IDs from the Zone IDs list." src="/docs/latest/images/rc/availability-zones-aws-hosted-no-multi-az.png" width="80%"/> </a> <p> If <strong> Multi-AZ </strong> is enabled, you must select three availability zones from the list. </p> <a href="/docs/latest/images/rc/availability-zones-multi-az.png" sdata-lightbox="/images/rc/availability-zones-multi-az.png"> <img alt="Select Manual selection to select three availability zones when Multi-AZ is enabled." src="/docs/latest/images/rc/availability-zones-multi-az.png" width="80%"/> </a> <p> For more information on availability zones, see the <a href="https://cloud.google.com/compute/docs/regions-zones/#available"> Google Cloud docs </a> or the <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html#concepts-availability-zones"> AWS docs </a> . </p> <h2 id="more-info"> More info </h2> <p> To learn more about high availability and replication, see: </p> <ul> <li> <a href="https://redislabs.com/redis-enterprise/technology/highly-available-redis/"> Highly Available Redis </a> </li> <li> <a href="/docs/latest/operate/rs/databases/durability-ha/replication/"> Database replication </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/databases/configuration/high-availability/"/> <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/memory-performance/memory-limit/.html
<section class="prose w-full py-12 max-w-none"> <h1> Database memory limits </h1> <p class="text-lg -mt-5 mb-10"> When you set a database's memory limit, you define the maximum size the database can reach. </p> <p> When you set a database's memory limit, you define the maximum size the database can reach in the cluster, across all database replicas and shards, including both primary and replica shards. </p> <p> If the total size of the database in the cluster reaches the memory limit, the data eviction policy is applied. </p> <h2 id="factors-for-sizing"> Factors for sizing </h2> <p> Factors to consider when sizing your database: </p> <ul> <li> <strong> dataset size </strong> : you want your limit to be above your dataset size to leave room for overhead. </li> <li> <strong> database throughput </strong> : high throughput needs more shards, leading to a higher memory limit. </li> <li> <a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/"> <strong> modules </strong> </a> : using modules with your database consumes more memory. </li> <li> <a href="/docs/latest/operate/rs/databases/durability-ha/clustering/"> <strong> database clustering </strong> </a> : enables you to spread your data into shards across multiple nodes. </li> <li> <a href="/docs/latest/operate/rs/databases/durability-ha/replication/"> <strong> database replication </strong> </a> : enabling replication doubles memory consumption. </li> </ul> <p> Additional factors for Active-Active databases: </p> <ul> <li> <p> <a href="/docs/latest/operate/rs/databases/active-active/"> <strong> Active-Active replication </strong> </a> : enabling Active-Active replication requires double the memory of regular replication, which can be up to two times (2x) the original data size per instance. </p> </li> <li> <p> <a href="/docs/latest/operate/rs/databases/active-active/manage/#replication-backlog/"> <strong> database replication backlog </strong> </a> for synchronization between shards. By default, this is set to 1% of the database size. </p> </li> <li> <p> <a href="/docs/latest/operate/rs/databases/active-active/manage/"> <strong> Active-Active replication backlog </strong> </a> for synchronization between clusters. By default, this is set to 1% of the database size. </p> <p> It's also important to know Active-Active databases have a lower threshold for activating the eviction policy, because it requires propagation to all participating clusters. The eviction policy starts to evict keys when one of the Active-Active instances reaches 80% of its memory limit. </p> </li> </ul> <p> Additional factors for databases with Auto Tiering enabled: </p> <ul> <li> <p> The available flash space must be greater than or equal to the total database size (RAM+Flash). The extra space accounts for write buffers and <a href="https://en.wikipedia.org/wiki/Write_amplification"> write amplification </a> . </p> </li> <li> <p> <a href="/docs/latest/operate/rs/databases/configure/database-persistence/"> <strong> database persistence </strong> </a> : Auto Tiering uses dual database persistence where both the primary and replica shards persist to disk. This may add some processor and network overhead, especially in cloud configurations with network attached storage. </p> </li> </ul> <h2 id="what-happens-when-redis-enterprise-software-is-low-on-ram"> What happens when Redis Enterprise Software is low on RAM? </h2> <p> Redis Enterprise Software manages node memory so that data is entirely in RAM (unless using Auto Tiering). If not enough RAM is available, Redis Enterprise prevents adding more data into the databases. </p> <p> Redis Enterprise Software protects the existing data and prevents the database from being able to store data into the shards. </p> <p> You can configure the cluster to move the data to another node, or even discard it according to the <a href="/docs/latest/operate/rs/databases/memory-performance/eviction-policy/"> eviction policy </a> set on each database by the administrator. </p> <p> <a href="/docs/latest/operate/rs/databases/auto-tiering/"> Auto Tiering </a> manages memory so that you can also use flash memory (SSD) to store data. </p> <h3 id="order-of-events-for-low-ram"> Order of events for low RAM </h3> <ol> <li> If there are other nodes available, your shards migrate to other nodes. </li> <li> If the eviction policy allows eviction, shards start to release memory, which can result in data loss. </li> <li> If the eviction policy does not allow eviction, you'll receive out of memory (OOM) messages. </li> <li> If shards can't free memory, Redis Enterprise relies on the OS processes to stop replicas, but tries to avoid stopping primary shards. </li> </ol> <p> We recommend that you have a <a href="/docs/latest/operate/rs/clusters/monitoring/"> monitoring platform </a> that alerts you before a system gets low on RAM. You must maintain sufficient free memory to make sure that you have a healthy Redis Enterprise installation. </p> <h2 id="memory-metrics"> Memory metrics </h2> <p> The Cluster Manager UI provides metrics that can help you evaluate your memory use. </p> <ul> <li> Free RAM </li> <li> RAM fragmentation </li> <li> Used memory </li> <li> Memory usage </li> <li> Memory limit </li> </ul> <p> See <a href="/docs/latest/operate/rs/references/metrics/"> console metrics </a> for more detailed information. </p> <h2 id="related-info"> Related info </h2> <ul> <li> <a href="/docs/latest/operate/rs/databases/memory-performance/"> Memory and performance </a> </li> <li> <a href="/docs/latest/operate/rs/clusters/optimize/disk-sizing-heavy-write-scenarios/"> Disk sizing for heavy write scenarios </a> </li> <li> <a href="/docs/latest/operate/rs/clusters/optimize/turn-off-services/"> Turn off services to free system memory </a> </li> <li> <a href="/docs/latest/operate/rs/databases/memory-performance/eviction-policy/"> Eviction policy </a> </li> <li> <a href="/docs/latest/operate/rs/databases/memory-performance/shard-placement-policy/"> Shard placement policy </a> </li> <li> <a href="/docs/latest/operate/rs/databases/configure/database-persistence/"> Database persistence </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/rs/databases/memory-performance/memory-limit/"/> <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/db_alerts_settings/bdb_alert_settings_with_threshold/.html
<section class="prose w-full py-12 max-w-none"> <h1> BDB alert settings with threshold object </h1> <p class="text-lg -mt-5 mb-10"> Documents the bdb_alert_settings_with_threshold 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> enabled </td> <td> boolean (default: false) </td> <td> Alert enabled or disabled </td> </tr> <tr> <td> threshold </td> <td> string </td> <td> Threshold for alert going on/off </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/db_alerts_settings/bdb_alert_settings_with_threshold/"/> <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/xreadgroup/.html
<section class="prose w-full py-12"> <h1 class="command-name"> XREADGROUP </h1> <div class="font-semibold text-redis-ink-900"> Syntax </div> <pre class="command-syntax">XREADGROUP GROUP group consumer [COUNT count] [BLOCK milliseconds] [NOACK] STREAMS key [key ...] id [id ...]</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"> For each stream mentioned: O(M) with M being the number of elements returned. If M is constant (e.g. always asking for the first 10 elements with COUNT), you can consider it O(1). On the other side when XREADGROUP blocks, XADD will pay the O(N) time in order to serve the N clients blocked on the stream getting new data. </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> <code> @blocking </code> <span class="mr-1 last:hidden"> , </span> </dd> </dl> <p> The <code> XREADGROUP </code> command is a special version of the <a href="/docs/latest/commands/xread/"> <code> XREAD </code> </a> command with support for consumer groups. Probably you will have to understand the <a href="/docs/latest/commands/xread/"> <code> XREAD </code> </a> command before reading this page will makes sense. </p> <p> Moreover, if you are new to streams, we recommend to read our <a href="/docs/latest/develop/data-types/streams/"> introduction to Redis Streams </a> . Make sure to understand the concept of consumer group in the introduction so that following how this command works will be simpler. </p> <h2 id="consumer-groups-in-30-seconds"> Consumer groups in 30 seconds </h2> <p> The difference between this command and the vanilla <a href="/docs/latest/commands/xread/"> <code> XREAD </code> </a> is that this one supports consumer groups. </p> <p> Without consumer groups, just using <a href="/docs/latest/commands/xread/"> <code> XREAD </code> </a> , all the clients are served with all the entries arriving in a stream. Instead using consumer groups with <code> XREADGROUP </code> , it is possible to create groups of clients that consume different parts of the messages arriving in a given stream. If, for instance, the stream gets the new entries A, B, and C and there are two consumers reading via a consumer group, one client will get, for instance, the messages A and C, and the other the message B, and so forth. </p> <p> Within a consumer group, a given consumer (that is, just a client consuming messages from the stream), has to identify with a unique <em> consumer name </em> . Which is just a string. </p> <p> One of the guarantees of consumer groups is that a given consumer can only see the history of messages that were delivered to it, so a message has just a single owner. However there is a special feature called <em> message claiming </em> that allows other consumers to claim messages in case there is a non recoverable failure of some consumer. In order to implement such semantics, consumer groups require explicit acknowledgment of the messages successfully processed by the consumer, via the <a href="/docs/latest/commands/xack/"> <code> XACK </code> </a> command. This is needed because the stream will track, for each consumer group, who is processing what message. </p> <p> This is how to understand if you want to use a consumer group or not: </p> <ol> <li> If you have a stream and multiple clients, and you want all the clients to get all the messages, you do not need a consumer group. </li> <li> If you have a stream and multiple clients, and you want the stream to be <em> partitioned </em> or <em> sharded </em> across your clients, so that each client will get a sub set of the messages arriving in a stream, you need a consumer group. </li> </ol> <h2 id="differences-between-xread-and-xreadgroup"> Differences between XREAD and XREADGROUP </h2> <p> From the point of view of the syntax, the commands are almost the same, however <code> XREADGROUP </code> <em> requires </em> a special and mandatory option: </p> <pre><code>GROUP &lt;group-name&gt; &lt;consumer-name&gt; </code></pre> <p> The group name is just the name of a consumer group associated to the stream. The group is created using the <a href="/docs/latest/commands/xgroup/"> <code> XGROUP </code> </a> command. The consumer name is the string that is used by the client to identify itself inside the group. The consumer is auto created inside the consumer group the first time it is saw. Different clients should select a different consumer name. </p> <p> When you read with <code> XREADGROUP </code> , the server will <em> remember </em> that a given message was delivered to you: the message will be stored inside the consumer group in what is called a Pending Entries List (PEL), that is a list of message IDs delivered but not yet acknowledged. </p> <p> The client will have to acknowledge the message processing using <a href="/docs/latest/commands/xack/"> <code> XACK </code> </a> in order for the pending entry to be removed from the PEL. The PEL can be inspected using the <a href="/docs/latest/commands/xpending/"> <code> XPENDING </code> </a> command. </p> <p> The <code> NOACK </code> subcommand can be used to avoid adding the message to the PEL in cases where reliability is not a requirement and the occasional message loss is acceptable. This is equivalent to acknowledging the message when it is read. </p> <p> The ID to specify in the <strong> STREAMS </strong> option when using <code> XREADGROUP </code> can be one of the following two: </p> <ul> <li> The special <code> &gt; </code> ID, which means that the consumer want to receive only messages that were <em> never delivered to any other consumer </em> . It just means, give me new messages. </li> <li> Any other ID, that is, 0 or any other valid ID or incomplete ID (just the millisecond time part), will have the effect of returning entries that are pending for the consumer sending the command with IDs greater than the one provided. So basically if the ID is not <code> &gt; </code> , then the command will just let the client access its pending entries: messages delivered to it, but not yet acknowledged. Note that in this case, both <code> BLOCK </code> and <code> NOACK </code> are ignored. </li> </ul> <p> Like <a href="/docs/latest/commands/xread/"> <code> XREAD </code> </a> the <code> XREADGROUP </code> command can be used in a blocking way. There are no differences in this regard. </p> <h2 id="what-happens-when-a-message-is-delivered-to-a-consumer"> What happens when a message is delivered to a consumer? </h2> <p> Two things: </p> <ol> <li> If the message was never delivered to anyone, that is, if we are talking about a new message, then a PEL (Pending Entries List) is created. </li> <li> If instead the message was already delivered to this consumer, and it is just re-fetching the same message again, then the <em> last delivery counter </em> is updated to the current time, and the <em> number of deliveries </em> is incremented by one. You can access those message properties using the <a href="/docs/latest/commands/xpending/"> <code> XPENDING </code> </a> command. </li> </ol> <h2 id="usage-example"> Usage example </h2> <p> Normally you use the command like that in order to get new messages and process them. In pseudo-code: </p> <pre tabindex="0"><code>WHILE true entries = XREADGROUP GROUP $GroupName $ConsumerName BLOCK 2000 COUNT 10 STREAMS mystream &gt; if entries == nil puts "Timeout... try again" CONTINUE end FOREACH entries AS stream_entries FOREACH stream_entries as message process_message(message.id,message.fields) # ACK the message as processed XACK mystream $GroupName message.id END END END </code></pre> <p> In this way the example consumer code will fetch only new messages, process them, and acknowledge them via <a href="/docs/latest/commands/xack/"> <code> XACK </code> </a> . However the example code above is not complete, because it does not handle recovering after a crash. What will happen if we crash in the middle of processing messages, is that our messages will remain in the pending entries list, so we can access our history by giving <code> XREADGROUP </code> initially an ID of 0, and performing the same loop. Once providing an ID of 0 the reply is an empty set of messages, we know that we processed and acknowledged all the pending messages: we can start to use <code> &gt; </code> as ID, in order to get the new messages and rejoin the consumers that are processing new things. </p> <p> To see how the command actually replies, please check the <a href="/docs/latest/commands/xread/"> <code> XREAD </code> </a> command page. </p> <h2 id="what-happens-when-a-pending-message-is-deleted"> What happens when a pending message is deleted? </h2> <p> Entries may be deleted from the stream due to trimming or explicit calls to <a href="/docs/latest/commands/xdel/"> <code> XDEL </code> </a> at any time. By design, Redis doesn't prevent the deletion of entries that are present in the stream's PELs. When this happens, the PELs retain the deleted entries' IDs, but the actual entry payload is no longer available. Therefore, when reading such PEL entries, Redis will return a null value in place of their respective data. </p> <p> Example: </p> <pre tabindex="0"><code>&gt; XADD mystream 1 myfield mydata "1-0" &gt; XGROUP CREATE mystream mygroup 0 OK &gt; XREADGROUP GROUP mygroup myconsumer STREAMS mystream &gt; 1) 1) "mystream" 2) 1) 1) "1-0" 2) 1) "myfield" 2) "mydata" &gt; XDEL mystream 1-0 (integer) 1 &gt; XREADGROUP GROUP mygroup myconsumer STREAMS mystream 0 1) 1) "mystream" 2) 1) 1) "1-0" 2) (nil) </code></pre> <p> Reading the <a href="/docs/latest/develop/data-types/streams/"> Redis Streams introduction </a> is highly suggested in order to understand more about the streams overall behavior and semantics. </p> <h2 id="resp2-reply"> RESP2 Reply </h2> <p> One of the following: </p> <ul> <li> <a href="../../develop/reference/protocol-spec#arrays"> Array reply </a> : an array where each element is an array composed of a two elements containing the key name and the entries reported for that key. The entries reported are full stream entries, having IDs and the list of all the fields and values. Field and values are guaranteed to be reported in the same order they were added by <code> XADD </code> . </li> <li> <a href="../../develop/reference/protocol-spec#bulk-strings"> Nil reply </a> : if the <em> BLOCK </em> option is given and a timeout occurs, or if there is no stream that can be served. </li> </ul> <h2 id="resp3-reply"> RESP3 Reply </h2> <p> One of the following: </p> <ul> <li> <a href="../../develop/reference/protocol-spec#maps"> Map reply </a> : A map of key-value elements where each element is composed of the key name and the entries reported for that key. The entries reported are full stream entries, having IDs and the list of all the fields and values. Field and values are guaranteed to be reported in the same order they were added by <code> XADD </code> . </li> <li> <a href="../../develop/reference/protocol-spec#nulls"> Null reply </a> : if the <em> BLOCK </em> option is given and a timeout occurs, or if there is no stream that can be served. </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/xreadgroup/"/> <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-6-2-10-february-2022/.html
<section class="prose w-full py-12 max-w-none"> <h1> Redis Enterprise Software Release Notes 6.2.10 (February 2022) </h1> <p class="text-lg -mt-5 mb-10"> Python 3 support. RHEL 8.5 support. </p> <p> <a href="https://redislabs.com/redis-enterprise-software/download-center/software/"> Redis Enterprise Software version 6.2.10 </a> is now available! </p> <p> The following table shows the MD5 checksums for the available packages. </p> <table> <thead> <tr> <th style="text-align:left"> Package </th> <th style="text-align:left"> MD5 Checksum </th> </tr> </thead> <tbody> <tr> <td style="text-align:left"> Ubuntu 16 </td> <td style="text-align:left"> <code> 531cea69a58fbc1125bc5f76ba01da7f </code> </td> </tr> <tr> <td style="text-align:left"> Ubuntu 18 </td> <td style="text-align:left"> <code> ec9ac6e0111dc85605d3b98e83f50150 </code> </td> </tr> <tr> <td style="text-align:left"> RedHat Enterprise Linux (RHEL) 7 <br/> Oracle Enterprise Linux (OL) 7 </td> <td style="text-align:left"> <code> 2f7572caab9600417ef8b4ee474d6768 </code> </td> </tr> <tr> <td style="text-align:left"> RedHat Enterprise Linux (RHEL) 8 <br/> Oracle Enterprise Linux (OL) 8 </td> <td style="text-align:left"> <code> 377a539ee050515e1e0640dec1e04129 </code> </td> </tr> <tr> <td style="text-align:left"> K8s Ubuntu </td> <td style="text-align:left"> <code> 099192416a70a12790535bdcd78a6e87 </code> </td> </tr> <tr> <td style="text-align:left"> K8s RHEL </td> <td style="text-align:left"> <code> f267abe81770ddf36f022232f4c2cb2e </code> </td> </tr> </tbody> </table> <h2 id="features-and-enhancements"> Features and enhancements </h2> <ul> <li> <p> Upgrade the Redis Enterprise infrastructure to <a href="https://www.python.org/"> Python v3.9 </a> . </p> </li> <li> <p> <a href="https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/8.5_release_notes/index"> Red Hat Enterprise Linux (RHEL) v8.5 </a> and <a href="https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/8.6_release_notes/index"> Red Hat Enterprise Linux (RHEL) v8.6 </a> is now a <a href="/docs/latest/operate/rs/installing-upgrading/install/plan-deployment/supported-platforms/"> supported platform </a> . </p> </li> <li> <p> <a href="https://docs.oracle.com/en/operating-systems/oracle-linux/8/"> Oracle Linux v8 </a> is now a <a href="/docs/latest/operate/rs/installing-upgrading/install/plan-deployment/supported-platforms/"> supported platform </a> . </p> </li> <li> <p> Compatibility with <a href="https://raw.githubusercontent.com/redis/redis/6.2/00-RELEASENOTES"> open source Redis 6.2.5 </a> . </p> </li> <li> <p> Compatibility with the <a href="https://github.com/redis/redis/releases/tag/6.2.6"> security fixes </a> of the latest <a href="https://github.com/redis/redis/releases/tag/6.2.6"> open source Redis 6.2.6 </a> . </p> </li> <li> <p> Enhancements and bug fixes. </p> </li> </ul> <h2 id="version-changes"> Version changes </h2> <h3 id="prerequisites-and-notes"> Prerequisites and notes </h3> <ul> <li> <p> You can <a href="/docs/latest/operate/rs/installing-upgrading/upgrading/"> upgrade to v6.2.10 </a> from Redis Enterprise Software v6.0 and later. </p> </li> <li> <p> Refer to <a href="/docs/latest/operate/rs/release-notes/rs-6-2-4-august-2021/"> v6.2.4 release notes </a> for important notes regarding changes made to the upgrade. </p> </li> <li> <p> Upgrades from versions earlier than v6.0 are not supported. </p> </li> <li> <p> If you plan to upgrade your cluster to RHEL 8, refer to <a href="/docs/latest/operate/rs/release-notes/rs-6-2-8-october-2021/"> v6.2.8 release notes </a> for known limitations. </p> </li> <li> <p> If you are using Active-Active or Active-Passive (ReplicaOf) databases and experience synchronization issues as a result of the upgrade, see RS67434 details in <a href="#resolved-issues"> Resolved issues </a> for help resolving the problem. </p> </li> </ul> <h3 id="product-lifecycle-updates"> Product lifecycle updates </h3> <p> Redis Enterprise Software v6.0.x will reach end of life (EOF) on May 31, 2022. </p> <p> To learn more, see the Redis Enterprise Software <a href="/docs/latest/operate/rs/installing-upgrading/product-lifecycle/"> product lifecycle </a> , which details the release number and the end-of-life schedule for Redis Enterprise Software. </p> <p> For Redis modules information and lifecycle, see <a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/modules-lifecycle/"> Module lifecycle </a> . </p> <h2 id="redis-modules"> Redis modules </h2> <p> Redis Enterprise Software v6.2.10 includes the following Redis modules: </p> <ul> <li> <a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redisearch/"> RediSearch v2.2.6 </a> </li> <li> <a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redisjson/"> RedisJSON v2.0.6 </a> </li> <li> <a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/bloom/release-notes/"> RedisBloom v2.2.9 </a> </li> <li> <a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redisgraph/"> RedisGraph v2.4.12 </a> </li> <li> <a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redistimeseries/"> RedisTimeSeries v1.4.13 </a> </li> </ul> <p> Starting with Redis Enterprise Software v6.2.10 build 121, the included modules versions are: </p> <ul> <li> <a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redisearch/"> RediSearch v2.4.6 </a> </li> <li> <a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redisjson/"> RedisJSON v2.0.8 </a> </li> <li> <a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/bloom/release-notes/"> RedisBloom v2.2.14 </a> </li> <li> <a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redisgraph/"> RedisGraph v2.8.12 </a> </li> <li> <a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redistimeseries/"> RedisTimeSeries v1.6.9 </a> </li> </ul> <p> For help upgrading a module, see <a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/install/add-module-to-cluster/#upgrading-the-module-for-the-database"> Add a module to a cluster </a> . </p> <h2 id="interface-enhancements"> Interface enhancements </h2> <ul> <li> When choosing RedisJSON, the user interface (UI) now suggests RedisSearch as well. To learn more, see the <a href="https://redis.com/blog/redisjson-public-preview-performance-benchmarking/"> RedisJSON preview announcement </a> , which details the benefits of combining <a href="http://redisjson.io/"> RedisJSON </a> and <a href="http://redisearch.io/"> RediSearch </a> . </li> <li> Adds the ability to sort the columns of the node list (RS48256). </li> <li> When creating a new geo-distributed (Active-Active) database, an endpoint port is no longer required. The system assigns one if none if provided (RS27632). </li> </ul> <h2 id="additional-enhancements"> Additional enhancements </h2> <ul> <li> <p> Added an option to run a connectivity health check for the management layer of Active-Active databases. Run the following REST API command: </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">GET https:/<span class="o">[</span>host<span class="o">][</span>:port<span class="o">]</span>/v1/crdbs/&lt;crdb_guid&gt;/health_report </span></span></code></pre> </div> </li> <li> <p> Added TLS handshake error messages to the DMC proxy log (RS59346). </p> </li> </ul> <h2 id="resolved-issues"> Resolved issues </h2> <ul> <li> <p> RS58219 - Fixes a UI error message that showed a path instead of a relevant error message. </p> </li> <li> <p> RS44958 - Fixes incorrect description for the graph "incoming traffic" in Active-Active (geo-distributed) database UI Metrics. </p> </li> <li> <p> RS66280 - Fixes the lexicographic <a href="/docs/latest/commands/sort/"> SORT </a> command on Active-Active databases (e.g. <code> SORT mylist ALPHA </code> ). The SORT command should only run on keys mapped to the same slot. </p> </li> <li> <p> RS64575 - Fixes a bug in the replication between primary and replica shards of a destination Active-active database in the scenario of using Replica-Of from a single to an Active-Active database, where the syncer process went down during the full sync. </p> </li> <li> <p> RS65370 - Adds logic to remove old syncer entries in the cluster configuration during upgrades. </p> </li> <li> <p> RS67434 - Version 6.2.10 fixes the mTLS handshake between the <a href="/docs/latest/operate/rs/databases/active-active/#syncer-process"> syncer process </a> and the <a href="https://docs.redis.com/latest//rs/references/terminology/#proxy"> proxy (DMC) </a> , where the proxy presented a leaf certificate without its full chain to the syncer. After upgrading to 6.2.10, syncer connections using invalid certificates will break the synchronization between Active-Active instances or deployments using Replica Of when TLS is enabled. To ensure certificates are valid before upgrading do the following: </p> <ul> <li> <p> For Active-Active databases, run the following command from one of the clusters: </p> <p> <code> crdb-cli crdb update --crdb-guid &lt;CRDB-GUID&gt; --force </code> </p> </li> <li> <p> For Active-Passive (Replica Of) databases: use the admin console to verify that the destination syncer has the correct certificate for the source proxy (DMC). For details, see <a href="/docs/latest/operate/rs/databases/import-export/replica-of/create/#configure-tls-on-replica-database"> Configure TLS for Replica Of </a> . </p> </li> </ul> </li> </ul> <h3 id="issues-resolved-in-build-96"> Issues resolved in build 96 </h3> <ul> <li> <p> RS67133 - An issue in Redis Enterprise Software affected replication in replica databases using RedisGraph, RediSearch, and RedisGears in specific scenarios. The problem appeared when importing an RDB file or while synchronizing target Active-Passive (ReplicaOf) databases. </p> <p> This issue is fixed in Redis Enterprise Software v6.2.10-96 and RedisGraph v2.8.11. We recommend upgrading to these versions at your earliest opportunity. (Failure to upgrade can lead to data loss.) </p> <p> Once the upgrades are complete, secondary shards might need to be restarted. You can use <code> rlutil </code> to restart secondary shards: </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">rlutil redis_restart <span class="nv">redis</span><span class="o">=</span>&lt;shard-id1&gt;,&lt;shard-id2&gt;,... </span></span></code></pre> </div> </li> </ul> <h3 id="issues-resolved-in-build-100"> Issues resolved in build 100 </h3> <ul> <li> RS74171 - A new command was added as part of Redis 6.2: <a href="/docs/latest/commands/xautoclaim/"> XAUTOCLAIM </a> . When used in an Active-Active configuration, this command may cause Redis shards to crash, potentially resulting in data loss. The issue is fixed in Redis Enterprise Software version 6.2.12. Additionally, we recommend enabling AOF persistence for all Active-Active configurations. </li> </ul> <h3 id="issues-resolved-in-build-121"> Issues resolved in build 121 </h3> <ul> <li> RS68668, RS72082 - Improvements for internode encryption certification rotation </li> <li> RS72304 - Avoid starting a master shard when both master and replica shards crash and the replica did not finish recovery </li> <li> RS74469 - Fix for some Redis Active-Active + Redis Streams scenarios that could lead to shard crash during backup; failure to backup </li> </ul> <h3 id="issues-resolved-in-build-129"> Issues resolved in build 129 </h3> <ul> <li> RS77003 - Add grace time to job scheduler to allow certificate rotation in case of failure due to scheduling conflicts. </li> <li> RS71112 - Update validation during db configuration to not fail due to ports associated with nodes that are no longer in the cluster. This was done to allow db configuration during adding and removing nodes as part of load balancing. </li> <li> RS78486 - Fix known issue from 6.2.10 build 100 - When using rladmin tune db to change the replica buffer size, the command appears to succeed, but the change does not take effect. </li> </ul> <h2 id="known-limitations"> Known limitations </h2> <ul> <li> <p> RS81463 - A shard may crash when resharding an Active-Active database with Auto Tiering . Specifically, the shard will crash when volatile keys or Active-Active tombstone keys reside in Flash memory. </p> </li> <li> <p> RS78364 - When using <code> rladmin tune db </code> to change the replica buffer size, the command appears to succeed, but the change does not take effect. This issue was introduced in build 100; it will be fixed in a future build of Redis Enterprise Software v6.2.10 and in the next release (v6.2.12). </p> </li> <li> <p> RS63258 - Redis Enterprise Software is not currently supported on RHEL 8 with FIPS enabled. </p> <p> FIPS changes system-generated keys, which can limit secure access to the cluster or the admin console via port 8443. </p> </li> <li> <p> RS63375 - RHEL 7 clusters cannot be directly upgraded to RHEL 8 when hosting databases using modules. </p> <p> Due to binary differences in modules between the two operating systems, you cannot directly update RHEL 7 clusters to RHEL 8 when those clusters host databases using modules. Instead, you need to create a new cluster on RHEL 8 and then migrate existing data from your RHEL 7 cluster. This does not apply to clusters that do not use modules. </p> </li> </ul> <p> All <a href="/docs/latest/operate/rs/release-notes/rs-6-2-4-august-2021/#known-limitations"> known limitations </a> listed in the v6.2.4 release notes have been addressed. </p> <h3 id="installation-limitations"> Installation limitations </h3> <p> Several Redis Enterprise Software installation reference files are installed to the directory <code> /etc/opt/redislabs/ </code> even if you use <a href="/docs/latest/operate/rs/installing-upgrading/install/customize-install-directories/"> custom installation directories </a> . </p> <p> As a workaround to install Redis Enterprise Software without using any root directories, do the following before installing Redis Enterprise Software: </p> <ol> <li> <p> Create all custom, non-root directories you want to use with Redis Enterprise Software. </p> </li> <li> <p> Mount <code> /etc/opt/redislabs </code> to one of the custom, non-root directories. </p> </li> </ol> <h2 id="known-issues"> Known issues </h2> <ul> <li> <p> The <code> ZRANGESTORE </code> command, with a special <code> zset-max-ziplist-entries </code> configuration can crash Redis 6.2. See <a href="https://github.com/redis/redis/pull/10767"> Redis repository 10767 </a> for more details. </p> </li> <li> <p> RS40641 - API requests are redirected to an internal IP in case the request arrives from a node which is not the master. To avoid this issue, use <a href="/docs/latest/operate/rs/references/cli-utilities/rladmin/cluster/config/"> <code> rladmin cluster config </code> </a> to configure <code> handle_redirects </code> or <code> handle_metrics_redirects </code> . </p> </li> </ul> <h2 id="security"> Security </h2> <h3 id="open-source-redis-security-fixes-compatibility"> Open Source Redis Security fixes compatibility </h3> <p> As part of Redis commitment to security, Redis Enterprise Software implements the latest <a href="https://github.com/redis/redis/releases"> security fixes </a> available with open source Redis. The following <a href="https://github.com/redis/redis"> Open Source Redis </a> <a href="https://github.com/redis/redis/security/advisories"> CVE’s </a> do not affect Redis Enterprise: </p> <ul> <li> <p> <a href="https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-32625"> CVE-2021-32625 </a> - Redis Enterprise is not impacted by the CVE that was found and fixed in open source Redis since Redis Enterprise does not implement LCS. Additional information about the open source Redis fix is on <a href="https://github.com/redis/redis/releases"> the Redis GitHub page </a> (Redis 6.2.4, Redis 6.0.14) </p> </li> <li> <p> <a href="https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-32672"> CVE-2021-32672 </a> - Redis Enterprise is not impacted by the CVE that was found and fixed in open source Redis because the LUA debugger is unsupported in Redis Enterprise. Additional information about the open source Redis fix is on <a href="https://github.com/redis/redis/releases"> the Redis GitHub page </a> (Redis 6.2.6, Redis 6.0.16) </p> </li> <li> <p> <a href="https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-32675"> CVE-2021-32675 </a> - Redis Enterprise is not impacted by the CVE that was found and fixed in open source Redis because the proxy in Redis Enterprise does not forward unauthenticated requests. Additional information about the open source Redis fix is on <a href="https://github.com/redis/redis/releases"> the Redis GitHub page </a> (Redis 6.2.6, Redis 6.0.16) </p> </li> <li> <p> <a href="https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-32762"> CVE-2021-32762 </a> - Redis Enterprise is not impacted by the CVE that was found and fixed in open source Redis because the memory allocator used in Redis Enterprise is not vulnerable. Additional information about the open source Redis fix is on <a href="https://github.com/redis/redis/releases"> the Redis GitHub page </a> (Redis 6.2.6, Redis 6.0.16) </p> </li> <li> <p> <a href="https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41099"> CVE-2021-41099 </a> - Redis Enterprise is not impacted by the CVE that was found and fixed in open source Redis because the proto-max-bulk-len CONFIG is blocked in Redis Enterprise. Additional information about the open source Redis fix is on <a href="https://github.com/redis/redis/releases"> the Redis GitHub page </a> (Redis 6.2.6, Redis 6.0.16)security fixes for <a href="https://github.com/redis/redis/security/advisories"> recent CVE’s </a> . Redis Enterprise has already included the fixes for the relevant CVE’s. Some CVE’s announced for Open Source Redis do not affect Redis Enterprise due to different and additional functionality available in Redis Enterprise that is not available in Open Source Redis. </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-6-2-10-february-2022/"/> <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/compatibility/commands/pub-sub/.html
<section class="prose w-full py-12 max-w-none"> <h1> Pub/sub commands compatibility </h1> <p class="text-lg -mt-5 mb-10"> Pub/sub commands compatibility. </p> <p> The following table shows which Redis Community Edition <a href="/docs/latest/commands/?group=pubsub"> pub/sub commands </a> are compatible with standard and Active-Active databases in Redis Enterprise Software and Redis Cloud. </p> <table> <thead> <tr> <th style="text-align:left"> Command </th> <th style="text-align:left"> Redis <br/> Enterprise </th> <th style="text-align:left"> Redis <br/> Cloud </th> <th style="text-align:left"> Notes </th> </tr> </thead> <tbody> <tr> <td style="text-align:left"> <a href="/docs/latest/commands/psubscribe/"> PSUBSCRIBE </a> </td> <td style="text-align:left"> <span title="Supported"> ✅ Standard </span> <br/> <span title="Supported"> <nobr> ✅ Active-Active </nobr> </span> </td> <td style="text-align:left"> <span title="Supported"> ✅ Standard </span> <br/> <span title="Supported"> <nobr> ✅ Active-Active </nobr> </span> </td> <td style="text-align:left"> </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/commands/publish/"> PUBLISH </a> </td> <td style="text-align:left"> <span title="Supported"> ✅ Standard </span> <br/> <span title="Supported"> <nobr> ✅ Active-Active </nobr> </span> </td> <td style="text-align:left"> <span title="Supported"> ✅ Standard </span> <br/> <span title="Supported"> <nobr> ✅ Active-Active </nobr> </span> </td> <td style="text-align:left"> </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/commands/pubsub-channels/"> PUBSUB CHANNELS </a> </td> <td style="text-align:left"> <span title="Supported"> ✅ Standard </span> <br/> <span title="Supported"> <nobr> ✅ Active-Active </nobr> </span> </td> <td style="text-align:left"> <span title="Supported"> ✅ Standard </span> <br/> <span title="Supported"> <nobr> ✅ Active-Active </nobr> </span> </td> <td style="text-align:left"> </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/commands/pubsub-numpat/"> PUBSUB NUMPAT </a> </td> <td style="text-align:left"> <span title="Supported"> ✅ Standard </span> <br/> <span title="Supported"> <nobr> ✅ Active-Active </nobr> </span> </td> <td style="text-align:left"> <span title="Supported"> ✅ Standard </span> <br/> <span title="Supported"> <nobr> ✅ Active-Active </nobr> </span> </td> <td style="text-align:left"> </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/commands/pubsub-numsub/"> PUBSUB NUMSUB </a> </td> <td style="text-align:left"> <span title="Supported"> ✅ Standard </span> <br/> <span title="Supported"> <nobr> ✅ Active-Active </nobr> </span> </td> <td style="text-align:left"> <span title="Supported"> ✅ Standard </span> <br/> <span title="Supported"> <nobr> ✅ Active-Active </nobr> </span> </td> <td style="text-align:left"> </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/commands/pubsub-shardchannels/"> PUBSUB SHARDCHANNELS </a> </td> <td style="text-align:left"> <span title="Supported"> ✅ Standard </span> <br/> <span title="Supported"> <nobr> ✅ Active-Active </nobr> </span> </td> <td style="text-align:left"> <span title="Supported"> ✅ Standard </span> <br/> <span title="Supported"> <nobr> ✅ Active-Active </nobr> </span> </td> <td style="text-align:left"> </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/commands/pubsub-shardnumsub/"> PUBSUB SHARDNUMSUB </a> </td> <td style="text-align:left"> <span title="Supported"> ✅ Standard </span> <br/> <span title="Supported"> <nobr> ✅ Active-Active </nobr> </span> </td> <td style="text-align:left"> <span title="Supported"> ✅ Standard </span> <br/> <span title="Supported"> <nobr> ✅ Active-Active </nobr> </span> </td> <td style="text-align:left"> </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/commands/punsubscribe/"> PUNSUBSCRIBE </a> </td> <td style="text-align:left"> <span title="Supported"> ✅ Standard </span> <br/> <span title="Supported"> <nobr> ✅ Active-Active </nobr> </span> </td> <td style="text-align:left"> <span title="Supported"> ✅ Standard </span> <br/> <span title="Supported"> <nobr> ✅ Active-Active </nobr> </span> </td> <td style="text-align:left"> </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/commands/spublish/"> SPUBLISH </a> </td> <td style="text-align:left"> <span title="Supported"> ✅ Standard </span> <br/> <span title="Supported"> <nobr> ✅ Active-Active </nobr> </span> </td> <td style="text-align:left"> <span title="Supported"> ✅ Standard </span> <br/> <span title="Supported"> <nobr> ✅ Active-Active </nobr> </span> </td> <td style="text-align:left"> </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/commands/ssubscribe/"> SSUBSCRIBE </a> </td> <td style="text-align:left"> <span title="Supported"> ✅ Standard </span> <br/> <span title="Supported"> <nobr> ✅ Active-Active </nobr> </span> </td> <td style="text-align:left"> <span title="Supported"> ✅ Standard </span> <br/> <span title="Supported"> <nobr> ✅ Active-Active </nobr> </span> </td> <td style="text-align:left"> </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/commands/subscribe/"> SUBSCRIBE </a> </td> <td style="text-align:left"> <span title="Supported"> ✅ Standard </span> <br/> <span title="Supported"> <nobr> ✅ Active-Active </nobr> </span> </td> <td style="text-align:left"> <span title="Supported"> ✅ Standard </span> <br/> <span title="Supported"> <nobr> ✅ Active-Active </nobr> </span> </td> <td style="text-align:left"> </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/commands/sunsubscribe/"> SUNSUBSCRIBE </a> </td> <td style="text-align:left"> <span title="Supported"> ✅ Standard </span> <br/> <span title="Supported"> <nobr> ✅ Active-Active </nobr> </span> </td> <td style="text-align:left"> <span title="Supported"> ✅ Standard </span> <br/> <span title="Supported"> <nobr> ✅ Active-Active </nobr> </span> </td> <td style="text-align:left"> </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/commands/unsubscribe/"> UNSUBSCRIBE </a> </td> <td style="text-align:left"> <span title="Supported"> ✅ Standard </span> <br/> <span title="Supported"> <nobr> ✅ Active-Active </nobr> </span> </td> <td style="text-align:left"> <span title="Supported"> ✅ Standard </span> <br/> <span title="Supported"> <nobr> ✅ Active-Active </nobr> </span> </td> <td style="text-align:left"> </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/compatibility/commands/pub-sub/"/> <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/redis_acls/.html
<section class="prose w-full py-12 max-w-none"> <h1> Redis access control list (ACL) requests </h1> <p class="text-lg -mt-5 mb-10"> Redis access control list (ACL) requests </p> <table> <thead> <tr> <th> Method </th> <th> Path </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> <a href="#get-all-redis_acls"> GET </a> </td> <td> <code> /v1/redis_acls </code> </td> <td> Get all Redis ACLs </td> </tr> <tr> <td> <a href="#get-redis_acl"> GET </a> </td> <td> <code> /v1/redis_acls/{uid} </code> </td> <td> Get a single Redis ACL </td> </tr> <tr> <td> <a href="#put-redis_acl"> PUT </a> </td> <td> <code> /v1/redis_acls/{uid} </code> </td> <td> Update a Redis ACL </td> </tr> <tr> <td> <a href="#post-redis_acl"> POST </a> </td> <td> <code> /v1/redis_acls </code> </td> <td> Create a new Redis ACL </td> </tr> <tr> <td> <a href="#delete-redis_acl"> DELETE </a> </td> <td> <code> /v1/redis_acls/{uid} </code> </td> <td> Delete a Redis ACL </td> </tr> </tbody> </table> <h2 id="get-all-redis_acls"> Get all Redis ACLs </h2> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">GET /v1/redis_acls </span></span></code></pre> </div> <p> Get all Redis ACL objects. </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_all_redis_acls_info"> view_all_redis_acls_info </a> </td> <td> admin <br/> cluster_member <br/> cluster_viewer <br/> db_member <br/> db_viewer </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 /redis_acls </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> <h3 id="get-all-response"> Response </h3> <p> Returns a JSON array of <a href="/docs/latest/operate/rs/7.4/references/rest-api/objects/redis_acl/"> Redis ACL objects </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="p">{</span> </span></span><span class="line"><span class="cl"> <span class="nt">"uid"</span><span class="p">:</span> <span class="mi">1</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">"Full Access"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"acl"</span><span class="p">:</span> <span class="s2">"+@all ~*"</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="mi">2</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">"Read Only"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"acl"</span><span class="p">:</span> <span class="s2">"+@read ~*"</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="mi">3</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">"Not Dangerous"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"acl"</span><span class="p">:</span> <span class="s2">"+@all -@dangerous ~*"</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="mi">17</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">"Geo"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"acl"</span><span class="p">:</span> <span class="s2">"~* +@geo"</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.5.2"> 501 Not Implemented </a> </td> <td> Cluster doesn't support redis_acl yet. </td> </tr> </tbody> </table> <h2 id="get-redis_acl"> Get Redis ACL </h2> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">GET /v1/redis_acls/<span class="o">{</span>int: uid<span class="o">}</span> </span></span></code></pre> </div> <p> Get a single Redis ACL object. </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/#view_redis_acl_info"> view_redis_acl_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-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 /redis_acls/1 </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"> 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 object's unique ID. </td> </tr> </tbody> </table> <h3 id="get-response"> Response </h3> <p> Returns a <a href="/docs/latest/operate/rs/7.4/references/rest-api/objects/redis_acl/"> Redis ACL object </a> . </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="mi">17</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">"Geo"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"acl"</span><span class="p">:</span> <span class="s2">"~* +@geo"</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> Success. </td> </tr> <tr> <td> <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.4"> 403 Forbidden </a> </td> <td> Operation is forbidden. </td> </tr> <tr> <td> <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5"> 404 Not Found </a> </td> <td> redis_acl does not exist. </td> </tr> <tr> <td> <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.2"> 501 Not Implemented </a> </td> <td> Cluster doesn't support redis_acl yet. </td> </tr> </tbody> </table> <h2 id="put-redis_acl"> Update Redis ACL </h2> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">PUT /v1/redis_acls/<span class="o">{</span>int: uid<span class="o">}</span> </span></span></code></pre> </div> <p> Update an existing Redis ACL object. </p> <h3 id="permissions-2"> 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_redis_acl"> update_redis_acl </a> </td> <td> admin </td> </tr> </tbody> </table> <h3 id="put-request"> Request </h3> <h4 id="example-http-request-2"> Example HTTP request </h4> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">PUT /redis_acls/17 </span></span></code></pre> </div> <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">"acl"</span><span class="p">:</span> <span class="s2">"~* +@geo -@dangerous"</span> </span></span><span class="line"><span class="cl"><span class="p">}</span> </span></span></code></pre> </div> <h4 id="headers-2"> 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> Include a <a href="/docs/latest/operate/rs/7.4/references/rest-api/objects/redis_acl/"> Redis ACL object </a> with updated fields in the request body. </p> <h3 id="put-response"> Response </h3> <p> Returns the updated <a href="/docs/latest/operate/rs/7.4/references/rest-api/objects/redis_acl/"> Redis ACL object </a> . </p> <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">"uid"</span><span class="p">:</span> <span class="mi">17</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">"Geo"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"acl"</span><span class="p">:</span> <span class="s2">"~* +@geo -@dangerous"</span> </span></span><span class="line"><span class="cl"><span class="p">}</span> </span></span></code></pre> </div> <h3 id="put-error-codes"> Error codes </h3> <table> <thead> <tr> <th> Code </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> unsupported_resource </td> <td> The cluster is not yet able to handle this resource type. This could happen in a partially upgraded cluster, where some of the nodes are still on a previous version. </td> </tr> <tr> <td> name_already_exists </td> <td> An object of the same type and name exists </td> </tr> <tr> <td> invalid_param </td> <td> A parameter has an illegal value </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, redis_acl was updated. </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 configuration parameters. </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 change a non-existent redis_acl. </td> </tr> <tr> <td> <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.10"> 409 Conflict </a> </td> <td> Cannot change a read-only object </td> </tr> <tr> <td> <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.2"> 501 Not Implemented </a> </td> <td> Cluster doesn't support redis_acl yet. </td> </tr> </tbody> </table> <h2 id="post-redis_acl"> Create Redis ACL </h2> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">POST /v1/redis_acls </span></span></code></pre> </div> <p> Create a new Redis ACL object. </p> <h3 id="permissions-3"> 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/#create_redis_acl"> create_redis_acl </a> </td> <td> admin </td> </tr> </tbody> </table> <h3 id="post-request"> Request </h3> <h4 id="example-http-request-3"> Example HTTP request </h4> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">POST /redis_acls </span></span></code></pre> </div> <h4 id="example-json-body-4"> 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">"name"</span><span class="p">:</span> <span class="s2">"Geo"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"acl"</span><span class="p">:</span> <span class="s2">"~* +@geo"</span> </span></span><span class="line"><span class="cl"><span class="p">}</span> </span></span></code></pre> </div> <h4 id="headers-3"> 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> Include a <a href="/docs/latest/operate/rs/7.4/references/rest-api/objects/redis_acl/"> Redis ACL object </a> in the request body. </p> <h3 id="post-response"> Response </h3> <p> Returns the newly created <a href="/docs/latest/operate/rs/7.4/references/rest-api/objects/redis_acl/"> Redis ACL object </a> . </p> <h4 id="example-json-body-5"> 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="mi">17</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">"Geo"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"acl"</span><span class="p">:</span> <span class="s2">"~* +@geo"</span> </span></span><span class="line"><span class="cl"><span class="p">}</span> </span></span></code></pre> </div> <h3 id="post-error-codes"> Error codes </h3> <p> Possible <code> error_code </code> values: </p> <table> <thead> <tr> <th> Code </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> unsupported_resource </td> <td> The cluster is not yet able to handle this resource type. This could happen in a partially upgraded cluster, where some of the nodes are still on a previous version. </td> </tr> <tr> <td> name_already_exists </td> <td> An object of the same type and name exists </td> </tr> <tr> <td> missing_field </td> <td> A needed field is missing </td> </tr> <tr> <td> invalid_param </td> <td> A parameter has an illegal value </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, redis_acl is created. </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 configuration parameters. </td> </tr> <tr> <td> <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.2"> 501 Not Implemented </a> </td> <td> Cluster doesn't support redis_acl yet. </td> </tr> </tbody> </table> <h3 id="examples"> Examples </h3> <h4 id="curl"> cURL </h4> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">curl -k -u <span class="s2">"[username]:[password]"</span> -X POST <span class="se">\ </span></span></span><span class="line"><span class="cl"><span class="se"></span> -H <span class="s1">'Content-Type: application/json'</span> <span class="se">\ </span></span></span><span class="line"><span class="cl"><span class="se"></span> -d <span class="s1">'{ "name": "Geo", "acl": "~* +@geo" }'</span> <span class="se">\ </span></span></span><span class="line"><span class="cl"><span class="se"></span> https://<span class="o">[</span>host<span class="o">][</span>:port<span class="o">]</span>/v1/redis_acls </span></span></code></pre> </div> <h4 id="python"> Python </h4> <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">requests</span> </span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">json</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="n">url</span> <span class="o">=</span> <span class="s2">"https://[host][:port]/v1/redis_acls"</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="n">headers</span> <span class="o">=</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="s1">'Content-Type'</span><span class="p">:</span> <span class="s1">'application/json'</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">payload</span> <span class="o">=</span> <span class="n">json</span><span class="o">.</span><span class="n">dumps</span><span class="p">({</span> </span></span><span class="line"><span class="cl"> <span class="s2">"name"</span><span class="p">:</span> <span class="s2">"Geo"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s2">"acl"</span><span class="p">:</span> <span class="s2">"~* +@geo"</span> </span></span><span class="line"><span class="cl"><span class="p">})</span> </span></span><span class="line"><span class="cl"><span class="n">auth</span><span class="o">=</span><span class="p">(</span><span class="s2">"[username]"</span><span class="p">,</span> <span class="s2">"[password]"</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="n">response</span> <span class="o">=</span> <span class="n">requests</span><span class="o">.</span><span class="n">request</span><span class="p">(</span><span class="s2">"POST"</span><span class="p">,</span> <span class="n">url</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="n">auth</span><span class="o">=</span><span class="n">auth</span><span class="p">,</span> <span class="n">headers</span><span class="o">=</span><span class="n">headers</span><span class="p">,</span> <span class="n">payload</span><span class="o">=</span><span class="n">payload</span><span class="p">,</span> <span class="n">verify</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="nb">print</span><span class="p">(</span><span class="n">response</span><span class="o">.</span><span class="n">text</span><span class="p">)</span> </span></span></code></pre> </div> <h2 id="delete-redis_acl"> Delete Redis ACL </h2> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">DELETE /v1/redis_acls/<span class="o">{</span>int: uid<span class="o">}</span> </span></span></code></pre> </div> <p> Delete a Redis ACL object. </p> <h3 id="permissions-4"> 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/#delete_redis_acl"> delete_redis_acl </a> </td> <td> admin </td> </tr> </tbody> </table> <h3 id="delete-request"> Request </h3> <h4 id="example-http-request-4"> Example HTTP request </h4> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">DELETE /redis_acls/1 </span></span></code></pre> </div> <h4 id="headers-4"> 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> The redis_acl unique ID. </td> </tr> </tbody> </table> <h3 id="delete-response"> Response </h3> <p> Returns a status code that indicates the Redis ACL deletion success or failure. </p> <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, the redis_acl is deleted. </td> </tr> <tr> <td> <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.7"> 406 Not Acceptable </a> </td> <td> The request is not acceptable. </td> </tr> <tr> <td> <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.10"> 409 Conflict </a> </td> <td> Cannot delete a read-only object </td> </tr> <tr> <td> <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.2"> 501 Not Implemented </a> </td> <td> Cluster doesn't support redis_acl yet. </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/redis_acls/"/> <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/modules/config/.html
<section class="prose w-full py-12 max-w-none"> <h1> Configure module requests </h1> <p class="text-lg -mt-5 mb-10"> Configure module requests </p> <table> <thead> <tr> <th> Method </th> <th> Path </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> <a href="#post-modules-config-bdb"> POST </a> </td> <td> <code> /v1/modules/config/bdb/{uid} </code> </td> <td> Configure module </td> </tr> </tbody> </table> <h2 id="post-modules-config-bdb"> Configure module </h2> <pre><code>POST /v1/modules/config/bdb/{string: uid} </code></pre> <p> Use the module runtime configuration command (if defined) to configure new arguments for the module. </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/#edit_bdb_module"> edit_bdb_module </a> </td> </tr> </tbody> </table> <h3 id="post-request"> Request </h3> <h4 id="example-http-request"> Example HTTP request </h4> <pre><code>POST /modules/config/bdb/1 </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">"modules"</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">"module_name"</span><span class="p">:</span> <span class="s2">"search"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"module_args"</span><span class="p">:</span> <span class="s2">"MINPREFIX 3 MAXEXPANSIONS 1000"</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> <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> <table> <thead> <tr> <th> Field </th> <th> Type </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> modules </td> <td> list of JSON objects </td> <td> List of modules (module_name) and their new configuration settings (module_args) </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 </td> </tr> <tr> <td> module_args </td> <td> string </td> <td> Module command line arguments (pattern does not allow special characters &amp;,&lt;,&gt;,”) </td> </tr> </tbody> </table> <h3 id="post-response"> Response </h3> <p> Returns a status code. If an error occurs, the response body may include an error code and message with more details. </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> field 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> db_not_exist </td> <td> Database with given UID doesn't exist in cluster </td> </tr> <tr> <td> missing_field </td> <td> "module_name" or "module_args" are not defined in request </td> </tr> <tr> <td> invalid_schema </td> <td> JSON object received is not a dict object </td> </tr> <tr> <td> param_error </td> <td> "module_args" parameter was not parsed properly </td> </tr> <tr> <td> module_not_exist </td> <td> Module with given "module_name" does not exist for the database </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, module updated on bdb. </td> </tr> <tr> <td> <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5"> 404 Not Found </a> </td> <td> bdb not found. </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 configuration parameters. </td> </tr> <tr> <td> <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.7"> 406 Not Acceptable </a> </td> <td> Module does not support runtime configuration of arguments. </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/modules/config/"/> <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/release-notes/previous-releases/k8s-5-4-14-2/.html
<section class="prose w-full py-12 max-w-none"> <h1> Redis Enterprise for Kubernetes Release Notes 5.4.14-2 (March 2020) </h1> <p class="text-lg -mt-5 mb-10"> Support for Redis Enterprise Software 5.4.14, K8s 1.16, and OpenShift 4.3. </p> <h2 id="overview"> Overview </h2> <p> The Redis Enterprise K8s 5.4.14-2 release is a maintenance release providing support for the latest Redis Enterprise Software release 5.4.14 and includes bug fixes as well as the following notable changes: </p> <h3 id="support-for-k8s-116"> Support for K8s 1.16 </h3> <p> This release now correctly handles the API deprecations, and API version changes that K8s release 1.16 introduced. </p> <h3 id="support-for-openshift-43-improved-olm-support"> Support for OpenShift 4.3; improved OLM support </h3> <p> The release now supports OpenShift 4.3. A new operator version is now available in OpenShift's Operator Hub and now includes a more comprehensive base template as well as references to documentation and support. </p> <h3 id="changes-to-the-upgrade-process"> Changes to the upgrade process </h3> <p> When the Operator is upgraded to a new release, it now prevents the Redis Enterprise Cluster nodes from being automatically upgraded, unless autoUpgrade is enabled or the RS image version is explicitly updated in the Redis Enterprise Cluster (REC) spec. The change was introduced to avoid situations where an Operator upgrade initiated a rolling update to the cluster nodes' StatefulSet. </p> <h3 id="deprecated-support-for-k8s-versions-19110"> Deprecated support for K8s versions 1.9/1.10 </h3> <p> This release deprecates support for K8s version 1.9/1.10 and OpenShift 3.9. If you are currently using these releases please contact Redis support for information about migrating to a new K8s release. </p> <h3 id="coming-soon"> Coming soon </h3> <ul> <li> The Database Custom Resource(CR), which represents Redis Enterprise databases, is in development and planned to be part of an upcoming release. The Database Controller for the Database CR is part of the Redis Enterprise K8s Operator. It is disabled in this release. </li> <li> The next release is planned to support K8s 1.17 and drop support for K8s versions 1.9/1.10. </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/kubernetes/release-notes/previous-releases/k8s-5-4-14-2/"/> <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/bgrewriteaof/.html
<section class="prose w-full py-12"> <h1 class="command-name"> BGREWRITEAOF </h1> <div class="font-semibold text-redis-ink-900"> Syntax </div> <pre class="command-syntax">BGREWRITEAOF</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.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> @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> Instruct Redis to start an <a href="/docs/latest/operate/oss_and_stack/management/persistence/#append-only-file"> Append Only File </a> rewrite process. The rewrite will create a small optimized version of the current Append Only File. </p> <p> If <code> BGREWRITEAOF </code> fails, no data gets lost as the old AOF will be untouched. </p> <p> The rewrite will be only triggered by Redis if there is not already a background process doing persistence. </p> <p> Specifically: </p> <ul> <li> If a Redis child is creating a snapshot on disk, the AOF rewrite is <em> scheduled </em> but not started until the saving child producing the RDB file terminates. In this case the <code> BGREWRITEAOF </code> will still return a positive status reply, but with an appropriate message. You can check if an AOF rewrite is scheduled looking at the <a href="/docs/latest/commands/info/"> <code> INFO </code> </a> command as of Redis 2.6 or successive versions. </li> <li> If an AOF rewrite is already in progress the command returns an error and no AOF rewrite will be scheduled for a later time. </li> <li> If the AOF rewrite could start, but the attempt at starting it fails (for instance because of an error in creating the child process), an error is returned to the caller. </li> </ul> <p> Since Redis 2.4 the AOF rewrite is automatically triggered by Redis, however the <code> BGREWRITEAOF </code> command can be used to trigger a rewrite at any time. </p> <p> See the <a href="/docs/latest/operate/oss_and_stack/management/persistence/"> persistence documentation </a> for detailed information. </p> <h2 id="resp2-reply"> RESP2 Reply </h2> <p> <a href="../../develop/reference/protocol-spec#simple-strings"> Simple string reply </a> : a simple string reply indicating that the rewriting started or is about to start ASAP when the call is executed with success. </p> <p> The command may reply with an error in certain cases, as documented above. </p> <h2 id="resp3-reply"> RESP3 Reply </h2> <p> <a href="../../develop/reference/protocol-spec#bulk-strings"> Bulk string reply </a> : a simple string reply indicating that the rewriting started or is about to start ASAP when the call is executed with success. </p> <p> The command may reply with an error in certain cases, as documented above. </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/bgrewriteaof/"/> <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/management/sentinel/.html
<section class="prose w-full py-12 max-w-none"> <h1> High availability with Redis Sentinel </h1> <p class="text-lg -mt-5 mb-10"> High availability for non-clustered Redis </p> <p> Redis Sentinel provides high availability for Redis when not using <a href="/docs/latest/operate/oss_and_stack/management/scaling/"> Redis Cluster </a> . </p> <p> Redis Sentinel also provides other collateral tasks such as monitoring, notifications and acts as a configuration provider for clients. </p> <p> This is the full list of Sentinel capabilities at a macroscopic level (i.e. the <em> big picture </em> ): </p> <ul> <li> <strong> Monitoring </strong> . Sentinel constantly checks if your master and replica instances are working as expected. </li> <li> <strong> Notification </strong> . Sentinel can notify the system administrator, or other computer programs, via an API, that something is wrong with one of the monitored Redis instances. </li> <li> <strong> Automatic failover </strong> . If a master is not working as expected, Sentinel can start a failover process where a replica is promoted to master, the other additional replicas are reconfigured to use the new master, and the applications using the Redis server are informed about the new address to use when connecting. </li> <li> <strong> Configuration provider </strong> . Sentinel acts as a source of authority for clients service discovery: clients connect to Sentinels in order to ask for the address of the current Redis master responsible for a given service. If a failover occurs, Sentinels will report the new address. </li> </ul> <h2 id="sentinel-as-a-distributed-system"> Sentinel as a distributed system </h2> <p> Redis Sentinel is a distributed system: </p> <p> Sentinel itself is designed to run in a configuration where there are multiple Sentinel processes cooperating together. The advantage of having multiple Sentinel processes cooperating are the following: </p> <ol> <li> Failure detection is performed when multiple Sentinels agree about the fact a given master is no longer available. This lowers the probability of false positives. </li> <li> Sentinel works even if not all the Sentinel processes are working, making the system robust against failures. There is no fun in having a failover system which is itself a single point of failure, after all. </li> </ol> <p> The sum of Sentinels, Redis instances (masters and replicas) and clients connecting to Sentinel and Redis, are also a larger distributed system with specific properties. In this document concepts will be introduced gradually starting from basic information needed in order to understand the basic properties of Sentinel, to more complex information (that are optional) in order to understand how exactly Sentinel works. </p> <h2 id="sentinel-quick-start"> Sentinel quick start </h2> <h3 id="obtaining-sentinel"> Obtaining Sentinel </h3> <p> The current version of Sentinel is called <strong> Sentinel 2 </strong> . It is a rewrite of the initial Sentinel implementation using stronger and simpler-to-predict algorithms (that are explained in this documentation). </p> <p> A stable release of Redis Sentinel is shipped since Redis 2.8. </p> <p> New developments are performed in the <em> unstable </em> branch, and new features sometimes are back ported into the latest stable branch as soon as they are considered to be stable. </p> <p> Redis Sentinel version 1, shipped with Redis 2.6, is deprecated and should not be used. </p> <h3 id="running-sentinel"> Running Sentinel </h3> <p> If you are using the <code> redis-sentinel </code> executable (or if you have a symbolic link with that name to the <code> redis-server </code> executable) you can run Sentinel with the following command line: </p> <pre><code>redis-sentinel /path/to/sentinel.conf </code></pre> <p> Otherwise you can use directly the <code> redis-server </code> executable starting it in Sentinel mode: </p> <pre><code>redis-server /path/to/sentinel.conf --sentinel </code></pre> <p> Both ways work the same. </p> <p> However <strong> it is mandatory </strong> to use a configuration file when running Sentinel, as this file will be used by the system in order to save the current state that will be reloaded in case of restarts. Sentinel will simply refuse to start if no configuration file is given or if the configuration file path is not writable. </p> <p> Sentinels by default run <strong> listening for connections to TCP port 26379 </strong> , so for Sentinels to work, port 26379 of your servers <strong> must be open </strong> to receive connections from the IP addresses of the other Sentinel instances. Otherwise Sentinels can't talk and can't agree about what to do, so failover will never be performed. </p> <h3 id="fundamental-things-to-know-about-sentinel-before-deploying"> Fundamental things to know about Sentinel before deploying </h3> <ol> <li> You need at least three Sentinel instances for a robust deployment. </li> <li> The three Sentinel instances should be placed into computers or virtual machines that are believed to fail in an independent way. So for example different physical servers or Virtual Machines executed on different availability zones. </li> <li> Sentinel + Redis distributed system does not guarantee that acknowledged writes are retained during failures, since Redis uses asynchronous replication. However there are ways to deploy Sentinel that make the window to lose writes limited to certain moments, while there are other less secure ways to deploy it. </li> <li> You need Sentinel support in your clients. Popular client libraries have Sentinel support, but not all. </li> <li> There is no HA setup which is safe if you don't test from time to time in development environments, or even better if you can, in production environments, if they work. You may have a misconfiguration that will become apparent only when it's too late (at 3am when your master stops working). </li> <li> <strong> Sentinel, Docker, or other forms of Network Address Translation or Port Mapping should be mixed with care </strong> : Docker performs port remapping, breaking Sentinel auto discovery of other Sentinel processes and the list of replicas for a master. Check the <a href="#sentinel-docker-nat-and-possible-issues"> section about <em> Sentinel and Docker </em> </a> later in this document for more information. </li> </ol> <h3 id="configuring-sentinel"> Configuring Sentinel </h3> <p> The Redis source distribution contains a file called <code> sentinel.conf </code> that is a self-documented example configuration file you can use to configure Sentinel, however a typical minimal configuration file looks like the following: </p> <pre><code>sentinel monitor mymaster 127.0.0.1 6379 2 sentinel down-after-milliseconds mymaster 60000 sentinel failover-timeout mymaster 180000 sentinel parallel-syncs mymaster 1 sentinel monitor resque 192.168.1.3 6380 4 sentinel down-after-milliseconds resque 10000 sentinel failover-timeout resque 180000 sentinel parallel-syncs resque 5 </code></pre> <p> You only need to specify the masters to monitor, giving to each separated master (that may have any number of replicas) a different name. There is no need to specify replicas, which are auto-discovered. Sentinel will update the configuration automatically with additional information about replicas (in order to retain the information in case of restart). The configuration is also rewritten every time a replica is promoted to master during a failover and every time a new Sentinel is discovered. </p> <p> The example configuration above basically monitors two sets of Redis instances, each composed of a master and an undefined number of replicas. One set of instances is called <code> mymaster </code> , and the other <code> resque </code> . </p> <p> The meaning of the arguments of <code> sentinel monitor </code> statements is the following: </p> <pre><code>sentinel monitor &lt;master-name&gt; &lt;ip&gt; &lt;port&gt; &lt;quorum&gt; </code></pre> <p> For the sake of clarity, let's check line by line what the configuration options mean: </p> <p> The first line is used to tell Redis to monitor a master called <em> mymaster </em> , that is at address 127.0.0.1 and port 6379, with a quorum of 2. Everything is pretty obvious but the <strong> quorum </strong> argument: </p> <ul> <li> The <strong> quorum </strong> is the number of Sentinels that need to agree about the fact the master is not reachable, in order to really mark the master as failing, and eventually start a failover procedure if possible. </li> <li> However <strong> the quorum is only used to detect the failure </strong> . In order to actually perform a failover, one of the Sentinels need to be elected leader for the failover and be authorized to proceed. This only happens with the vote of the <strong> majority of the Sentinel processes </strong> . </li> </ul> <p> So for example if you have 5 Sentinel processes, and the quorum for a given master set to the value of 2, this is what happens: </p> <ul> <li> If two Sentinels agree at the same time about the master being unreachable, one of the two will try to start a failover. </li> <li> If there are at least a total of three Sentinels reachable, the failover will be authorized and will actually start. </li> </ul> <p> In practical terms this means during failures <strong> Sentinel never starts a failover if the majority of Sentinel processes are unable to talk </strong> (aka no failover in the minority partition). </p> <h3 id="other-sentinel-options"> Other Sentinel options </h3> <p> The other options are almost always in the form: </p> <pre><code>sentinel &lt;option_name&gt; &lt;master_name&gt; &lt;option_value&gt; </code></pre> <p> And are used for the following purposes: </p> <ul> <li> <code> down-after-milliseconds </code> is the time in milliseconds an instance should not be reachable (either does not reply to our PINGs or it is replying with an error) for a Sentinel starting to think it is down. </li> <li> <code> parallel-syncs </code> sets the number of replicas that can be reconfigured to use the new master after a failover at the same time. The lower the number, the more time it will take for the failover process to complete, however if the replicas are configured to serve old data, you may not want all the replicas to re-synchronize with the master at the same time. While the replication process is mostly non blocking for a replica, there is a moment when it stops to load the bulk data from the master. You may want to make sure only one replica at a time is not reachable by setting this option to the value of 1. </li> </ul> <p> Additional options are described in the rest of this document and documented in the example <code> sentinel.conf </code> file shipped with the Redis distribution. </p> <p> Configuration parameters can be modified at runtime: </p> <ul> <li> Master-specific configuration parameters are modified using <code> SENTINEL SET </code> . </li> <li> Global configuration parameters are modified using <code> SENTINEL CONFIG SET </code> . </li> </ul> <p> See the <a href="#reconfiguring-sentinel-at-runtime"> <em> Reconfiguring Sentinel at runtime </em> section </a> for more information. </p> <h3 id="example-sentinel-deployments"> Example Sentinel deployments </h3> <p> Now that you know the basic information about Sentinel, you may wonder where you should place your Sentinel processes, how many Sentinel processes you need and so forth. This section shows a few example deployments. </p> <p> We use ASCII art in order to show you configuration examples in a <em> graphical </em> format, this is what the different symbols means: </p> <pre><code>+--------------------+ | This is a computer | | or VM that fails | | independently. We | | call it a "box" | +--------------------+ </code></pre> <p> We write inside the boxes what they are running: </p> <pre><code>+-------------------+ | Redis master M1 | | Redis Sentinel S1 | +-------------------+ </code></pre> <p> Different boxes are connected by lines, to show that they are able to talk: </p> <pre><code>+-------------+ +-------------+ | Sentinel S1 |---------------| Sentinel S2 | +-------------+ +-------------+ </code></pre> <p> Network partitions are shown as interrupted lines using slashes: </p> <pre><code>+-------------+ +-------------+ | Sentinel S1 |------ // ------| Sentinel S2 | +-------------+ +-------------+ </code></pre> <p> Also note that: </p> <ul> <li> Masters are called M1, M2, M3, ..., Mn. </li> <li> Replicas are called R1, R2, R3, ..., Rn (R stands for <em> replica </em> ). </li> <li> Sentinels are called S1, S2, S3, ..., Sn. </li> <li> Clients are called C1, C2, C3, ..., Cn. </li> <li> When an instance changes role because of Sentinel actions, we put it inside square brackets, so [M1] means an instance that is now a master because of Sentinel intervention. </li> </ul> <p> Note that we will never show <strong> setups where just two Sentinels are used </strong> , since Sentinels always need <strong> to talk with the majority </strong> in order to start a failover. </p> <h4 id="example-1-just-two-sentinels-dont-do-this"> Example 1: just two Sentinels, DON'T DO THIS </h4> <pre><code>+----+ +----+ | M1 |---------| R1 | | S1 | | S2 | +----+ +----+ Configuration: quorum = 1 </code></pre> <ul> <li> In this setup, if the master M1 fails, R1 will be promoted since the two Sentinels can reach agreement about the failure (obviously with quorum set to 1) and can also authorize a failover because the majority is two. So apparently it could superficially work, however check the next points to see why this setup is broken. </li> <li> If the box where M1 is running stops working, also S1 stops working. The Sentinel running in the other box S2 will not be able to authorize a failover, so the system will become not available. </li> </ul> <p> Note that a majority is needed in order to order different failovers, and later propagate the latest configuration to all the Sentinels. Also note that the ability to failover in a single side of the above setup, without any agreement, would be very dangerous: </p> <pre><code>+----+ +------+ | M1 |----//-----| [M1] | | S1 | | S2 | +----+ +------+ </code></pre> <p> In the above configuration we created two masters (assuming S2 could failover without authorization) in a perfectly symmetrical way. Clients may write indefinitely to both sides, and there is no way to understand when the partition heals what configuration is the right one, in order to prevent a <em> permanent split brain condition </em> . </p> <p> So please <strong> deploy at least three Sentinels in three different boxes </strong> always. </p> <h4 id="example-2-basic-setup-with-three-boxes"> Example 2: basic setup with three boxes </h4> <p> This is a very simple setup, that has the advantage to be simple to tune for additional safety. It is based on three boxes, each box running both a Redis process and a Sentinel process. </p> <pre><code> +----+ | M1 | | S1 | +----+ | +----+ | +----+ | R2 |----+----| R3 | | S2 | | S3 | +----+ +----+ Configuration: quorum = 2 </code></pre> <p> If the master M1 fails, S2 and S3 will agree about the failure and will be able to authorize a failover, making clients able to continue. </p> <p> In every Sentinel setup, as Redis uses asynchronous replication, there is always the risk of losing some writes because a given acknowledged write may not be able to reach the replica which is promoted to master. However in the above setup there is a higher risk due to clients being partitioned away with an old master, like in the following picture: </p> <pre><code> +----+ | M1 | | S1 | &lt;- C1 (writes will be lost) +----+ | / / +------+ | +----+ | [M2] |----+----| R3 | | S2 | | S3 | +------+ +----+ </code></pre> <p> In this case a network partition isolated the old master M1, so the replica R2 is promoted to master. However clients, like C1, that are in the same partition as the old master, may continue to write data to the old master. This data will be lost forever since when the partition will heal, the master will be reconfigured as a replica of the new master, discarding its data set. </p> <p> This problem can be mitigated using the following Redis replication feature, that allows to stop accepting writes if a master detects that it is no longer able to transfer its writes to the specified number of replicas. </p> <pre><code>min-replicas-to-write 1 min-replicas-max-lag 10 </code></pre> <p> With the above configuration (please see the self-commented <code> redis.conf </code> example in the Redis distribution for more information) a Redis instance, when acting as a master, will stop accepting writes if it can't write to at least 1 replica. Since replication is asynchronous <em> not being able to write </em> actually means that the replica is either disconnected, or is not sending us asynchronous acknowledges for more than the specified <code> max-lag </code> number of seconds. </p> <p> Using this configuration, the old Redis master M1 in the above example, will become unavailable after 10 seconds. When the partition heals, the Sentinel configuration will converge to the new one, the client C1 will be able to fetch a valid configuration and will continue with the new master. </p> <p> However there is no free lunch. With this refinement, if the two replicas are down, the master will stop accepting writes. It's a trade off. </p> <h4 id="example-3-sentinel-in-the-client-boxes"> Example 3: Sentinel in the client boxes </h4> <p> Sometimes we have only two Redis boxes available, one for the master and one for the replica. The configuration in the example 2 is not viable in that case, so we can resort to the following, where Sentinels are placed where clients are: </p> <pre><code> +----+ +----+ | M1 |----+----| R1 | | | | | | +----+ | +----+ | +------------+------------+ | | | | | | +----+ +----+ +----+ | C1 | | C2 | | C3 | | S1 | | S2 | | S3 | +----+ +----+ +----+ Configuration: quorum = 2 </code></pre> <p> In this setup, the point of view Sentinels is the same as the clients: if a master is reachable by the majority of the clients, it is fine. C1, C2, C3 here are generic clients, it does not mean that C1 identifies a single client connected to Redis. It is more likely something like an application server, a Rails app, or something like that. </p> <p> If the box where M1 and S1 are running fails, the failover will happen without issues, however it is easy to see that different network partitions will result in different behaviors. For example Sentinel will not be able to setup if the network between the clients and the Redis servers is disconnected, since the Redis master and replica will both be unavailable. </p> <p> Note that if C3 gets partitioned with M1 (hardly possible with the network described above, but more likely possible with different layouts, or because of failures at the software layer), we have a similar issue as described in Example 2, with the difference that here we have no way to break the symmetry, since there is just a replica and master, so the master can't stop accepting queries when it is disconnected from its replica, otherwise the master would never be available during replica failures. </p> <p> So this is a valid setup but the setup in the Example 2 has advantages such as the HA system of Redis running in the same boxes as Redis itself which may be simpler to manage, and the ability to put a bound on the amount of time a master in the minority partition can receive writes. </p> <h4 id="example-4-sentinel-client-side-with-less-than-three-clients"> Example 4: Sentinel client side with less than three clients </h4> <p> The setup described in the Example 3 cannot be used if there are less than three boxes in the client side (for example three web servers). In this case we need to resort to a mixed setup like the following: </p> <pre><code> +----+ +----+ | M1 |----+----| R1 | | S1 | | | S2 | +----+ | +----+ | +------+-----+ | | | | +----+ +----+ | C1 | | C2 | | S3 | | S4 | +----+ +----+ Configuration: quorum = 3 </code></pre> <p> This is similar to the setup in Example 3, but here we run four Sentinels in the four boxes we have available. If the master M1 becomes unavailable the other three Sentinels will perform the failover. </p> <p> In theory this setup works removing the box where C2 and S4 are running, and setting the quorum to 2. However it is unlikely that we want HA in the Redis side without having high availability in our application layer. </p> <h3 id="sentinel-docker-nat-and-possible-issues"> Sentinel, Docker, NAT, and possible issues </h3> <p> Docker uses a technique called port mapping: programs running inside Docker containers may be exposed with a different port compared to the one the program believes to be using. This is useful in order to run multiple containers using the same ports, at the same time, in the same server. </p> <p> Docker is not the only software system where this happens, there are other Network Address Translation setups where ports may be remapped, and sometimes not ports but also IP addresses. </p> <p> Remapping ports and addresses creates issues with Sentinel in two ways: </p> <ol> <li> Sentinel auto-discovery of other Sentinels no longer works, since it is based on <em> hello </em> messages where each Sentinel announce at which port and IP address they are listening for connection. However Sentinels have no way to understand that an address or port is remapped, so it is announcing an information that is not correct for other Sentinels to connect. </li> <li> Replicas are listed in the <a href="/commands/info"> <code> INFO </code> </a> output of a Redis master in a similar way: the address is detected by the master checking the remote peer of the TCP connection, while the port is advertised by the replica itself during the handshake, however the port may be wrong for the same reason as exposed in point 1. </li> </ol> <p> Since Sentinels auto detect replicas using masters <a href="/commands/info"> <code> INFO </code> </a> output information, the detected replicas will not be reachable, and Sentinel will never be able to failover the master, since there are no good replicas from the point of view of the system, so there is currently no way to monitor with Sentinel a set of master and replica instances deployed with Docker, <strong> unless you instruct Docker to map the port 1:1 </strong> . </p> <p> For the first problem, in case you want to run a set of Sentinel instances using Docker with forwarded ports (or any other NAT setup where ports are remapped), you can use the following two Sentinel configuration directives in order to force Sentinel to announce a specific set of IP and port: </p> <pre><code>sentinel announce-ip &lt;ip&gt; sentinel announce-port &lt;port&gt; </code></pre> <p> Note that Docker has the ability to run in <em> host networking mode </em> (check the <code> --net=host </code> option for more information). This should create no issues since ports are not remapped in this setup. </p> <h3 id="ip-addresses-and-dns-names"> IP Addresses and DNS names </h3> <p> Older versions of Sentinel did not support host names and required IP addresses to be specified everywhere. Starting with version 6.2, Sentinel has <em> optional </em> support for host names. </p> <p> <strong> This capability is disabled by default. If you're going to enable DNS/hostnames support, please note: </strong> </p> <ol> <li> The name resolution configuration on your Redis and Sentinel nodes must be reliable and be able to resolve addresses quickly. Unexpected delays in address resolution may have a negative impact on Sentinel. </li> <li> You should use hostnames everywhere and avoid mixing hostnames and IP addresses. To do that, use <code> replica-announce-ip &lt;hostname&gt; </code> and <code> sentinel announce-ip &lt;hostname&gt; </code> for all Redis and Sentinel instances, respectively. </li> </ol> <p> Enabling the <code> resolve-hostnames </code> global configuration allows Sentinel to accept host names: </p> <ul> <li> As part of a <code> sentinel monitor </code> command </li> <li> As a replica address, if the replica uses a host name value for <code> replica-announce-ip </code> </li> </ul> <p> Sentinel will accept host names as valid inputs and resolve them, but will still refer to IP addresses when announcing an instance, updating configuration files, etc. </p> <p> Enabling the <code> announce-hostnames </code> global configuration makes Sentinel use host names instead. This affects replies to clients, values written in configuration files, the <a href="/commands/replicaof"> <code> REPLICAOF </code> </a> command issued to replicas, etc. </p> <p> This behavior may not be compatible with all Sentinel clients, that may explicitly expect an IP address. </p> <p> Using host names may be useful when clients use TLS to connect to instances and require a name rather than an IP address in order to perform certificate ASN matching. </p> <h2 id="a-quick-tutorial"> A quick tutorial </h2> <p> In the next sections of this document, all the details about <a href="#sentinel-api"> <em> Sentinel API </em> </a> , configuration and semantics will be covered incrementally. However for people that want to play with the system ASAP, this section is a tutorial that shows how to configure and interact with 3 Sentinel instances. </p> <p> Here we assume that the instances are executed at port 5000, 5001, 5002. We also assume that you have a running Redis master at port 6379 with a replica running at port 6380. We will use the IPv4 loopback address 127.0.0.1 everywhere during the tutorial, assuming you are running the simulation on your personal computer. </p> <p> The three Sentinel configuration files should look like the following: </p> <pre><code>port 5000 sentinel monitor mymaster 127.0.0.1 6379 2 sentinel down-after-milliseconds mymaster 5000 sentinel failover-timeout mymaster 60000 sentinel parallel-syncs mymaster 1 </code></pre> <p> The other two configuration files will be identical but using 5001 and 5002 as port numbers. </p> <p> A few things to note about the above configuration: </p> <ul> <li> The master set is called <code> mymaster </code> . It identifies the master and its replicas. Since each <em> master set </em> has a different name, Sentinel can monitor different sets of masters and replicas at the same time. </li> <li> The quorum was set to the value of 2 (last argument of <code> sentinel monitor </code> configuration directive). </li> <li> The <code> down-after-milliseconds </code> value is 5000 milliseconds, that is 5 seconds, so masters will be detected as failing as soon as we don't receive any reply from our pings within this amount of time. </li> </ul> <p> Once you start the three Sentinels, you'll see a few messages they log, like: </p> <pre><code>+monitor master mymaster 127.0.0.1 6379 quorum 2 </code></pre> <p> This is a Sentinel event, and you can receive this kind of events via Pub/Sub if you <a href="/commands/subscribe"> <code> SUBSCRIBE </code> </a> to the event name as specified later in <a href="#pubsub-messages"> <em> Pub/Sub Messages </em> section </a> . </p> <p> Sentinel generates and logs different events during failure detection and failover. </p> <h2 id="asking-sentinel-about-the-state-of-a-master"> Asking Sentinel about the state of a master </h2> <p> The most obvious thing to do with Sentinel to get started, is check if the master it is monitoring is doing well: </p> <pre><code>$ redis-cli -p 5000 127.0.0.1:5000&gt; sentinel master mymaster 1) "name" 2) "mymaster" 3) "ip" 4) "127.0.0.1" 5) "port" 6) "6379" 7) "runid" 8) "953ae6a589449c13ddefaee3538d356d287f509b" 9) "flags" 10) "master" 11) "link-pending-commands" 12) "0" 13) "link-refcount" 14) "1" 15) "last-ping-sent" 16) "0" 17) "last-ok-ping-reply" 18) "735" 19) "last-ping-reply" 20) "735" 21) "down-after-milliseconds" 22) "5000" 23) "info-refresh" 24) "126" 25) "role-reported" 26) "master" 27) "role-reported-time" 28) "532439" 29) "config-epoch" 30) "1" 31) "num-slaves" 32) "1" 33) "num-other-sentinels" 34) "2" 35) "quorum" 36) "2" 37) "failover-timeout" 38) "60000" 39) "parallel-syncs" 40) "1" </code></pre> <p> As you can see, it prints a number of information about the master. There are a few that are of particular interest for us: </p> <ol> <li> <code> num-other-sentinels </code> is 2, so we know the Sentinel already detected two more Sentinels for this master. If you check the logs you'll see the <code> +sentinel </code> events generated. </li> <li> <code> flags </code> is just <code> master </code> . If the master was down we could expect to see <code> s_down </code> or <code> o_down </code> flag as well here. </li> <li> <code> num-slaves </code> is correctly set to 1, so Sentinel also detected that there is an attached replica to our master. </li> </ol> <p> In order to explore more about this instance, you may want to try the following two commands: </p> <pre><code>SENTINEL replicas mymaster SENTINEL sentinels mymaster </code></pre> <p> The first will provide similar information about the replicas connected to the master, and the second about the other Sentinels. </p> <h2 id="obtaining-the-address-of-the-current-master"> Obtaining the address of the current master </h2> <p> As we already specified, Sentinel also acts as a configuration provider for clients that want to connect to a set of master and replicas. Because of possible failovers or reconfigurations, clients have no idea about who is the currently active master for a given set of instances, so Sentinel exports an API to ask this question: </p> <pre><code>127.0.0.1:5000&gt; SENTINEL get-master-addr-by-name mymaster 1) "127.0.0.1" 2) "6379" </code></pre> <h3 id="testing-the-failover"> Testing the failover </h3> <p> At this point our toy Sentinel deployment is ready to be tested. We can just kill our master and check if the configuration changes. To do so we can just do: </p> <pre><code>redis-cli -p 6379 DEBUG sleep 30 </code></pre> <p> This command will make our master no longer reachable, sleeping for 30 seconds. It basically simulates a master hanging for some reason. </p> <p> If you check the Sentinel logs, you should be able to see a lot of action: </p> <ol> <li> Each Sentinel detects the master is down with an <code> +sdown </code> event. </li> <li> This event is later escalated to <code> +odown </code> , which means that multiple Sentinels agree about the fact the master is not reachable. </li> <li> Sentinels vote a Sentinel that will start the first failover attempt. </li> <li> The failover happens. </li> </ol> <p> If you ask again what is the current master address for <code> mymaster </code> , eventually we should get a different reply this time: </p> <pre><code>127.0.0.1:5000&gt; SENTINEL get-master-addr-by-name mymaster 1) "127.0.0.1" 2) "6380" </code></pre> <p> So far so good... At this point you may jump to create your Sentinel deployment or can read more to understand all the Sentinel commands and internals. </p> <h2 id="sentinel-api"> Sentinel API </h2> <p> Sentinel provides an API in order to inspect its state, check the health of monitored masters and replicas, subscribe in order to receive specific notifications, and change the Sentinel configuration at run time. </p> <p> By default Sentinel runs using TCP port 26379 (note that 6379 is the normal Redis port). Sentinels accept commands using the Redis protocol, so you can use <code> redis-cli </code> or any other unmodified Redis client in order to talk with Sentinel. </p> <p> It is possible to directly query a Sentinel to check what is the state of the monitored Redis instances from its point of view, to see what other Sentinels it knows, and so forth. Alternatively, using Pub/Sub, it is possible to receive <em> push style </em> notifications from Sentinels, every time some event happens, like a failover, or an instance entering an error condition, and so forth. </p> <h3 id="sentinel-commands"> Sentinel commands </h3> <p> The <code> SENTINEL </code> command is the main API for Sentinel. The following is the list of its subcommands (minimal version is noted for where applicable): </p> <ul> <li> <strong> SENTINEL CONFIG GET <code> &lt;name&gt; </code> </strong> ( <code> &gt;= 6.2 </code> ) Get the current value of a global Sentinel configuration parameter. The specified name may be a wildcard, similar to the Redis <a href="/commands/config-get"> <code> CONFIG GET </code> </a> command. </li> <li> <strong> SENTINEL CONFIG SET <code> &lt;name&gt; </code> <code> &lt;value&gt; </code> </strong> ( <code> &gt;= 6.2 </code> ) Set the value of a global Sentinel configuration parameter. </li> <li> <strong> SENTINEL CKQUORUM <code> &lt;master name&gt; </code> </strong> Check if the current Sentinel configuration is able to reach the quorum needed to failover a master, and the majority needed to authorize the failover. This command should be used in monitoring systems to check if a Sentinel deployment is ok. </li> <li> <strong> SENTINEL FLUSHCONFIG </strong> Force Sentinel to rewrite its configuration on disk, including the current Sentinel state. Normally Sentinel rewrites the configuration every time something changes in its state (in the context of the subset of the state which is persisted on disk across restart). However sometimes it is possible that the configuration file is lost because of operation errors, disk failures, package upgrade scripts or configuration managers. In those cases a way to force Sentinel to rewrite the configuration file is handy. This command works even if the previous configuration file is completely missing. </li> <li> <strong> SENTINEL FAILOVER <code> &lt;master name&gt; </code> </strong> Force a failover as if the master was not reachable, and without asking for agreement to other Sentinels (however a new version of the configuration will be published so that the other Sentinels will update their configurations). </li> <li> <strong> SENTINEL GET-MASTER-ADDR-BY-NAME <code> &lt;master name&gt; </code> </strong> Return the ip and port number of the master with that name. If a failover is in progress or terminated successfully for this master it returns the address and port of the promoted replica. </li> <li> <strong> SENTINEL INFO-CACHE </strong> ( <code> &gt;= 3.2 </code> ) Return cached <a href="/commands/info"> <code> INFO </code> </a> output from masters and replicas. </li> <li> <strong> SENTINEL IS-MASTER-DOWN-BY-ADDR <ip> <port> <current-epoch> <runid> </runid> </current-epoch> </port> </ip> </strong> Check if the master specified by ip:port is down from current Sentinel's point of view. This command is mostly for internal use. </li> <li> <strong> SENTINEL MASTER <code> &lt;master name&gt; </code> </strong> Show the state and info of the specified master. </li> <li> <strong> SENTINEL MASTERS </strong> Show a list of monitored masters and their state. </li> <li> <strong> SENTINEL MONITOR </strong> Start Sentinel's monitoring. Refer to the <a href="#reconfiguring-sentinel-at-runtime"> <em> Reconfiguring Sentinel at Runtime </em> section </a> for more information. </li> <li> <strong> SENTINEL MYID </strong> ( <code> &gt;= 6.2 </code> ) Return the ID of the Sentinel instance. </li> <li> <strong> SENTINEL PENDING-SCRIPTS </strong> This command returns information about pending scripts. </li> <li> <strong> SENTINEL REMOVE </strong> Stop Sentinel's monitoring. Refer to the <a href="#reconfiguring-sentinel-at-runtime"> <em> Reconfiguring Sentinel at Runtime </em> section </a> for more information. </li> <li> <strong> SENTINEL REPLICAS <code> &lt;master name&gt; </code> </strong> ( <code> &gt;= 5.0 </code> ) Show a list of replicas for this master, and their state. </li> <li> <strong> SENTINEL SENTINELS <code> &lt;master name&gt; </code> </strong> Show a list of sentinel instances for this master, and their state. </li> <li> <strong> SENTINEL SET </strong> Set Sentinel's monitoring configuration. Refer to the <a href="#reconfiguring-sentinel-at-runtime"> <em> Reconfiguring Sentinel at Runtime </em> section </a> for more information. </li> <li> <strong> SENTINEL SIMULATE-FAILURE (crash-after-election|crash-after-promotion|help) </strong> ( <code> &gt;= 3.2 </code> ) This command simulates different Sentinel crash scenarios. </li> <li> <strong> SENTINEL RESET <code> &lt;pattern&gt; </code> </strong> This command will reset all the masters with matching name. The pattern argument is a glob-style pattern. The reset process clears any previous state in a master (including a failover in progress), and removes every replica and sentinel already discovered and associated with the master. </li> </ul> <p> For connection management and administration purposes, Sentinel supports the following subset of Redis' commands: </p> <ul> <li> <strong> ACL </strong> ( <code> &gt;= 6.2 </code> ) This command manages the Sentinel Access Control List. For more information refer to the <a href="/docs/latest/operate/oss_and_stack/management/security/acl/"> ACL </a> documentation page and the <a href="#sentinel-access-control-list-authentication"> <em> Sentinel Access Control List authentication </em> </a> . </li> <li> <strong> AUTH </strong> ( <code> &gt;= 5.0.1 </code> ) Authenticate a client connection. For more information refer to the <a href="/commands/auth"> <code> AUTH </code> </a> command and the <a href="#configuring-sentinel-instances-with-authentication"> <em> Configuring Sentinel instances with authentication </em> section </a> . </li> <li> <strong> CLIENT </strong> This command manages client connections. For more information refer to its subcommands' pages. </li> <li> <strong> COMMAND </strong> ( <code> &gt;= 6.2 </code> ) This command returns information about commands. For more information refer to the <a href="/commands/command"> <code> COMMAND </code> </a> command and its various subcommands. </li> <li> <strong> HELLO </strong> ( <code> &gt;= 6.0 </code> ) Switch the connection's protocol. For more information refer to the <a href="/commands/hello"> <code> HELLO </code> </a> command. </li> <li> <strong> INFO </strong> Return information and statistics about the Sentinel server. For more information see the <a href="/commands/info"> <code> INFO </code> </a> command. </li> <li> <strong> PING </strong> This command simply returns PONG. </li> <li> <strong> ROLE </strong> This command returns the string "sentinel" and a list of monitored masters. For more information refer to the <a href="/commands/role"> <code> ROLE </code> </a> command. </li> <li> <strong> SHUTDOWN </strong> Shut down the Sentinel instance. </li> </ul> <p> Lastly, Sentinel also supports the <a href="/commands/subscribe"> <code> SUBSCRIBE </code> </a> , <a href="/commands/unsubscribe"> <code> UNSUBSCRIBE </code> </a> , <a href="/commands/psubscribe"> <code> PSUBSCRIBE </code> </a> and <a href="/commands/punsubscribe"> <code> PUNSUBSCRIBE </code> </a> commands. Refer to the <a href="#pubsub-messages"> <em> Pub/Sub Messages </em> section </a> for more details. </p> <h3 id="reconfiguring-sentinel-at-runtime"> Reconfiguring Sentinel at Runtime </h3> <p> Starting with Redis version 2.8.4, Sentinel provides an API in order to add, remove, or change the configuration of a given master. Note that if you have multiple sentinels you should apply the changes to all to your instances for Redis Sentinel to work properly. This means that changing the configuration of a single Sentinel does not automatically propagate the changes to the other Sentinels in the network. </p> <p> The following is a list of <code> SENTINEL </code> subcommands used in order to update the configuration of a Sentinel instance. </p> <ul> <li> <strong> SENTINEL MONITOR <code> &lt;name&gt; </code> <code> &lt;ip&gt; </code> <code> &lt;port&gt; </code> <code> &lt;quorum&gt; </code> </strong> This command tells the Sentinel to start monitoring a new master with the specified name, ip, port, and quorum. It is identical to the <code> sentinel monitor </code> configuration directive in <code> sentinel.conf </code> configuration file, with the difference that you can't use a hostname in as <code> ip </code> , but you need to provide an IPv4 or IPv6 address. </li> <li> <strong> SENTINEL REMOVE <code> &lt;name&gt; </code> </strong> is used in order to remove the specified master: the master will no longer be monitored, and will totally be removed from the internal state of the Sentinel, so it will no longer listed by <code> SENTINEL masters </code> and so forth. </li> <li> <strong> SENTINEL SET <code> &lt;name&gt; </code> [ <code> &lt;option&gt; </code> <code> &lt;value&gt; </code> ...] </strong> The SET command is very similar to the <a href="/commands/config-set"> <code> CONFIG SET </code> </a> command of Redis, and is used in order to change configuration parameters of a specific master. Multiple option / value pairs can be specified (or none at all). All the configuration parameters that can be configured via <code> sentinel.conf </code> are also configurable using the SET command. </li> </ul> <p> The following is an example of <code> SENTINEL SET </code> command in order to modify the <code> down-after-milliseconds </code> configuration of a master called <code> objects-cache </code> : </p> <pre><code>SENTINEL SET objects-cache-master down-after-milliseconds 1000 </code></pre> <p> As already stated, <code> SENTINEL SET </code> can be used to set all the configuration parameters that are settable in the startup configuration file. Moreover it is possible to change just the master quorum configuration without removing and re-adding the master with <code> SENTINEL REMOVE </code> followed by <code> SENTINEL MONITOR </code> , but simply using: </p> <pre><code>SENTINEL SET objects-cache-master quorum 5 </code></pre> <p> Note that there is no equivalent GET command since <code> SENTINEL MASTER </code> provides all the configuration parameters in a simple to parse format (as a field/value pairs array). </p> <p> Starting with Redis version 6.2, Sentinel also allows getting and setting global configuration parameters which were only supported in the configuration file prior to that. </p> <ul> <li> <strong> SENTINEL CONFIG GET <code> &lt;name&gt; </code> </strong> Get the current value of a global Sentinel configuration parameter. The specified name may be a wildcard, similar to the Redis <a href="/commands/config-get"> <code> CONFIG GET </code> </a> command. </li> <li> <strong> SENTINEL CONFIG SET <code> &lt;name&gt; </code> <code> &lt;value&gt; </code> </strong> Set the value of a global Sentinel configuration parameter. </li> </ul> <p> Global parameters that can be manipulated include: </p> <ul> <li> <code> resolve-hostnames </code> , <code> announce-hostnames </code> . See <a href="#ip-addresses-and-dns-names"> <em> IP addresses and DNS names </em> </a> . </li> <li> <code> announce-ip </code> , <code> announce-port </code> . See <a href="#sentinel-docker-nat-and-possible-issues"> <em> Sentinel, Docker, NAT, and possible issues </em> </a> . </li> <li> <code> sentinel-user </code> , <code> sentinel-pass </code> . See <a href="#configuring-sentinel-instances-with-authentication"> <em> Configuring Sentinel instances with authentication </em> </a> . </li> </ul> <h3 id="adding-or-removing-sentinels"> Adding or removing Sentinels </h3> <p> Adding a new Sentinel to your deployment is a simple process because of the auto-discover mechanism implemented by Sentinel. All you need to do is to start the new Sentinel configured to monitor the currently active master. Within 10 seconds the Sentinel will acquire the list of other Sentinels and the set of replicas attached to the master. </p> <p> If you need to add multiple Sentinels at once, it is suggested to add it one after the other, waiting for all the other Sentinels to already know about the first one before adding the next. This is useful in order to still guarantee that majority can be achieved only in one side of a partition, in the chance failures should happen in the process of adding new Sentinels. </p> <p> This can be easily achieved by adding every new Sentinel with a 30 seconds delay, and during absence of network partitions. </p> <p> At the end of the process it is possible to use the command <code> SENTINEL MASTER mastername </code> in order to check if all the Sentinels agree about the total number of Sentinels monitoring the master. </p> <p> Removing a Sentinel is a bit more complex: <strong> Sentinels never forget already seen Sentinels </strong> , even if they are not reachable for a long time, since we don't want to dynamically change the majority needed to authorize a failover and the creation of a new configuration number. So in order to remove a Sentinel the following steps should be performed in absence of network partitions: </p> <ol> <li> Stop the Sentinel process of the Sentinel you want to remove. </li> <li> Send a <code> SENTINEL RESET * </code> command to all the other Sentinel instances (instead of <code> * </code> you can use the exact master name if you want to reset just a single master). One after the other, waiting at least 30 seconds between instances. </li> <li> Check that all the Sentinels agree about the number of Sentinels currently active, by inspecting the output of <code> SENTINEL MASTER mastername </code> of every Sentinel. </li> </ol> <h3 id="removing-the-old-master-or-unreachable-replicas"> Removing the old master or unreachable replicas </h3> <p> Sentinels never forget about replicas of a given master, even when they are unreachable for a long time. This is useful, because Sentinels should be able to correctly reconfigure a returning replica after a network partition or a failure event. </p> <p> Moreover, after a failover, the failed over master is virtually added as a replica of the new master, this way it will be reconfigured to replicate with the new master as soon as it will be available again. </p> <p> However sometimes you want to remove a replica (that may be the old master) forever from the list of replicas monitored by Sentinels. </p> <p> In order to do this, you need to send a <code> SENTINEL RESET mastername </code> command to all the Sentinels: they'll refresh the list of replicas within the next 10 seconds, only adding the ones listed as correctly replicating from the current master <a href="/commands/info"> <code> INFO </code> </a> output. </p> <h3 id="pubsub-messages"> Pub/Sub messages </h3> <p> A client can use a Sentinel as a Redis-compatible Pub/Sub server (but you can't use <a href="/commands/publish"> <code> PUBLISH </code> </a> ) in order to <a href="/commands/subscribe"> <code> SUBSCRIBE </code> </a> or <a href="/commands/psubscribe"> <code> PSUBSCRIBE </code> </a> to channels and get notified about specific events. </p> <p> The channel name is the same as the name of the event. For instance the channel named <code> +sdown </code> will receive all the notifications related to instances entering an <code> SDOWN </code> (SDOWN means the instance is no longer reachable from the point of view of the Sentinel you are querying) condition. </p> <p> To get all the messages simply subscribe using <code> PSUBSCRIBE * </code> . </p> <p> The following is a list of channels and message formats you can receive using this API. The first word is the channel / event name, the rest is the format of the data. </p> <p> Note: where <em> instance details </em> is specified it means that the following arguments are provided to identify the target instance: </p> <pre><code>&lt;instance-type&gt; &lt;name&gt; &lt;ip&gt; &lt;port&gt; @ &lt;master-name&gt; &lt;master-ip&gt; &lt;master-port&gt; </code></pre> <p> The part identifying the master (from the @ argument to the end) is optional and is only specified if the instance is not a master itself. </p> <ul> <li> <strong> +reset-master </strong> <code> &lt;instance details&gt; </code> -- The master was reset. </li> <li> <strong> +slave </strong> <code> &lt;instance details&gt; </code> -- A new replica was detected and attached. </li> <li> <strong> +failover-state-reconf-slaves </strong> <code> &lt;instance details&gt; </code> -- Failover state changed to <code> reconf-slaves </code> state. </li> <li> <strong> +failover-detected </strong> <code> &lt;instance details&gt; </code> -- A failover started by another Sentinel or any other external entity was detected (An attached replica turned into a master). </li> <li> <strong> +slave-reconf-sent </strong> <code> &lt;instance details&gt; </code> -- The leader sentinel sent the <a href="/commands/replicaof"> <code> REPLICAOF </code> </a> command to this instance in order to reconfigure it for the new replica. </li> <li> <strong> +slave-reconf-inprog </strong> <code> &lt;instance details&gt; </code> -- The replica being reconfigured showed to be a replica of the new master ip:port pair, but the synchronization process is not yet complete. </li> <li> <strong> +slave-reconf-done </strong> <code> &lt;instance details&gt; </code> -- The replica is now synchronized with the new master. </li> <li> <strong> -dup-sentinel </strong> <code> &lt;instance details&gt; </code> -- One or more sentinels for the specified master were removed as duplicated (this happens for instance when a Sentinel instance is restarted). </li> <li> <strong> +sentinel </strong> <code> &lt;instance details&gt; </code> -- A new sentinel for this master was detected and attached. </li> <li> <strong> +sdown </strong> <code> &lt;instance details&gt; </code> -- The specified instance is now in Subjectively Down state. </li> <li> <strong> -sdown </strong> <code> &lt;instance details&gt; </code> -- The specified instance is no longer in Subjectively Down state. </li> <li> <strong> +odown </strong> <code> &lt;instance details&gt; </code> -- The specified instance is now in Objectively Down state. </li> <li> <strong> -odown </strong> <code> &lt;instance details&gt; </code> -- The specified instance is no longer in Objectively Down state. </li> <li> <strong> +new-epoch </strong> <code> &lt;instance details&gt; </code> -- The current epoch was updated. </li> <li> <strong> +try-failover </strong> <code> &lt;instance details&gt; </code> -- New failover in progress, waiting to be elected by the majority. </li> <li> <strong> +elected-leader </strong> <code> &lt;instance details&gt; </code> -- Won the election for the specified epoch, can do the failover. </li> <li> <strong> +failover-state-select-slave </strong> <code> &lt;instance details&gt; </code> -- New failover state is <code> select-slave </code> : we are trying to find a suitable replica for promotion. </li> <li> <strong> no-good-slave </strong> <code> &lt;instance details&gt; </code> -- There is no good replica to promote. Currently we'll try after some time, but probably this will change and the state machine will abort the failover at all in this case. </li> <li> <strong> selected-slave </strong> <code> &lt;instance details&gt; </code> -- We found the specified good replica to promote. </li> <li> <strong> failover-state-send-slaveof-noone </strong> <code> &lt;instance details&gt; </code> -- We are trying to reconfigure the promoted replica as master, waiting for it to switch. </li> <li> <strong> failover-end-for-timeout </strong> <code> &lt;instance details&gt; </code> -- The failover terminated for timeout, replicas will eventually be configured to replicate with the new master anyway. </li> <li> <strong> failover-end </strong> <code> &lt;instance details&gt; </code> -- The failover terminated with success. All the replicas appears to be reconfigured to replicate with the new master. </li> <li> <strong> switch-master </strong> <code> &lt;master name&gt; &lt;oldip&gt; &lt;oldport&gt; &lt;newip&gt; &lt;newport&gt; </code> -- The master new IP and address is the specified one after a configuration change. This is <strong> the message most external users are interested in </strong> . </li> <li> <strong> +tilt </strong> -- Tilt mode entered. </li> <li> <strong> -tilt </strong> -- Tilt mode exited. </li> </ul> <h3 id="handling-of--busy-state"> Handling of -BUSY state </h3> <p> The -BUSY error is returned by a Redis instance when a Lua script is running for more time than the configured Lua script time limit. When this happens before triggering a fail over Redis Sentinel will try to send a <a href="/commands/script-kill"> <code> SCRIPT KILL </code> </a> command, that will only succeed if the script was read-only. </p> <p> If the instance is still in an error condition after this try, it will eventually be failed over. </p> <h2 id="replicas-priority"> Replicas priority </h2> <p> Redis instances have a configuration parameter called <code> replica-priority </code> . This information is exposed by Redis replica instances in their <a href="/commands/info"> <code> INFO </code> </a> output, and Sentinel uses it in order to pick a replica among the ones that can be used in order to failover a master: </p> <ol> <li> If the replica priority is set to 0, the replica is never promoted to master. </li> <li> Replicas with a <em> lower </em> priority number are preferred by Sentinel. </li> </ol> <p> For example if there is a replica S1 in the same data center of the current master, and another replica S2 in another data center, it is possible to set S1 with a priority of 10 and S2 with a priority of 100, so that if the master fails and both S1 and S2 are available, S1 will be preferred. </p> <p> For more information about the way replicas are selected, please check the <a href="#replica-selection-and-priority"> <em> Replica selection and priority </em> section </a> of this documentation. </p> <h3 id="sentinel-and-redis-authentication"> Sentinel and Redis authentication </h3> <p> When the master is configured to require authentication from clients, as a security measure, replicas need to also be aware of the credentials in order to authenticate with the master and create the master-replica connection used for the asynchronous replication protocol. </p> <h2 id="redis-access-control-list-authentication"> Redis Access Control List authentication </h2> <p> Starting with Redis 6, user authentication and permission is managed with the <a href="/docs/latest/operate/oss_and_stack/management/security/acl/"> Access Control List (ACL) </a> . </p> <p> In order for Sentinels to connect to Redis server instances when they are configured with ACL, the Sentinel configuration must include the following directives: </p> <pre><code>sentinel auth-user &lt;master-name&gt; &lt;username&gt; sentinel auth-pass &lt;master-name&gt; &lt;password&gt; </code></pre> <p> Where <code> &lt;username&gt; </code> and <code> &lt;password&gt; </code> are the username and password for accessing the group's instances. These credentials should be provisioned on all of the group's Redis instances with the minimal control permissions. For example: </p> <pre><code>127.0.0.1:6379&gt; ACL SETUSER sentinel-user ON &gt;somepassword allchannels +multi +slaveof +ping +exec +subscribe +config|rewrite +role +publish +info +client|setname +client|kill +script|kill </code></pre> <h3 id="redis-password-only-authentication"> Redis password-only authentication </h3> <p> Until Redis 6, authentication is achieved using the following configuration directives: </p> <ul> <li> <code> requirepass </code> in the master, in order to set the authentication password, and to make sure the instance will not process requests for non authenticated clients. </li> <li> <code> masterauth </code> in the replicas in order for the replicas to authenticate with the master in order to correctly replicate data from it. </li> </ul> <p> When Sentinel is used, there is not a single master, since after a failover replicas may play the role of masters, and old masters can be reconfigured in order to act as replicas, so what you want to do is to set the above directives in all your instances, both masters and replicas. </p> <p> This is also usually a sane setup since you don't want to protect data only in the master, having the same data accessible in the replicas. </p> <p> However, in the uncommon case where you need a replica that is accessible without authentication, you can still do it by setting up <strong> a replica priority of zero </strong> , to prevent this replica from being promoted to master, and configuring in this replica only the <code> masterauth </code> directive, without using the <code> requirepass </code> directive, so that data will be readable by unauthenticated clients. </p> <p> In order for Sentinels to connect to Redis server instances when they are configured with <code> requirepass </code> , the Sentinel configuration must include the <code> sentinel auth-pass </code> directive, in the format: </p> <pre><code>sentinel auth-pass &lt;master-name&gt; &lt;password&gt; </code></pre> <h2 id="configuring-sentinel-instances-with-authentication"> Configuring Sentinel instances with authentication </h2> <p> Sentinel instances themselves can be secured by requiring clients to authenticate via the <a href="/commands/auth"> <code> AUTH </code> </a> command. Starting with Redis 6.2, the <a href="/docs/latest/operate/oss_and_stack/management/security/acl/"> Access Control List (ACL) </a> is available, whereas previous versions (starting with Redis 5.0.1) support password-only authentication. </p> <p> Note that Sentinel's authentication configuration should be <strong> applied to each of the instances </strong> in your deployment, and <strong> all instances should use the same configuration </strong> . Furthermore, ACL and password-only authentication should not be used together. </p> <h3 id="sentinel-access-control-list-authentication"> Sentinel Access Control List authentication </h3> <p> The first step in securing a Sentinel instance with ACL is preventing any unauthorized access to it. To do that, you'll need to disable the default superuser (or at the very least set it up with a strong password) and create a new one and allow it access to Pub/Sub channels: </p> <pre><code>127.0.0.1:5000&gt; ACL SETUSER admin ON &gt;admin-password allchannels +@all OK 127.0.0.1:5000&gt; ACL SETUSER default off OK </code></pre> <p> The default user is used by Sentinel to connect to other instances. You can provide the credentials of another superuser with the following configuration directives: </p> <pre><code>sentinel sentinel-user &lt;username&gt; sentinel sentinel-pass &lt;password&gt; </code></pre> <p> Where <code> &lt;username&gt; </code> and <code> &lt;password&gt; </code> are the Sentinel's superuser and password, respectively (e.g. <code> admin </code> and <code> admin-password </code> in the example above). </p> <p> Lastly, for authenticating incoming client connections, you can create a Sentinel restricted user profile such as the following: </p> <pre><code>127.0.0.1:5000&gt; ACL SETUSER sentinel-user ON &gt;user-password -@all +auth +client|getname +client|id +client|setname +command +hello +ping +role +sentinel|get-master-addr-by-name +sentinel|master +sentinel|myid +sentinel|replicas +sentinel|sentinels +sentinel|masters </code></pre> <p> Refer to the documentation of your Sentinel client of choice for further information. </p> <h3 id="sentinel-password-only-authentication"> Sentinel password-only authentication </h3> <p> To use Sentinel with password-only authentication, add the <code> requirepass </code> configuration directive to <strong> all </strong> your Sentinel instances as follows: </p> <pre><code>requirepass "your_password_here" </code></pre> <p> When configured this way, Sentinels will do two things: </p> <ol> <li> A password will be required from clients in order to send commands to Sentinels. This is obvious since this is how such configuration directive works in Redis in general. </li> <li> Moreover the same password configured to access the local Sentinel, will be used by this Sentinel instance in order to authenticate to all the other Sentinel instances it connects to. </li> </ol> <p> This means that <strong> you will have to configure the same <code> requirepass </code> password in all the Sentinel instances </strong> . This way every Sentinel can talk with every other Sentinel without any need to configure for each Sentinel the password to access all the other Sentinels, that would be very impractical. </p> <p> Before using this configuration, make sure your client library can send the <a href="/commands/auth"> <code> AUTH </code> </a> command to Sentinel instances. </p> <h3 id="sentinel-clients-implementation"> Sentinel clients implementation </h3> <hr/> <p> Sentinel requires explicit client support, unless the system is configured to execute a script that performs a transparent redirection of all the requests to the new master instance (virtual IP or other similar systems). The topic of client libraries implementation is covered in the document <a href="/docs/latest/develop/reference/sentinel-clients/"> Sentinel clients guidelines </a> . </p> <h2 id="more-advanced-concepts"> More advanced concepts </h2> <p> In the following sections we'll cover a few details about how Sentinel works, without resorting to implementation details and algorithms that will be covered in the final part of this document. </p> <h3 id="sdown-and-odown-failure-state"> SDOWN and ODOWN failure state </h3> <p> Redis Sentinel has two different concepts of <em> being down </em> , one is called a <em> Subjectively Down </em> condition (SDOWN) and is a down condition that is local to a given Sentinel instance. Another is called <em> Objectively Down </em> condition (ODOWN) and is reached when enough Sentinels (at least the number configured as the <code> quorum </code> parameter of the monitored master) have an SDOWN condition, and get feedback from other Sentinels using the <code> SENTINEL is-master-down-by-addr </code> command. </p> <p> From the point of view of a Sentinel an SDOWN condition is reached when it does not receive a valid reply to PING requests for the number of seconds specified in the configuration as <code> is-master-down-after-milliseconds </code> parameter. </p> <p> An acceptable reply to PING is one of the following: </p> <ul> <li> PING replied with +PONG. </li> <li> PING replied with -LOADING error. </li> <li> PING replied with -MASTERDOWN error. </li> </ul> <p> Any other reply (or no reply at all) is considered non valid. However note that <strong> a logical master that advertises itself as a replica in the INFO output is considered to be down </strong> . </p> <p> Note that SDOWN requires that no acceptable reply is received for the whole interval configured, so for instance if the interval is 30000 milliseconds (30 seconds) and we receive an acceptable ping reply every 29 seconds, the instance is considered to be working. </p> <p> SDOWN is not enough to trigger a failover: it only means a single Sentinel believes a Redis instance is not available. To trigger a failover, the ODOWN state must be reached. </p> <p> To switch from SDOWN to ODOWN no strong consensus algorithm is used, but just a form of gossip: if a given Sentinel gets reports that a master is not working from enough Sentinels <strong> in a given time range </strong> , the SDOWN is promoted to ODOWN. If this acknowledge is later missing, the flag is cleared. </p> <p> A more strict authorization that uses an actual majority is required in order to really start the failover, but no failover can be triggered without reaching the ODOWN state. </p> <p> The ODOWN condition <strong> only applies to masters </strong> . For other kind of instances Sentinel doesn't require to act, so the ODOWN state is never reached for replicas and other sentinels, but only SDOWN is. </p> <p> However SDOWN has also semantic implications. For example a replica in SDOWN state is not selected to be promoted by a Sentinel performing a failover. </p> <h2 id="sentinels-and-replicas-auto-discovery"> Sentinels and replicas auto discovery </h2> <p> Sentinels stay connected with other Sentinels in order to reciprocally check the availability of each other, and to exchange messages. However you don't need to configure a list of other Sentinel addresses in every Sentinel instance you run, as Sentinel uses the Redis instances Pub/Sub capabilities in order to discover the other Sentinels that are monitoring the same masters and replicas. </p> <p> This feature is implemented by sending <em> hello messages </em> into the channel named <code> __sentinel__:hello </code> . </p> <p> Similarly you don't need to configure what is the list of the replicas attached to a master, as Sentinel will auto discover this list querying Redis. </p> <ul> <li> Every Sentinel publishes a message to every monitored master and replica Pub/Sub channel <code> __sentinel__:hello </code> , every two seconds, announcing its presence with ip, port, runid. </li> <li> Every Sentinel is subscribed to the Pub/Sub channel <code> __sentinel__:hello </code> of every master and replica, looking for unknown sentinels. When new sentinels are detected, they are added as sentinels of this master. </li> <li> Hello messages also include the full current configuration of the master. If the receiving Sentinel has a configuration for a given master which is older than the one received, it updates to the new configuration immediately. </li> <li> Before adding a new sentinel to a master a Sentinel always checks if there is already a sentinel with the same runid or the same address (ip and port pair). In that case all the matching sentinels are removed, and the new added. </li> </ul> <h2 id="sentinel-reconfiguration-of-instances-outside-the-failover-procedure"> Sentinel reconfiguration of instances outside the failover procedure </h2> <p> Even when no failover is in progress, Sentinels will always try to set the current configuration on monitored instances. Specifically: </p> <ul> <li> Replicas (according to the current configuration) that claim to be masters, will be configured as replicas to replicate with the current master. </li> <li> Replicas connected to a wrong master, will be reconfigured to replicate with the right master. </li> </ul> <p> For Sentinels to reconfigure replicas, the wrong configuration must be observed for some time, that is greater than the period used to broadcast new configurations. </p> <p> This prevents Sentinels with a stale configuration (for example because they just rejoined from a partition) will try to change the replicas configuration before receiving an update. </p> <p> Also note how the semantics of always trying to impose the current configuration makes the failover more resistant to partitions: </p> <ul> <li> Masters failed over are reconfigured as replicas when they return available. </li> <li> Replicas partitioned away during a partition are reconfigured once reachable. </li> </ul> <p> The important lesson to remember about this section is: <strong> Sentinel is a system where each process will always try to impose the last logical configuration to the set of monitored instances </strong> . </p> <h3 id="replica-selection-and-priority"> Replica selection and priority </h3> <p> When a Sentinel instance is ready to perform a failover, since the master is in <code> ODOWN </code> state and the Sentinel received the authorization to failover from the majority of the Sentinel instances known, a suitable replica needs to be selected. </p> <p> The replica selection process evaluates the following information about replicas: </p> <ol> <li> Disconnection time from the master. </li> <li> Replica priority. </li> <li> Replication offset processed. </li> <li> Run ID. </li> </ol> <p> A replica that is found to be disconnected from the master for more than ten times the configured master timeout (down-after-milliseconds option), plus the time the master is also not available from the point of view of the Sentinel doing the failover, is considered to be not suitable for the failover and is skipped. </p> <p> In more rigorous terms, a replica whose the <a href="/commands/info"> <code> INFO </code> </a> output suggests it has been disconnected from the master for more than: </p> <pre><code>(down-after-milliseconds * 10) + milliseconds_since_master_is_in_SDOWN_state </code></pre> <p> Is considered to be unreliable and is disregarded entirely. </p> <p> The replica selection only considers the replicas that passed the above test, and sorts it based on the above criteria, in the following order. </p> <ol> <li> The replicas are sorted by <code> replica-priority </code> as configured in the <code> redis.conf </code> file of the Redis instance. A lower priority will be preferred. </li> <li> If the priority is the same, the replication offset processed by the replica is checked, and the replica that received more data from the master is selected. </li> <li> If multiple replicas have the same priority and processed the same data from the master, a further check is performed, selecting the replica with the lexicographically smaller run ID. Having a lower run ID is not a real advantage for a replica, but is useful in order to make the process of replica selection more deterministic, instead of resorting to select a random replica. </li> </ol> <p> In most cases, <code> replica-priority </code> does not need to be set explicitly so all instances will use the same default value. If there is a particular fail-over preference, <code> replica-priority </code> must be set on all instances, including masters, as a master may become a replica at some future point in time - and it will then need the proper <code> replica-priority </code> settings. </p> <p> A Redis instance can be configured with a special <code> replica-priority </code> of zero in order to be <strong> never selected </strong> by Sentinels as the new master. However a replica configured in this way will still be reconfigured by Sentinels in order to replicate with the new master after a failover, the only difference is that it will never become a master itself. </p> <h2 id="algorithms-and-internals"> Algorithms and internals </h2> <p> In the following sections we will explore the details of Sentinel behavior. It is not strictly needed for users to be aware of all the details, but a deep understanding of Sentinel may help to deploy and operate Sentinel in a more effective way. </p> <h3 id="quorum"> Quorum </h3> <p> The previous sections showed that every master monitored by Sentinel is associated to a configured <strong> quorum </strong> . It specifies the number of Sentinel processes that need to agree about the unreachability or error condition of the master in order to trigger a failover. </p> <p> However, after the failover is triggered, in order for the failover to actually be performed, <strong> at least a majority of Sentinels must authorize the Sentinel to failover </strong> . Sentinel never performs a failover in the partition where a minority of Sentinels exist. </p> <p> Let's try to make things a bit more clear: </p> <ul> <li> Quorum: the number of Sentinel processes that need to detect an error condition in order for a master to be flagged as <strong> ODOWN </strong> . </li> <li> The failover is triggered by the <strong> ODOWN </strong> state. </li> <li> Once the failover is triggered, the Sentinel trying to failover is required to ask for authorization to a majority of Sentinels (or more than the majority if the quorum is set to a number greater than the majority). </li> </ul> <p> The difference may seem subtle but is actually quite simple to understand and use. For example if you have 5 Sentinel instances, and the quorum is set to 2, a failover will be triggered as soon as 2 Sentinels believe that the master is not reachable, however one of the two Sentinels will be able to failover only if it gets authorization at least from 3 Sentinels. </p> <p> If instead the quorum is configured to 5, all the Sentinels must agree about the master error condition, and the authorization from all Sentinels is required in order to failover. </p> <p> This means that the quorum can be used to tune Sentinel in two ways: </p> <ol> <li> If a quorum is set to a value smaller than the majority of Sentinels we deploy, we are basically making Sentinel more sensitive to master failures, triggering a failover as soon as even just a minority of Sentinels is no longer able to talk with the master. </li> <li> If a quorum is set to a value greater than the majority of Sentinels, we are making Sentinel able to failover only when there are a very large number (larger than majority) of well connected Sentinels which agree about the master being down. </li> </ol> <h3 id="configuration-epochs"> Configuration epochs </h3> <p> Sentinels require to get authorizations from a majority in order to start a failover for a few important reasons: </p> <p> When a Sentinel is authorized, it gets a unique <strong> configuration epoch </strong> for the master it is failing over. This is a number that will be used to version the new configuration after the failover is completed. Because a majority agreed that a given version was assigned to a given Sentinel, no other Sentinel will be able to use it. This means that every configuration of every failover is versioned with a unique version. We'll see why this is so important. </p> <p> Moreover Sentinels have a rule: if a Sentinel voted another Sentinel for the failover of a given master, it will wait some time to try to failover the same master again. This delay is the <code> 2 * failover-timeout </code> you can configure in <code> sentinel.conf </code> . This means that Sentinels will not try to failover the same master at the same time, the first to ask to be authorized will try, if it fails another will try after some time, and so forth. </p> <p> Redis Sentinel guarantees the <em> liveness </em> property that if a majority of Sentinels are able to talk, eventually one will be authorized to failover if the master is down. </p> <p> Redis Sentinel also guarantees the <em> safety </em> property that every Sentinel will failover the same master using a different <em> configuration epoch </em> . </p> <h3 id="configuration-propagation"> Configuration propagation </h3> <p> Once a Sentinel is able to failover a master successfully, it will start to broadcast the new configuration so that the other Sentinels will update their information about a given master. </p> <p> For a failover to be considered successful, it requires that the Sentinel was able to send the <code> REPLICAOF NO ONE </code> command to the selected replica, and that the switch to master was later observed in the <a href="/commands/info"> <code> INFO </code> </a> output of the master. </p> <p> At this point, even if the reconfiguration of the replicas is in progress, the failover is considered to be successful, and all the Sentinels are required to start reporting the new configuration. </p> <p> The way a new configuration is propagated is the reason why we need that every Sentinel failover is authorized with a different version number (configuration epoch). </p> <p> Every Sentinel continuously broadcast its version of the configuration of a master using Redis Pub/Sub messages, both in the master and all the replicas. At the same time all the Sentinels wait for messages to see what is the configuration advertised by the other Sentinels. </p> <p> Configurations are broadcast in the <code> __sentinel__:hello </code> Pub/Sub channel. </p> <p> Because every configuration has a different version number, the greater version always wins over smaller versions. </p> <p> So for example the configuration for the master <code> mymaster </code> start with all the Sentinels believing the master is at 192.168.1.50:6379. This configuration has version 1. After some time a Sentinel is authorized to failover with version 2. If the failover is successful, it will start to broadcast a new configuration, let's say 192.168.1.50:9000, with version 2. All the other instances will see this configuration and will update their configuration accordingly, since the new configuration has a greater version. </p> <p> This means that Sentinel guarantees a second liveness property: a set of Sentinels that are able to communicate will all converge to the same configuration with the higher version number. </p> <p> Basically if the net is partitioned, every partition will converge to the higher local configuration. In the special case of no partitions, there is a single partition and every Sentinel will agree about the configuration. </p> <h3 id="consistency-under-partitions"> Consistency under partitions </h3> <p> Redis Sentinel configurations are eventually consistent, so every partition will converge to the higher configuration available. However in a real-world system using Sentinel there are three different players: </p> <ul> <li> Redis instances. </li> <li> Sentinel instances. </li> <li> Clients. </li> </ul> <p> In order to define the behavior of the system we have to consider all three. </p> <p> The following is a simple network where there are 3 nodes, each running a Redis instance, and a Sentinel instance: </p> <pre><code> +-------------+ | Sentinel 1 |----- Client A | Redis 1 (M) | +-------------+ | | +-------------+ | +------------+ | Sentinel 2 |-----+-- // ----| Sentinel 3 |----- Client B | Redis 2 (S) | | Redis 3 (M)| +-------------+ +------------+ </code></pre> <p> In this system the original state was that Redis 3 was the master, while Redis 1 and 2 were replicas. A partition occurred isolating the old master. Sentinels 1 and 2 started a failover promoting Sentinel 1 as the new master. </p> <p> The Sentinel properties guarantee that Sentinel 1 and 2 now have the new configuration for the master. However Sentinel 3 has still the old configuration since it lives in a different partition. </p> <p> We know that Sentinel 3 will get its configuration updated when the network partition will heal, however what happens during the partition if there are clients partitioned with the old master? </p> <p> Clients will be still able to write to Redis 3, the old master. When the partition will rejoin, Redis 3 will be turned into a replica of Redis 1, and all the data written during the partition will be lost. </p> <p> Depending on your configuration you may want or not that this scenario happens: </p> <ul> <li> If you are using Redis as a cache, it could be handy that Client B is still able to write to the old master, even if its data will be lost. </li> <li> If you are using Redis as a store, this is not good and you need to configure the system in order to partially prevent this problem. </li> </ul> <p> Since Redis is asynchronously replicated, there is no way to totally prevent data loss in this scenario, however you can bound the divergence between Redis 3 and Redis 1 using the following Redis configuration option: </p> <pre><code>min-replicas-to-write 1 min-replicas-max-lag 10 </code></pre> <p> With the above configuration (please see the self-commented <code> redis.conf </code> example in the Redis distribution for more information) a Redis instance, when acting as a master, will stop accepting writes if it can't write to at least 1 replica. Since replication is asynchronous <em> not being able to write </em> actually means that the replica is either disconnected, or is not sending us asynchronous acknowledges for more than the specified <code> max-lag </code> number of seconds. </p> <p> Using this configuration the Redis 3 in the above example will become unavailable after 10 seconds. When the partition heals, the Sentinel 3 configuration will converge to the new one, and Client B will be able to fetch a valid configuration and continue. </p> <p> In general Redis + Sentinel as a whole are an <strong> eventually consistent system </strong> where the merge function is <strong> last failover wins </strong> , and the data from old masters are discarded to replicate the data of the current master, so there is always a window for losing acknowledged writes. This is due to Redis asynchronous replication and the discarding nature of the "virtual" merge function of the system. Note that this is not a limitation of Sentinel itself, and if you orchestrate the failover with a strongly consistent replicated state machine, the same properties will still apply. There are only two ways to avoid losing acknowledged writes: </p> <ol> <li> Use synchronous replication (and a proper consensus algorithm to run a replicated state machine). </li> <li> Use an eventually consistent system where different versions of the same object can be merged. </li> </ol> <p> Redis currently is not able to use any of the above systems, and is currently outside the development goals. However there are proxies implementing solution "2" on top of Redis stores such as SoundCloud <a href="https://github.com/soundcloud/roshi"> Roshi </a> , or Netflix <a href="https://github.com/Netflix/dynomite"> Dynomite </a> . </p> <h2 id="sentinel-persistent-state"> Sentinel persistent state </h2> <p> Sentinel state is persisted in the sentinel configuration file. For example every time a new configuration is received, or created (leader Sentinels), for a master, the configuration is persisted on disk together with the configuration epoch. This means that it is safe to stop and restart Sentinel processes. </p> <h3 id="tilt-mode"> TILT mode </h3> <p> Redis Sentinel is heavily dependent on the computer time: for instance in order to understand if an instance is available it remembers the time of the latest successful reply to the PING command, and compares it with the current time to understand how old it is. </p> <p> However if the computer time changes in an unexpected way, or if the computer is very busy, or the process blocked for some reason, Sentinel may start to behave in an unexpected way. </p> <p> The TILT mode is a special "protection" mode that a Sentinel can enter when something odd is detected that can lower the reliability of the system. The Sentinel timer interrupt is normally called 10 times per second, so we expect that more or less 100 milliseconds will elapse between two calls to the timer interrupt. </p> <p> What a Sentinel does is to register the previous time the timer interrupt was called, and compare it with the current call: if the time difference is negative or unexpectedly big (2 seconds or more) the TILT mode is entered (or if it was already entered the exit from the TILT mode postponed). </p> <p> When in TILT mode the Sentinel will continue to monitor everything, but: </p> <ul> <li> It stops acting at all. </li> <li> It starts to reply negatively to <code> SENTINEL is-master-down-by-addr </code> requests as the ability to detect a failure is no longer trusted. </li> </ul> <p> If everything appears to be normal for 30 second, the TILT mode is exited. </p> <p> In the Sentinel TILT mode, if we send the INFO command, we could get the following response: </p> <pre><code>$ redis-cli -p 26379 127.0.0.1:26379&gt; info (Other information from Sentinel server skipped.) # Sentinel sentinel_masters:1 sentinel_tilt:0 sentinel_tilt_since_seconds:-1 sentinel_running_scripts:0 sentinel_scripts_queue_length:0 sentinel_simulate_failure_flags:0 master0:name=mymaster,status=ok,address=127.0.0.1:6379,slaves=0,sentinels=1 </code></pre> <p> The field "sentinel_tilt_since_seconds" indicates how many seconds the Sentinel already is in the TILT mode. If it is not in TILT mode, the value will be -1. </p> <p> Note that in some ways TILT mode could be replaced using the monotonic clock API that many kernels offer. However it is not still clear if this is a good solution since the current system avoids issues in case the process is just suspended or not executed by the scheduler for a long time. </p> <p> <strong> A note about the word slave used in this man page </strong> : Starting with Redis 5, if not for backward compatibility, the Redis project no longer uses the word slave. Unfortunately in this command the word slave is part of the protocol, so we'll be able to remove such occurrences only when this API will be naturally deprecated. </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/management/sentinel/"/> <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/rladmin/cluster/debug_info/.html
<section class="prose w-full py-12 max-w-none"> <h1> rladmin cluster debug_info </h1> <p class="text-lg -mt-5 mb-10"> Creates a support package. </p> <p> Downloads a support package to the specified path. If you do not specify a path, it downloads the package to the default path specified in the cluster configuration file. </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">rladmin cluster debug_info </span></span><span class="line"><span class="cl"> <span class="o">[</span> node &lt;ID&gt; <span class="o">]</span> </span></span><span class="line"><span class="cl"> <span class="o">[</span> path &lt;path&gt; <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> node </td> <td> integer </td> <td> Downloads a support package for the specified node </td> </tr> <tr> <td> path </td> <td> filepath </td> <td> Specifies the location where the support package should download </td> </tr> </tbody> </table> <h3 id="returns"> Returns </h3> <p> Reports the progress of the support package download. </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 debug_info node <span class="m">1</span> </span></span><span class="line"><span class="cl">Preparing the debug info files package </span></span><span class="line"><span class="cl">Downloading... </span></span><span class="line"><span class="cl"><span class="o">[==================================================]</span> </span></span><span class="line"><span class="cl">Downloading complete. File /tmp/debuginfo.20220511-215637.node-1.tar.gz is saved. </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/references/cli-utilities/rladmin/cluster/debug_info/"/> <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.reserve/.html
<section class="prose w-full py-12"> <h1 class="command-name"> CF.RESERVE </h1> <div class="font-semibold text-redis-ink-900"> Syntax </div> <pre class="command-syntax">CF.RESERVE key capacity [BUCKETSIZE bucketsize] [MAXITERATIONS maxiterations] [EXPANSION expansion]</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(1) </dd> </dl> <p> Creates an empty cuckoo filter with a single sub-filter for the initial specified capacity. </p> <p> According to the cuckoo filter behavior, the filter is likely to declare itself full before <code> capacity </code> is reached; therefore, the fill rate will likely never reach 100 percent. The fill rate can be improved by using a larger <code> bucketsize </code> at the cost of a higher error rate. When the filter self-declare itself <code> full </code> , it will auto-expand by generating additional sub-filters at the cost of reduced performance and increased error rate. The new sub-filter is created with size of the previous sub-filter multiplied by <code> expansion </code> . Like bucket size, additional sub-filters grow the error rate linearly. </p> <p> The minimal false positive error rate is 2/255 ≈ 0.78% when bucket size of 1 is used. Larger buckets increase the error rate linearly (for example, a bucket size of 3 yields a 2.35% error rate) but improve the fill rate of the filter. </p> <p> <code> maxiterations </code> dictates the number of attempts to find a slot for the incoming fingerprint. Once the filter gets full, high <code> maxIterations </code> value will slow down insertions. </p> <p> Unused capacity in prior sub-filters is automatically used when possible. The filter can grow up to 32 times. </p> <h2 id="required-arguments"> Required arguments </h2> <details open=""> <summary> <code> key </code> </summary> <p> is key name for the the cuckoo filter to be created. </p> </details> <details open=""> <summary> <code> capacity </code> </summary> <p> Estimated capacity for the filter. </p> <p> Capacity is rounded to the next <code> 2^n </code> number. </p> <p> The filter will likely not fill up to 100% of it's capacity. Make sure to reserve extra capacity if you want to avoid expansions. </p> </details> <h2 id="optional-arguments"> Optional arguments </h2> <details open=""> <summary> <code> BUCKETSIZE bucketsize </code> </summary> <p> Number of items in each bucket. </p> <p> A higher bucket size value improves the fill rate but also causes a higher error rate and slightly slower performance. </p> <p> <code> bucketsize </code> is an integer between 1 and 255. The default value is 2. </p> </details> <details open=""> <summary> <code> MAXITERATIONS maxiterations </code> </summary> <p> Number of attempts to swap items between buckets before declaring filter as full and creating an additional filter. </p> <p> A low value is better for performance and a higher number is better for filter fill rate. </p> <p> <code> maxiterations </code> is an integer between 1 and 65535. The default value is 20. </p> </details> <details open=""> <summary> <code> EXPANSION expansion </code> </summary> <p> When a new filter is created, its size is the size of the current filter multiplied by <code> expansion </code> . </p> <p> <code> expansion </code> is an integer between 0 and 32768. The default value is 1. </p> <p> Expansion is rounded to the next <code> 2^n </code> number. </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/#simple-strings"> Simple string reply </a> - <code> OK </code> if filter created successfully </li> <li> [] on error (invalid arguments, key already exists, 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&gt; CF.RESERVE cf <span class="m">1000</span> </span></span><span class="line"><span class="cl">OK </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl">redis&gt; CF.RESERVE cf <span class="m">1000</span> </span></span><span class="line"><span class="cl"><span class="o">(</span>error<span class="o">)</span> ERR item exists </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl">redis&gt; CF.RESERVE cf_params <span class="m">1000</span> BUCKETSIZE <span class="m">8</span> MAXITERATIONS <span class="m">20</span> EXPANSION <span class="m">2</span> </span></span><span class="line"><span class="cl">OK</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.reserve/"/> <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-6-0-8-september-2020/.html
<section class="prose w-full py-12 max-w-none"> <h1> Redis Enterprise Software Release Notes 6.0.8 (September 2020) </h1> <p class="text-lg -mt-5 mb-10"> RediSearch 2.0 support. Improved rladmin support for module upgrades. </p> <p> <a href="https://redislabs.com/download-center/#downloads"> Redis Enterprise Software (RS) 6.0.8 </a> is now available! This version includes the new RediSearch 2.0 module, open source Redis 6.0.5, changes the rladmin tool for upgrading modules, and includes bug fixes. </p> <h2 id="version-information"> Version information </h2> <h3 id="upgrade-instructions"> Upgrade instructions </h3> <p> Follow <a href="/docs/latest/operate/rs/installing-upgrading/upgrading/"> these instructions </a> for upgrading to RS 6.0.8 from RS 5.4.0 and above. For Active-Active deployments, this release requires that you <a href="/docs/latest/operate/rs/installing-upgrading/upgrading/upgrade-active-active/"> upgrade the CRDB featureset version </a> . </p> <h3 id="end-of-life"> End of life </h3> <p> End of Life (EOL) for Redis Enterprise Software 6.0 and previous RS versions, can be found <a href="/docs/latest/operate/rs/installing-upgrading/product-lifecycle/"> here </a> . EOL for Redis Modules can be found <a href="/docs/latest/operate/rs/installing-upgrading/product-lifecycle/"> here </a> . </p> <ul> <li> Support for Red Hat Enterprise Linux 6 and Oracle Linux 6 <a href="/docs/latest/operate/rs/installing-upgrading/install/plan-deployment/supported-platforms/"> operating systems platforms </a> will end on November 30, 2020. </li> <li> Support for Ubuntu 14.04 (Trusty Tahr) <a href="/docs/latest/operate/rs/installing-upgrading/install/plan-deployment/supported-platforms/"> operating systems platforms </a> will end on November 30, 2020. </li> </ul> <h2 id="new-features"> New features </h2> <h3 id="open-source-redis-6"> Open source Redis 6 </h3> <p> RS 6.0 includes open source Redis 6.0.5. For more information about Redis 6.0.5, check out the <a href="https://raw.githubusercontent.com/redis/redis/6.0.5/00-RELEASENOTES"> release notes </a> . </p> <h3 id="upgrading-redis-modules-via-rladmin"> Upgrading Redis modules via rladmin </h3> <p> The <a href="/docs/latest/operate/rs/references/cli-utilities/rladmin/"> <code> rladmin </code> CLI </a> introduces several updates to the commands for upgrading modules. It is now easier to upgrade your modules to the latest module version. Find out more <a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/install/upgrade-module/"> here </a> . </p> <h2 id="redis-modules"> Redis modules </h2> <p> The following GA releases of Redis Modules are bundled in RS 6.0: </p> <ul> <li> <a href="https://redislabs.com/redis-enterprise/redis-search/"> RediSearch </a> , version <a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redisearch/"> 2.0 </a> (updated) </li> <li> <a href="https://redislabs.com/redis-enterprise/redis-json/"> RedisJSON </a> , version <a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redisjson/redisjson-1.0-release-notes/"> 1.0.4 </a> </li> <li> <a href="https://redislabs.com/redis-enterprise/redis-graph/"> RedisGraph </a> , version <a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redisgraph/redisgraph-2.0-release-notes/"> 2.0.19 </a> (updated) </li> <li> <a href="https://redislabs.com/redis-enterprise/redis-time-series/"> RedisTimeSeries </a> , version <a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redistimeseries/redistimeseries-1.2-release-notes/"> 1.2.7 </a> (updated) </li> <li> <a href="https://redislabs.com/redis-enterprise/redis-bloom/"> RedisBloom </a> , version <a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redisbloom/redisbloom-2.2-release-notes/"> 2.2.4 </a> (updated) </li> </ul> <p> To use the updated modules with a database, you must <a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/install/upgrade-module/"> upgrade the module on the database </a> . </p> <h2 id="additional-capabilities"> Additional capabilities </h2> <ul> <li> <p> <a href="/docs/latest/integrate/prometheus-with-redis-enterprise/prometheus-metrics-definitions/#shard-metrics"> Shard level metrics </a> have been added to the metrics_exporter and are now available from Prometheus. You can find all of the metrics <a href="/docs/latest/integrate/prometheus-with-redis-enterprise/prometheus-metrics-definitions/"> here </a> . </p> </li> <li> <p> RS DEB packages (for Ubuntu) and RPM packages (for RHEL) are now signed with a GPG key so customers can verify that the package is authentic and has not been tampered with. You can access the GPG on the <a href="/docs/latest/operate/rs/installing-upgrading/#installing-rs-on-linux"> installaion page </a> . </p> </li> <li> <p> The <a href="/docs/latest/operate/rs/references/cli-utilities/crdb-cli/"> <code> crdb-cli </code> </a> history log is now being added to support packages. </p> </li> </ul> <h2 id="important-fixes"> Important fixes </h2> <ul> <li> RS33193 - Improved log files handling in the proxy for large files. </li> <li> RS43572 - Fixed a bug causing the UI to fail when enabling SMTP STARTLS. </li> <li> RS46062 - Fixed missing metrics of Active-Active databases in Grafana. </li> <li> RS44758 - Fixed non responding button for saving a new user via the UI. With build 6.0.8-32: </li> <li> RS45627, RS47382 - Fixed bugs causing clients to disconnect when using XREAD and XREADGROUP commands in blocking mode on other clients’ connections. </li> </ul> <h2 id="known-limitations"> Known limitations </h2> <p> -RS81463 - A shard may crash when resharding an Active-Active database with Auto Tiering . Specifically, the shard will crash when volatile keys or Active-Active tombstone keys reside in Flash memory. </p> <h3 id="active-active-databases"> Active-Active databases </h3> <ul> <li> RS44656 - A bug causing TLS mode for clients connections to toggle between ‘all communication’ to ‘for crdb communication only’ when performing a global configuration change. <em> <strong> TBD </strong> </em> </li> <li> RS51359 - Active-Active databases, using replication and Append Only File (AOF) for <a href="/docs/latest/operate/rs/databases/configure/database-persistence/"> Database persistence </a> , are suffering from memory leaks on replica shards, causing them to grow bigger than the master shards. Customers are advised to upgrade to RS 6.0.12 <em> <strong> TBD </strong> </em> . Meanwhile you can use snapshots for database persistence or restart the replica shards <em> <strong> TBD </strong> </em> . </li> </ul> <h3 id="installation-limitations"> Installation limitations </h3> <p> Several Redis Enterprise Software installation reference files are installed to the directory <code> /etc/opt/redislabs/ </code> even if you use <a href="/docs/latest/operate/rs/installing-upgrading/install/customize-install-directories/"> custom installation directories </a> . </p> <p> As a workaround to install Redis Enterprise Software without using any root directories, do the following before installing Redis Enterprise Software: </p> <ol> <li> <p> Create all custom, non-root directories you want to use with Redis Enterprise Software. </p> </li> <li> <p> Mount <code> /etc/opt/redislabs </code> to one of the custom, non-root directories. </p> </li> </ol> <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 Database capabilities that improve its compatibility with open source Redis. Now the string data-type in Active-Active Redis Database 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 Active-Active Redis Database protocol </a> . </li> <li> When you upgrade an Active-Active Redis with active AOF from version <a href="/docs/latest/operate/rs/release-notes/legacy-release-notes/rs-5-4-2-april-2019/"> RS 5.4.2 </a> or lower to version <a href="/docs/latest/operate/rs/release-notes/legacy-release-notes/rs-5-4-4-june-2019/"> RS 5.4.2 </a> 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> <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, contact <a href="https://redislabs.com/support"> Support </a> . </li> <li> Starting from <a href="/docs/latest/operate/rs/release-notes/legacy-release-notes/rs-5-4-2-april-2019/"> RS 5.4.2 </a> , to preserve the current Redis major.minor version during database upgrade you must use the keep_redis_version option instead of keep_current_version. </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> Starting from RS 5.4.2 and after you upgrade an Active-Active database, TYPE commands for string data-type in Active-Active databases 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/rs-6-0-8-september-2020/"/> <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/utm_sourceredisinsight&utm_mediumrepository&utm_campaignrelease_notes.html
<section class="prose w-full py-12 max-w-none"> <h1> Redis Query Engine </h1> <p class="text-lg -mt-5 mb-10"> Searching and querying Redis data using the Redis Query Engine </p> <p> The Redis Query Engine offers an enhanced Redis experience via the following search and query features: </p> <ul> <li> A rich query language </li> <li> Incremental indexing on JSON and hash documents </li> <li> Vector search </li> <li> Full-text search </li> <li> Geospatial queries </li> <li> Aggregations </li> </ul> <p> You can find a complete list of features in the <a href="/docs/latest/develop/interact/search-and-query/advanced-concepts/"> reference documentation </a> . </p> <p> The Redis Query Engine features allow you to use Redis as a: </p> <ul> <li> Document database </li> <li> Vector database </li> <li> Secondary index </li> <li> Search engine </li> </ul> <p> Here are the next steps to get you started: </p> <ol> <li> Follow our <a href="/docs/latest/develop/get-started/document-database/"> quick start guide </a> to get some initial hands-on experience. </li> <li> Learn how to <a href="/docs/latest/develop/interact/search-and-query/indexing/"> create an index </a> . </li> <li> Learn how to <a href="/docs/latest/develop/interact/search-and-query/query/"> query your data </a> . </li> <li> <a href="/docs/latest/operate/redisinsight/"> Install Redis Insight </a> , connect it to your Redis database, and then use <a href="/docs/latest/develop/tools/insight/#redis-copilot"> Redis Copilot </a> to help you learn how to execute complex queries against your own data using simple, plain language prompts. </li> </ol> <h2 id="enable-the-redis-query-engine"> Enable the Redis Query Engine </h2> <p> The Redis Query Engine is not available by default in the basic Redis server, so you should install Redis Stack or Redis Enterprise, both of which include Redis search and other useful modules. See <a href="/docs/latest/operate/oss_and_stack/install/install-stack/"> Install Redis Stack </a> or <a href="/docs/latest/operate/rs/installing-upgrading/install/"> Install Redis Enterprise </a> for full installation instructions. </p> <h2 id="license-and-source-code"> License and source code </h2> <p> The Redis Query Engine features of Redis Stack are available under the Source Available License 2.0 (RSALv2) or the Server Side Public License v1 (SSPLv1). Please read the <a href="https://raw.githubusercontent.com/RediSearch/RediSearch/master/LICENSE.txt"> license file </a> for further details. The source code and the <a href="https://github.com/RediSearch/RediSearch/releases"> detailed release notes </a> are available on <a href="https://github.com/RediSearch/RediSearch"> GitHub </a> . </p> <p> Do you have questions? Feel free to ask at the <a href="https://forum.redis.com/c/modules/redisearch/"> RediSearch forum </a> . </p> <p> Redis Ltd. provides commercial support for Redis Stack. Please see the <a href="https://redis.com/redis-enterprise/technology/redis-search/#sds"> Redis Ltd. website </a> for more details and contact information. </p> <br/> <nav> <a href="/docs/latest/develop/interact/search-and-query/basic-constructs/"> Basic constructs </a> <p> Basic constructs for searching and querying Redis data </p> <a href="/docs/latest/develop/interact/search-and-query/indexing/"> Indexing </a> <p> How to index and search JSON documents </p> <a href="/docs/latest/develop/interact/search-and-query/query/"> Query data </a> <p> Understand how to query, search, and aggregate Redis data </p> <a href="/docs/latest/develop/interact/search-and-query/query-use-cases/"> Use cases </a> <p> Redis Query Engine use cases </p> <a href="/docs/latest/develop/interact/search-and-query/advanced-concepts/"> Advanced concepts </a> <p> Details about query syntax, aggregation, scoring, and other search and query options </p> <a href="/docs/latest/develop/interact/search-and-query/administration/"> Administration </a> <p> Redis Query Engine Administration </p> <a href="/docs/latest/develop/interact/search-and-query/deprecated/"> Deprecated </a> <p> Deprecated features </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/develop/interact/search-and-query/"/> <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/manage/.html
<section class="prose w-full py-12 max-w-none"> <h1> Manage Active-Active databases </h1> <p class="text-lg -mt-5 mb-10"> Manage your Active-Active database settings. </p> <p> You can configure and manage your Active-Active database from either the Cluster Manager UI or the command line. </p> <p> To change the global configuration of the Active-Active database, use <a href="/docs/latest/operate/rs/references/cli-utilities/crdb-cli/"> <code> crdb-cli </code> </a> . </p> <p> If you need to apply changes locally to one database instance, you use the Cluster Manager UI or <a href="/docs/latest/operate/rs/references/cli-utilities/rladmin/"> <code> rladmin </code> </a> . </p> <h2 id="database-settings"> Database settings </h2> <p> Many Active-Active database settings can be changed after database creation. One notable exception is database clustering. Database clustering can't be turned on or off after the database has been created. </p> <h2 id="participating-clusters"> Participating clusters </h2> <p> You can add and remove participating clusters of an Active-Active database to change the topology. To manage the changes to Active-Active topology, use <a href="/docs/latest/operate/rs/references/cli-utilities/crdb-cli/"> <code> crdb-cli </code> </a> or the participating clusters list in the Cluster Manager UI. </p> <h3 id="add-participating-clusters"> Add participating clusters </h3> <p> All existing participating clusters must be online and in a syncing state when you add new participating clusters. </p> <p> New participating clusters create the Active-Active database instance based on the global Active-Active database configuration. After you add new participating clusters to an existing Active-Active database, the new database instance can accept connections and read operations. The new instance does not accept write operations until it is in the syncing state. </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 an Active-Active database <a href="/docs/latest/operate/rs/databases/auto-tiering/"> runs on flash memory </a> , you cannot add participating clusters that run on RAM only. </div> </div> <p> To add a new participating cluster to an existing Active-Active configuration using the Cluster Manager UI: </p> <ol> <li> <p> Select the Active-Active database from the <strong> Databases </strong> list and go to its <strong> Configuration </strong> screen. </p> </li> <li> <p> Click <strong> Edit </strong> . </p> </li> <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/participating-clusters-add-cluster.png" sdata-lightbox="/images/rs/screenshots/databases/active-active-databases/participating-clusters-add-cluster.png"> <img alt="Add cluster panel." src="/docs/latest/images/rs/screenshots/databases/active-active-databases/participating-clusters-add-cluster.png"/> </a> </li> <li> <p> Click <strong> Join cluster </strong> to add the cluster to the list of participating clusters. </p> </li> <li> <p> Click <strong> Save </strong> . </p> </li> </ol> <h3 id="remove-participating-clusters"> Remove participating clusters </h3> <p> All existing participating clusters must be online and in a syncing state when you remove an online participating cluster. If you must remove offline participating clusters, you can forcefully remove them. If a forcefully removed participating cluster tries to rejoin the cluster, its Active-Active database membership will be out of date. The joined participating clusters reject updates sent from the removed participating cluster. To prevent rejoin attempts, purge the forcefully removed instance from the participating cluster. </p> <p> To remove a participating cluster using the Cluster Manager UI: </p> <ol> <li> <p> Select the Active-Active database from the <strong> Databases </strong> list and go to its <strong> Configuration </strong> screen. </p> </li> <li> <p> Click <strong> Edit </strong> . </p> </li> <li> <p> In the <strong> Participating clusters </strong> section, point to the cluster you want to delete in the <strong> Other participating clusters </strong> list: </p> <a href="/docs/latest/images/rs/screenshots/databases/active-active-databases/participating-clusters-edit-delete.png" sdata-lightbox="/images/rs/screenshots/databases/active-active-databases/participating-clusters-edit-delete.png"> <img alt="Edit and delete buttons appear when you point to an entry in the Other participating clusters list." src="/docs/latest/images/rs/screenshots/databases/active-active-databases/participating-clusters-edit-delete.png"/> </a> </li> <li> <p> Click <a href="/docs/latest/images/rs/buttons/delete-button.png#no-click" sdata-lightbox="/images/rs/buttons/delete-button.png#no-click"> <img alt="The Delete button" class="inline" src="/docs/latest/images/rs/buttons/delete-button.png#no-click" width="25px"/> </a> to remove the cluster. </p> </li> <li> <p> Click <strong> Save </strong> . </p> </li> </ol> <h2 id="replication-backlog"> Replication backlog </h2> <p> Redis databases that use <a href="/docs/latest/operate/rs/databases/durability-ha/replication/"> replication for high availability </a> maintain a replication backlog (per shard) to synchronize the primary and replica shards of a database. In addition to the database replication backlog, Active-Active databases maintain a backlog (per shard) to synchronize the database instances between clusters. </p> <p> By default, both the database and Active-Active replication backlogs are set to one percent (1%) of the database size divided by the number of shards. This can range between 1MB to 250MB per shard for each backlog. </p> <h3 id="change-the-replication-backlog-size"> Change the replication backlog size </h3> <p> Use the <a href="/docs/latest/operate/rs/references/cli-utilities/crdb-cli/"> <code> crdb-cli </code> </a> utility to control the size of the replication backlogs. You can set it to <code> auto </code> or set a specific size. </p> <p> Update the database replication backlog configuration with the <code> crdb-cli </code> command shown below. </p> <div class="highlight"> <pre class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">crdb-cli crdb update --crdb-guid &lt;crdb_guid&gt; --default-db-config "{\"repl_backlog_size\": &lt;size in MB | 'auto'&gt;}" </span></span></code></pre> </div> <p> Update the Active-Active (CRDT) replication backlog with the command shown below: </p> <div class="highlight"> <pre class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">crdb-cli crdb update --crdb-guid &lt;crdb_guid&gt; --default-db-config "{\"crdt_repl_backlog_size\": &lt;size in MB | 'auto'&gt;}" </span></span></code></pre> </div> <h2 id="data-persistence"> Data persistence </h2> <p> Active-Active supports AOF (Append-Only File) data persistence only. Snapshot persistence is <em> not </em> supported for Active-Active databases and should not be used. </p> <p> If an Active-Active database is currently using snapshot data persistence, use <code> crdb-cli </code> to switch to AOF persistence: </p> <div class="highlight"> <pre class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl"> crdb-cli crdb update --crdb-guid &lt;CRDB_GUID&gt; --default-db-config '{"data_persistence": "aof", "aof_policy":"appendfsync-every-sec"}' </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/active-active/manage/"/> <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/crdbs/health_report/.html
<section class="prose w-full py-12 max-w-none"> <h1> CRDB health report requests </h1> <p class="text-lg -mt-5 mb-10"> Active-Active database health report requests </p> <table> <thead> <tr> <th> Method </th> <th> Path </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> <a href="#get-crdbs-health"> GET </a> </td> <td> <code> /v1/crdbs/{crdb_guid}/health_report </code> </td> <td> Get a health report for an Active-Active database </td> </tr> </tbody> </table> <h2 id="get-crdbs-health"> Get health report </h2> <pre><code>GET /v1/crdbs/{crdb_guid}/health_report </code></pre> <p> Get a health report for an Active-Active database. </p> <h3 id="get-request"> Request </h3> <h4 id="example-http-request"> Example HTTP request </h4> <pre><code>GET /crdbs/{crdb_guid}/health_report </code></pre> <h4 id="url-parameters"> URL parameters </h4> <table> <thead> <tr> <th> Field </th> <th> Type </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> crdb_guid </td> <td> string </td> <td> Globally unique Active-Active database ID (GUID) </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> instance_id </td> <td> integer </td> <td> The request retrieves information from the specified Active-Active database instance. If this instance doesn’t exist, the request retrieves information from all instances. (optional) </td> </tr> </tbody> </table> <h3 id="get-response"> Response </h3> <p> Returns a JSON array of <a href="/docs/latest/operate/rs/references/rest-api/objects/crdb/health_report/"> CRDB health report objects </a> . </p> <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> Action was successful. </td> </tr> <tr> <td> <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5"> 404 Not Found </a> </td> <td> Configuration or Active-Active database not found. </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/crdbs/health_report/"/> <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.40.0/.html
<section class="prose w-full py-12"> <h1> RedisInsight v2.40.0, December 2023 </h1> <p class="text-lg -mt-5 mb-10"> RedisInsight v2.40 </p> <h2 id="240-december-2023"> 2.40 (December 2023) </h2> <p> This is the General Availability (GA) release of RedisInsight 2.40. </p> <h3 id="highlights"> Highlights </h3> <ul> <li> To simplify in-app provisioning of a free <a href="https://redis.com/comparisons/oss-vs-enterprise/?utm_source=redisinsight&amp;utm_medium=rel_notes&amp;utm_campaign=2_40"> Redis Cloud </a> database to use with RedisInsight interactive tutorials, the recommended cloud vendor and region are now preselected </li> <li> Optimizations when uploading large text files with the list of Redis commands, available under bulk actions in Browser </li> </ul> <h3 id="details"> Details </h3> <p> <strong> Features and improvements </strong> </p> <ul> <li> <a href="https://github.com/RedisInsight/RedisInsight/pull/2879"> #2879 </a> UX improvements to simplify in-app provisioning of a free <a href="https://redis.com/comparisons/oss-vs-enterprise/?utm_source=redisinsight&amp;utm_medium=rel_notes&amp;utm_campaign=2_40"> Redis Cloud </a> database. Create a new database with a preselected cloud vendor and region by using the recommended sign-up settings. You can manage your database by signing in to the <a href="https://cloud.redis.io/#/databases?utm_source=redisinsight&amp;utm_medium=rel_notes&amp;utm_campaign=2_40"> Redis Cloud console </a> </li> <li> <a href="https://github.com/RedisInsight/RedisInsight/pull/2851"> #2851 </a> See plan, cloud vendor, and region details after successfully provisioning your free <a href="https://redis.com/comparisons/oss-vs-enterprise/?utm_source=redisinsight&amp;utm_medium=rel_notes&amp;utm_campaign=2_40"> Redis Cloud </a> database </li> <li> <a href="https://github.com/RedisInsight/RedisInsight/pull/2882"> #2882 </a> Optimizations when uploading large text files with the list of Redis commands, available under bulk actions in Browser </li> <li> <a href="https://github.com/RedisInsight/RedisInsight/pull/2808"> #2808 </a> Enhanced security measurement to no longer display existing passwords for Redis Sentinel in plain text </li> <li> <a href="https://github.com/RedisInsight/RedisInsight/pull/2875"> #2875 </a> Increased performance when resizing the key list and key details in the Tree view, ensuring a smoother user experience </li> <li> <a href="https://github.com/RedisInsight/RedisInsight/pull/2866"> #2866 </a> Support for hyphens in <a href="https://github.com/RedisInsight/RedisInsight/issues/2865"> node host names </a> </li> </ul> <p> <strong> Bugs </strong> </p> <ul> <li> <a href="https://github.com/RedisInsight/RedisInsight/pull/2868"> #2868 </a> Prevent <a href="https://github.com/RedisInsight/RedisInsight/issues/2791"> unintentional data overwrites </a> by disabling both manual and automatic refreshing of key values while editing in the Browser </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.40.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/json.del.html
<section class="prose w-full py-12"> <h1 class="command-name"> JSON.DEL </h1> <div class="font-semibold text-redis-ink-900"> Syntax </div> <pre class="command-syntax">JSON.DEL 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 size of the deleted value, O(N) when path is evaluated to multiple values, where N is the size of the key </dd> </dl> <p> Delete a value </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 modify. </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> . Nonexisting paths are ignored. </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> Deleting an object's root is equivalent to deleting the key from Redis. </div> </div> </details> <h2 id="return"> Return </h2> <p> JSON.DEL returns an integer reply specified as the number of paths deleted (0 or more). 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> <details open=""> <summary> <b> Delete a value </b> </summary> <p> Create a JSON document. </p> <div class="highlight"> <pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">redis&gt; JSON.SET doc $ <span class="s1">'{"a": 1, "nested": {"a": 2, "b": 3}}'</span> </span></span><span class="line"><span class="cl">OK</span></span></code></pre> </div> <p> Delete specified values. </p> <div class="highlight"> <pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">redis&gt; JSON.DEL doc $..a </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> Get the updated document. </p> <div class="highlight"> <pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">redis&gt; JSON.GET doc $ </span></span><span class="line"><span class="cl"><span class="s2">"[{\"nested\":{\"b\":3}}]"</span></span></span></code></pre> </div> </details> <h2 id="see-also"> See also </h2> <p> <a href="/docs/latest/commands/json.set/"> <code> JSON.SET </code> </a> | <a href="/docs/latest/commands/json.arrlen/"> <code> JSON.ARRLEN </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.del/"/> <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/supported-platforms/.html
<section class="prose w-full py-12 max-w-none"> <h1> Supported platforms </h1> <p class="text-lg -mt-5 mb-10"> Redis Enterprise Software is supported on several operating systems, cloud environments, and virtual environments. </p> <p> Redis Enterprise Software is supported on several operating systems, cloud environments, and virtual environments. </p> <h2 id="supported-platforms"> Supported platforms </h2> <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 Software <br/> major versions </th> <th style="text-align:center"> 7.8 </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"> Nov 2024 </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"> Nov 2026 </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> <td style="text-align:center"> </td> </tr> <tr> <td> RHEL 9 &amp; <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"> – </td> <td style="text-align:center"> – </td> <td style="text-align:center"> – </td> </tr> <tr> <td> RHEL 9 <br/> FIPS mode <sup> <a href="#table-note-5"> 5 </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> <td style="text-align:center"> – </td> </tr> <tr> <td> RHEL 8 &amp; <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> <td style="text-align:center"> <span title="Supported"> ✅ </span> </td> </tr> <tr> <td> RHEL 7 &amp; <br/> compatible distros <sup> <a href="#table-note-1"> 1 </a> </sup> </td> <td style="text-align:center"> – </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"> <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"> – </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"> – </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"> <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"> – </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> <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> <td style="text-align:center"> <span title="Supported"> ✅ </span> </td> </tr> </tbody> </table> <ol> <li> <p> <a name="table-note-1"> </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"> </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"> </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"> </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> <li> <p> <a name="table-note-5"> </a> Supported only if <a href="https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/9/html/security_hardening/switching-rhel-to-fips-mode_security-hardening#proc_installing-the-system-with-fips-mode-enabled_switching-rhel-to-fips-mode"> FIPS was enabled during RHEL installation </a> to ensure FIPS compliance. </p> </li> </ol> <p> The following table shows which Redis Enterprise Software version first tested and added support for each RHEL version: </p> <table> <thead> <tr> <th> RHEL version </th> <th> Redis Enterprise version </th> </tr> </thead> <tbody> <tr> <td> 8.4 </td> <td> 6.2.8 </td> </tr> <tr> <td> 8.5 </td> <td> 6.2.10 </td> </tr> <tr> <td> 8.6 </td> <td> 6.2.10 </td> </tr> <tr> <td> 8.7 </td> <td> 6.4.2 </td> </tr> <tr> <td> 8.8 </td> <td> 6.4.2 </td> </tr> <tr> <td> 8.9 </td> <td> 7.2.4 </td> </tr> <tr> <td> 9.3 </td> <td> 7.4.2 </td> </tr> </tbody> </table> <h2 id="operating-system-compatibility-policy"> Operating system compatibility policy </h2> <p> Redis maintains a list of <a href="#supported-platforms"> supported operating systems </a> for each major version of Redis Enterprise Software and the specific OS versions tested with Redis Enterprise releases. Because the list is updated as new OS versions are introduced and old ones become obsolete, we encourage you to check the list and plan upgrades accordingly. We also suggest you keep Redis Enterprise and corresponding supported OS versions up to date. </p> <p> We thoroughly test the most recent minor version of each supported major OS to ensure the best compatibility and performance with every Redis Enterprise release. This process helps detect and address potential compatibility issues early on. </p> <p> Due to the vast array of minor updates and variations across operating systems, we cannot test compatibility with every minor OS version and each Redis Enterprise version. However, because OS vendors each have an Application Binary Interface (ABI) they support and avoid breaking, except to address severe security issues, newer minor OS versions are generally expected to work correctly. We will add a note to this document if specific OS minor versions have significant ABI or dependency changes. An earlier OS minor version also might work, although it is not guaranteed. </p> <p> Despite our rigorous testing, we recommend users test their Redis applications with any new OS update before deploying it in a production environment. This additional testing layer can help identify any unique issues in your setup. </p> <h3 id="red-hat-enterprise-linux-rhel"> Red Hat Enterprise Linux (RHEL) </h3> <p> Red Hat has a well-defined lifecycle for support. For details, see <a href="https://access.redhat.com/support/policy/updates/errata#RHEL8_and_9_Life_Cycle"> Red Hat Enterprise Linux Life Cycle </a> . </p> <p> Redis supports and tests RHEL 8 and 9 minor releases and extended update support timeframes. However, none of the longer Red Hat support cycles, such as SAP and EEUS, are supported. </p> <p> We only support what the vendor supports in accordance with their policies. When Red Hat no longer supports a particular release, it is no longer supported by Redis as well. If future Redis Enterprise releases will not support a major RHEL version, the release notes and the <a href="#supported-platforms"> supported platforms </a> table will include deprecation warnings. </p> <h3 id="rhel-clones-and-equivalent-enterprise-os"> RHEL clones and equivalent Enterprise OS </h3> <p> The <a href="#supported-platforms"> supported platforms </a> table lists the versions of Red Hat Enterprise Linux (RHEL) that Redis supports. This support extends to the ABI and package compatibility with RHEL of the same version. </p> <p> The RHEL-compatible distributions CentOS, CentOS Stream, Alma Linux, Rocky Linux, and Oracle Linux running the Red Hat Compatible Kernel (RHCK) are supported if they provide full RHEL compatibility. If Redis identifies or questions some incompatibility from a clone, you might be asked to test on another clone or RHEL directly. </p> <h2 id="operating-system-limitations"> Operating system limitations </h2> <h3 id="tls-10-and-tls-11"> TLS 1.0 and TLS 1.1 </h3> <p> Redis Enterprise Software version 6.2.8 removed support for TLS 1.0 and TLS 1.1 on Red Hat Enterprise Linux 8 (RHEL 8) because that operating system <a href="https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/security_hardening/using-the-system-wide-cryptographic-policies_security-hardening"> does not enable support </a> for these versions by default. </p> <h3 id="ubuntu-20-rejects-sha1-certificates"> Ubuntu 20 rejects SHA1 certificates </h3> <p> With Ubuntu 20.04, you cannot use the SHA1 hash algorithm because <a href="https://manpages.ubuntu.com/manpages/focal/man3/SSL_CTX_set_security_level.3ssl.html#notes"> OpenSSL's security level is set to 2 by default </a> . As a result, the operating system rejects SHA1 certificates, even if you enable the <code> mtls_allow_weak_hashing </code> option. </p> <p> To avoid issues with SHA1 certificates, replace them with new certificates that use SHA-256. Note that certificates provided by Redis Enterprise Software use SHA-256. </p> <h3 id="upgrade-rhel-when-using-modules"> Upgrade RHEL when using modules </h3> <p> RHEL 7 clusters cannot be directly upgraded to RHEL 8 when hosting databases using modules, due to binary differences in modules between the two operating systems. Instead, you need to create a new cluster on RHEL 8 and then migrate existing data from your RHEL 7 cluster. This does not apply to clusters that do not use modules. </p> <p> This limitation is fixed for clusters using Redis Enterprise Software version 7.2.4 and later. </p> <h3 id="modules-cannot-load-in-oracle-linux-7--8"> Modules cannot load in Oracle Linux 7 &amp; 8 </h3> <p> Databases hosted on Oracle Linux 7 &amp; 8 cannot load modules. </p> <p> As a temporary workaround, you can change the node's <code> os_name </code> in the Cluster Configuration Store (CCS): </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">ccs-cli hset node:&lt;ID&gt; os_name rhel </span></span></code></pre> </div> <p> This limitation was fixed in <a href="/docs/latest/operate/rs/release-notes/rs-7-2-4-releases/rs-7-2-4-64/"> Redis Enterprise Software version 7.2.4-64 </a> . </p> <h3 id="openssl-compatibility-issue-for-742-modules-on-amazon-linux-2"> OpenSSL compatibility issue for 7.4.2 modules on Amazon Linux 2 </h3> <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> <h3 id="redisgraph-prevents-upgrade-to-rhel-9"> RedisGraph prevents upgrade to RHEL 9 </h3> <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="virtualization-platforms"> Virtualization platforms </h2> <p> Redis Enterprise Software is compatible with VMware and other similar virtualization platforms. Make sure to do the following: </p> <ul> <li> Configure your memory, CPU, network, and storage settings to allow for optimal Redis Enterprise performance. </li> <li> Pin each Redis Enterprise shard to a specific ESX or ESXi host by setting the appropriate affinity rules. </li> <li> If you must manually migrate a virtual machine to another host, follow the best practices for <a href="/docs/latest/operate/rs/clusters/maintenance-mode/"> shard maintenance </a> and contact support if you have questions. </li> <li> Turn off VMware VMotion because Redis Enterprise is not compatible with VMotion. </li> <li> Don't use snapshots because Redis Enterprise cluster manages states dynamically, so a snapshot might not have the correct node and cluster states. </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/references/supported-platforms/"/> <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/release-notes/previous-releases/.html
<section class="prose w-full py-12 max-w-none"> <h1> Previous version Redis Enterprise for Kubernetes release notes </h1> <p class="text-lg -mt-5 mb-10"> Release notes for versions of Redis Enterprise for Kubernetes released more than 18 months ago. </p> <p> Below are archived release notes for Redis Enterprise for Kubernetes versions released more than 18 months ago. </p> <table> <thead> <tr> <th style="text-align:left"> Version (Release date) </th> <th style="text-align:left"> Major changes </th> </tr> </thead> <tbody> <tr> <td style="text-align:left"> <a href="/docs/latest/operate/kubernetes/release-notes/previous-releases/k8s-6-0-20-12/"> 6.0.20-12 (July 2021) </a> </td> <td style="text-align:left"> Support for RS 6.0.20-97, EKS, Hashicorp Vault, and added feature support for OpenShift OLM. </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/operate/kubernetes/release-notes/previous-releases/k8s-6-0-20-4/"> 6.0.20-4 (May 2021) </a> </td> <td style="text-align:left"> Support for 6.0.20-69, OpenShift 4.7, and K8s 1.20. Hashicorp Vault integration with REC and REDB secrets. </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/operate/kubernetes/release-notes/previous-releases/k8s-6-0-12-5/"> 6.0.12-5 (February 2021) </a> </td> <td style="text-align:left"> Support for RS 6.0.12-57, Amazon Kubernetes Service (AKS), and role permissions on custom resources. </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/operate/kubernetes/release-notes/previous-releases/k8s-6-0-8-20/"> 6.0.8-20 (December 2020) </a> </td> <td style="text-align:left"> Support for RS 6.0.8, consumer namespaces, Gesher admission controller proxy, and custom resource validation via schema. </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/operate/kubernetes/release-notes/previous-releases/k8s-6-0-8-1/"> 6.0.8-1 (October 2020) </a> </td> <td style="text-align:left"> Support for RS 6.0.8-28, OpenShift 4.5, K8s 1.18, and Gesher admission controller proxy. </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/operate/kubernetes/release-notes/previous-releases/k8s-6-0-6-24/"> 6.0.6-24 (August 2020) </a> </td> <td style="text-align:left"> Various bug fixes. </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/operate/kubernetes/release-notes/previous-releases/k8s-6-0-6-23/"> 6.0.6-23 (August 2020) </a> </td> <td style="text-align:left"> Support for Redis Enterprise Software 6.0.6-39, Rancher support, new database backup and alert options. </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/operate/kubernetes/release-notes/previous-releases/k8s-6-0-6-11/"> 6.0.6-11 (July 2020) </a> </td> <td style="text-align:left"> Maintenance release; support RS 6.0.6-39 and various bug fixes. </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/operate/kubernetes/release-notes/previous-releases/k8s-6-0-6-6/"> 6.0.6-6 (June 2020) </a> </td> <td style="text-align:left"> Support for RS 6.0.6, new database and admission controllers, various improvements and bug fixes. </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/operate/kubernetes/release-notes/previous-releases/k8s-5-4-14-2/"> 5.4.14-2 (March 2020) </a> </td> <td style="text-align:left"> Support for Redis Enterprise Software 5.4.14, K8s 1.16, and OpenShift 4.3. </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/operate/kubernetes/release-notes/previous-releases/k8s-5-4-10-8/"> 5.4.10-8 (January 2020) </a> </td> <td style="text-align:left"> Support for the Redis Enterprise Software 5.4.10 and multiple enhancements. </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/kubernetes/release-notes/previous-releases/"/> <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.22.1/.html
<section class="prose w-full py-12"> <h1> RedisInsight v2.22.1, March 2023 </h1> <p class="text-lg -mt-5 mb-10"> RedisInsight v2.22.1 </p> <h2 id="2221-march-2023"> 2.22.1 (March 2023) </h2> <p> This is the General Availability (GA) release of RedisInsight 2.22. </p> <h3 id="highlights"> Highlights </h3> <ul> <li> Share your Redis expertise with your team and the wider community by building custom RedisInsight tutorials. Use our <a href="https://github.com/RedisInsight/Tutorials"> instructions </a> to describe your implementations of Redis for other users to follow and interact with in the context of a connected Redis database </li> <li> Take a quick tour of RedisInsight to discover how it can enhance your development experience when building with Redis or Redis Stack </li> <li> Select from a list of supported decompression formats to view your data in a human-readable format </li> </ul> <h3 id="details"> Details </h3> <p> <strong> Features and improvements </strong> </p> <ul> <li> <a href="https://github.com/RedisInsight/RedisInsight/pull/1782"> #1782 </a> , <a href="https://github.com/RedisInsight/RedisInsight/pull/1813"> #1813 </a> Share your Redis expertise with your team and the wider community by building custom RedisInsight tutorials. The tutorials use markdown and are easy to write. They are an ideal way to describe practical implementations of Redis so users can follow and interact with commands in the context of an already connected Redis database. Check out these <a href="https://github.com/RedisInsight/Tutorials"> instructions </a> to start creating your own tutorials. Let the community discover your content by labeling your GitHub repository with <a href="https://github.com/topics/redis-tutorials"> redis-tutorials </a> </li> <li> <a href="https://github.com/RedisInsight/RedisInsight/pull/1834"> #1834 </a> Take a quick tour of RedisInsight to discover how it can enhance your development experience. To start the tour, in the left-side navigation, open the Help Center (above the Settings icon), reset the onboarding and open the Browser page </li> <li> <a href="https://github.com/RedisInsight/RedisInsight/pull/1742"> #1742 </a> , <a href="https://github.com/RedisInsight/RedisInsight/pull/1753"> #1753 </a> , <a href="https://github.com/RedisInsight/RedisInsight/pull/1755"> #1755 </a> , <a href="https://github.com/RedisInsight/RedisInsight/pull/1762"> #1762 </a> Configure one of the following data decompression formats when adding a database connection to view your data in a human-readable format: GZIP, LZ4, ZSTD, SNAPPY </li> <li> <a href="https://github.com/RedisInsight/RedisInsight/pull/1787"> #1787 </a> Added UX improvements to the search by values of keys feature in Browser: Enable the search box after the index is selected </li> </ul> <p> <strong> Bugs </strong> </p> <ul> <li> <a href="https://github.com/RedisInsight/RedisInsight/pull/1808"> #1808 </a> Prevent errors when running Docker RedisInsight on Safari Version 16.2 </li> <li> <a href="https://github.com/RedisInsight/RedisInsight/pull/1835"> #1835 </a> Display total memory and total keys for replicas in Sentinel </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.22.1/"/> <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/subscriptions/upgrade-essentials-pro/.html
<section class="prose w-full py-12 max-w-none"> <h1> Upgrade database from Redis Cloud Essentials to Redis Cloud Pro </h1> <p class="text-lg -mt-5 mb-10"> Upgrade your Redis Cloud Essentials subscription to a Redis Cloud Pro subscription. </p> <p> Redis Cloud Essentials supports low throughput workflows. It supports a range of availability, persistence, and backup options, and can be great for testing and prototyping. However, if your databases need higher throughput, or you're missing features that are not available with Redis Cloud Essentials, you may want to upgrade Redis Cloud Essentials to Redis Cloud Pro. </p> <p> For more information about the different subscription plans, see <a href="/docs/latest/operate/rc/subscriptions/#subscription-plans"> Subscription plans </a> . </p> <p> To upgrade your Essentials plan, see <a href="/docs/latest/operate/rc/subscriptions/view-essentials-subscription/#upgrade-plan"> Upgrade subscription plan </a> . </p> <h2 id="upgrade-essentials-subscription-to-pro"> Upgrade Essentials subscription to Pro </h2> <p> To follow the steps in this guide, you must have a database with <a href="/docs/latest/operate/rc/subscriptions/view-essentials-subscription/"> Redis Cloud Essentials </a> that you want to upgrade to Redis Cloud Pro. </p> <p> To upgrade your Essentials database to Redis Cloud Pro: </p> <ol> <li> <p> <a href="#create-rcp"> Create a new database in Redis Cloud Pro </a> with the right specifications to be able to migrate your database. </p> </li> <li> <p> <a href="#migrate-database"> Migrate your Essentials database </a> to your new Redis Cloud Pro database. </p> </li> </ol> <h3 id="create-rcp"> Create Redis Cloud Pro database </h3> <p> <a href="/docs/latest/operate/rc/databases/create-database/create-pro-database-new/"> Create a new database </a> with the following specifications: </p> <ul> <li> Select <strong> Redis Cloud Pro </strong> for your subscription type. </li> <li> Select the <strong> Version </strong> that matches the Redis version your Essentials subscriptions use. </li> <li> In the <a href="/docs/latest/operate/rc/databases/create-database/create-pro-database-new/#sizing-tab"> <strong> Sizing tab </strong> </a> , create your databases with the following specifications: <ul> <li> Set the memory limit to comply with <a href="/docs/latest/operate/rc/databases/migrate-databases/#active-passive-memory-requirements"> Active-Passive memory requirements </a> if you want to migrate your database using <a href="/docs/latest/operate/rc/databases/migrate-databases/#sync-using-active-passive"> Active-Passive </a> . </li> <li> Select any advanced capabilities that your Essentials database offers. You can find a list of enabled advanced capabilities in the <a href="/docs/latest/operate/rc/databases/view-edit-database/#configuration-details-tab"> Configuration tab </a> of your database. </li> </ul> </li> </ul> <h3 id="migrate-database"> Migrate database </h3> <p> You can migrate your Redis Cloud Essentials database to your new Redis Cloud Pro subscription using any method in the <a href="/docs/latest/operate/rc/databases/migrate-databases/"> Migrate databases </a> guide. This guide uses <a href="/docs/latest/operate/rc/databases/migrate-databases/#sync-using-active-passive"> Active-Passive </a> to migrate databases between subscriptions in the same account. </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> Before you follow this guide, be aware of the following limitations: </p> <ul> <li> <p> This guide is for migrating databases between subscriptions in the same Redis Cloud console account. <a href="https://redis.io/support/"> Contact support </a> if you want to migrate a database between accounts using Active-Passive. </p> </li> <li> <p> As long as Active-Passive is enabled, data in the target database will not expire and will not be evicted regardless of the set <a href="/docs/latest/operate/rc/databases/configuration/data-eviction-policies/"> data eviction policy </a> . We recommend that you turn off Active-Passive after the databases are synced. </p> </li> </ul> </div> </div> <ol> <li> <p> Select the database you want to migrate your data to. This will be your target database. </p> </li> <li> <p> From the <strong> Configuration </strong> tab of the target database, select <strong> Edit database </strong> . </p> <a href="/docs/latest/images/rc/button-database-edit.png" sdata-lightbox="/images/rc/button-database-edit.png"> <img alt="The Edit database button lets you change selected database properties." src="/docs/latest/images/rc/button-database-edit.png"/> </a> </li> <li> <p> In the <strong> Durability </strong> section, enable <strong> Active-Passive Redis </strong> and then select <strong> Add Source </strong> . </p> <a href="/docs/latest/images/rc/migrate-data-active-passive-enable.png" sdata-lightbox="/images/rc/migrate-data-active-passive-enable.png"> <img alt="Active-Passive settings are located in the **Durability** section of the database **Configuration** tab." src="/docs/latest/images/rc/migrate-data-active-passive-enable.png"/> </a> <a href="/docs/latest/images/rc/button-database-uri-add.png" sdata-lightbox="/images/rc/button-database-uri-add.png"> <img alt="Use the **Add Source** button to specify the source of the Active-Passive replica." src="/docs/latest/images/rc/button-database-uri-add.png" width="150px"/> </a> </li> <li> <p> This will open the <strong> Add Active-Passive Redis </strong> screen. Select <strong> Current account </strong> to connect a database in your current account. </p> <a href="/docs/latest/images/rc/migrate-data-add-active-passive.png" sdata-lightbox="/images/rc/migrate-data-add-active-passive.png"> <img alt="The Add Active-Passive Redis screen." src="/docs/latest/images/rc/migrate-data-add-active-passive.png"/> </a> </li> <li> <p> Select your Redis Cloud Essentials database from the <strong> Source database </strong> list. This will be your source database. You can type in the database's name to find it. </p> <a href="/docs/latest/images/rc/database-add-account-path-list.png" sdata-lightbox="/images/rc/database-add-account-path-list.png"> <img alt="Select the Source database from the database list." src="/docs/latest/images/rc/database-add-account-path-list.png"/> </a> </li> <li> <p> Select <strong> Save Database </strong> to begin updating the database. </p> <a href="/docs/latest/images/rc/button-database-save.png" sdata-lightbox="/images/rc/button-database-save.png"> <img alt="Use the **Save Database** button to save your changes, deploy the database, and to start data migration." src="/docs/latest/images/rc/button-database-save.png"/> </a> <p> Initially, the database status is <strong> Pending </strong> , which means the update task is still running. </p> <a href="/docs/latest/images/rc/icon-database-update-status-pending.png" sdata-lightbox="/images/rc/icon-database-update-status-pending.png"> <img alt="When the status is 'Pending', your changes are still being deployed." src="/docs/latest/images/rc/icon-database-update-status-pending.png"/> </a> <p> The sync process doesn't begin until the database becomes <code> Active </code> . </p> <a href="/docs/latest/images/rc/icon-database-update-status-active.png" sdata-lightbox="/images/rc/icon-database-update-status-active.png"> <img alt="When the status becomes 'Active', data begins to sync." src="/docs/latest/images/rc/icon-database-update-status-active.png"/> </a> <p> When data has fully migrated to the target database, database status reports <code> Synced </code> . </p> <a href="/docs/latest/images/rc/migrate-data-status-synced.png" sdata-lightbox="/images/rc/migrate-data-status-synced.png"> <img alt="When the data is migrated, the target database status displays `Synced`." src="/docs/latest/images/rc/migrate-data-status-synced.png"/> </a> <p> Active-Passive sync lets you migrate data while apps and other connections are using the source database. Once the data is migrated, you should migrate active connections to the target database before you move on. </p> </li> <li> <p> After your data and connections are migrated, turn off <strong> Active-Passive Redis </strong> from the target database. </p> </li> <li> <p> <a href="/docs/latest/operate/rc/databases/delete-database/"> Delete the source 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/rc/subscriptions/upgrade-essentials-pro/"/> <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/clients/client-side-caching/.html
<section class="prose w-full py-12"> <h1> Client-side caching introduction </h1> <p class="text-lg -mt-5 mb-10"> Server-assisted, client-side caching in Redis </p> <p> <em> Client-side caching </em> reduces network traffic between a Redis client and the server, which generally improves performance. </p> <p> By default, an <a href="https://en.wikipedia.org/wiki/Application_server"> application server </a> (which sits between the user app and the database) contacts the Redis database server through the client library for every read request. The diagram below shows the flow of communication from the user app, through the application server to the database and back again: </p> <a href="/docs/latest/images/csc/CSCNoCache.drawio.svg" sdata-lightbox="/images/csc/CSCNoCache.drawio.svg"> <img src="/docs/latest/images/csc/CSCNoCache.drawio.svg"/> </a> <p> When you use client-side caching, the client library maintains a local cache of data items as it retrieves them from the database. When the same items are needed again, the client can satisfy the read requests from the cache instead of the database: </p> <a href="/docs/latest/images/csc/CSCWithCache.drawio.svg" sdata-lightbox="/images/csc/CSCWithCache.drawio.svg"> <img src="/docs/latest/images/csc/CSCWithCache.drawio.svg"/> </a> <p> Accessing the cache is much faster than communicating with the database over the network and it reduces network traffic. Client-side caching reduces the load on the database server, so you may be able to run it using less hardware resources. </p> <p> As with other forms of <a href="https://en.wikipedia.org/wiki/Cache_(computing)"> caching </a> , client-side caching works well in the very common use case where a small subset of the data is accessed much more frequently than the rest of the data (according to the <a href="https://en.wikipedia.org/wiki/Pareto_principle"> Pareto principle </a> ). </p> <h2 id="tracking"> Updating the cache when the data changes </h2> <p> All caching systems must implement a scheme to update data in the cache when the corresponding data changes in the main database. Redis uses an approach called <em> tracking </em> . </p> <p> When client-side caching is enabled, the Redis server remembers or <em> tracks </em> the set of keys that each client connection has previously read. This includes cases where the client reads data directly, as with the <a href="/docs/latest/commands/get/"> <code> GET </code> </a> command, and also where the server calculates values from the stored data, as with <a href="/docs/latest/commands/strlen/"> <code> STRLEN </code> </a> . When any client writes new data to a tracked key, the server sends an invalidation message to all clients that have accessed that key previously. This message warns the clients that their cached copies of the data are no longer valid and the clients will evict the stale data in response. Next time a client reads from the same key, it will access the database directly and refresh its cache with the updated data. </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 any connection from a client gets disconnected (including one from a connection pool), then the client will flush all keys from the client-side cache. Caching then resumes for subsequent reads from the connections that are still active. </div> </div> <p> The sequence diagram below shows how two clients might interact as they access and update the same key: </p> <a href="/docs/latest/images/csc/CSCSeqDiagram.drawio.svg" sdata-lightbox="/images/csc/CSCSeqDiagram.drawio.svg"> <img src="/docs/latest/images/csc/CSCSeqDiagram.drawio.svg"/> </a> <h2 id="which-commands-can-cache-data"> Which commands can cache data? </h2> <p> All read-only commands (with the <code> @read </code> <a href="/docs/latest/operate/oss_and_stack/management/security/acl/"> ACL category </a> ) will use cached data, except for the following: </p> <ul> <li> Any commands for <a href="/docs/latest/develop/data-types/probabilistic/"> probabilistic data types </a> . These types are designed to be updated frequently, which means that caching has little or no benefit. </li> <li> Non-deterministic commands such as <a href="/docs/latest/commands/hrandfield/"> <code> HRANDFIELD </code> </a> , <a href="/docs/latest/commands/hscan/"> <code> HSCAN </code> </a> , and <a href="/docs/latest/commands/zrandmember/"> <code> ZRANDMEMBER </code> </a> . By design, these commands give different results each time they are called. </li> <li> Redis Query Engine commands (with the <code> FT.* </code> prefix), such as <a href="/docs/latest/commands/ft.search"> <code> FT.SEARCH </code> </a> . </li> </ul> <p> You can use the <a href="/docs/latest/commands/monitor/"> <code> MONITOR </code> </a> command to check the server's behavior when you are using client-side caching. Because <code> MONITOR </code> only reports activity from the server, you should find the first cacheable access to a key causes a response from the server. However, subsequent accesses are satisfied by the cache, and so <code> MONITOR </code> should report no server activity if client-side caching is working correctly. </p> <h2 id="what-data-gets-cached-for-a-command"> What data gets cached for a command? </h2> <p> Broadly speaking, the data from the specific response to a command invocation gets cached after it is used for the first time. Subsets of that data or values calculated from it are retrieved from the server as usual and then cached separately. For example: </p> <ul> <li> The whole string retrieved by <a href="/docs/latest/commands/get/"> <code> GET </code> </a> is added to the cache. Parts of the same string retrieved by <a href="/docs/latest/commands/substr/"> <code> SUBSTR </code> </a> are calculated on the server the first time and then cached separately from the original string. </li> <li> Using <a href="/docs/latest/commands/getbit/"> <code> GETBIT </code> </a> or <a href="/docs/latest/commands/bitfield/"> <code> BITFIELD </code> </a> on a string caches the returned values separately from the original string. </li> <li> For composite data types accessed by keys ( <a href="/docs/latest/develop/data-types/hashes/"> hash </a> , <a href="/docs/latest/develop/data-types/json/"> JSON </a> , <a href="/docs/latest/develop/data-types/sets/"> set </a> , and <a href="/docs/latest/develop/data-types/sorted-sets/"> sorted set </a> ), the whole object is cached separately from the individual fields. So the results of <code> JSON.GET mykey $ </code> and <code> JSON.GET mykey $.myfield </code> create separate entries in the cache. </li> <li> Ranges from <a href="/docs/latest/develop/data-types/lists/"> lists </a> , <a href="/docs/latest/develop/data-types/streams/"> streams </a> , and <a href="/docs/latest/develop/data-types/sorted-sets/"> sorted sets </a> are cached separately from the object they form a part of. Likewise, subsets returned by <a href="/docs/latest/commands/sinter/"> <code> SINTER </code> </a> and <a href="/docs/latest/commands/sdiff/"> <code> SDIFF </code> </a> create separate cache entries. </li> <li> For multi-key read commands such as <a href="/docs/latest/commands/mget/"> <code> MGET </code> </a> , the ordering of the keys is significant. For example <code> MGET name:1 name:2 </code> is cached separately from <code> MGET name:2 name:1 </code> because the server returns the values in the order you specify. </li> <li> Boolean or numeric values calculated from data types (for example <a href="/docs/latest/commands/sismember/"> <code> SISMEMBER </code> </a> ) and <a href="/docs/latest/commands/llen/"> <code> LLEN </code> </a> are cached separately from the object they refer to. </li> </ul> <h2 id="usage-recommendations"> Usage recommendations </h2> <p> Like any caching system, client-side caching has some limitations: </p> <ul> <li> The cache has only a limited amount of memory available. When the limit is reached, the client must <em> evict </em> potentially useful items from the cache to make room for new ones. </li> <li> Cache misses, tracking, and invalidation messages always add a slight performance penalty. </li> </ul> <p> Below are some guidelines to help you use client-side caching efficiently, within these limitations: </p> <ul> <li> <p> <strong> Use a separate connection for data that is not cache-friendly </strong> : Caching gives the most benefit for keys that are read frequently and updated infrequently. However, you may also have data, such as counters and scoreboards, that receives frequent updates. In cases like this, the performance overhead of the invalidation messages can be greater than the savings made by caching. Avoid this problem by using a separate connection <em> without </em> client-side caching for any data that is not cache-friendly. </p> </li> <li> <p> <strong> Estimate how many items you can cache </strong> : The client libraries let you specify the maximum number of items you want to hold in the cache. You can calculate an estimate for this number by dividing the maximum desired size of the cache in memory by the average size of the items you want to store (use the <a href="/docs/latest/commands/memory-usage/"> <code> MEMORY USAGE </code> </a> command to get the memory footprint of a key). For example, if you had 10MB (or 10485760 bytes) available for the cache, and the average size of an item was 80 bytes, you could fit approximately 10485760 / 80 = 131072 items in the cache. Monitor memory usage on your server with a realistic test load to adjust your estimate up or down. </p> <h2 id="reference"> Reference </h2> <p> The Redis server implements extra features for client-side caching that are not used by the main Redis clients, but may be useful for custom clients and other advanced applications. See <a href="/docs/latest/develop/reference/client-side-caching/"> Client-side caching reference </a> for a full technical guide to all the options available for client-side caching. </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/develop/clients/client-side-caching/"/> <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/latency-latest/.html
<section class="prose w-full py-12"> <h1 class="command-name"> LATENCY LATEST </h1> <div class="font-semibold text-redis-ink-900"> Syntax </div> <pre class="command-syntax">LATENCY LATEST</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.13 </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> @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> The <code> LATENCY LATEST </code> command reports the latest latency events logged. </p> <p> Each reported event has the following fields: </p> <ul> <li> Event name. </li> <li> Unix timestamp of the latest latency spike for the event. </li> <li> Latest event latency in millisecond. </li> <li> All-time maximum latency for this event. </li> </ul> <p> "All-time" means the maximum latency since the Redis instance was started, or the time that events were reset <a href="/docs/latest/commands/latency-reset/"> <code> LATENCY RESET </code> </a> . </p> <h2 id="examples"> Examples </h2> <pre tabindex="0"><code>127.0.0.1:6379&gt; debug sleep 1 OK (1.00s) 127.0.0.1:6379&gt; debug sleep .25 OK 127.0.0.1:6379&gt; latency latest 1) 1) "command" 2) (integer) 1405067976 3) (integer) 251 4) (integer) 1001 </code></pre> <p> For more information refer to the <a href="/operate/oss_and_stack/management/optimization/latency-monitor.md"> Latency Monitoring Framework page </a> . </p> <h2 id="resp2resp3-reply"> RESP2/RESP3 Reply </h2> <a href="../../develop/reference/protocol-spec#arrays"> Array reply </a> : an array where each element is a four elements array representing the event's name, timestamp, latest and all-time latency measurements. <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/latency-latest/"/> <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/administration/overview/.html
<section class="prose w-full py-12"> <h1> Technical overview </h1> <p class="text-lg -mt-5 mb-10"> Technical overview of the search and query features of Redis Stack </p> <h2 id="abstract"> Abstract </h2> <p> RediSearch is a powerful text search and secondary indexing engine that is built on top of Redis as a Redis module. </p> <p> Unlike other Redis search libraries, it does not use the internal data structures of Redis such as sorted sets. Using its own highly optimized data structures and algorithms, it allows for advanced search features, high performance, and a low memory footprint. It can perform simple text searches, as well as complex structured queries, filtering by numeric properties and geographical distances. </p> <p> RediSearch supports continuous indexing with no performance degradation, maintaining concurrent loads of querying and indexing. This makes it ideal for searching frequently updated databases without the need for batch indexing and service interrupts. </p> <p> The Enterprise version of RediSearch supports scaling the search engine across many servers, allowing it to easily grow to billions of documents on hundreds of servers. </p> <p> All of this is done while taking advantage of Redis's robust architecture and infrastructure. Using Redis's protocol, replication, persistence, and clustering, RediSearch delivers a powerful yet simple to manage and maintain search and indexing engine that can be used as a standalone database, or to augment existing Redis databases with advanced powerful indexing capabilities. </p> <hr/> <h2 id="main-features"> Main features </h2> <ul> <li> Full-Text indexing of multiple fields in a document, including: <ul> <li> Exact phrase matching. </li> <li> Stemming in many languages. </li> <li> Chinese tokenization support. </li> <li> Prefix queries. </li> <li> Optional, negative, and union queries. </li> </ul> </li> <li> Distributed search on billions of documents. </li> <li> Numeric property indexing. </li> <li> Geographical indexing and radius filters. </li> <li> Incremental indexing without performance loss. </li> <li> A structured query language for advanced queries: <ul> <li> Unions and intersections </li> <li> Optional and negative queries </li> <li> Tag filtering </li> <li> Prefix matching </li> </ul> </li> <li> A powerful auto-complete engine with fuzzy matching. </li> <li> Multiple scoring models and sorting by values. </li> <li> Concurrent, low-latency insertion and updates of documents. </li> <li> Concurrent searches allowing long-running queries without blocking Redis. </li> <li> An extension mechanism allowing custom scoring models and query extension. </li> <li> Support for indexing existing Hash objects in Redis databases. </li> </ul> <hr/> <h2 id="indexing-documents"> Indexing documents </h2> <p> Redis Stack needs to know how to index documents in order to search effectively. A document may have several fields, each with its own weight. For example, a title is usually more important than the text itself. The engine can also use numeric or geographical fields for filtering. Hence, the first step is to create the index definition, which tells Redis Stack how to treat the documents that will be added. For example, to define an index of products, indexing their title, description, brand, and price fields, the index creation would look like: </p> <pre tabindex="0"><code>FT.CREATE idx PREFIX 1 doc: SCHEMA title TEXT WEIGHT 5 description TEXT brand TEXT PRICE numeric </code></pre> <p> When a document is added to this index, as in the following example, each field of the document is broken into its terms (tokenization), and indexed by marking the index for each of the terms in the index. As a result, the product is added immediately to the index and can now be found in future searches. </p> <pre tabindex="0"><code>HSET doc:1 title "Acme 42 inch LCD TV" description "42 inch brand new Full-HD tv with smart tv capabilities" brand "Acme" price 300 </code></pre> <p> This tells Redis Stack to take the document, break each field into its terms (tokenization), and index it by marking the index for each of the terms in the index as contained in this document. Thus, the product is added immediately to the index and can now be found in future searches. </p> <h2 id="searching"> Searching </h2> <p> Now that the products have been added to our index, searching is very simple: </p> <pre tabindex="0"><code>FT.SEARCH idx "full hd tv" </code></pre> <p> This will tell Redis Stack to intersect the lists of documents for each term and return all documents containing the three terms. Of course, more complex queries can be performed, and the full syntax of the query language is detailed below. </p> <h2 id="data-structures"> Data structures </h2> <p> Redis Stack uses its own custom data structures and uses Redis' native structures only for storing the actual document content (using Hash objects). </p> <p> Using specialized data structures allows faster searches and more memory effective storage of index records, utilizing compression techniques like delta encoding. </p> <p> These are the data structures Redis Stack uses under the hood: </p> <h3 id="index-and-document-metadata"> Index and document metadata </h3> <p> For each search <em> index </em> , there is a root data structure containing the schema, statistics, etc., but most importantly, compact metadata about each document indexed. </p> <p> Internally, inside the index, Redis Stack uses delta encoded lists of numeric, incremental, 32-bit document ids. This means that the user given keys or ids for documents, need to be replaced with the internal ids on indexing, and back to the original ids on search. </p> <p> For that, Redis Stack saves two tables, mapping the two kinds of ids in two ways (one table uses a compact trie, the other is simply an array where the internal document ID is the array index). On top of that, for each document, its user given presumptive score is stored, along with some status bits and any optional payload attached to the document by the user. </p> <p> Accessing the document metadata table is an order of magnitude faster than accessing the hash object where the document is actually saved, so scoring functions that need to access metadata about the document can operate fast enough. </p> <h3 id="inverted-index"> Inverted index </h3> <p> For each term appearing in at least one document, an inverted index is kept, which is basically a list of all the documents where this term appears. The list is compressed using delta coding, and the document ids are always incrementing. </p> <p> For example, when a user indexes the documents "foo", "bar", and "baz", they are assigned incrementing ids, e.g., <code> 1025, 1045, 1080 </code> . When encoding them into the index, only the first ID is encoded, followed by the deltas between each entry and the previous one, e.g., <code> 1025, 20, 35 </code> . </p> <p> Using variable-width encoding, one byte is used to express numbers under 255, two bytes for numbers between 256 and 16,383, and so on. This can compress the index by up to 75%. </p> <p> On top of the IDs, the frequency of each term in each document, a bit mask representing the fields in which the term appeared in the document, and a list of the positions in which the term appeared is saved. </p> <p> The structure of the default search record is as follows. Usually, all the entries are one byte long: </p> <pre tabindex="0"><code>+----------------+------------+------------------+-------------+------------------------+ | docId_delta | frequency | field mask | offsets len | offset, offset, .... | | (1-4 bytes) | (1-2 bytes)| (1-16 bytes) | (1-2 bytes)| (1-2 bytes per offset) | +----------------+------------+------------------+-------------+------------------------+ </code></pre> <p> Optionally, you can choose not to save any one of those attributes besides the ID, degrading the features available to the engine. </p> <h3 id="numeric-index"> Numeric index </h3> <p> Numeric properties are indexed in a special data structure that enables filtering by numeric ranges in an efficient way. One could view a numeric value as a term operating just like an inverted index. For example, all the products with the price $100 are in a specific list, which is intersected with the rest of the query. See <a href="/docs/latest/develop/interact/search-and-query/administration/design#query-execution-engine"> query execution engine </a> for more information. </p> <p> However, in order to filter by a range of prices, you would have to intersect the query with all the distinct prices within that range, or perform a union query. If the range has many values in it, this becomes highly inefficient. </p> <p> To avoid this, numeric entries are grouped, with close values together, in a single range node. These nodes are stored in a binary range tree, which allows the engine to select the relevant nodes and union them together. Each entry in a range node contains a document Id and the actual numeric value for that document. To further optimize, the tree uses an adaptive algorithm to try to merge as many nodes as possible within the same range node. </p> <h3 id="tag-index"> Tag index </h3> <p> Tag indexes are similar to full-text indexes, but use simpler tokenization and encoding in the index. The values in these fields cannot be accessed by general field-less search and can be used only with a special syntax. </p> <p> The main differences between tag fields and full-text fields are: </p> <ol> <li> <p> The tokenization is simpler. The user can determine a separator (defaults to a comma) for multiple tags. Whitespace trimming is done only at the end of tags. Thus, tags can contain spaces, punctuation marks, accents, etc. The only two transformations that are performed are lower-casing (for latin languages only as of now) and whitespace trimming. </p> </li> <li> <p> Tags cannot be found from a general full-text search. If a document has a field called <em> tags </em> with the values <em> foo </em> and <em> bar </em> , searching for foo or bar without a special tag modifier (see below) will not return this document. </p> </li> <li> <p> The index is much simpler and more compressed. Only the document IDs are stored in the index, usually resulting in 1-2 bytes per index entry. </p> </li> </ol> <h3 id="geo-index"> Geo index </h3> <p> Geo indexes utilize Redis's own geo-indexing capabilities. At query time, the geographical part of the query (a radius filter) is sent to Redis, returning only the ids of documents that are within that radius. Longitude and latitude should be passed as a string <code> lon,lat </code> . For example, <code> 1.23,4.56 </code> . </p> <h3 id="auto-complete"> Auto-complete </h3> <p> The auto-complete engine (see below for a fuller description) utilizes a compact trie or prefix tree to encode terms and search them by prefix. </p> <h2 id="query-language"> Query language </h2> <p> Simple syntax is supported for complex queries that can be combined together to express complex filtering and matching rules. The query is a text string in the <a href="/docs/latest/commands/ft.search/"> <code> FT.SEARCH </code> </a> request that is parsed using a complex query processor. </p> <ul> <li> Multi-word phrases are lists of tokens, e.g., <code> foo bar baz </code> , and imply intersection (logical AND) of the terms. </li> <li> Exact phrases are wrapped in quotes, e.g <code> "hello world" </code> . </li> <li> OR unions (e.g., <code> word1 OR word2 </code> ), are expressed with a pipe ( <code> | </code> ) character. For example, <code> hello|hallo|shalom|hola </code> . </li> <li> NOT negation (e.g., <code> word1 NOT word2 </code> ) of expressions or sub-queries use the dash ( <code> - </code> ) character. For example, <code> hello -world </code> . </li> <li> Prefix matches (all terms starting with a prefix) are expressed with a <code> * </code> following a 2-letter or longer prefix. </li> <li> Selection of specific fields using the syntax <code> @field:hello world </code> . </li> <li> Numeric Range matches on numeric fields with the syntax <code> @field:[{min} {max}] </code> . </li> <li> Geo radius matches on geo fields with the syntax <code> @field:[{lon} {lat} {radius} {m|km|mi|ft}] </code> </li> <li> Tag field filters with the syntax <code> @field:{tag | tag | ...} </code> . See the <a href="/docs/latest/develop/interact/search-and-query/query/#tag-filters"> full documentation on tag fields </a> . </li> <li> Optional terms or clauses: <code> foo ~bar </code> means bar is optional but documents with bar in them will rank higher. </li> </ul> <h3 id="complex-query-examples"> Complex query examples </h3> <p> Expressions can be combined together to express complex rules. For example, given a database of products, where each entity has the fields <code> title </code> , <code> brand </code> , <code> tags </code> and <code> price </code> , expressing a generic search would be simply: </p> <pre tabindex="0"><code>lcd tv </code></pre> <p> This would return documents containing these terms in any field. Limiting the search to specific fields (title only in this case) is expressed as: </p> <pre tabindex="0"><code>@title:(lcd tv) </code></pre> <p> Numeric filters can be combined to filter by price within a given price range: </p> <pre tabindex="0"><code> @title:(lcd tv) @price:[100 500.2] </code></pre> <p> Multiple text fields can be accessed in different query clauses. For example, to select products of multiple brands: </p> <pre tabindex="0"><code> @title:(lcd tv) @brand:(sony | samsung | lg) @price:[100 500.2] </code></pre> <p> Tag fields can be used to index multi-term properties without actual full-text tokenization: </p> <pre tabindex="0"><code> @title:(lcd tv) @brand:(sony | samsung | lg) @tags:{42 inch | smart tv} @price:[100 500.2] </code></pre> <p> And negative clauses can also be added to filter out plasma and CRT TVs: </p> <pre tabindex="0"><code> @title:(lcd tv) @brand:(sony | samsung | lg) @tags:{42 inch | smart tv} @price:[100 500.2] -@tags:{plasma | crt} </code></pre> <h2 id="scoring-model"> Scoring model </h2> <p> Redis Stack comes with a few very basic scoring functions to evaluate document relevance. They are all based on document scores and term frequency. This is regardless of the ability to use sortable fields (see below). Scoring functions are specified by adding the <code> SCORER {scorer_name} </code> argument to a search request. </p> <p> If you prefer a custom scoring function, it is possible to add more functions using the <a href="/docs/latest/develop/interact/search-and-query/administration/extensions/"> extension API </a> . </p> <p> These are the pre-bundled scoring functions available in Redis Stack: </p> <ul> <li> <p> <strong> TFIDF </strong> (default) </p> <p> Basic <a href="https://en.wikipedia.org/wiki/Tf%E2%80%93idf"> TF-IDF scoring </a> with document score and proximity boosting factored in. </p> </li> <li> <p> <strong> TFIDF.DOCNORM </strong> </p> </li> <li> <p> Identical to the default TFIDF scorer, with one important distinction: </p> </li> <li> <p> <strong> BM25 </strong> </p> <p> A variation on the basic TF-IDF scorer. See <a href="https://en.wikipedia.org/wiki/Okapi_BM25"> this Wikipedia article for more information </a> . </p> </li> <li> <p> <strong> DISMAX </strong> </p> <p> A simple scorer that sums up the frequencies of the matched terms. In the case of union clauses, it will give the maximum value of those matches. </p> </li> <li> <p> <strong> DOCSCORE </strong> </p> <p> A scoring function that just returns the presumptive score of the document without applying any calculations to it. Since document scores can be updated, this can be useful if you'd like to use an external score and nothing further. </p> </li> </ul> <h2 id="sortable-fields"> Sortable fields </h2> <p> It is possible to bypass the scoring function mechanism and order search results by the value of different document properties (fields) directly, even if the sorting field is not used by the query. For example, you can search for first name and sort by the last name. </p> <p> When creating the index with <a href="/docs/latest/commands/ft.create/"> <code> FT.CREATE </code> </a> , you can declare <code> TEXT </code> , <code> TAG </code> , <code> NUMERIC </code> , and <code> GEO </code> properties as <code> SORTABLE </code> . When a property is sortable, you can later decide to order the results by its values with relatively low latency. When a property is not sortable, it can still be sorted by its values, but may increase latency. For example, the following schema: </p> <pre tabindex="0"><code>FT.CREATE users SCHEMA first_name TEXT last_name TEXT SORTABLE age NUMERIC SORTABLE </code></pre> <p> Would allow the following query: </p> <pre tabindex="0"><code>FT.SEARCH users "john lennon" SORTBY age DESC </code></pre> <h2 id="result-highlighting-and-summarization"> Result highlighting and summarization </h2> <p> Redis Stack uses advanced algorithms for highlighting and summarizing, which enable only the relevant portions of a document to appear in response to a search query. This feature allows users to immediately understand the relevance of a document to their search criteria, typically highlighting the matching terms in bold text. The syntax is as follows: </p> <pre tabindex="0"><code>FT.SEARCH ... SUMMARIZE [FIELDS {num} {field}] [FRAGS {numFrags}] [LEN {fragLen}] [SEPARATOR {separator}] HIGHLIGHT [FIELDS {num} {field}] [TAGS {openTag} {closeTag}] </code></pre> <p> Summarization will fragment the text into smaller sized snippets. Each snippet will contain the found term(s) and some additional surrounding context. </p> <p> Highlighting will highlight the found term and its variants with a user-defined tag. This may be used to display the matched text in a different typeface using a markup language, or to otherwise make the text appear differently. </p> <h2 id="auto-completion"> Auto-completion </h2> <p> Another important feature for Redis Stack is its auto-complete engine. This allows users to create dictionaries of weighted terms, and then query them for completion suggestions to a given user prefix. Completions can have payloads, which are user-provided pieces of data that can be used for display. For example, completing the names of users, it is possible to add extra metadata about users to be displayed. </p> <p> For example, if a user starts to put the term “lcd tv” into a dictionary, sending the prefix “lc” will return the full term as a result. The dictionary is modeled as a compact trie (prefix tree) with weights, which is traversed to find the top suffixes of a prefix. </p> <p> Redis Stack also allows fuzzy suggestions, meaning you can get suggestions to prefixes even if the user makes a typo in their prefix. This is enabled using a Levenshtein automaton, allowing efficient searching of the dictionary for all terms within a maximal Levenshtein distance of a term or prefix. Suggestions are then weighted based on both their original score and their distance from the prefix typed by the user. </p> <p> However, searching for fuzzy prefixes (especially very short ones) will traverse an enormous number of suggestions. In fact, fuzzy suggestions for any single letter will traverse the entire dictionary, so the recommendation is to use this feature carefully and in full consideration of the performance penalty it incurs. </p> <p> Redis Stack's auto-completer supports Unicode, allowing for fuzzy matches in non-latin languages as well. </p> <h2 id="search-engine-internals"> Search engine internals </h2> <h3 id="the-redis-module-api"> The Redis module API </h3> <p> RediSearch is implemented using the <a href="/docs/latest/develop/reference/modules/"> Redis module API </a> and is loaded into Redis as an extension module at start-up. </p> <p> Redis modules make it possible to extend Redis's core functionality, implementing new Redis commands, data structures, and capabilities with similar performance to native core Redis itself. Redis modules are dynamic libraries that can be loaded into Redis at start-up or loaded at run-time using the <a href="/docs/latest/commands/module-load/"> <code> MODULE LOAD </code> </a> command. Redis exports a C API, in the form of a single C header file called <code> redismodule.h </code> . </p> <p> While the logic of RediSearch and its algorithms are mostly independent, and it could be ported quite easily to run as a stand-alone server, it still takes advantage of Redis as a robust infrastructure for a database server. Building on top of Redis means that, by default, modules are afforded: </p> <ul> <li> A high performance network protocol server </li> <li> Robust replication </li> <li> Highly durable persistence as snapshots of transaction logs </li> <li> Cluster mode </li> </ul> <h3 id="query-execution-engine"> Query execution engine </h3> <p> Redis Stack uses a high-performance flexible query processing engine that can evaluate very complex queries in real time. </p> <p> The above query language is compiled into an execution plan that consists of a tree of index iterators or filters. These can be any of: </p> <ul> <li> Numeric filter </li> <li> Tag filter </li> <li> Text filter </li> <li> Geo filter </li> <li> Intersection operation (combining 2 or more filters) </li> <li> Union operation (combining 2 or more filters) </li> <li> NOT operation (negating the results of an underlying filter) </li> <li> Optional operation (wrapping an underlying filter in an optional matching filter) </li> </ul> <p> The query parser generates a tree of these filters. For example, a multi-word search would be resolved into an intersect operation of multiple text filters, each traversing an inverted index of a different term. Simple optimizations such as removing redundant layers in the tree are applied. </p> <p> Each of the filters in the resulting tree evaluates one match at a time. This means that at any given moment, the query processor is busy evaluating and scoring one matching document. This means that very little memory allocation is done at run-time, resulting in higher performance. </p> <p> The resulting matching documents are then fed to a post-processing chain of result processors that are responsible for scoring them, extracting the top-N results, loading the documents from storage, and sending them to the client. That chain is dynamic as well, which adapts based on the attributes of the query. For example, a query that only needs to return document ids will not include a stage for loading documents from storage. </p> <h3 id="concurrent-updates-and-searches"> Concurrent updates and searches </h3> <p> While RediSearch is extremely fast and uses highly optimized data structures and algorithms, it was facing the same problem with regards to concurrency. Depending on the size of your data set and the cardinality of search queries, queries can take anywhere between a few microseconds to hundreds of milliseconds, or even seconds in extreme cases. When that happens, the entire Redis server process is blocked. </p> <p> Think, for example, of a full-text query intersecting the terms "hello" and "world", each with a million entries, and a half-million common intersection points. To perform that query in a millisecond, Redis would have to scan, intersect, and rank each result in one nanosecond, <a href="https://gist.github.com/jboner/2841832"> which is impossible with current hardware </a> . The same goes for indexing a 1,000 word document. It blocks Redis entirely for the duration of the query. </p> <p> RediSearch uses the Redis Module API's concurrency features to avoid stalling the server for long periods of time. The idea is simple - while Redis itself is single-threaded, a module can run many threads, and any one of those threads can acquire the <strong> Global Lock </strong> when it needs to access Redis data, operate on it, and release it. </p> <p> Redis cannot be queried in parallel, as only one thread can acquire the lock, including the Redis main thread, but care is taken to make sure that a long-running query will give other queries time to run by yielding this lock from time to time. </p> <p> The following design principles were adopted to allow concurrency: </p> <ol> <li> <p> RediSearch has a thread pool for running concurrent search queries. </p> </li> <li> <p> When a search request arrives, it is passed to the handler, parsed on the main thread, and then a request object is passed to the thread pool via a queue. </p> </li> <li> <p> The thread pool runs a query processing function in its own thread. </p> </li> <li> <p> The function locks the Redis Global lock and starts executing the query. </p> </li> <li> <p> Since the search execution is basically an iterator running in a cycle, the elapsed time is sampled every several iterations (sampling on each iteration would slow things down as it has a cost of its own). </p> </li> <li> <p> If enough time has elapsed, the query processor releases the Global Lock and immediately tries to acquire it again. When the lock is released, the kernel will schedule another thread to run - be it Redis's main thread, or another query thread. </p> </li> <li> <p> When the lock is acquired again, all Redis resources that were held before releasing the lock are re-opened (keys might have been deleted while the thread has been sleeping) and work resumes from the previous state. </p> </li> </ol> <p> Thus the operating system's scheduler makes sure all query threads get CPU time to run. While one is running the rest wait idly, but since execution is yielded about 5,000 times a second, it creates the effect of concurrency. Fast queries will finish in one go without yielding execution, slow ones will take many iterations to finish, but will allow other queries to run concurrently. </p> <h3 id="index-garbage-collection"> Index garbage collection </h3> <p> RediSearch is optimized for high write, update, and delete throughput. One of the main design choices dictated by this goal is that deleting and updating documents do not actually delete anything from the index: </p> <ol> <li> Deletion simply marks the document deleted in a global document metadata table using a single bit. </li> <li> Updating, on the other hand, marks a document as deleted, assigns it a new incremental document ID, and re-indexes the document under a new ID, without performing a comparison of the change. </li> </ol> <p> What this means, is that index entries belonging to deleted documents are not removed from the index, and can be seen as garbage. Over time, an index with many deletes and updates will contain mostly garbage, both slowing things down and consuming unnecessary memory. </p> <p> To overcome this, RediSearch employs a background garbage collection (GC) mechanism. During normal operation of the index, a special thread randomly samples indexes, traverses them, and looks for garbage. Index sections containing garbage are cleaned and memory is reclaimed. This is done in a non- intrusive way, operating on very small amounts of data per scan, and utilizing Redis's concurrency mechanism (see above) to avoid interrupting searches and indexing. The algorithm also tries to adapt to the state of the index, increasing the GC's frequency if the index contains a lot of garbage, and decreasing it if it doesn't, to the point of hardly scanning if the index does not contain garbage. </p> <h3 id="extension-model"> Extension model </h3> <p> RedisSearch supports an extension mechanism, much like Redis supports modules. The API is very minimal at the moment, and it does not yet support dynamic loading of extensions at run-time. Instead, extensions must be written in C (or a language that has an interface with C) and compiled into dynamic libraries that will be loaded at start-up. </p> <p> There are two kinds of extension APIs at the moment: </p> <ol> <li> <strong> Query expanders </strong> , whose role is to expand query tokens (i.e., stemmers). </li> <li> <strong> Scoring functions </strong> , whose role is to rank search results at query time. </li> </ol> <p> Extensions are compiled into dynamic libraries and loaded into RediSearch on initialization of the module. The mechanism is based on the code of Redis's own module system, albeit far simpler. </p> <hr/> <h2 id="scalable-distributed-search"> Scalable distributed search </h2> <p> While RediSearch is very fast and memory efficient, if an index is big enough, at some point it will be too slow or consume too much memory. It must then be scaled out and partitioned over several machines, each of which will hold a small part of the complete search index. </p> <p> Traditional clusters map different keys to different shards to achieve this. However, with search indexes this approach is not practical. If each word’s index was mapped to a different shard, it would be necessary to intersect records from different servers for multi-term queries. </p> <p> The way to address this challenge is to employ a technique called index partitioning, which is very simple at its core: </p> <ul> <li> The index is split across many machines/partitions by document ID. </li> <li> Every partition has a complete index of all the documents mapped to it. </li> <li> All shards are queried concurrently and the results from each shard are merged into a single result. </li> </ul> <p> To facilitate this, a new component called a coordinator is added to the cluster. When searching for documents, the coordinator receives the query and sends it to N partitions, each holding a sub-index of 1/N documents. Since we’re only interested in the top K results of all partitions, each partition returns just its own top K results. Then, the N lists of K elements are merged and the top K elements are extracted from the merged list. </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/develop/interact/search-and-query/administration/overview/"/> <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/data-types/hashes/.html
<section class="prose w-full py-12"> <h1> Redis hashes </h1> <p class="text-lg -mt-5 mb-10"> Introduction to Redis hashes </p> <p> Redis hashes are record types structured as collections of field-value pairs. You can use hashes to represent basic objects and to store groupings of counters, among other things. </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="hash_tutorial-stepset_get_all"> <input checked="" class="radiotab w-0 h-0" data-lang="redis-cli" id="redis-cli_hash_tutorial-stepset_get_all" name="hash_tutorial-stepset_get_all" 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_hash_tutorial-stepset_get_all" title="Open example"> &gt;_ Redis CLI </label> <div aria-labelledby="tab-hash_tutorial-stepset_get_all" class="panel order-last hidden w-full mt-0 relative" id="panel_redis-cli_hash_tutorial-stepset_get_all" role="tabpanel" tabindex="0"> <div class="highlight"> <pre class="chroma"><code class="language-plaintext" data-lang="plaintext"><span class="line hl"><span class="cl">&gt; HSET bike:1 model Deimos brand Ergonom type 'Enduro bikes' price 4972 </span></span><span class="line hl"><span class="cl">(integer) 4 </span></span><span class="line hl"><span class="cl">&gt; HGET bike:1 model </span></span><span class="line hl"><span class="cl">"Deimos" </span></span><span class="line hl"><span class="cl">&gt; HGET bike:1 price </span></span><span class="line hl"><span class="cl">"4972" </span></span><span class="line hl"><span class="cl">&gt; HGETALL bike:1 </span></span><span class="line hl"><span class="cl">1) "model" </span></span><span class="line hl"><span class="cl">2) "Deimos" </span></span><span class="line hl"><span class="cl">3) "brand" </span></span><span class="line hl"><span class="cl">4) "Ergonom" </span></span><span class="line hl"><span class="cl">5) "type" </span></span><span class="line hl"><span class="cl">6) "Enduro bikes" </span></span><span class="line hl"><span class="cl">7) "price" </span></span><span class="line hl"><span class="cl">8) "4972"</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_hash_tutorial-stepset_get_all')" 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_hash_tutorial-stepset_get_all" name="hash_tutorial-stepset_get_all" 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_hash_tutorial-stepset_get_all" title="Open example"> Python </label> <div aria-labelledby="tab-hash_tutorial-stepset_get_all" class="panel order-last hidden w-full mt-0 relative" id="panel_Python_hash_tutorial-stepset_get_all" 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="s2">""" </span></span></span><span class="line"><span class="cl"><span class="s2">Code samples for Hash doc pages: </span></span></span><span class="line"><span class="cl"><span class="s2"> https://redis.io/docs/latest/develop/data-types/hashes/ </span></span></span><span class="line"><span class="cl"><span class="s2">"""</span> </span></span><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">decode_responses</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="n">res1</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">hset</span><span class="p">(</span> </span></span><span class="line hl"><span class="cl"> <span class="s2">"bike:1"</span><span class="p">,</span> </span></span><span class="line hl"><span class="cl"> <span class="n">mapping</span><span class="o">=</span><span class="p">{</span> </span></span><span class="line hl"><span class="cl"> <span class="s2">"model"</span><span class="p">:</span> <span class="s2">"Deimos"</span><span class="p">,</span> </span></span><span class="line hl"><span class="cl"> <span class="s2">"brand"</span><span class="p">:</span> <span class="s2">"Ergonom"</span><span class="p">,</span> </span></span><span class="line hl"><span class="cl"> <span class="s2">"type"</span><span class="p">:</span> <span class="s2">"Enduro bikes"</span><span class="p">,</span> </span></span><span class="line hl"><span class="cl"> <span class="s2">"price"</span><span class="p">:</span> <span class="mi">4972</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="nb">print</span><span class="p">(</span><span class="n">res1</span><span class="p">)</span> </span></span><span class="line hl"><span class="cl"><span class="c1"># &gt;&gt;&gt; 4</span> </span></span><span class="line hl"><span class="cl"> </span></span><span class="line hl"><span class="cl"><span class="n">res2</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">hget</span><span class="p">(</span><span class="s2">"bike:1"</span><span class="p">,</span> <span class="s2">"model"</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">res2</span><span class="p">)</span> </span></span><span class="line hl"><span class="cl"><span class="c1"># &gt;&gt;&gt; 'Deimos'</span> </span></span><span class="line hl"><span class="cl"> </span></span><span class="line hl"><span class="cl"><span class="n">res3</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">hget</span><span class="p">(</span><span class="s2">"bike:1"</span><span class="p">,</span> <span class="s2">"price"</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">res3</span><span class="p">)</span> </span></span><span class="line hl"><span class="cl"><span class="c1"># &gt;&gt;&gt; '4972'</span> </span></span><span class="line hl"><span class="cl"> </span></span><span class="line hl"><span class="cl"><span class="n">res4</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">hgetall</span><span class="p">(</span><span class="s2">"bike: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">res4</span><span class="p">)</span> </span></span><span class="line hl"><span class="cl"><span class="c1"># &gt;&gt;&gt; {'model': 'Deimos', 'brand': 'Ergonom', 'type': 'Enduro bikes', 'price': '4972'}</span> </span></span><span class="line hl"><span class="cl"> </span></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">res5</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">hmget</span><span class="p">(</span><span class="s2">"bike:1"</span><span class="p">,</span> <span class="p">[</span><span class="s2">"model"</span><span class="p">,</span> <span class="s2">"price"</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">res5</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="c1"># &gt;&gt;&gt; ['Deimos', '4972']</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">res6</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">hincrby</span><span class="p">(</span><span class="s2">"bike:1"</span><span class="p">,</span> <span class="s2">"price"</span><span class="p">,</span> <span class="mi">100</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">res6</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="c1"># &gt;&gt;&gt; 5072</span> </span></span><span class="line"><span class="cl"><span class="n">res7</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">hincrby</span><span class="p">(</span><span class="s2">"bike:1"</span><span class="p">,</span> <span class="s2">"price"</span><span class="p">,</span> <span class="o">-</span><span class="mi">100</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">res7</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="c1"># &gt;&gt;&gt; 4972</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="n">res11</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">hincrby</span><span class="p">(</span><span class="s2">"bike:1:stats"</span><span class="p">,</span> <span class="s2">"rides"</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">res11</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="c1"># &gt;&gt;&gt; 1</span> </span></span><span class="line"><span class="cl"><span class="n">res12</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">hincrby</span><span class="p">(</span><span class="s2">"bike:1:stats"</span><span class="p">,</span> <span class="s2">"rides"</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">res12</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="c1"># &gt;&gt;&gt; 2</span> </span></span><span class="line"><span class="cl"><span class="n">res13</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">hincrby</span><span class="p">(</span><span class="s2">"bike:1:stats"</span><span class="p">,</span> <span class="s2">"rides"</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">res13</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="c1"># &gt;&gt;&gt; 3</span> </span></span><span class="line"><span class="cl"><span class="n">res14</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">hincrby</span><span class="p">(</span><span class="s2">"bike:1:stats"</span><span class="p">,</span> <span class="s2">"crashes"</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">res14</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="c1"># &gt;&gt;&gt; 1</span> </span></span><span class="line"><span class="cl"><span class="n">res15</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">hincrby</span><span class="p">(</span><span class="s2">"bike:1:stats"</span><span class="p">,</span> <span class="s2">"owners"</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">res15</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="c1"># &gt;&gt;&gt; 1</span> </span></span><span class="line"><span class="cl"><span class="n">res16</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">hget</span><span class="p">(</span><span class="s2">"bike:1:stats"</span><span class="p">,</span> <span class="s2">"rides"</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">res16</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="c1"># &gt;&gt;&gt; 3</span> </span></span><span class="line"><span class="cl"><span class="n">res17</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">hmget</span><span class="p">(</span><span class="s2">"bike:1:stats"</span><span class="p">,</span> <span class="p">[</span><span class="s2">"crashes"</span><span class="p">,</span> <span class="s2">"owners"</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">res17</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="c1"># &gt;&gt;&gt; ['1', '1']</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_Python_hash_tutorial-stepset_get_all')" 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_hash_tutorial-stepset_get_all" 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/dt_hash.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_hash_tutorial-stepset_get_all" name="hash_tutorial-stepset_get_all" 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_hash_tutorial-stepset_get_all" title="Open example"> Node.js </label> <div aria-labelledby="tab-hash_tutorial-stepset_get_all" class="panel order-last hidden w-full mt-0 relative" id="panel_Nodejs_hash_tutorial-stepset_get_all" role="tabpanel" tabindex="0"> <div class="highlight"> <pre class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl"><span class="kr">import</span> <span class="nx">assert</span> <span class="nx">from</span> <span class="s1">'assert'</span><span class="p">;</span> </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="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">connect</span><span class="p">();</span> </span></span><span class="line hl"><span class="cl"><span class="kr">const</span> <span class="nx">res1</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hSet</span><span class="p">(</span> </span></span><span class="line hl"><span class="cl"> <span class="s1">'bike: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="s1">'model'</span><span class="o">:</span> <span class="s1">'Deimos'</span><span class="p">,</span> </span></span><span class="line hl"><span class="cl"> <span class="s1">'brand'</span><span class="o">:</span> <span class="s1">'Ergonom'</span><span class="p">,</span> </span></span><span class="line hl"><span class="cl"> <span class="s1">'type'</span><span class="o">:</span> <span class="s1">'Enduro bikes'</span><span class="p">,</span> </span></span><span class="line hl"><span class="cl"> <span class="s1">'price'</span><span class="o">:</span> <span class="mi">4972</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="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">res1</span><span class="p">)</span> <span class="c1">// 4 </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">res2</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hGet</span><span class="p">(</span><span class="s1">'bike:1'</span><span class="p">,</span> <span class="s1">'model'</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">res2</span><span class="p">)</span> <span class="c1">// 'Deimos' </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">res3</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hGet</span><span class="p">(</span><span class="s1">'bike:1'</span><span class="p">,</span> <span class="s1">'price'</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">res3</span><span class="p">)</span> <span class="c1">// '4972' </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">res4</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hGetAll</span><span class="p">(</span><span class="s1">'bike: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">res4</span><span class="p">)</span> </span></span><span class="line hl"><span class="cl"><span class="cm">/* </span></span></span><span class="line hl"><span class="cl"><span class="cm">{ </span></span></span><span class="line hl"><span class="cl"><span class="cm"> brand: 'Ergonom', </span></span></span><span class="line hl"><span class="cl"><span class="cm"> model: 'Deimos', </span></span></span><span class="line hl"><span class="cl"><span class="cm"> price: '4972', </span></span></span><span class="line hl"><span class="cl"><span class="cm"> type: 'Enduro bikes' </span></span></span><span class="line hl"><span class="cl"><span class="cm">} </span></span></span><span class="line hl"><span class="cl"><span class="cm">*/</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="kr">const</span> <span class="nx">res5</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hmGet</span><span class="p">(</span><span class="s1">'bike:1'</span><span class="p">,</span> <span class="p">[</span><span class="s1">'model'</span><span class="p">,</span> <span class="s1">'price'</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">res5</span><span class="p">)</span> <span class="c1">// ['Deimos', '4972'] </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">res6</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hIncrBy</span><span class="p">(</span><span class="s1">'bike:1'</span><span class="p">,</span> <span class="s1">'price'</span><span class="p">,</span> <span class="mi">100</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">res6</span><span class="p">)</span> <span class="c1">// 5072 </span></span></span><span class="line"><span class="cl"><span class="c1"></span><span class="kr">const</span> <span class="nx">res7</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hIncrBy</span><span class="p">(</span><span class="s1">'bike:1'</span><span class="p">,</span> <span class="s1">'price'</span><span class="p">,</span> <span class="o">-</span><span class="mi">100</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">res7</span><span class="p">)</span> <span class="c1">// 4972 </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">res11</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hIncrBy</span><span class="p">(</span><span class="s1">'bike:1:stats'</span><span class="p">,</span> <span class="s1">'rides'</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">res11</span><span class="p">)</span> <span class="c1">// 1 </span></span></span><span class="line"><span class="cl"><span class="c1"></span><span class="kr">const</span> <span class="nx">res12</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hIncrBy</span><span class="p">(</span><span class="s1">'bike:1:stats'</span><span class="p">,</span> <span class="s1">'rides'</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">res12</span><span class="p">)</span> <span class="c1">// 2 </span></span></span><span class="line"><span class="cl"><span class="c1"></span><span class="kr">const</span> <span class="nx">res13</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hIncrBy</span><span class="p">(</span><span class="s1">'bike:1:stats'</span><span class="p">,</span> <span class="s1">'rides'</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">res13</span><span class="p">)</span> <span class="c1">// 3 </span></span></span><span class="line"><span class="cl"><span class="c1"></span><span class="kr">const</span> <span class="nx">res14</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hIncrBy</span><span class="p">(</span><span class="s1">'bike:1:stats'</span><span class="p">,</span> <span class="s1">'crashes'</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">res14</span><span class="p">)</span> <span class="c1">// 1 </span></span></span><span class="line"><span class="cl"><span class="c1"></span><span class="kr">const</span> <span class="nx">res15</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hIncrBy</span><span class="p">(</span><span class="s1">'bike:1:stats'</span><span class="p">,</span> <span class="s1">'owners'</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">res15</span><span class="p">)</span> <span class="c1">// 1 </span></span></span><span class="line"><span class="cl"><span class="c1"></span><span class="kr">const</span> <span class="nx">res16</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hGet</span><span class="p">(</span><span class="s1">'bike:1:stats'</span><span class="p">,</span> <span class="s1">'rides'</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">res16</span><span class="p">)</span> <span class="c1">// 3 </span></span></span><span class="line"><span class="cl"><span class="c1"></span><span class="kr">const</span> <span class="nx">res17</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hmGet</span><span class="p">(</span><span class="s1">'bike:1:stats'</span><span class="p">,</span> <span class="p">[</span><span class="s1">'crashes'</span><span class="p">,</span> <span class="s1">'owners'</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">res17</span><span class="p">)</span> <span class="c1">// ['1', '1'] </span></span></span><span class="line"><span class="cl"><span class="c1"></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_hash_tutorial-stepset_get_all')" 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_hash_tutorial-stepset_get_all" 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/dt-hash.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_hash_tutorial-stepset_get_all" name="hash_tutorial-stepset_get_all" 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_hash_tutorial-stepset_get_all" title="Open example"> Java </label> <div aria-labelledby="tab-hash_tutorial-stepset_get_all" class="panel order-last hidden w-full mt-0 relative" id="panel_Java_hash_tutorial-stepset_get_all" 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">package</span> <span class="nn">io.redis.examples</span><span class="o">;</span> </span></span><span class="line"><span class="cl"> </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></span><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.List</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></span><span class="line"><span class="cl"><span class="kd">public</span> <span class="kd">class</span> <span class="nc">HashExample</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="k">try</span> <span class="o">(</span><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 class="o">{</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">&lt;</span><span class="n">String</span><span class="o">,</span> <span class="n">String</span><span class="o">&gt;</span> <span class="n">bike1</span> <span class="o">=</span> <span class="k">new</span> <span class="n">HashMap</span><span class="o">&lt;&gt;();</span> </span></span><span class="line hl"><span class="cl"> <span class="n">bike1</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">"model"</span><span class="o">,</span> <span class="s">"Deimos"</span><span class="o">);</span> </span></span><span class="line hl"><span class="cl"> <span class="n">bike1</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">"brand"</span><span class="o">,</span> <span class="s">"Ergonom"</span><span class="o">);</span> </span></span><span class="line hl"><span class="cl"> <span class="n">bike1</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">"type"</span><span class="o">,</span> <span class="s">"Enduro bikes"</span><span class="o">);</span> </span></span><span class="line hl"><span class="cl"> <span class="n">bike1</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">"price"</span><span class="o">,</span> <span class="s">"4972"</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="n">Long</span> <span class="n">res1</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">hset</span><span class="o">(</span><span class="s">"bike:1"</span><span class="o">,</span> <span class="n">bike1</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">res1</span><span class="o">);</span> <span class="c1">// 4 </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">String</span> <span class="n">res2</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">hget</span><span class="o">(</span><span class="s">"bike:1"</span><span class="o">,</span> <span class="s">"model"</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">res2</span><span class="o">);</span> <span class="c1">// Deimos </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">String</span> <span class="n">res3</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">hget</span><span class="o">(</span><span class="s">"bike:1"</span><span class="o">,</span> <span class="s">"price"</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">res3</span><span class="o">);</span> <span class="c1">// 4972 </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">Map</span><span class="o">&lt;</span><span class="n">String</span><span class="o">,</span> <span class="n">String</span><span class="o">&gt;</span> <span class="n">res4</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">hgetAll</span><span class="o">(</span><span class="s">"bike: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">res4</span><span class="o">);</span> <span class="c1">// {type=Enduro bikes, brand=Ergonom, price=4972, model=Deimos} </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">List</span><span class="o">&lt;</span><span class="n">String</span><span class="o">&gt;</span> <span class="n">res5</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">hmget</span><span class="o">(</span><span class="s">"bike:1"</span><span class="o">,</span> <span class="s">"model"</span><span class="o">,</span> <span class="s">"price"</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">res5</span><span class="o">);</span> <span class="c1">// [Deimos, 4972] </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">Long</span> <span class="n">res6</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">hincrBy</span><span class="o">(</span><span class="s">"bike:1"</span><span class="o">,</span> <span class="s">"price"</span><span class="o">,</span> <span class="mi">100</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">res6</span><span class="o">);</span> <span class="c1">// 5072 </span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="n">Long</span> <span class="n">res7</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">hincrBy</span><span class="o">(</span><span class="s">"bike:1"</span><span class="o">,</span> <span class="s">"price"</span><span class="o">,</span> <span class="o">-</span><span class="mi">100</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">res7</span><span class="o">);</span> <span class="c1">// 4972 </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">Long</span> <span class="n">res8</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">hincrBy</span><span class="o">(</span><span class="s">"bike:1:stats"</span><span class="o">,</span> <span class="s">"rides"</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">res8</span><span class="o">);</span> <span class="c1">// 1 </span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="n">Long</span> <span class="n">res9</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">hincrBy</span><span class="o">(</span><span class="s">"bike:1:stats"</span><span class="o">,</span> <span class="s">"rides"</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">res9</span><span class="o">);</span> <span class="c1">// 2 </span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="n">Long</span> <span class="n">res10</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">hincrBy</span><span class="o">(</span><span class="s">"bike:1:stats"</span><span class="o">,</span> <span class="s">"rides"</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">res10</span><span class="o">);</span> <span class="c1">// 3 </span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="n">Long</span> <span class="n">res11</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">hincrBy</span><span class="o">(</span><span class="s">"bike:1:stats"</span><span class="o">,</span> <span class="s">"crashes"</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">res11</span><span class="o">);</span> <span class="c1">// 1 </span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="n">Long</span> <span class="n">res12</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">hincrBy</span><span class="o">(</span><span class="s">"bike:1:stats"</span><span class="o">,</span> <span class="s">"owners"</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">res12</span><span class="o">);</span> <span class="c1">// 1 </span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="n">String</span> <span class="n">res13</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">hget</span><span class="o">(</span><span class="s">"bike:1:stats"</span><span class="o">,</span> <span class="s">"rides"</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">res13</span><span class="o">);</span> <span class="c1">// 3 </span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="n">List</span><span class="o">&lt;</span><span class="n">String</span><span class="o">&gt;</span> <span class="n">res14</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">hmget</span><span class="o">(</span><span class="s">"bike:1:stats"</span><span class="o">,</span> <span class="s">"crashes"</span><span class="o">,</span> <span class="s">"owners"</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">res14</span><span class="o">);</span> <span class="c1">// [1, 1] </span></span></span><span class="line"><span class="cl"><span class="c1"></span> </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 class="o">}</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_Java_hash_tutorial-stepset_get_all')" 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_hash_tutorial-stepset_get_all" 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/HashExample.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_hash_tutorial-stepset_get_all" name="hash_tutorial-stepset_get_all" 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_hash_tutorial-stepset_get_all" title="Open example"> Go </label> <div aria-labelledby="tab-hash_tutorial-stepset_get_all" class="panel order-last hidden w-full mt-0 relative" id="panel_Go_hash_tutorial-stepset_get_all" 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_set_get_all</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">&amp;</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">hashFields</span> <span class="o">:=</span> <span class="p">[]</span><span class="kt">string</span><span class="p">{</span> </span></span><span class="line hl"><span class="cl"> <span class="s">"model"</span><span class="p">,</span> <span class="s">"Deimos"</span><span class="p">,</span> </span></span><span class="line hl"><span class="cl"> <span class="s">"brand"</span><span class="p">,</span> <span class="s">"Ergonom"</span><span class="p">,</span> </span></span><span class="line hl"><span class="cl"> <span class="s">"type"</span><span class="p">,</span> <span class="s">"Enduro bikes"</span><span class="p">,</span> </span></span><span class="line hl"><span class="cl"> <span class="s">"price"</span><span class="p">,</span> <span class="s">"4972"</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">res1</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">HSet</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1"</span><span class="p">,</span> <span class="nx">hashFields</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">res1</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; 4 </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">res2</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">HGet</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1"</span><span class="p">,</span> <span class="s">"model"</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">res2</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; Deimos </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">res3</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">HGet</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1"</span><span class="p">,</span> <span class="s">"price"</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">res3</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; 4972 </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">cmdReturn</span> <span class="o">:=</span> <span class="nx">rdb</span><span class="p">.</span><span class="nf">HGetAll</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1"</span><span class="p">)</span> </span></span><span class="line hl"><span class="cl"> <span class="nx">res4</span><span class="p">,</span> <span class="nx">err</span> <span class="o">:=</span> <span class="nx">cmdReturn</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">res4</span><span class="p">)</span> </span></span><span class="line hl"><span class="cl"> <span class="c1">// &gt;&gt;&gt; map[brand:Ergonom model:Deimos price:4972 type:Enduro bikes] </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="kd">type</span> <span class="nx">BikeInfo</span> <span class="kd">struct</span> <span class="p">{</span> </span></span><span class="line hl"><span class="cl"> <span class="nx">Model</span> <span class="kt">string</span> <span class="s">`redis:"model"`</span> </span></span><span class="line hl"><span class="cl"> <span class="nx">Brand</span> <span class="kt">string</span> <span class="s">`redis:"brand"`</span> </span></span><span class="line hl"><span class="cl"> <span class="nx">Type</span> <span class="kt">string</span> <span class="s">`redis:"type"`</span> </span></span><span class="line hl"><span class="cl"> <span class="nx">Price</span> <span class="kt">int</span> <span class="s">`redis:"price"`</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="kd">var</span> <span class="nx">res4a</span> <span class="nx">BikeInfo</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="nx">cmdReturn</span><span class="p">.</span><span class="nf">Scan</span><span class="p">(</span><span class="o">&amp;</span><span class="nx">res4a</span><span class="p">);</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">Printf</span><span class="p">(</span><span class="s">"Model: %v, Brand: %v, Type: %v, Price: $%v\n"</span><span class="p">,</span> </span></span><span class="line hl"><span class="cl"> <span class="nx">res4a</span><span class="p">.</span><span class="nx">Model</span><span class="p">,</span> <span class="nx">res4a</span><span class="p">.</span><span class="nx">Brand</span><span class="p">,</span> <span class="nx">res4a</span><span class="p">.</span><span class="nx">Type</span><span class="p">,</span> <span class="nx">res4a</span><span class="p">.</span><span class="nx">Price</span><span class="p">)</span> </span></span><span class="line hl"><span class="cl"> <span class="c1">// &gt;&gt;&gt; Model: Deimos, Brand: Ergonom, Type: Enduro bikes, Price: $4972 </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_hmget</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">&amp;</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">hashFields</span> <span class="o">:=</span> <span class="p">[]</span><span class="kt">string</span><span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="s">"model"</span><span class="p">,</span> <span class="s">"Deimos"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s">"brand"</span><span class="p">,</span> <span class="s">"Ergonom"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s">"type"</span><span class="p">,</span> <span class="s">"Enduro bikes"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s">"price"</span><span class="p">,</span> <span class="s">"4972"</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">_</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">HSet</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1"</span><span class="p">,</span> <span class="nx">hashFields</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">cmdReturn</span> <span class="o">:=</span> <span class="nx">rdb</span><span class="p">.</span><span class="nf">HMGet</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1"</span><span class="p">,</span> <span class="s">"model"</span><span class="p">,</span> <span class="s">"price"</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> <span class="nx">res5</span><span class="p">,</span> <span class="nx">err</span> <span class="o">:=</span> <span class="nx">cmdReturn</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">res5</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; [Deimos 4972] </span></span></span><span class="line"><span class="cl"><span class="c1"></span> </span></span><span class="line"><span class="cl"> <span class="kd">type</span> <span class="nx">BikeInfo</span> <span class="kd">struct</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="nx">Model</span> <span class="kt">string</span> <span class="s">`redis:"model"`</span> </span></span><span class="line"><span class="cl"> <span class="nx">Brand</span> <span class="kt">string</span> <span class="s">`redis:"-"`</span> </span></span><span class="line"><span class="cl"> <span class="nx">Type</span> <span class="kt">string</span> <span class="s">`redis:"-"`</span> </span></span><span class="line"><span class="cl"> <span class="nx">Price</span> <span class="kt">int</span> <span class="s">`redis:"price"`</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">var</span> <span class="nx">res5a</span> <span class="nx">BikeInfo</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="nx">cmdReturn</span><span class="p">.</span><span class="nf">Scan</span><span class="p">(</span><span class="o">&amp;</span><span class="nx">res5a</span><span class="p">);</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">Printf</span><span class="p">(</span><span class="s">"Model: %v, Price: $%v\n"</span><span class="p">,</span> <span class="nx">res5a</span><span class="p">.</span><span class="nx">Model</span><span class="p">,</span> <span class="nx">res5a</span><span class="p">.</span><span class="nx">Price</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> <span class="c1">// &gt;&gt;&gt; Model: Deimos, Price: $4972 </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_hincrby</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">&amp;</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">hashFields</span> <span class="o">:=</span> <span class="p">[]</span><span class="kt">string</span><span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="s">"model"</span><span class="p">,</span> <span class="s">"Deimos"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s">"brand"</span><span class="p">,</span> <span class="s">"Ergonom"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s">"type"</span><span class="p">,</span> <span class="s">"Enduro bikes"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s">"price"</span><span class="p">,</span> <span class="s">"4972"</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">_</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">HSet</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1"</span><span class="p">,</span> <span class="nx">hashFields</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">res6</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">HIncrBy</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1"</span><span class="p">,</span> <span class="s">"price"</span><span class="p">,</span> <span class="mi">100</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">res6</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; 5072 </span></span></span><span class="line"><span class="cl"><span class="c1"></span> </span></span><span class="line"><span class="cl"> <span class="nx">res7</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">HIncrBy</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1"</span><span class="p">,</span> <span class="s">"price"</span><span class="p">,</span> <span class="o">-</span><span class="mi">100</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">res7</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; 4972 </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_incrby_get_mget</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">&amp;</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">res8</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">HIncrBy</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1:stats"</span><span class="p">,</span> <span class="s">"rides"</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">res8</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; 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">res9</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">HIncrBy</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1:stats"</span><span class="p">,</span> <span class="s">"rides"</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">res9</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; 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">res10</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">HIncrBy</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1:stats"</span><span class="p">,</span> <span class="s">"rides"</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">res10</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; 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">res11</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">HIncrBy</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1:stats"</span><span class="p">,</span> <span class="s">"crashes"</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">res11</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; 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">res12</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">HIncrBy</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1:stats"</span><span class="p">,</span> <span class="s">"owners"</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">res12</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; 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">res13</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">HGet</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1:stats"</span><span class="p">,</span> <span class="s">"rides"</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">res13</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; 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">res14</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">HMGet</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1:stats"</span><span class="p">,</span> <span class="s">"crashes"</span><span class="p">,</span> <span class="s">"owners"</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">res14</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; [1 1] </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_hash_tutorial-stepset_get_all')" 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_hash_tutorial-stepset_get_all" 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/hash_tutorial_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_hash_tutorial-stepset_get_all" name="hash_tutorial-stepset_get_all" 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_hash_tutorial-stepset_get_all" title="Open example"> C# </label> <div aria-labelledby="tab-hash_tutorial-stepset_get_all" class="panel order-last hidden w-full mt-0 relative" id="panel_Csharp_hash_tutorial-stepset_get_all" 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 class="k">public</span> <span class="k">class</span> <span class="nc">HashExample</span> </span></span><span class="line"><span class="cl"><span class="p">{</span> </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 class="n">db</span><span class="p">.</span><span class="n">KeyDelete</span><span class="p">(</span><span class="s">"bike:1"</span><span class="p">);</span> </span></span><span class="line hl"><span class="cl"> <span class="n">db</span><span class="p">.</span><span class="n">HashSet</span><span class="p">(</span><span class="s">"bike:1"</span><span class="p">,</span> <span class="k">new</span> <span class="n">HashEntry</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="k">new</span> <span class="n">HashEntry</span><span class="p">(</span><span class="s">"model"</span><span class="p">,</span> <span class="s">"Deimos"</span><span class="p">),</span> </span></span><span class="line hl"><span class="cl"> <span class="k">new</span> <span class="n">HashEntry</span><span class="p">(</span><span class="s">"brand"</span><span class="p">,</span> <span class="s">"Ergonom"</span><span class="p">),</span> </span></span><span class="line hl"><span class="cl"> <span class="k">new</span> <span class="n">HashEntry</span><span class="p">(</span><span class="s">"type"</span><span class="p">,</span> <span class="s">"Enduro bikes"</span><span class="p">),</span> </span></span><span class="line hl"><span class="cl"> <span class="k">new</span> <span class="n">HashEntry</span><span class="p">(</span><span class="s">"price"</span><span class="p">,</span> <span class="m">4972</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="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="s">"Hash Created"</span><span class="p">);</span> </span></span><span class="line hl"><span class="cl"> <span class="c1">// Hash Created</span> </span></span><span class="line hl"><span class="cl"> </span></span><span class="line hl"><span class="cl"> <span class="kt">var</span> <span class="n">model</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">HashGet</span><span class="p">(</span><span class="s">"bike:1"</span><span class="p">,</span> <span class="s">"model"</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">$"Model: {model}"</span><span class="p">);</span> </span></span><span class="line hl"><span class="cl"> <span class="c1">// Model: Deimos</span> </span></span><span class="line hl"><span class="cl"> </span></span><span class="line hl"><span class="cl"> <span class="kt">var</span> <span class="n">price</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">HashGet</span><span class="p">(</span><span class="s">"bike:1"</span><span class="p">,</span> <span class="s">"price"</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">$"Price: {price}"</span><span class="p">);</span> </span></span><span class="line hl"><span class="cl"> <span class="c1">// Price: 4972</span> </span></span><span class="line hl"><span class="cl"> </span></span><span class="line hl"><span class="cl"> <span class="kt">var</span> <span class="n">bike</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">HashGetAll</span><span class="p">(</span><span class="s">"bike: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">"bike: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">"\n"</span><span class="p">,</span> <span class="n">bike</span><span class="p">.</span><span class="n">Select</span><span class="p">(</span><span class="n">b</span> <span class="p">=&gt;</span> <span class="s">$"{b.Name}: {b.Value}"</span><span class="p">)));</span> </span></span><span class="line hl"><span class="cl"> <span class="c1">// Bike:1:</span> </span></span><span class="line hl"><span class="cl"> <span class="c1">// model: Deimos</span> </span></span><span class="line hl"><span class="cl"> <span class="c1">// brand: Ergonom</span> </span></span><span class="line hl"><span class="cl"> <span class="c1">// type: Enduro bikes</span> </span></span><span class="line hl"><span class="cl"> <span class="c1">// price: 4972</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">var</span> <span class="n">values</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">HashGet</span><span class="p">(</span><span class="s">"bike:1"</span><span class="p">,</span> <span class="k">new</span> <span class="n">RedisValue</span><span class="p">[]</span> <span class="p">{</span> <span class="s">"model"</span><span class="p">,</span> <span class="s">"price"</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">values</span><span class="p">));</span> </span></span><span class="line"><span class="cl"> <span class="c1">// Deimos 4972</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="kt">var</span> <span class="n">newPrice</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">HashIncrement</span><span class="p">(</span><span class="s">"bike:1"</span><span class="p">,</span> <span class="s">"price"</span><span class="p">,</span> <span class="m">100</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">$"New price: {newPrice}"</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> <span class="c1">// New price: 5072</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="n">newPrice</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">HashIncrement</span><span class="p">(</span><span class="s">"bike:1"</span><span class="p">,</span> <span class="s">"price"</span><span class="p">,</span> <span class="p">-</span><span class="m">100</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">$"New price: {newPrice}"</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> <span class="c1">// New price: 4972</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="kt">var</span> <span class="n">rides</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">HashIncrement</span><span class="p">(</span><span class="s">"bike:1"</span><span class="p">,</span> <span class="s">"rides"</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">$"Rides: {rides}"</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> <span class="c1">// Rides: 1</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="n">rides</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">HashIncrement</span><span class="p">(</span><span class="s">"bike:1"</span><span class="p">,</span> <span class="s">"rides"</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">$"Rides: {rides}"</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> <span class="c1">// Rides: 2</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="n">rides</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">HashIncrement</span><span class="p">(</span><span class="s">"bike:1"</span><span class="p">,</span> <span class="s">"rides"</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">$"Rides: {rides}"</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> <span class="c1">// Rides: 3</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="kt">var</span> <span class="n">crashes</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">HashIncrement</span><span class="p">(</span><span class="s">"bike:1"</span><span class="p">,</span> <span class="s">"crashes"</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">$"Crashes: {crashes}"</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> <span class="c1">// Crashes: 1</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="kt">var</span> <span class="n">owners</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">HashIncrement</span><span class="p">(</span><span class="s">"bike:1"</span><span class="p">,</span> <span class="s">"owners"</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">$"Owners: {owners}"</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> <span class="c1">// Owners: 1</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="kt">var</span> <span class="n">stats</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">HashGet</span><span class="p">(</span><span class="s">"bike:1"</span><span class="p">,</span> <span class="k">new</span> <span class="n">RedisValue</span><span class="p">[]</span> <span class="p">{</span> <span class="s">"crashes"</span><span class="p">,</span> <span class="s">"owners"</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">$"Bike stats: crashes={stats[0]}, owners={stats[1]}"</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> <span class="c1">// Bike stats: crashes=1, owners=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> <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_hash_tutorial-stepset_get_all')" 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_hash_tutorial-stepset_get_all" 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/HashExample.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> While hashes are handy to represent <em> objects </em> , actually the number of fields you can put inside a hash has no practical limits (other than available memory), so you can use hashes in many different ways inside your application. </p> <p> The command <a href="/docs/latest/commands/hset/"> <code> HSET </code> </a> sets multiple fields of the hash, while <a href="/docs/latest/commands/hget/"> <code> HGET </code> </a> retrieves a single field. <a href="/docs/latest/commands/hmget/"> <code> HMGET </code> </a> is similar to <a href="/docs/latest/commands/hget/"> <code> HGET </code> </a> but returns an array of values: </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="hash_tutorial-stephmget"> <input checked="" class="radiotab w-0 h-0" data-lang="redis-cli" id="redis-cli_hash_tutorial-stephmget" name="hash_tutorial-stephmget" 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_hash_tutorial-stephmget" title="Open example"> &gt;_ Redis CLI </label> <div aria-labelledby="tab-hash_tutorial-stephmget" class="panel order-last hidden w-full mt-0 relative" id="panel_redis-cli_hash_tutorial-stephmget" role="tabpanel" tabindex="0"> <div class="highlight"> <pre class="chroma"><code class="language-plaintext" data-lang="plaintext"><span class="line hl"><span class="cl">&gt; HMGET bike:1 model price no-such-field </span></span><span class="line hl"><span class="cl">1) "Deimos" </span></span><span class="line hl"><span class="cl">2) "4972" </span></span><span class="line hl"><span class="cl">3) (nil)</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_hash_tutorial-stephmget')" 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_hash_tutorial-stephmget" name="hash_tutorial-stephmget" 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_hash_tutorial-stephmget" title="Open example"> Python </label> <div aria-labelledby="tab-hash_tutorial-stephmget" class="panel order-last hidden w-full mt-0 relative" id="panel_Python_hash_tutorial-stephmget" 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="s2">""" </span></span></span><span class="line"><span class="cl"><span class="s2">Code samples for Hash doc pages: </span></span></span><span class="line"><span class="cl"><span class="s2"> https://redis.io/docs/latest/develop/data-types/hashes/ </span></span></span><span class="line"><span class="cl"><span class="s2">"""</span> </span></span><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">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 class="n">res1</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">hset</span><span class="p">(</span> </span></span><span class="line"><span class="cl"> <span class="s2">"bike:1"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="n">mapping</span><span class="o">=</span><span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="s2">"model"</span><span class="p">:</span> <span class="s2">"Deimos"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s2">"brand"</span><span class="p">:</span> <span class="s2">"Ergonom"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s2">"type"</span><span class="p">:</span> <span class="s2">"Enduro bikes"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s2">"price"</span><span class="p">:</span> <span class="mi">4972</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="nb">print</span><span class="p">(</span><span class="n">res1</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="c1"># &gt;&gt;&gt; 4</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="n">res2</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">hget</span><span class="p">(</span><span class="s2">"bike:1"</span><span class="p">,</span> <span class="s2">"model"</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">res2</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="c1"># &gt;&gt;&gt; 'Deimos'</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="n">res3</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">hget</span><span class="p">(</span><span class="s2">"bike:1"</span><span class="p">,</span> <span class="s2">"price"</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">res3</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="c1"># &gt;&gt;&gt; '4972'</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="n">res4</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">hgetall</span><span class="p">(</span><span class="s2">"bike: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">res4</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="c1"># &gt;&gt;&gt; {'model': 'Deimos', 'brand': 'Ergonom', 'type': 'Enduro bikes', 'price': '4972'}</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 hl"><span class="cl"><span class="n">res5</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">hmget</span><span class="p">(</span><span class="s2">"bike:1"</span><span class="p">,</span> <span class="p">[</span><span class="s2">"model"</span><span class="p">,</span> <span class="s2">"price"</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">res5</span><span class="p">)</span> </span></span><span class="line hl"><span class="cl"><span class="c1"># &gt;&gt;&gt; ['Deimos', '4972']</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">res6</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">hincrby</span><span class="p">(</span><span class="s2">"bike:1"</span><span class="p">,</span> <span class="s2">"price"</span><span class="p">,</span> <span class="mi">100</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">res6</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="c1"># &gt;&gt;&gt; 5072</span> </span></span><span class="line"><span class="cl"><span class="n">res7</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">hincrby</span><span class="p">(</span><span class="s2">"bike:1"</span><span class="p">,</span> <span class="s2">"price"</span><span class="p">,</span> <span class="o">-</span><span class="mi">100</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">res7</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="c1"># &gt;&gt;&gt; 4972</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="n">res11</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">hincrby</span><span class="p">(</span><span class="s2">"bike:1:stats"</span><span class="p">,</span> <span class="s2">"rides"</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">res11</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="c1"># &gt;&gt;&gt; 1</span> </span></span><span class="line"><span class="cl"><span class="n">res12</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">hincrby</span><span class="p">(</span><span class="s2">"bike:1:stats"</span><span class="p">,</span> <span class="s2">"rides"</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">res12</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="c1"># &gt;&gt;&gt; 2</span> </span></span><span class="line"><span class="cl"><span class="n">res13</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">hincrby</span><span class="p">(</span><span class="s2">"bike:1:stats"</span><span class="p">,</span> <span class="s2">"rides"</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">res13</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="c1"># &gt;&gt;&gt; 3</span> </span></span><span class="line"><span class="cl"><span class="n">res14</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">hincrby</span><span class="p">(</span><span class="s2">"bike:1:stats"</span><span class="p">,</span> <span class="s2">"crashes"</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">res14</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="c1"># &gt;&gt;&gt; 1</span> </span></span><span class="line"><span class="cl"><span class="n">res15</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">hincrby</span><span class="p">(</span><span class="s2">"bike:1:stats"</span><span class="p">,</span> <span class="s2">"owners"</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">res15</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="c1"># &gt;&gt;&gt; 1</span> </span></span><span class="line"><span class="cl"><span class="n">res16</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">hget</span><span class="p">(</span><span class="s2">"bike:1:stats"</span><span class="p">,</span> <span class="s2">"rides"</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">res16</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="c1"># &gt;&gt;&gt; 3</span> </span></span><span class="line"><span class="cl"><span class="n">res17</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">hmget</span><span class="p">(</span><span class="s2">"bike:1:stats"</span><span class="p">,</span> <span class="p">[</span><span class="s2">"crashes"</span><span class="p">,</span> <span class="s2">"owners"</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">res17</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="c1"># &gt;&gt;&gt; ['1', '1']</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_Python_hash_tutorial-stephmget')" 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_hash_tutorial-stephmget" 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/dt_hash.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_hash_tutorial-stephmget" name="hash_tutorial-stephmget" 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_hash_tutorial-stephmget" title="Open example"> Node.js </label> <div aria-labelledby="tab-hash_tutorial-stephmget" class="panel order-last hidden w-full mt-0 relative" id="panel_Nodejs_hash_tutorial-stephmget" role="tabpanel" tabindex="0"> <div class="highlight"> <pre class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl"><span class="kr">import</span> <span class="nx">assert</span> <span class="nx">from</span> <span class="s1">'assert'</span><span class="p">;</span> </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="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">connect</span><span class="p">();</span> </span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">res1</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hSet</span><span class="p">(</span> </span></span><span class="line"><span class="cl"> <span class="s1">'bike: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="s1">'model'</span><span class="o">:</span> <span class="s1">'Deimos'</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s1">'brand'</span><span class="o">:</span> <span class="s1">'Ergonom'</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s1">'type'</span><span class="o">:</span> <span class="s1">'Enduro bikes'</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s1">'price'</span><span class="o">:</span> <span class="mi">4972</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">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">res1</span><span class="p">)</span> <span class="c1">// 4 </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">res2</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hGet</span><span class="p">(</span><span class="s1">'bike:1'</span><span class="p">,</span> <span class="s1">'model'</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">res2</span><span class="p">)</span> <span class="c1">// 'Deimos' </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">res3</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hGet</span><span class="p">(</span><span class="s1">'bike:1'</span><span class="p">,</span> <span class="s1">'price'</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">res3</span><span class="p">)</span> <span class="c1">// '4972' </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">res4</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hGetAll</span><span class="p">(</span><span class="s1">'bike: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">res4</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="cm">/* </span></span></span><span class="line"><span class="cl"><span class="cm">{ </span></span></span><span class="line"><span class="cl"><span class="cm"> brand: 'Ergonom', </span></span></span><span class="line"><span class="cl"><span class="cm"> model: 'Deimos', </span></span></span><span class="line"><span class="cl"><span class="cm"> price: '4972', </span></span></span><span class="line"><span class="cl"><span class="cm"> type: 'Enduro bikes' </span></span></span><span class="line"><span class="cl"><span class="cm">} </span></span></span><span class="line"><span class="cl"><span class="cm">*/</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="kr">const</span> <span class="nx">res5</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hmGet</span><span class="p">(</span><span class="s1">'bike:1'</span><span class="p">,</span> <span class="p">[</span><span class="s1">'model'</span><span class="p">,</span> <span class="s1">'price'</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">res5</span><span class="p">)</span> <span class="c1">// ['Deimos', '4972'] </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">res6</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hIncrBy</span><span class="p">(</span><span class="s1">'bike:1'</span><span class="p">,</span> <span class="s1">'price'</span><span class="p">,</span> <span class="mi">100</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">res6</span><span class="p">)</span> <span class="c1">// 5072 </span></span></span><span class="line"><span class="cl"><span class="c1"></span><span class="kr">const</span> <span class="nx">res7</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hIncrBy</span><span class="p">(</span><span class="s1">'bike:1'</span><span class="p">,</span> <span class="s1">'price'</span><span class="p">,</span> <span class="o">-</span><span class="mi">100</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">res7</span><span class="p">)</span> <span class="c1">// 4972 </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">res11</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hIncrBy</span><span class="p">(</span><span class="s1">'bike:1:stats'</span><span class="p">,</span> <span class="s1">'rides'</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">res11</span><span class="p">)</span> <span class="c1">// 1 </span></span></span><span class="line"><span class="cl"><span class="c1"></span><span class="kr">const</span> <span class="nx">res12</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hIncrBy</span><span class="p">(</span><span class="s1">'bike:1:stats'</span><span class="p">,</span> <span class="s1">'rides'</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">res12</span><span class="p">)</span> <span class="c1">// 2 </span></span></span><span class="line"><span class="cl"><span class="c1"></span><span class="kr">const</span> <span class="nx">res13</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hIncrBy</span><span class="p">(</span><span class="s1">'bike:1:stats'</span><span class="p">,</span> <span class="s1">'rides'</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">res13</span><span class="p">)</span> <span class="c1">// 3 </span></span></span><span class="line"><span class="cl"><span class="c1"></span><span class="kr">const</span> <span class="nx">res14</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hIncrBy</span><span class="p">(</span><span class="s1">'bike:1:stats'</span><span class="p">,</span> <span class="s1">'crashes'</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">res14</span><span class="p">)</span> <span class="c1">// 1 </span></span></span><span class="line"><span class="cl"><span class="c1"></span><span class="kr">const</span> <span class="nx">res15</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hIncrBy</span><span class="p">(</span><span class="s1">'bike:1:stats'</span><span class="p">,</span> <span class="s1">'owners'</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">res15</span><span class="p">)</span> <span class="c1">// 1 </span></span></span><span class="line"><span class="cl"><span class="c1"></span><span class="kr">const</span> <span class="nx">res16</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hGet</span><span class="p">(</span><span class="s1">'bike:1:stats'</span><span class="p">,</span> <span class="s1">'rides'</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">res16</span><span class="p">)</span> <span class="c1">// 3 </span></span></span><span class="line"><span class="cl"><span class="c1"></span><span class="kr">const</span> <span class="nx">res17</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hmGet</span><span class="p">(</span><span class="s1">'bike:1:stats'</span><span class="p">,</span> <span class="p">[</span><span class="s1">'crashes'</span><span class="p">,</span> <span class="s1">'owners'</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">res17</span><span class="p">)</span> <span class="c1">// ['1', '1'] </span></span></span><span class="line"><span class="cl"><span class="c1"></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_hash_tutorial-stephmget')" 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_hash_tutorial-stephmget" 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/dt-hash.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_hash_tutorial-stephmget" name="hash_tutorial-stephmget" 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_hash_tutorial-stephmget" title="Open example"> Java </label> <div aria-labelledby="tab-hash_tutorial-stephmget" class="panel order-last hidden w-full mt-0 relative" id="panel_Java_hash_tutorial-stephmget" 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">package</span> <span class="nn">io.redis.examples</span><span class="o">;</span> </span></span><span class="line"><span class="cl"> </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></span><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.List</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></span><span class="line"><span class="cl"><span class="kd">public</span> <span class="kd">class</span> <span class="nc">HashExample</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="k">try</span> <span class="o">(</span><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 class="o">{</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">&lt;</span><span class="n">String</span><span class="o">,</span> <span class="n">String</span><span class="o">&gt;</span> <span class="n">bike1</span> <span class="o">=</span> <span class="k">new</span> <span class="n">HashMap</span><span class="o">&lt;&gt;();</span> </span></span><span class="line"><span class="cl"> <span class="n">bike1</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">"model"</span><span class="o">,</span> <span class="s">"Deimos"</span><span class="o">);</span> </span></span><span class="line"><span class="cl"> <span class="n">bike1</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">"brand"</span><span class="o">,</span> <span class="s">"Ergonom"</span><span class="o">);</span> </span></span><span class="line"><span class="cl"> <span class="n">bike1</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">"type"</span><span class="o">,</span> <span class="s">"Enduro bikes"</span><span class="o">);</span> </span></span><span class="line"><span class="cl"> <span class="n">bike1</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">"price"</span><span class="o">,</span> <span class="s">"4972"</span><span class="o">);</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="n">Long</span> <span class="n">res1</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">hset</span><span class="o">(</span><span class="s">"bike:1"</span><span class="o">,</span> <span class="n">bike1</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">res1</span><span class="o">);</span> <span class="c1">// 4 </span></span></span><span class="line"><span class="cl"><span class="c1"></span> </span></span><span class="line"><span class="cl"> <span class="n">String</span> <span class="n">res2</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">hget</span><span class="o">(</span><span class="s">"bike:1"</span><span class="o">,</span> <span class="s">"model"</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">res2</span><span class="o">);</span> <span class="c1">// Deimos </span></span></span><span class="line"><span class="cl"><span class="c1"></span> </span></span><span class="line"><span class="cl"> <span class="n">String</span> <span class="n">res3</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">hget</span><span class="o">(</span><span class="s">"bike:1"</span><span class="o">,</span> <span class="s">"price"</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">res3</span><span class="o">);</span> <span class="c1">// 4972 </span></span></span><span class="line"><span class="cl"><span class="c1"></span> </span></span><span class="line"><span class="cl"> <span class="n">Map</span><span class="o">&lt;</span><span class="n">String</span><span class="o">,</span> <span class="n">String</span><span class="o">&gt;</span> <span class="n">res4</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">hgetAll</span><span class="o">(</span><span class="s">"bike: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">res4</span><span class="o">);</span> <span class="c1">// {type=Enduro bikes, brand=Ergonom, price=4972, model=Deimos} </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">List</span><span class="o">&lt;</span><span class="n">String</span><span class="o">&gt;</span> <span class="n">res5</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">hmget</span><span class="o">(</span><span class="s">"bike:1"</span><span class="o">,</span> <span class="s">"model"</span><span class="o">,</span> <span class="s">"price"</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">res5</span><span class="o">);</span> <span class="c1">// [Deimos, 4972] </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">Long</span> <span class="n">res6</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">hincrBy</span><span class="o">(</span><span class="s">"bike:1"</span><span class="o">,</span> <span class="s">"price"</span><span class="o">,</span> <span class="mi">100</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">res6</span><span class="o">);</span> <span class="c1">// 5072 </span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="n">Long</span> <span class="n">res7</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">hincrBy</span><span class="o">(</span><span class="s">"bike:1"</span><span class="o">,</span> <span class="s">"price"</span><span class="o">,</span> <span class="o">-</span><span class="mi">100</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">res7</span><span class="o">);</span> <span class="c1">// 4972 </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">Long</span> <span class="n">res8</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">hincrBy</span><span class="o">(</span><span class="s">"bike:1:stats"</span><span class="o">,</span> <span class="s">"rides"</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">res8</span><span class="o">);</span> <span class="c1">// 1 </span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="n">Long</span> <span class="n">res9</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">hincrBy</span><span class="o">(</span><span class="s">"bike:1:stats"</span><span class="o">,</span> <span class="s">"rides"</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">res9</span><span class="o">);</span> <span class="c1">// 2 </span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="n">Long</span> <span class="n">res10</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">hincrBy</span><span class="o">(</span><span class="s">"bike:1:stats"</span><span class="o">,</span> <span class="s">"rides"</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">res10</span><span class="o">);</span> <span class="c1">// 3 </span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="n">Long</span> <span class="n">res11</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">hincrBy</span><span class="o">(</span><span class="s">"bike:1:stats"</span><span class="o">,</span> <span class="s">"crashes"</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">res11</span><span class="o">);</span> <span class="c1">// 1 </span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="n">Long</span> <span class="n">res12</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">hincrBy</span><span class="o">(</span><span class="s">"bike:1:stats"</span><span class="o">,</span> <span class="s">"owners"</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">res12</span><span class="o">);</span> <span class="c1">// 1 </span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="n">String</span> <span class="n">res13</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">hget</span><span class="o">(</span><span class="s">"bike:1:stats"</span><span class="o">,</span> <span class="s">"rides"</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">res13</span><span class="o">);</span> <span class="c1">// 3 </span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="n">List</span><span class="o">&lt;</span><span class="n">String</span><span class="o">&gt;</span> <span class="n">res14</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">hmget</span><span class="o">(</span><span class="s">"bike:1:stats"</span><span class="o">,</span> <span class="s">"crashes"</span><span class="o">,</span> <span class="s">"owners"</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">res14</span><span class="o">);</span> <span class="c1">// [1, 1] </span></span></span><span class="line"><span class="cl"><span class="c1"></span> </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 class="o">}</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_Java_hash_tutorial-stephmget')" 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_hash_tutorial-stephmget" 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/HashExample.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_hash_tutorial-stephmget" name="hash_tutorial-stephmget" 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_hash_tutorial-stephmget" title="Open example"> Go </label> <div aria-labelledby="tab-hash_tutorial-stephmget" class="panel order-last hidden w-full mt-0 relative" id="panel_Go_hash_tutorial-stephmget" 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_set_get_all</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">&amp;</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">hashFields</span> <span class="o">:=</span> <span class="p">[]</span><span class="kt">string</span><span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="s">"model"</span><span class="p">,</span> <span class="s">"Deimos"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s">"brand"</span><span class="p">,</span> <span class="s">"Ergonom"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s">"type"</span><span class="p">,</span> <span class="s">"Enduro bikes"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s">"price"</span><span class="p">,</span> <span class="s">"4972"</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">res1</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">HSet</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1"</span><span class="p">,</span> <span class="nx">hashFields</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">res1</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; 4 </span></span></span><span class="line"><span class="cl"><span class="c1"></span> </span></span><span class="line"><span class="cl"> <span class="nx">res2</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">HGet</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1"</span><span class="p">,</span> <span class="s">"model"</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">res2</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; Deimos </span></span></span><span class="line"><span class="cl"><span class="c1"></span> </span></span><span class="line"><span class="cl"> <span class="nx">res3</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">HGet</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1"</span><span class="p">,</span> <span class="s">"price"</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">res3</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; 4972 </span></span></span><span class="line"><span class="cl"><span class="c1"></span> </span></span><span class="line"><span class="cl"> <span class="nx">cmdReturn</span> <span class="o">:=</span> <span class="nx">rdb</span><span class="p">.</span><span class="nf">HGetAll</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1"</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> <span class="nx">res4</span><span class="p">,</span> <span class="nx">err</span> <span class="o">:=</span> <span class="nx">cmdReturn</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">res4</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> <span class="c1">// &gt;&gt;&gt; map[brand:Ergonom model:Deimos price:4972 type:Enduro bikes] </span></span></span><span class="line"><span class="cl"><span class="c1"></span> </span></span><span class="line"><span class="cl"> <span class="kd">type</span> <span class="nx">BikeInfo</span> <span class="kd">struct</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="nx">Model</span> <span class="kt">string</span> <span class="s">`redis:"model"`</span> </span></span><span class="line"><span class="cl"> <span class="nx">Brand</span> <span class="kt">string</span> <span class="s">`redis:"brand"`</span> </span></span><span class="line"><span class="cl"> <span class="nx">Type</span> <span class="kt">string</span> <span class="s">`redis:"type"`</span> </span></span><span class="line"><span class="cl"> <span class="nx">Price</span> <span class="kt">int</span> <span class="s">`redis:"price"`</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">var</span> <span class="nx">res4a</span> <span class="nx">BikeInfo</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="nx">cmdReturn</span><span class="p">.</span><span class="nf">Scan</span><span class="p">(</span><span class="o">&amp;</span><span class="nx">res4a</span><span class="p">);</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">Printf</span><span class="p">(</span><span class="s">"Model: %v, Brand: %v, Type: %v, Price: $%v\n"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nx">res4a</span><span class="p">.</span><span class="nx">Model</span><span class="p">,</span> <span class="nx">res4a</span><span class="p">.</span><span class="nx">Brand</span><span class="p">,</span> <span class="nx">res4a</span><span class="p">.</span><span class="nx">Type</span><span class="p">,</span> <span class="nx">res4a</span><span class="p">.</span><span class="nx">Price</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> <span class="c1">// &gt;&gt;&gt; Model: Deimos, Brand: Ergonom, Type: Enduro bikes, Price: $4972 </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_hmget</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">&amp;</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">hashFields</span> <span class="o">:=</span> <span class="p">[]</span><span class="kt">string</span><span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="s">"model"</span><span class="p">,</span> <span class="s">"Deimos"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s">"brand"</span><span class="p">,</span> <span class="s">"Ergonom"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s">"type"</span><span class="p">,</span> <span class="s">"Enduro bikes"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s">"price"</span><span class="p">,</span> <span class="s">"4972"</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">_</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">HSet</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1"</span><span class="p">,</span> <span class="nx">hashFields</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 hl"><span class="cl"> <span class="nx">cmdReturn</span> <span class="o">:=</span> <span class="nx">rdb</span><span class="p">.</span><span class="nf">HMGet</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1"</span><span class="p">,</span> <span class="s">"model"</span><span class="p">,</span> <span class="s">"price"</span><span class="p">)</span> </span></span><span class="line hl"><span class="cl"> <span class="nx">res5</span><span class="p">,</span> <span class="nx">err</span> <span class="o">:=</span> <span class="nx">cmdReturn</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">res5</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; [Deimos 4972] </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="kd">type</span> <span class="nx">BikeInfo</span> <span class="kd">struct</span> <span class="p">{</span> </span></span><span class="line hl"><span class="cl"> <span class="nx">Model</span> <span class="kt">string</span> <span class="s">`redis:"model"`</span> </span></span><span class="line hl"><span class="cl"> <span class="nx">Brand</span> <span class="kt">string</span> <span class="s">`redis:"-"`</span> </span></span><span class="line hl"><span class="cl"> <span class="nx">Type</span> <span class="kt">string</span> <span class="s">`redis:"-"`</span> </span></span><span class="line hl"><span class="cl"> <span class="nx">Price</span> <span class="kt">int</span> <span class="s">`redis:"price"`</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="kd">var</span> <span class="nx">res5a</span> <span class="nx">BikeInfo</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="nx">cmdReturn</span><span class="p">.</span><span class="nf">Scan</span><span class="p">(</span><span class="o">&amp;</span><span class="nx">res5a</span><span class="p">);</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">Printf</span><span class="p">(</span><span class="s">"Model: %v, Price: $%v\n"</span><span class="p">,</span> <span class="nx">res5a</span><span class="p">.</span><span class="nx">Model</span><span class="p">,</span> <span class="nx">res5a</span><span class="p">.</span><span class="nx">Price</span><span class="p">)</span> </span></span><span class="line hl"><span class="cl"> <span class="c1">// &gt;&gt;&gt; Model: Deimos, Price: $4972 </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_hincrby</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">&amp;</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">hashFields</span> <span class="o">:=</span> <span class="p">[]</span><span class="kt">string</span><span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="s">"model"</span><span class="p">,</span> <span class="s">"Deimos"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s">"brand"</span><span class="p">,</span> <span class="s">"Ergonom"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s">"type"</span><span class="p">,</span> <span class="s">"Enduro bikes"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s">"price"</span><span class="p">,</span> <span class="s">"4972"</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">_</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">HSet</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1"</span><span class="p">,</span> <span class="nx">hashFields</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">res6</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">HIncrBy</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1"</span><span class="p">,</span> <span class="s">"price"</span><span class="p">,</span> <span class="mi">100</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">res6</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; 5072 </span></span></span><span class="line"><span class="cl"><span class="c1"></span> </span></span><span class="line"><span class="cl"> <span class="nx">res7</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">HIncrBy</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1"</span><span class="p">,</span> <span class="s">"price"</span><span class="p">,</span> <span class="o">-</span><span class="mi">100</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">res7</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; 4972 </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_incrby_get_mget</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">&amp;</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">res8</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">HIncrBy</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1:stats"</span><span class="p">,</span> <span class="s">"rides"</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">res8</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; 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">res9</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">HIncrBy</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1:stats"</span><span class="p">,</span> <span class="s">"rides"</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">res9</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; 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">res10</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">HIncrBy</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1:stats"</span><span class="p">,</span> <span class="s">"rides"</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">res10</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; 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">res11</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">HIncrBy</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1:stats"</span><span class="p">,</span> <span class="s">"crashes"</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">res11</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; 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">res12</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">HIncrBy</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1:stats"</span><span class="p">,</span> <span class="s">"owners"</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">res12</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; 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">res13</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">HGet</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1:stats"</span><span class="p">,</span> <span class="s">"rides"</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">res13</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; 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">res14</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">HMGet</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1:stats"</span><span class="p">,</span> <span class="s">"crashes"</span><span class="p">,</span> <span class="s">"owners"</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">res14</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; [1 1] </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_hash_tutorial-stephmget')" 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_hash_tutorial-stephmget" 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/hash_tutorial_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_hash_tutorial-stephmget" name="hash_tutorial-stephmget" 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_hash_tutorial-stephmget" title="Open example"> C# </label> <div aria-labelledby="tab-hash_tutorial-stephmget" class="panel order-last hidden w-full mt-0 relative" id="panel_Csharp_hash_tutorial-stephmget" 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 class="k">public</span> <span class="k">class</span> <span class="nc">HashExample</span> </span></span><span class="line"><span class="cl"><span class="p">{</span> </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 class="n">db</span><span class="p">.</span><span class="n">KeyDelete</span><span class="p">(</span><span class="s">"bike:1"</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> <span class="n">db</span><span class="p">.</span><span class="n">HashSet</span><span class="p">(</span><span class="s">"bike:1"</span><span class="p">,</span> <span class="k">new</span> <span class="n">HashEntry</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">new</span> <span class="n">HashEntry</span><span class="p">(</span><span class="s">"model"</span><span class="p">,</span> <span class="s">"Deimos"</span><span class="p">),</span> </span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">HashEntry</span><span class="p">(</span><span class="s">"brand"</span><span class="p">,</span> <span class="s">"Ergonom"</span><span class="p">),</span> </span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">HashEntry</span><span class="p">(</span><span class="s">"type"</span><span class="p">,</span> <span class="s">"Enduro bikes"</span><span class="p">),</span> </span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">HashEntry</span><span class="p">(</span><span class="s">"price"</span><span class="p">,</span> <span class="m">4972</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="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="s">"Hash Created"</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> <span class="c1">// Hash Created</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="kt">var</span> <span class="n">model</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">HashGet</span><span class="p">(</span><span class="s">"bike:1"</span><span class="p">,</span> <span class="s">"model"</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">$"Model: {model}"</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> <span class="c1">// Model: Deimos</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="kt">var</span> <span class="n">price</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">HashGet</span><span class="p">(</span><span class="s">"bike:1"</span><span class="p">,</span> <span class="s">"price"</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">$"Price: {price}"</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> <span class="c1">// Price: 4972</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="kt">var</span> <span class="n">bike</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">HashGetAll</span><span class="p">(</span><span class="s">"bike: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">"bike: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">"\n"</span><span class="p">,</span> <span class="n">bike</span><span class="p">.</span><span class="n">Select</span><span class="p">(</span><span class="n">b</span> <span class="p">=&gt;</span> <span class="s">$"{b.Name}: {b.Value}"</span><span class="p">)));</span> </span></span><span class="line"><span class="cl"> <span class="c1">// Bike:1:</span> </span></span><span class="line"><span class="cl"> <span class="c1">// model: Deimos</span> </span></span><span class="line"><span class="cl"> <span class="c1">// brand: Ergonom</span> </span></span><span class="line"><span class="cl"> <span class="c1">// type: Enduro bikes</span> </span></span><span class="line"><span class="cl"> <span class="c1">// price: 4972</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">var</span> <span class="n">values</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">HashGet</span><span class="p">(</span><span class="s">"bike:1"</span><span class="p">,</span> <span class="k">new</span> <span class="n">RedisValue</span><span class="p">[]</span> <span class="p">{</span> <span class="s">"model"</span><span class="p">,</span> <span class="s">"price"</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">values</span><span class="p">));</span> </span></span><span class="line hl"><span class="cl"> <span class="c1">// Deimos 4972</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="kt">var</span> <span class="n">newPrice</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">HashIncrement</span><span class="p">(</span><span class="s">"bike:1"</span><span class="p">,</span> <span class="s">"price"</span><span class="p">,</span> <span class="m">100</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">$"New price: {newPrice}"</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> <span class="c1">// New price: 5072</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="n">newPrice</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">HashIncrement</span><span class="p">(</span><span class="s">"bike:1"</span><span class="p">,</span> <span class="s">"price"</span><span class="p">,</span> <span class="p">-</span><span class="m">100</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">$"New price: {newPrice}"</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> <span class="c1">// New price: 4972</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="kt">var</span> <span class="n">rides</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">HashIncrement</span><span class="p">(</span><span class="s">"bike:1"</span><span class="p">,</span> <span class="s">"rides"</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">$"Rides: {rides}"</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> <span class="c1">// Rides: 1</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="n">rides</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">HashIncrement</span><span class="p">(</span><span class="s">"bike:1"</span><span class="p">,</span> <span class="s">"rides"</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">$"Rides: {rides}"</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> <span class="c1">// Rides: 2</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="n">rides</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">HashIncrement</span><span class="p">(</span><span class="s">"bike:1"</span><span class="p">,</span> <span class="s">"rides"</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">$"Rides: {rides}"</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> <span class="c1">// Rides: 3</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="kt">var</span> <span class="n">crashes</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">HashIncrement</span><span class="p">(</span><span class="s">"bike:1"</span><span class="p">,</span> <span class="s">"crashes"</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">$"Crashes: {crashes}"</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> <span class="c1">// Crashes: 1</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="kt">var</span> <span class="n">owners</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">HashIncrement</span><span class="p">(</span><span class="s">"bike:1"</span><span class="p">,</span> <span class="s">"owners"</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">$"Owners: {owners}"</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> <span class="c1">// Owners: 1</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="kt">var</span> <span class="n">stats</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">HashGet</span><span class="p">(</span><span class="s">"bike:1"</span><span class="p">,</span> <span class="k">new</span> <span class="n">RedisValue</span><span class="p">[]</span> <span class="p">{</span> <span class="s">"crashes"</span><span class="p">,</span> <span class="s">"owners"</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">$"Bike stats: crashes={stats[0]}, owners={stats[1]}"</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> <span class="c1">// Bike stats: crashes=1, owners=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> <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_hash_tutorial-stephmget')" 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_hash_tutorial-stephmget" 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/HashExample.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> There are commands that are able to perform operations on individual fields as well, like <a href="/docs/latest/commands/hincrby/"> <code> HINCRBY </code> </a> : </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="hash_tutorial-stephincrby"> <input checked="" class="radiotab w-0 h-0" data-lang="redis-cli" id="redis-cli_hash_tutorial-stephincrby" name="hash_tutorial-stephincrby" 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_hash_tutorial-stephincrby" title="Open example"> &gt;_ Redis CLI </label> <div aria-labelledby="tab-hash_tutorial-stephincrby" class="panel order-last hidden w-full mt-0 relative" id="panel_redis-cli_hash_tutorial-stephincrby" role="tabpanel" tabindex="0"> <div class="highlight"> <pre class="chroma"><code class="language-plaintext" data-lang="plaintext"><span class="line hl"><span class="cl">&gt; HINCRBY bike:1 price 100 </span></span><span class="line hl"><span class="cl">(integer) 5072 </span></span><span class="line hl"><span class="cl">&gt; HINCRBY bike:1 price -100 </span></span><span class="line hl"><span class="cl">(integer) 4972</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_hash_tutorial-stephincrby')" 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_hash_tutorial-stephincrby" name="hash_tutorial-stephincrby" 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_hash_tutorial-stephincrby" title="Open example"> Python </label> <div aria-labelledby="tab-hash_tutorial-stephincrby" class="panel order-last hidden w-full mt-0 relative" id="panel_Python_hash_tutorial-stephincrby" 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="s2">""" </span></span></span><span class="line"><span class="cl"><span class="s2">Code samples for Hash doc pages: </span></span></span><span class="line"><span class="cl"><span class="s2"> https://redis.io/docs/latest/develop/data-types/hashes/ </span></span></span><span class="line"><span class="cl"><span class="s2">"""</span> </span></span><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">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 class="n">res1</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">hset</span><span class="p">(</span> </span></span><span class="line"><span class="cl"> <span class="s2">"bike:1"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="n">mapping</span><span class="o">=</span><span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="s2">"model"</span><span class="p">:</span> <span class="s2">"Deimos"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s2">"brand"</span><span class="p">:</span> <span class="s2">"Ergonom"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s2">"type"</span><span class="p">:</span> <span class="s2">"Enduro bikes"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s2">"price"</span><span class="p">:</span> <span class="mi">4972</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="nb">print</span><span class="p">(</span><span class="n">res1</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="c1"># &gt;&gt;&gt; 4</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="n">res2</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">hget</span><span class="p">(</span><span class="s2">"bike:1"</span><span class="p">,</span> <span class="s2">"model"</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">res2</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="c1"># &gt;&gt;&gt; 'Deimos'</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="n">res3</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">hget</span><span class="p">(</span><span class="s2">"bike:1"</span><span class="p">,</span> <span class="s2">"price"</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">res3</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="c1"># &gt;&gt;&gt; '4972'</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="n">res4</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">hgetall</span><span class="p">(</span><span class="s2">"bike: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">res4</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="c1"># &gt;&gt;&gt; {'model': 'Deimos', 'brand': 'Ergonom', 'type': 'Enduro bikes', 'price': '4972'}</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="n">res5</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">hmget</span><span class="p">(</span><span class="s2">"bike:1"</span><span class="p">,</span> <span class="p">[</span><span class="s2">"model"</span><span class="p">,</span> <span class="s2">"price"</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">res5</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="c1"># &gt;&gt;&gt; ['Deimos', '4972']</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">res6</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">hincrby</span><span class="p">(</span><span class="s2">"bike:1"</span><span class="p">,</span> <span class="s2">"price"</span><span class="p">,</span> <span class="mi">100</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">res6</span><span class="p">)</span> </span></span><span class="line hl"><span class="cl"><span class="c1"># &gt;&gt;&gt; 5072</span> </span></span><span class="line hl"><span class="cl"><span class="n">res7</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">hincrby</span><span class="p">(</span><span class="s2">"bike:1"</span><span class="p">,</span> <span class="s2">"price"</span><span class="p">,</span> <span class="o">-</span><span class="mi">100</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">res7</span><span class="p">)</span> </span></span><span class="line hl"><span class="cl"><span class="c1"># &gt;&gt;&gt; 4972</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="n">res11</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">hincrby</span><span class="p">(</span><span class="s2">"bike:1:stats"</span><span class="p">,</span> <span class="s2">"rides"</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">res11</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="c1"># &gt;&gt;&gt; 1</span> </span></span><span class="line"><span class="cl"><span class="n">res12</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">hincrby</span><span class="p">(</span><span class="s2">"bike:1:stats"</span><span class="p">,</span> <span class="s2">"rides"</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">res12</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="c1"># &gt;&gt;&gt; 2</span> </span></span><span class="line"><span class="cl"><span class="n">res13</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">hincrby</span><span class="p">(</span><span class="s2">"bike:1:stats"</span><span class="p">,</span> <span class="s2">"rides"</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">res13</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="c1"># &gt;&gt;&gt; 3</span> </span></span><span class="line"><span class="cl"><span class="n">res14</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">hincrby</span><span class="p">(</span><span class="s2">"bike:1:stats"</span><span class="p">,</span> <span class="s2">"crashes"</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">res14</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="c1"># &gt;&gt;&gt; 1</span> </span></span><span class="line"><span class="cl"><span class="n">res15</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">hincrby</span><span class="p">(</span><span class="s2">"bike:1:stats"</span><span class="p">,</span> <span class="s2">"owners"</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">res15</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="c1"># &gt;&gt;&gt; 1</span> </span></span><span class="line"><span class="cl"><span class="n">res16</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">hget</span><span class="p">(</span><span class="s2">"bike:1:stats"</span><span class="p">,</span> <span class="s2">"rides"</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">res16</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="c1"># &gt;&gt;&gt; 3</span> </span></span><span class="line"><span class="cl"><span class="n">res17</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">hmget</span><span class="p">(</span><span class="s2">"bike:1:stats"</span><span class="p">,</span> <span class="p">[</span><span class="s2">"crashes"</span><span class="p">,</span> <span class="s2">"owners"</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">res17</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="c1"># &gt;&gt;&gt; ['1', '1']</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_Python_hash_tutorial-stephincrby')" 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_hash_tutorial-stephincrby" 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/dt_hash.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_hash_tutorial-stephincrby" name="hash_tutorial-stephincrby" 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_hash_tutorial-stephincrby" title="Open example"> Node.js </label> <div aria-labelledby="tab-hash_tutorial-stephincrby" class="panel order-last hidden w-full mt-0 relative" id="panel_Nodejs_hash_tutorial-stephincrby" role="tabpanel" tabindex="0"> <div class="highlight"> <pre class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl"><span class="kr">import</span> <span class="nx">assert</span> <span class="nx">from</span> <span class="s1">'assert'</span><span class="p">;</span> </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="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">connect</span><span class="p">();</span> </span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">res1</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hSet</span><span class="p">(</span> </span></span><span class="line"><span class="cl"> <span class="s1">'bike: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="s1">'model'</span><span class="o">:</span> <span class="s1">'Deimos'</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s1">'brand'</span><span class="o">:</span> <span class="s1">'Ergonom'</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s1">'type'</span><span class="o">:</span> <span class="s1">'Enduro bikes'</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s1">'price'</span><span class="o">:</span> <span class="mi">4972</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">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">res1</span><span class="p">)</span> <span class="c1">// 4 </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">res2</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hGet</span><span class="p">(</span><span class="s1">'bike:1'</span><span class="p">,</span> <span class="s1">'model'</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">res2</span><span class="p">)</span> <span class="c1">// 'Deimos' </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">res3</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hGet</span><span class="p">(</span><span class="s1">'bike:1'</span><span class="p">,</span> <span class="s1">'price'</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">res3</span><span class="p">)</span> <span class="c1">// '4972' </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">res4</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hGetAll</span><span class="p">(</span><span class="s1">'bike: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">res4</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="cm">/* </span></span></span><span class="line"><span class="cl"><span class="cm">{ </span></span></span><span class="line"><span class="cl"><span class="cm"> brand: 'Ergonom', </span></span></span><span class="line"><span class="cl"><span class="cm"> model: 'Deimos', </span></span></span><span class="line"><span class="cl"><span class="cm"> price: '4972', </span></span></span><span class="line"><span class="cl"><span class="cm"> type: 'Enduro bikes' </span></span></span><span class="line"><span class="cl"><span class="cm">} </span></span></span><span class="line"><span class="cl"><span class="cm">*/</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="kr">const</span> <span class="nx">res5</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hmGet</span><span class="p">(</span><span class="s1">'bike:1'</span><span class="p">,</span> <span class="p">[</span><span class="s1">'model'</span><span class="p">,</span> <span class="s1">'price'</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">res5</span><span class="p">)</span> <span class="c1">// ['Deimos', '4972'] </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">res6</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hIncrBy</span><span class="p">(</span><span class="s1">'bike:1'</span><span class="p">,</span> <span class="s1">'price'</span><span class="p">,</span> <span class="mi">100</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">res6</span><span class="p">)</span> <span class="c1">// 5072 </span></span></span><span class="line hl"><span class="cl"><span class="c1"></span><span class="kr">const</span> <span class="nx">res7</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hIncrBy</span><span class="p">(</span><span class="s1">'bike:1'</span><span class="p">,</span> <span class="s1">'price'</span><span class="p">,</span> <span class="o">-</span><span class="mi">100</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">res7</span><span class="p">)</span> <span class="c1">// 4972 </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">res11</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hIncrBy</span><span class="p">(</span><span class="s1">'bike:1:stats'</span><span class="p">,</span> <span class="s1">'rides'</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">res11</span><span class="p">)</span> <span class="c1">// 1 </span></span></span><span class="line"><span class="cl"><span class="c1"></span><span class="kr">const</span> <span class="nx">res12</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hIncrBy</span><span class="p">(</span><span class="s1">'bike:1:stats'</span><span class="p">,</span> <span class="s1">'rides'</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">res12</span><span class="p">)</span> <span class="c1">// 2 </span></span></span><span class="line"><span class="cl"><span class="c1"></span><span class="kr">const</span> <span class="nx">res13</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hIncrBy</span><span class="p">(</span><span class="s1">'bike:1:stats'</span><span class="p">,</span> <span class="s1">'rides'</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">res13</span><span class="p">)</span> <span class="c1">// 3 </span></span></span><span class="line"><span class="cl"><span class="c1"></span><span class="kr">const</span> <span class="nx">res14</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hIncrBy</span><span class="p">(</span><span class="s1">'bike:1:stats'</span><span class="p">,</span> <span class="s1">'crashes'</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">res14</span><span class="p">)</span> <span class="c1">// 1 </span></span></span><span class="line"><span class="cl"><span class="c1"></span><span class="kr">const</span> <span class="nx">res15</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hIncrBy</span><span class="p">(</span><span class="s1">'bike:1:stats'</span><span class="p">,</span> <span class="s1">'owners'</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">res15</span><span class="p">)</span> <span class="c1">// 1 </span></span></span><span class="line"><span class="cl"><span class="c1"></span><span class="kr">const</span> <span class="nx">res16</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hGet</span><span class="p">(</span><span class="s1">'bike:1:stats'</span><span class="p">,</span> <span class="s1">'rides'</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">res16</span><span class="p">)</span> <span class="c1">// 3 </span></span></span><span class="line"><span class="cl"><span class="c1"></span><span class="kr">const</span> <span class="nx">res17</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hmGet</span><span class="p">(</span><span class="s1">'bike:1:stats'</span><span class="p">,</span> <span class="p">[</span><span class="s1">'crashes'</span><span class="p">,</span> <span class="s1">'owners'</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">res17</span><span class="p">)</span> <span class="c1">// ['1', '1'] </span></span></span><span class="line"><span class="cl"><span class="c1"></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_hash_tutorial-stephincrby')" 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_hash_tutorial-stephincrby" 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/dt-hash.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_hash_tutorial-stephincrby" name="hash_tutorial-stephincrby" 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_hash_tutorial-stephincrby" title="Open example"> Java </label> <div aria-labelledby="tab-hash_tutorial-stephincrby" class="panel order-last hidden w-full mt-0 relative" id="panel_Java_hash_tutorial-stephincrby" 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">package</span> <span class="nn">io.redis.examples</span><span class="o">;</span> </span></span><span class="line"><span class="cl"> </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></span><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.List</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></span><span class="line"><span class="cl"><span class="kd">public</span> <span class="kd">class</span> <span class="nc">HashExample</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="k">try</span> <span class="o">(</span><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 class="o">{</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">&lt;</span><span class="n">String</span><span class="o">,</span> <span class="n">String</span><span class="o">&gt;</span> <span class="n">bike1</span> <span class="o">=</span> <span class="k">new</span> <span class="n">HashMap</span><span class="o">&lt;&gt;();</span> </span></span><span class="line"><span class="cl"> <span class="n">bike1</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">"model"</span><span class="o">,</span> <span class="s">"Deimos"</span><span class="o">);</span> </span></span><span class="line"><span class="cl"> <span class="n">bike1</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">"brand"</span><span class="o">,</span> <span class="s">"Ergonom"</span><span class="o">);</span> </span></span><span class="line"><span class="cl"> <span class="n">bike1</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">"type"</span><span class="o">,</span> <span class="s">"Enduro bikes"</span><span class="o">);</span> </span></span><span class="line"><span class="cl"> <span class="n">bike1</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">"price"</span><span class="o">,</span> <span class="s">"4972"</span><span class="o">);</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="n">Long</span> <span class="n">res1</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">hset</span><span class="o">(</span><span class="s">"bike:1"</span><span class="o">,</span> <span class="n">bike1</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">res1</span><span class="o">);</span> <span class="c1">// 4 </span></span></span><span class="line"><span class="cl"><span class="c1"></span> </span></span><span class="line"><span class="cl"> <span class="n">String</span> <span class="n">res2</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">hget</span><span class="o">(</span><span class="s">"bike:1"</span><span class="o">,</span> <span class="s">"model"</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">res2</span><span class="o">);</span> <span class="c1">// Deimos </span></span></span><span class="line"><span class="cl"><span class="c1"></span> </span></span><span class="line"><span class="cl"> <span class="n">String</span> <span class="n">res3</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">hget</span><span class="o">(</span><span class="s">"bike:1"</span><span class="o">,</span> <span class="s">"price"</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">res3</span><span class="o">);</span> <span class="c1">// 4972 </span></span></span><span class="line"><span class="cl"><span class="c1"></span> </span></span><span class="line"><span class="cl"> <span class="n">Map</span><span class="o">&lt;</span><span class="n">String</span><span class="o">,</span> <span class="n">String</span><span class="o">&gt;</span> <span class="n">res4</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">hgetAll</span><span class="o">(</span><span class="s">"bike: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">res4</span><span class="o">);</span> <span class="c1">// {type=Enduro bikes, brand=Ergonom, price=4972, model=Deimos} </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">List</span><span class="o">&lt;</span><span class="n">String</span><span class="o">&gt;</span> <span class="n">res5</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">hmget</span><span class="o">(</span><span class="s">"bike:1"</span><span class="o">,</span> <span class="s">"model"</span><span class="o">,</span> <span class="s">"price"</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">res5</span><span class="o">);</span> <span class="c1">// [Deimos, 4972] </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">Long</span> <span class="n">res6</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">hincrBy</span><span class="o">(</span><span class="s">"bike:1"</span><span class="o">,</span> <span class="s">"price"</span><span class="o">,</span> <span class="mi">100</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">res6</span><span class="o">);</span> <span class="c1">// 5072 </span></span></span><span class="line hl"><span class="cl"><span class="c1"></span> <span class="n">Long</span> <span class="n">res7</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">hincrBy</span><span class="o">(</span><span class="s">"bike:1"</span><span class="o">,</span> <span class="s">"price"</span><span class="o">,</span> <span class="o">-</span><span class="mi">100</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">res7</span><span class="o">);</span> <span class="c1">// 4972 </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">Long</span> <span class="n">res8</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">hincrBy</span><span class="o">(</span><span class="s">"bike:1:stats"</span><span class="o">,</span> <span class="s">"rides"</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">res8</span><span class="o">);</span> <span class="c1">// 1 </span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="n">Long</span> <span class="n">res9</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">hincrBy</span><span class="o">(</span><span class="s">"bike:1:stats"</span><span class="o">,</span> <span class="s">"rides"</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">res9</span><span class="o">);</span> <span class="c1">// 2 </span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="n">Long</span> <span class="n">res10</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">hincrBy</span><span class="o">(</span><span class="s">"bike:1:stats"</span><span class="o">,</span> <span class="s">"rides"</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">res10</span><span class="o">);</span> <span class="c1">// 3 </span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="n">Long</span> <span class="n">res11</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">hincrBy</span><span class="o">(</span><span class="s">"bike:1:stats"</span><span class="o">,</span> <span class="s">"crashes"</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">res11</span><span class="o">);</span> <span class="c1">// 1 </span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="n">Long</span> <span class="n">res12</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">hincrBy</span><span class="o">(</span><span class="s">"bike:1:stats"</span><span class="o">,</span> <span class="s">"owners"</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">res12</span><span class="o">);</span> <span class="c1">// 1 </span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="n">String</span> <span class="n">res13</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">hget</span><span class="o">(</span><span class="s">"bike:1:stats"</span><span class="o">,</span> <span class="s">"rides"</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">res13</span><span class="o">);</span> <span class="c1">// 3 </span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="n">List</span><span class="o">&lt;</span><span class="n">String</span><span class="o">&gt;</span> <span class="n">res14</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">hmget</span><span class="o">(</span><span class="s">"bike:1:stats"</span><span class="o">,</span> <span class="s">"crashes"</span><span class="o">,</span> <span class="s">"owners"</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">res14</span><span class="o">);</span> <span class="c1">// [1, 1] </span></span></span><span class="line"><span class="cl"><span class="c1"></span> </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 class="o">}</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_Java_hash_tutorial-stephincrby')" 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_hash_tutorial-stephincrby" 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/HashExample.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_hash_tutorial-stephincrby" name="hash_tutorial-stephincrby" 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_hash_tutorial-stephincrby" title="Open example"> Go </label> <div aria-labelledby="tab-hash_tutorial-stephincrby" class="panel order-last hidden w-full mt-0 relative" id="panel_Go_hash_tutorial-stephincrby" 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_set_get_all</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">&amp;</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">hashFields</span> <span class="o">:=</span> <span class="p">[]</span><span class="kt">string</span><span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="s">"model"</span><span class="p">,</span> <span class="s">"Deimos"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s">"brand"</span><span class="p">,</span> <span class="s">"Ergonom"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s">"type"</span><span class="p">,</span> <span class="s">"Enduro bikes"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s">"price"</span><span class="p">,</span> <span class="s">"4972"</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">res1</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">HSet</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1"</span><span class="p">,</span> <span class="nx">hashFields</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">res1</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; 4 </span></span></span><span class="line"><span class="cl"><span class="c1"></span> </span></span><span class="line"><span class="cl"> <span class="nx">res2</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">HGet</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1"</span><span class="p">,</span> <span class="s">"model"</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">res2</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; Deimos </span></span></span><span class="line"><span class="cl"><span class="c1"></span> </span></span><span class="line"><span class="cl"> <span class="nx">res3</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">HGet</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1"</span><span class="p">,</span> <span class="s">"price"</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">res3</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; 4972 </span></span></span><span class="line"><span class="cl"><span class="c1"></span> </span></span><span class="line"><span class="cl"> <span class="nx">cmdReturn</span> <span class="o">:=</span> <span class="nx">rdb</span><span class="p">.</span><span class="nf">HGetAll</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1"</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> <span class="nx">res4</span><span class="p">,</span> <span class="nx">err</span> <span class="o">:=</span> <span class="nx">cmdReturn</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">res4</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> <span class="c1">// &gt;&gt;&gt; map[brand:Ergonom model:Deimos price:4972 type:Enduro bikes] </span></span></span><span class="line"><span class="cl"><span class="c1"></span> </span></span><span class="line"><span class="cl"> <span class="kd">type</span> <span class="nx">BikeInfo</span> <span class="kd">struct</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="nx">Model</span> <span class="kt">string</span> <span class="s">`redis:"model"`</span> </span></span><span class="line"><span class="cl"> <span class="nx">Brand</span> <span class="kt">string</span> <span class="s">`redis:"brand"`</span> </span></span><span class="line"><span class="cl"> <span class="nx">Type</span> <span class="kt">string</span> <span class="s">`redis:"type"`</span> </span></span><span class="line"><span class="cl"> <span class="nx">Price</span> <span class="kt">int</span> <span class="s">`redis:"price"`</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">var</span> <span class="nx">res4a</span> <span class="nx">BikeInfo</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="nx">cmdReturn</span><span class="p">.</span><span class="nf">Scan</span><span class="p">(</span><span class="o">&amp;</span><span class="nx">res4a</span><span class="p">);</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">Printf</span><span class="p">(</span><span class="s">"Model: %v, Brand: %v, Type: %v, Price: $%v\n"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nx">res4a</span><span class="p">.</span><span class="nx">Model</span><span class="p">,</span> <span class="nx">res4a</span><span class="p">.</span><span class="nx">Brand</span><span class="p">,</span> <span class="nx">res4a</span><span class="p">.</span><span class="nx">Type</span><span class="p">,</span> <span class="nx">res4a</span><span class="p">.</span><span class="nx">Price</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> <span class="c1">// &gt;&gt;&gt; Model: Deimos, Brand: Ergonom, Type: Enduro bikes, Price: $4972 </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_hmget</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">&amp;</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">hashFields</span> <span class="o">:=</span> <span class="p">[]</span><span class="kt">string</span><span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="s">"model"</span><span class="p">,</span> <span class="s">"Deimos"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s">"brand"</span><span class="p">,</span> <span class="s">"Ergonom"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s">"type"</span><span class="p">,</span> <span class="s">"Enduro bikes"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s">"price"</span><span class="p">,</span> <span class="s">"4972"</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">_</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">HSet</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1"</span><span class="p">,</span> <span class="nx">hashFields</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">cmdReturn</span> <span class="o">:=</span> <span class="nx">rdb</span><span class="p">.</span><span class="nf">HMGet</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1"</span><span class="p">,</span> <span class="s">"model"</span><span class="p">,</span> <span class="s">"price"</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> <span class="nx">res5</span><span class="p">,</span> <span class="nx">err</span> <span class="o">:=</span> <span class="nx">cmdReturn</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">res5</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; [Deimos 4972] </span></span></span><span class="line"><span class="cl"><span class="c1"></span> </span></span><span class="line"><span class="cl"> <span class="kd">type</span> <span class="nx">BikeInfo</span> <span class="kd">struct</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="nx">Model</span> <span class="kt">string</span> <span class="s">`redis:"model"`</span> </span></span><span class="line"><span class="cl"> <span class="nx">Brand</span> <span class="kt">string</span> <span class="s">`redis:"-"`</span> </span></span><span class="line"><span class="cl"> <span class="nx">Type</span> <span class="kt">string</span> <span class="s">`redis:"-"`</span> </span></span><span class="line"><span class="cl"> <span class="nx">Price</span> <span class="kt">int</span> <span class="s">`redis:"price"`</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">var</span> <span class="nx">res5a</span> <span class="nx">BikeInfo</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="nx">cmdReturn</span><span class="p">.</span><span class="nf">Scan</span><span class="p">(</span><span class="o">&amp;</span><span class="nx">res5a</span><span class="p">);</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">Printf</span><span class="p">(</span><span class="s">"Model: %v, Price: $%v\n"</span><span class="p">,</span> <span class="nx">res5a</span><span class="p">.</span><span class="nx">Model</span><span class="p">,</span> <span class="nx">res5a</span><span class="p">.</span><span class="nx">Price</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> <span class="c1">// &gt;&gt;&gt; Model: Deimos, Price: $4972 </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_hincrby</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">&amp;</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">hashFields</span> <span class="o">:=</span> <span class="p">[]</span><span class="kt">string</span><span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="s">"model"</span><span class="p">,</span> <span class="s">"Deimos"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s">"brand"</span><span class="p">,</span> <span class="s">"Ergonom"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s">"type"</span><span class="p">,</span> <span class="s">"Enduro bikes"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s">"price"</span><span class="p">,</span> <span class="s">"4972"</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">_</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">HSet</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1"</span><span class="p">,</span> <span class="nx">hashFields</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 hl"><span class="cl"> <span class="nx">res6</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">HIncrBy</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1"</span><span class="p">,</span> <span class="s">"price"</span><span class="p">,</span> <span class="mi">100</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">res6</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; 5072 </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">res7</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">HIncrBy</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1"</span><span class="p">,</span> <span class="s">"price"</span><span class="p">,</span> <span class="o">-</span><span class="mi">100</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">res7</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; 4972 </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_incrby_get_mget</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">&amp;</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">res8</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">HIncrBy</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1:stats"</span><span class="p">,</span> <span class="s">"rides"</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">res8</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; 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">res9</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">HIncrBy</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1:stats"</span><span class="p">,</span> <span class="s">"rides"</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">res9</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; 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">res10</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">HIncrBy</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1:stats"</span><span class="p">,</span> <span class="s">"rides"</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">res10</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; 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">res11</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">HIncrBy</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1:stats"</span><span class="p">,</span> <span class="s">"crashes"</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">res11</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; 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">res12</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">HIncrBy</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1:stats"</span><span class="p">,</span> <span class="s">"owners"</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">res12</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; 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">res13</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">HGet</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1:stats"</span><span class="p">,</span> <span class="s">"rides"</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">res13</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; 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">res14</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">HMGet</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1:stats"</span><span class="p">,</span> <span class="s">"crashes"</span><span class="p">,</span> <span class="s">"owners"</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">res14</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; [1 1] </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_hash_tutorial-stephincrby')" 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_hash_tutorial-stephincrby" 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/hash_tutorial_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_hash_tutorial-stephincrby" name="hash_tutorial-stephincrby" 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_hash_tutorial-stephincrby" title="Open example"> C# </label> <div aria-labelledby="tab-hash_tutorial-stephincrby" class="panel order-last hidden w-full mt-0 relative" id="panel_Csharp_hash_tutorial-stephincrby" 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 class="k">public</span> <span class="k">class</span> <span class="nc">HashExample</span> </span></span><span class="line"><span class="cl"><span class="p">{</span> </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 class="n">db</span><span class="p">.</span><span class="n">KeyDelete</span><span class="p">(</span><span class="s">"bike:1"</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> <span class="n">db</span><span class="p">.</span><span class="n">HashSet</span><span class="p">(</span><span class="s">"bike:1"</span><span class="p">,</span> <span class="k">new</span> <span class="n">HashEntry</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">new</span> <span class="n">HashEntry</span><span class="p">(</span><span class="s">"model"</span><span class="p">,</span> <span class="s">"Deimos"</span><span class="p">),</span> </span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">HashEntry</span><span class="p">(</span><span class="s">"brand"</span><span class="p">,</span> <span class="s">"Ergonom"</span><span class="p">),</span> </span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">HashEntry</span><span class="p">(</span><span class="s">"type"</span><span class="p">,</span> <span class="s">"Enduro bikes"</span><span class="p">),</span> </span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">HashEntry</span><span class="p">(</span><span class="s">"price"</span><span class="p">,</span> <span class="m">4972</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="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="s">"Hash Created"</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> <span class="c1">// Hash Created</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="kt">var</span> <span class="n">model</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">HashGet</span><span class="p">(</span><span class="s">"bike:1"</span><span class="p">,</span> <span class="s">"model"</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">$"Model: {model}"</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> <span class="c1">// Model: Deimos</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="kt">var</span> <span class="n">price</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">HashGet</span><span class="p">(</span><span class="s">"bike:1"</span><span class="p">,</span> <span class="s">"price"</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">$"Price: {price}"</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> <span class="c1">// Price: 4972</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="kt">var</span> <span class="n">bike</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">HashGetAll</span><span class="p">(</span><span class="s">"bike: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">"bike: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">"\n"</span><span class="p">,</span> <span class="n">bike</span><span class="p">.</span><span class="n">Select</span><span class="p">(</span><span class="n">b</span> <span class="p">=&gt;</span> <span class="s">$"{b.Name}: {b.Value}"</span><span class="p">)));</span> </span></span><span class="line"><span class="cl"> <span class="c1">// Bike:1:</span> </span></span><span class="line"><span class="cl"> <span class="c1">// model: Deimos</span> </span></span><span class="line"><span class="cl"> <span class="c1">// brand: Ergonom</span> </span></span><span class="line"><span class="cl"> <span class="c1">// type: Enduro bikes</span> </span></span><span class="line"><span class="cl"> <span class="c1">// price: 4972</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">var</span> <span class="n">values</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">HashGet</span><span class="p">(</span><span class="s">"bike:1"</span><span class="p">,</span> <span class="k">new</span> <span class="n">RedisValue</span><span class="p">[]</span> <span class="p">{</span> <span class="s">"model"</span><span class="p">,</span> <span class="s">"price"</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">values</span><span class="p">));</span> </span></span><span class="line"><span class="cl"> <span class="c1">// Deimos 4972</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line hl"><span class="cl"> <span class="kt">var</span> <span class="n">newPrice</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">HashIncrement</span><span class="p">(</span><span class="s">"bike:1"</span><span class="p">,</span> <span class="s">"price"</span><span class="p">,</span> <span class="m">100</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">$"New price: {newPrice}"</span><span class="p">);</span> </span></span><span class="line hl"><span class="cl"> <span class="c1">// New price: 5072</span> </span></span><span class="line hl"><span class="cl"> </span></span><span class="line hl"><span class="cl"> <span class="n">newPrice</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">HashIncrement</span><span class="p">(</span><span class="s">"bike:1"</span><span class="p">,</span> <span class="s">"price"</span><span class="p">,</span> <span class="p">-</span><span class="m">100</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">$"New price: {newPrice}"</span><span class="p">);</span> </span></span><span class="line hl"><span class="cl"> <span class="c1">// New price: 4972</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="kt">var</span> <span class="n">rides</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">HashIncrement</span><span class="p">(</span><span class="s">"bike:1"</span><span class="p">,</span> <span class="s">"rides"</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">$"Rides: {rides}"</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> <span class="c1">// Rides: 1</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="n">rides</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">HashIncrement</span><span class="p">(</span><span class="s">"bike:1"</span><span class="p">,</span> <span class="s">"rides"</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">$"Rides: {rides}"</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> <span class="c1">// Rides: 2</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="n">rides</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">HashIncrement</span><span class="p">(</span><span class="s">"bike:1"</span><span class="p">,</span> <span class="s">"rides"</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">$"Rides: {rides}"</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> <span class="c1">// Rides: 3</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="kt">var</span> <span class="n">crashes</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">HashIncrement</span><span class="p">(</span><span class="s">"bike:1"</span><span class="p">,</span> <span class="s">"crashes"</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">$"Crashes: {crashes}"</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> <span class="c1">// Crashes: 1</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="kt">var</span> <span class="n">owners</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">HashIncrement</span><span class="p">(</span><span class="s">"bike:1"</span><span class="p">,</span> <span class="s">"owners"</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">$"Owners: {owners}"</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> <span class="c1">// Owners: 1</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="kt">var</span> <span class="n">stats</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">HashGet</span><span class="p">(</span><span class="s">"bike:1"</span><span class="p">,</span> <span class="k">new</span> <span class="n">RedisValue</span><span class="p">[]</span> <span class="p">{</span> <span class="s">"crashes"</span><span class="p">,</span> <span class="s">"owners"</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">$"Bike stats: crashes={stats[0]}, owners={stats[1]}"</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> <span class="c1">// Bike stats: crashes=1, owners=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> <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_hash_tutorial-stephincrby')" 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_hash_tutorial-stephincrby" 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/HashExample.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> You can find the <a href="/docs/latest/commands/#hash"> full list of hash commands in the documentation </a> . </p> <p> It is worth noting that small hashes (i.e., a few elements with small values) are encoded in special way in memory that make them very memory efficient. </p> <h2 id="basic-commands"> Basic commands </h2> <ul> <li> <a href="/docs/latest/commands/hset/"> <code> HSET </code> </a> : sets the value of one or more fields on a hash. </li> <li> <a href="/docs/latest/commands/hget/"> <code> HGET </code> </a> : returns the value at a given field. </li> <li> <a href="/docs/latest/commands/hmget/"> <code> HMGET </code> </a> : returns the values at one or more given fields. </li> <li> <a href="/docs/latest/commands/hincrby/"> <code> HINCRBY </code> </a> : increments the value at a given field by the integer provided. </li> </ul> <p> See the <a href="/docs/latest/commands/?group=hash"> complete list of hash commands </a> . </p> <h2 id="examples"> Examples </h2> <ul> <li> Store counters for the number of times bike:1 has been ridden, has crashed, or has changed owners: <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="hash_tutorial-stepincrby_get_mget"> <input checked="" class="radiotab w-0 h-0" data-lang="redis-cli" id="redis-cli_hash_tutorial-stepincrby_get_mget" name="hash_tutorial-stepincrby_get_mget" 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_hash_tutorial-stepincrby_get_mget" title="Open example"> &gt;_ Redis CLI </label> <div aria-labelledby="tab-hash_tutorial-stepincrby_get_mget" class="panel order-last hidden w-full mt-0 relative" id="panel_redis-cli_hash_tutorial-stepincrby_get_mget" role="tabpanel" tabindex="0"> <div class="highlight"> <pre class="chroma"><code class="language-plaintext" data-lang="plaintext"><span class="line hl"><span class="cl">&gt; HINCRBY bike:1:stats rides 1 </span></span><span class="line hl"><span class="cl">(integer) 1 </span></span><span class="line hl"><span class="cl">&gt; HINCRBY bike:1:stats rides 1 </span></span><span class="line hl"><span class="cl">(integer) 2 </span></span><span class="line hl"><span class="cl">&gt; HINCRBY bike:1:stats rides 1 </span></span><span class="line hl"><span class="cl">(integer) 3 </span></span><span class="line hl"><span class="cl">&gt; HINCRBY bike:1:stats crashes 1 </span></span><span class="line hl"><span class="cl">(integer) 1 </span></span><span class="line hl"><span class="cl">&gt; HINCRBY bike:1:stats owners 1 </span></span><span class="line hl"><span class="cl">(integer) 1 </span></span><span class="line hl"><span class="cl">&gt; HGET bike:1:stats rides </span></span><span class="line hl"><span class="cl">"3" </span></span><span class="line hl"><span class="cl">&gt; HMGET bike:1:stats owners crashes </span></span><span class="line hl"><span class="cl">1) "1" </span></span><span class="line hl"><span class="cl">2) "1"</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_hash_tutorial-stepincrby_get_mget')" 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_hash_tutorial-stepincrby_get_mget" name="hash_tutorial-stepincrby_get_mget" 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_hash_tutorial-stepincrby_get_mget" title="Open example"> Python </label> <div aria-labelledby="tab-hash_tutorial-stepincrby_get_mget" class="panel order-last hidden w-full mt-0 relative" id="panel_Python_hash_tutorial-stepincrby_get_mget" 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="s2">""" </span></span></span><span class="line"><span class="cl"><span class="s2">Code samples for Hash doc pages: </span></span></span><span class="line"><span class="cl"><span class="s2"> https://redis.io/docs/latest/develop/data-types/hashes/ </span></span></span><span class="line"><span class="cl"><span class="s2">"""</span> </span></span><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">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 class="n">res1</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">hset</span><span class="p">(</span> </span></span><span class="line"><span class="cl"> <span class="s2">"bike:1"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="n">mapping</span><span class="o">=</span><span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="s2">"model"</span><span class="p">:</span> <span class="s2">"Deimos"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s2">"brand"</span><span class="p">:</span> <span class="s2">"Ergonom"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s2">"type"</span><span class="p">:</span> <span class="s2">"Enduro bikes"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s2">"price"</span><span class="p">:</span> <span class="mi">4972</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="nb">print</span><span class="p">(</span><span class="n">res1</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="c1"># &gt;&gt;&gt; 4</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="n">res2</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">hget</span><span class="p">(</span><span class="s2">"bike:1"</span><span class="p">,</span> <span class="s2">"model"</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">res2</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="c1"># &gt;&gt;&gt; 'Deimos'</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="n">res3</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">hget</span><span class="p">(</span><span class="s2">"bike:1"</span><span class="p">,</span> <span class="s2">"price"</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">res3</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="c1"># &gt;&gt;&gt; '4972'</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="n">res4</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">hgetall</span><span class="p">(</span><span class="s2">"bike: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">res4</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="c1"># &gt;&gt;&gt; {'model': 'Deimos', 'brand': 'Ergonom', 'type': 'Enduro bikes', 'price': '4972'}</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="n">res5</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">hmget</span><span class="p">(</span><span class="s2">"bike:1"</span><span class="p">,</span> <span class="p">[</span><span class="s2">"model"</span><span class="p">,</span> <span class="s2">"price"</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">res5</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="c1"># &gt;&gt;&gt; ['Deimos', '4972']</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">res6</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">hincrby</span><span class="p">(</span><span class="s2">"bike:1"</span><span class="p">,</span> <span class="s2">"price"</span><span class="p">,</span> <span class="mi">100</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">res6</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="c1"># &gt;&gt;&gt; 5072</span> </span></span><span class="line"><span class="cl"><span class="n">res7</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">hincrby</span><span class="p">(</span><span class="s2">"bike:1"</span><span class="p">,</span> <span class="s2">"price"</span><span class="p">,</span> <span class="o">-</span><span class="mi">100</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">res7</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="c1"># &gt;&gt;&gt; 4972</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 hl"><span class="cl"><span class="n">res11</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">hincrby</span><span class="p">(</span><span class="s2">"bike:1:stats"</span><span class="p">,</span> <span class="s2">"rides"</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="nb">print</span><span class="p">(</span><span class="n">res11</span><span class="p">)</span> </span></span><span class="line hl"><span class="cl"><span class="c1"># &gt;&gt;&gt; 1</span> </span></span><span class="line hl"><span class="cl"><span class="n">res12</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">hincrby</span><span class="p">(</span><span class="s2">"bike:1:stats"</span><span class="p">,</span> <span class="s2">"rides"</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="nb">print</span><span class="p">(</span><span class="n">res12</span><span class="p">)</span> </span></span><span class="line hl"><span class="cl"><span class="c1"># &gt;&gt;&gt; 2</span> </span></span><span class="line hl"><span class="cl"><span class="n">res13</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">hincrby</span><span class="p">(</span><span class="s2">"bike:1:stats"</span><span class="p">,</span> <span class="s2">"rides"</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="nb">print</span><span class="p">(</span><span class="n">res13</span><span class="p">)</span> </span></span><span class="line hl"><span class="cl"><span class="c1"># &gt;&gt;&gt; 3</span> </span></span><span class="line hl"><span class="cl"><span class="n">res14</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">hincrby</span><span class="p">(</span><span class="s2">"bike:1:stats"</span><span class="p">,</span> <span class="s2">"crashes"</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="nb">print</span><span class="p">(</span><span class="n">res14</span><span class="p">)</span> </span></span><span class="line hl"><span class="cl"><span class="c1"># &gt;&gt;&gt; 1</span> </span></span><span class="line hl"><span class="cl"><span class="n">res15</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">hincrby</span><span class="p">(</span><span class="s2">"bike:1:stats"</span><span class="p">,</span> <span class="s2">"owners"</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="nb">print</span><span class="p">(</span><span class="n">res15</span><span class="p">)</span> </span></span><span class="line hl"><span class="cl"><span class="c1"># &gt;&gt;&gt; 1</span> </span></span><span class="line hl"><span class="cl"><span class="n">res16</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">hget</span><span class="p">(</span><span class="s2">"bike:1:stats"</span><span class="p">,</span> <span class="s2">"rides"</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">res16</span><span class="p">)</span> </span></span><span class="line hl"><span class="cl"><span class="c1"># &gt;&gt;&gt; 3</span> </span></span><span class="line hl"><span class="cl"><span class="n">res17</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">hmget</span><span class="p">(</span><span class="s2">"bike:1:stats"</span><span class="p">,</span> <span class="p">[</span><span class="s2">"crashes"</span><span class="p">,</span> <span class="s2">"owners"</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">res17</span><span class="p">)</span> </span></span><span class="line hl"><span class="cl"><span class="c1"># &gt;&gt;&gt; ['1', '1']</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_Python_hash_tutorial-stepincrby_get_mget')" 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_hash_tutorial-stepincrby_get_mget" 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/dt_hash.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_hash_tutorial-stepincrby_get_mget" name="hash_tutorial-stepincrby_get_mget" 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_hash_tutorial-stepincrby_get_mget" title="Open example"> Node.js </label> <div aria-labelledby="tab-hash_tutorial-stepincrby_get_mget" class="panel order-last hidden w-full mt-0 relative" id="panel_Nodejs_hash_tutorial-stepincrby_get_mget" role="tabpanel" tabindex="0"> <div class="highlight"> <pre class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl"><span class="kr">import</span> <span class="nx">assert</span> <span class="nx">from</span> <span class="s1">'assert'</span><span class="p">;</span> </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="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">connect</span><span class="p">();</span> </span></span><span class="line hl"><span class="cl"><span class="kr">const</span> <span class="nx">res1</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hSet</span><span class="p">(</span> </span></span><span class="line hl"><span class="cl"> <span class="s1">'bike: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="s1">'model'</span><span class="o">:</span> <span class="s1">'Deimos'</span><span class="p">,</span> </span></span><span class="line hl"><span class="cl"> <span class="s1">'brand'</span><span class="o">:</span> <span class="s1">'Ergonom'</span><span class="p">,</span> </span></span><span class="line hl"><span class="cl"> <span class="s1">'type'</span><span class="o">:</span> <span class="s1">'Enduro bikes'</span><span class="p">,</span> </span></span><span class="line hl"><span class="cl"> <span class="s1">'price'</span><span class="o">:</span> <span class="mi">4972</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="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">res1</span><span class="p">)</span> <span class="c1">// 4 </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">res2</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hGet</span><span class="p">(</span><span class="s1">'bike:1'</span><span class="p">,</span> <span class="s1">'model'</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">res2</span><span class="p">)</span> <span class="c1">// 'Deimos' </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">res3</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hGet</span><span class="p">(</span><span class="s1">'bike:1'</span><span class="p">,</span> <span class="s1">'price'</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">res3</span><span class="p">)</span> <span class="c1">// '4972' </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">res4</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hGetAll</span><span class="p">(</span><span class="s1">'bike: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">res4</span><span class="p">)</span> </span></span><span class="line hl"><span class="cl"><span class="cm">/* </span></span></span><span class="line hl"><span class="cl"><span class="cm">{ </span></span></span><span class="line hl"><span class="cl"><span class="cm"> brand: 'Ergonom', </span></span></span><span class="line hl"><span class="cl"><span class="cm"> model: 'Deimos', </span></span></span><span class="line hl"><span class="cl"><span class="cm"> price: '4972', </span></span></span><span class="line hl"><span class="cl"><span class="cm"> type: 'Enduro bikes' </span></span></span><span class="line hl"><span class="cl"><span class="cm">} </span></span></span><span class="line hl"><span class="cl"><span class="cm">*/</span> </span></span><span class="line hl"><span class="cl"> </span></span><span class="line hl"><span class="cl"> </span></span><span class="line hl"><span class="cl"><span class="kr">const</span> <span class="nx">res5</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hmGet</span><span class="p">(</span><span class="s1">'bike:1'</span><span class="p">,</span> <span class="p">[</span><span class="s1">'model'</span><span class="p">,</span> <span class="s1">'price'</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">res5</span><span class="p">)</span> <span class="c1">// ['Deimos', '4972'] </span></span></span><span class="line hl"><span class="cl"><span class="c1"></span> </span></span><span class="line hl"><span class="cl"> </span></span><span class="line hl"><span class="cl"><span class="kr">const</span> <span class="nx">res6</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hIncrBy</span><span class="p">(</span><span class="s1">'bike:1'</span><span class="p">,</span> <span class="s1">'price'</span><span class="p">,</span> <span class="mi">100</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">res6</span><span class="p">)</span> <span class="c1">// 5072 </span></span></span><span class="line hl"><span class="cl"><span class="c1"></span><span class="kr">const</span> <span class="nx">res7</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hIncrBy</span><span class="p">(</span><span class="s1">'bike:1'</span><span class="p">,</span> <span class="s1">'price'</span><span class="p">,</span> <span class="o">-</span><span class="mi">100</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">res7</span><span class="p">)</span> <span class="c1">// 4972 </span></span></span><span class="line hl"><span class="cl"><span class="c1"></span> </span></span><span class="line hl"><span class="cl"> </span></span><span class="line hl"><span class="cl"><span class="kr">const</span> <span class="nx">res11</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hIncrBy</span><span class="p">(</span><span class="s1">'bike:1:stats'</span><span class="p">,</span> <span class="s1">'rides'</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">res11</span><span class="p">)</span> <span class="c1">// 1 </span></span></span><span class="line hl"><span class="cl"><span class="c1"></span><span class="kr">const</span> <span class="nx">res12</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hIncrBy</span><span class="p">(</span><span class="s1">'bike:1:stats'</span><span class="p">,</span> <span class="s1">'rides'</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">res12</span><span class="p">)</span> <span class="c1">// 2 </span></span></span><span class="line hl"><span class="cl"><span class="c1"></span><span class="kr">const</span> <span class="nx">res13</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hIncrBy</span><span class="p">(</span><span class="s1">'bike:1:stats'</span><span class="p">,</span> <span class="s1">'rides'</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">res13</span><span class="p">)</span> <span class="c1">// 3 </span></span></span><span class="line hl"><span class="cl"><span class="c1"></span><span class="kr">const</span> <span class="nx">res14</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hIncrBy</span><span class="p">(</span><span class="s1">'bike:1:stats'</span><span class="p">,</span> <span class="s1">'crashes'</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">res14</span><span class="p">)</span> <span class="c1">// 1 </span></span></span><span class="line hl"><span class="cl"><span class="c1"></span><span class="kr">const</span> <span class="nx">res15</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hIncrBy</span><span class="p">(</span><span class="s1">'bike:1:stats'</span><span class="p">,</span> <span class="s1">'owners'</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">res15</span><span class="p">)</span> <span class="c1">// 1 </span></span></span><span class="line hl"><span class="cl"><span class="c1"></span><span class="kr">const</span> <span class="nx">res16</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hGet</span><span class="p">(</span><span class="s1">'bike:1:stats'</span><span class="p">,</span> <span class="s1">'rides'</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">res16</span><span class="p">)</span> <span class="c1">// 3 </span></span></span><span class="line hl"><span class="cl"><span class="c1"></span><span class="kr">const</span> <span class="nx">res17</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hmGet</span><span class="p">(</span><span class="s1">'bike:1:stats'</span><span class="p">,</span> <span class="p">[</span><span class="s1">'crashes'</span><span class="p">,</span> <span class="s1">'owners'</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">res17</span><span class="p">)</span> <span class="c1">// ['1', '1'] </span></span></span><span class="line hl"><span class="cl"><span class="c1"></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_hash_tutorial-stepincrby_get_mget')" 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_hash_tutorial-stepincrby_get_mget" 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/dt-hash.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_hash_tutorial-stepincrby_get_mget" name="hash_tutorial-stepincrby_get_mget" 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_hash_tutorial-stepincrby_get_mget" title="Open example"> Java </label> <div aria-labelledby="tab-hash_tutorial-stepincrby_get_mget" class="panel order-last hidden w-full mt-0 relative" id="panel_Java_hash_tutorial-stepincrby_get_mget" 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">package</span> <span class="nn">io.redis.examples</span><span class="o">;</span> </span></span><span class="line"><span class="cl"> </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></span><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.List</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></span><span class="line"><span class="cl"><span class="kd">public</span> <span class="kd">class</span> <span class="nc">HashExample</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="k">try</span> <span class="o">(</span><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 class="o">{</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">&lt;</span><span class="n">String</span><span class="o">,</span> <span class="n">String</span><span class="o">&gt;</span> <span class="n">bike1</span> <span class="o">=</span> <span class="k">new</span> <span class="n">HashMap</span><span class="o">&lt;&gt;();</span> </span></span><span class="line"><span class="cl"> <span class="n">bike1</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">"model"</span><span class="o">,</span> <span class="s">"Deimos"</span><span class="o">);</span> </span></span><span class="line"><span class="cl"> <span class="n">bike1</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">"brand"</span><span class="o">,</span> <span class="s">"Ergonom"</span><span class="o">);</span> </span></span><span class="line"><span class="cl"> <span class="n">bike1</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">"type"</span><span class="o">,</span> <span class="s">"Enduro bikes"</span><span class="o">);</span> </span></span><span class="line"><span class="cl"> <span class="n">bike1</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">"price"</span><span class="o">,</span> <span class="s">"4972"</span><span class="o">);</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="n">Long</span> <span class="n">res1</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">hset</span><span class="o">(</span><span class="s">"bike:1"</span><span class="o">,</span> <span class="n">bike1</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">res1</span><span class="o">);</span> <span class="c1">// 4 </span></span></span><span class="line"><span class="cl"><span class="c1"></span> </span></span><span class="line"><span class="cl"> <span class="n">String</span> <span class="n">res2</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">hget</span><span class="o">(</span><span class="s">"bike:1"</span><span class="o">,</span> <span class="s">"model"</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">res2</span><span class="o">);</span> <span class="c1">// Deimos </span></span></span><span class="line"><span class="cl"><span class="c1"></span> </span></span><span class="line"><span class="cl"> <span class="n">String</span> <span class="n">res3</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">hget</span><span class="o">(</span><span class="s">"bike:1"</span><span class="o">,</span> <span class="s">"price"</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">res3</span><span class="o">);</span> <span class="c1">// 4972 </span></span></span><span class="line"><span class="cl"><span class="c1"></span> </span></span><span class="line"><span class="cl"> <span class="n">Map</span><span class="o">&lt;</span><span class="n">String</span><span class="o">,</span> <span class="n">String</span><span class="o">&gt;</span> <span class="n">res4</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">hgetAll</span><span class="o">(</span><span class="s">"bike: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">res4</span><span class="o">);</span> <span class="c1">// {type=Enduro bikes, brand=Ergonom, price=4972, model=Deimos} </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">List</span><span class="o">&lt;</span><span class="n">String</span><span class="o">&gt;</span> <span class="n">res5</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">hmget</span><span class="o">(</span><span class="s">"bike:1"</span><span class="o">,</span> <span class="s">"model"</span><span class="o">,</span> <span class="s">"price"</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">res5</span><span class="o">);</span> <span class="c1">// [Deimos, 4972] </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">Long</span> <span class="n">res6</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">hincrBy</span><span class="o">(</span><span class="s">"bike:1"</span><span class="o">,</span> <span class="s">"price"</span><span class="o">,</span> <span class="mi">100</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">res6</span><span class="o">);</span> <span class="c1">// 5072 </span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="n">Long</span> <span class="n">res7</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">hincrBy</span><span class="o">(</span><span class="s">"bike:1"</span><span class="o">,</span> <span class="s">"price"</span><span class="o">,</span> <span class="o">-</span><span class="mi">100</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">res7</span><span class="o">);</span> <span class="c1">// 4972 </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">Long</span> <span class="n">res8</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">hincrBy</span><span class="o">(</span><span class="s">"bike:1:stats"</span><span class="o">,</span> <span class="s">"rides"</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">res8</span><span class="o">);</span> <span class="c1">// 1 </span></span></span><span class="line hl"><span class="cl"><span class="c1"></span> <span class="n">Long</span> <span class="n">res9</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">hincrBy</span><span class="o">(</span><span class="s">"bike:1:stats"</span><span class="o">,</span> <span class="s">"rides"</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">res9</span><span class="o">);</span> <span class="c1">// 2 </span></span></span><span class="line hl"><span class="cl"><span class="c1"></span> <span class="n">Long</span> <span class="n">res10</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">hincrBy</span><span class="o">(</span><span class="s">"bike:1:stats"</span><span class="o">,</span> <span class="s">"rides"</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">res10</span><span class="o">);</span> <span class="c1">// 3 </span></span></span><span class="line hl"><span class="cl"><span class="c1"></span> <span class="n">Long</span> <span class="n">res11</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">hincrBy</span><span class="o">(</span><span class="s">"bike:1:stats"</span><span class="o">,</span> <span class="s">"crashes"</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">res11</span><span class="o">);</span> <span class="c1">// 1 </span></span></span><span class="line hl"><span class="cl"><span class="c1"></span> <span class="n">Long</span> <span class="n">res12</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">hincrBy</span><span class="o">(</span><span class="s">"bike:1:stats"</span><span class="o">,</span> <span class="s">"owners"</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">res12</span><span class="o">);</span> <span class="c1">// 1 </span></span></span><span class="line hl"><span class="cl"><span class="c1"></span> <span class="n">String</span> <span class="n">res13</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">hget</span><span class="o">(</span><span class="s">"bike:1:stats"</span><span class="o">,</span> <span class="s">"rides"</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">res13</span><span class="o">);</span> <span class="c1">// 3 </span></span></span><span class="line hl"><span class="cl"><span class="c1"></span> <span class="n">List</span><span class="o">&lt;</span><span class="n">String</span><span class="o">&gt;</span> <span class="n">res14</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">hmget</span><span class="o">(</span><span class="s">"bike:1:stats"</span><span class="o">,</span> <span class="s">"crashes"</span><span class="o">,</span> <span class="s">"owners"</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">res14</span><span class="o">);</span> <span class="c1">// [1, 1] </span></span></span><span class="line"><span class="cl"><span class="c1"></span> </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 class="o">}</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_Java_hash_tutorial-stepincrby_get_mget')" 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_hash_tutorial-stepincrby_get_mget" 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/HashExample.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_hash_tutorial-stepincrby_get_mget" name="hash_tutorial-stepincrby_get_mget" 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_hash_tutorial-stepincrby_get_mget" title="Open example"> Go </label> <div aria-labelledby="tab-hash_tutorial-stepincrby_get_mget" class="panel order-last hidden w-full mt-0 relative" id="panel_Go_hash_tutorial-stepincrby_get_mget" 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_set_get_all</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">&amp;</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">hashFields</span> <span class="o">:=</span> <span class="p">[]</span><span class="kt">string</span><span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="s">"model"</span><span class="p">,</span> <span class="s">"Deimos"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s">"brand"</span><span class="p">,</span> <span class="s">"Ergonom"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s">"type"</span><span class="p">,</span> <span class="s">"Enduro bikes"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s">"price"</span><span class="p">,</span> <span class="s">"4972"</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">res1</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">HSet</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1"</span><span class="p">,</span> <span class="nx">hashFields</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">res1</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; 4 </span></span></span><span class="line"><span class="cl"><span class="c1"></span> </span></span><span class="line"><span class="cl"> <span class="nx">res2</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">HGet</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1"</span><span class="p">,</span> <span class="s">"model"</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">res2</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; Deimos </span></span></span><span class="line"><span class="cl"><span class="c1"></span> </span></span><span class="line"><span class="cl"> <span class="nx">res3</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">HGet</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1"</span><span class="p">,</span> <span class="s">"price"</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">res3</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; 4972 </span></span></span><span class="line"><span class="cl"><span class="c1"></span> </span></span><span class="line"><span class="cl"> <span class="nx">cmdReturn</span> <span class="o">:=</span> <span class="nx">rdb</span><span class="p">.</span><span class="nf">HGetAll</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1"</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> <span class="nx">res4</span><span class="p">,</span> <span class="nx">err</span> <span class="o">:=</span> <span class="nx">cmdReturn</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">res4</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> <span class="c1">// &gt;&gt;&gt; map[brand:Ergonom model:Deimos price:4972 type:Enduro bikes] </span></span></span><span class="line"><span class="cl"><span class="c1"></span> </span></span><span class="line"><span class="cl"> <span class="kd">type</span> <span class="nx">BikeInfo</span> <span class="kd">struct</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="nx">Model</span> <span class="kt">string</span> <span class="s">`redis:"model"`</span> </span></span><span class="line"><span class="cl"> <span class="nx">Brand</span> <span class="kt">string</span> <span class="s">`redis:"brand"`</span> </span></span><span class="line"><span class="cl"> <span class="nx">Type</span> <span class="kt">string</span> <span class="s">`redis:"type"`</span> </span></span><span class="line"><span class="cl"> <span class="nx">Price</span> <span class="kt">int</span> <span class="s">`redis:"price"`</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">var</span> <span class="nx">res4a</span> <span class="nx">BikeInfo</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="nx">cmdReturn</span><span class="p">.</span><span class="nf">Scan</span><span class="p">(</span><span class="o">&amp;</span><span class="nx">res4a</span><span class="p">);</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">Printf</span><span class="p">(</span><span class="s">"Model: %v, Brand: %v, Type: %v, Price: $%v\n"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nx">res4a</span><span class="p">.</span><span class="nx">Model</span><span class="p">,</span> <span class="nx">res4a</span><span class="p">.</span><span class="nx">Brand</span><span class="p">,</span> <span class="nx">res4a</span><span class="p">.</span><span class="nx">Type</span><span class="p">,</span> <span class="nx">res4a</span><span class="p">.</span><span class="nx">Price</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> <span class="c1">// &gt;&gt;&gt; Model: Deimos, Brand: Ergonom, Type: Enduro bikes, Price: $4972 </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_hmget</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">&amp;</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">hashFields</span> <span class="o">:=</span> <span class="p">[]</span><span class="kt">string</span><span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="s">"model"</span><span class="p">,</span> <span class="s">"Deimos"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s">"brand"</span><span class="p">,</span> <span class="s">"Ergonom"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s">"type"</span><span class="p">,</span> <span class="s">"Enduro bikes"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s">"price"</span><span class="p">,</span> <span class="s">"4972"</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">_</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">HSet</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1"</span><span class="p">,</span> <span class="nx">hashFields</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">cmdReturn</span> <span class="o">:=</span> <span class="nx">rdb</span><span class="p">.</span><span class="nf">HMGet</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1"</span><span class="p">,</span> <span class="s">"model"</span><span class="p">,</span> <span class="s">"price"</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> <span class="nx">res5</span><span class="p">,</span> <span class="nx">err</span> <span class="o">:=</span> <span class="nx">cmdReturn</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">res5</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; [Deimos 4972] </span></span></span><span class="line"><span class="cl"><span class="c1"></span> </span></span><span class="line"><span class="cl"> <span class="kd">type</span> <span class="nx">BikeInfo</span> <span class="kd">struct</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="nx">Model</span> <span class="kt">string</span> <span class="s">`redis:"model"`</span> </span></span><span class="line"><span class="cl"> <span class="nx">Brand</span> <span class="kt">string</span> <span class="s">`redis:"-"`</span> </span></span><span class="line"><span class="cl"> <span class="nx">Type</span> <span class="kt">string</span> <span class="s">`redis:"-"`</span> </span></span><span class="line"><span class="cl"> <span class="nx">Price</span> <span class="kt">int</span> <span class="s">`redis:"price"`</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">var</span> <span class="nx">res5a</span> <span class="nx">BikeInfo</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="nx">cmdReturn</span><span class="p">.</span><span class="nf">Scan</span><span class="p">(</span><span class="o">&amp;</span><span class="nx">res5a</span><span class="p">);</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">Printf</span><span class="p">(</span><span class="s">"Model: %v, Price: $%v\n"</span><span class="p">,</span> <span class="nx">res5a</span><span class="p">.</span><span class="nx">Model</span><span class="p">,</span> <span class="nx">res5a</span><span class="p">.</span><span class="nx">Price</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> <span class="c1">// &gt;&gt;&gt; Model: Deimos, Price: $4972 </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_hincrby</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">&amp;</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">hashFields</span> <span class="o">:=</span> <span class="p">[]</span><span class="kt">string</span><span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="s">"model"</span><span class="p">,</span> <span class="s">"Deimos"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s">"brand"</span><span class="p">,</span> <span class="s">"Ergonom"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s">"type"</span><span class="p">,</span> <span class="s">"Enduro bikes"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s">"price"</span><span class="p">,</span> <span class="s">"4972"</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">_</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">HSet</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1"</span><span class="p">,</span> <span class="nx">hashFields</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">res6</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">HIncrBy</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1"</span><span class="p">,</span> <span class="s">"price"</span><span class="p">,</span> <span class="mi">100</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">res6</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; 5072 </span></span></span><span class="line"><span class="cl"><span class="c1"></span> </span></span><span class="line"><span class="cl"> <span class="nx">res7</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">HIncrBy</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1"</span><span class="p">,</span> <span class="s">"price"</span><span class="p">,</span> <span class="o">-</span><span class="mi">100</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">res7</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; 4972 </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_incrby_get_mget</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">&amp;</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">res8</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">HIncrBy</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1:stats"</span><span class="p">,</span> <span class="s">"rides"</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">res8</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; 1 </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">res9</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">HIncrBy</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1:stats"</span><span class="p">,</span> <span class="s">"rides"</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">res9</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; 2 </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">res10</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">HIncrBy</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1:stats"</span><span class="p">,</span> <span class="s">"rides"</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">res10</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; 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">res11</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">HIncrBy</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1:stats"</span><span class="p">,</span> <span class="s">"crashes"</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">res11</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; 1 </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">res12</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">HIncrBy</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1:stats"</span><span class="p">,</span> <span class="s">"owners"</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">res12</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; 1 </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">res13</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">HGet</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1:stats"</span><span class="p">,</span> <span class="s">"rides"</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">res13</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; 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">res14</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">HMGet</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"bike:1:stats"</span><span class="p">,</span> <span class="s">"crashes"</span><span class="p">,</span> <span class="s">"owners"</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">res14</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; [1 1] </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_hash_tutorial-stepincrby_get_mget')" 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_hash_tutorial-stepincrby_get_mget" 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/hash_tutorial_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_hash_tutorial-stepincrby_get_mget" name="hash_tutorial-stepincrby_get_mget" 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_hash_tutorial-stepincrby_get_mget" title="Open example"> C# </label> <div aria-labelledby="tab-hash_tutorial-stepincrby_get_mget" class="panel order-last hidden w-full mt-0 relative" id="panel_Csharp_hash_tutorial-stepincrby_get_mget" 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 class="k">public</span> <span class="k">class</span> <span class="nc">HashExample</span> </span></span><span class="line"><span class="cl"><span class="p">{</span> </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 class="n">db</span><span class="p">.</span><span class="n">KeyDelete</span><span class="p">(</span><span class="s">"bike:1"</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> <span class="n">db</span><span class="p">.</span><span class="n">HashSet</span><span class="p">(</span><span class="s">"bike:1"</span><span class="p">,</span> <span class="k">new</span> <span class="n">HashEntry</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">new</span> <span class="n">HashEntry</span><span class="p">(</span><span class="s">"model"</span><span class="p">,</span> <span class="s">"Deimos"</span><span class="p">),</span> </span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">HashEntry</span><span class="p">(</span><span class="s">"brand"</span><span class="p">,</span> <span class="s">"Ergonom"</span><span class="p">),</span> </span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">HashEntry</span><span class="p">(</span><span class="s">"type"</span><span class="p">,</span> <span class="s">"Enduro bikes"</span><span class="p">),</span> </span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">HashEntry</span><span class="p">(</span><span class="s">"price"</span><span class="p">,</span> <span class="m">4972</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="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="s">"Hash Created"</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> <span class="c1">// Hash Created</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="kt">var</span> <span class="n">model</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">HashGet</span><span class="p">(</span><span class="s">"bike:1"</span><span class="p">,</span> <span class="s">"model"</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">$"Model: {model}"</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> <span class="c1">// Model: Deimos</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="kt">var</span> <span class="n">price</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">HashGet</span><span class="p">(</span><span class="s">"bike:1"</span><span class="p">,</span> <span class="s">"price"</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">$"Price: {price}"</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> <span class="c1">// Price: 4972</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="kt">var</span> <span class="n">bike</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">HashGetAll</span><span class="p">(</span><span class="s">"bike: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">"bike: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">"\n"</span><span class="p">,</span> <span class="n">bike</span><span class="p">.</span><span class="n">Select</span><span class="p">(</span><span class="n">b</span> <span class="p">=&gt;</span> <span class="s">$"{b.Name}: {b.Value}"</span><span class="p">)));</span> </span></span><span class="line"><span class="cl"> <span class="c1">// Bike:1:</span> </span></span><span class="line"><span class="cl"> <span class="c1">// model: Deimos</span> </span></span><span class="line"><span class="cl"> <span class="c1">// brand: Ergonom</span> </span></span><span class="line"><span class="cl"> <span class="c1">// type: Enduro bikes</span> </span></span><span class="line"><span class="cl"> <span class="c1">// price: 4972</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">var</span> <span class="n">values</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">HashGet</span><span class="p">(</span><span class="s">"bike:1"</span><span class="p">,</span> <span class="k">new</span> <span class="n">RedisValue</span><span class="p">[]</span> <span class="p">{</span> <span class="s">"model"</span><span class="p">,</span> <span class="s">"price"</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">values</span><span class="p">));</span> </span></span><span class="line"><span class="cl"> <span class="c1">// Deimos 4972</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="kt">var</span> <span class="n">newPrice</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">HashIncrement</span><span class="p">(</span><span class="s">"bike:1"</span><span class="p">,</span> <span class="s">"price"</span><span class="p">,</span> <span class="m">100</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">$"New price: {newPrice}"</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> <span class="c1">// New price: 5072</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="n">newPrice</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">HashIncrement</span><span class="p">(</span><span class="s">"bike:1"</span><span class="p">,</span> <span class="s">"price"</span><span class="p">,</span> <span class="p">-</span><span class="m">100</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">$"New price: {newPrice}"</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> <span class="c1">// New price: 4972</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line hl"><span class="cl"> <span class="kt">var</span> <span class="n">rides</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">HashIncrement</span><span class="p">(</span><span class="s">"bike:1"</span><span class="p">,</span> <span class="s">"rides"</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">$"Rides: {rides}"</span><span class="p">);</span> </span></span><span class="line hl"><span class="cl"> <span class="c1">// Rides: 1</span> </span></span><span class="line hl"><span class="cl"> </span></span><span class="line hl"><span class="cl"> <span class="n">rides</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">HashIncrement</span><span class="p">(</span><span class="s">"bike:1"</span><span class="p">,</span> <span class="s">"rides"</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">$"Rides: {rides}"</span><span class="p">);</span> </span></span><span class="line hl"><span class="cl"> <span class="c1">// Rides: 2</span> </span></span><span class="line hl"><span class="cl"> </span></span><span class="line hl"><span class="cl"> <span class="n">rides</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">HashIncrement</span><span class="p">(</span><span class="s">"bike:1"</span><span class="p">,</span> <span class="s">"rides"</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">$"Rides: {rides}"</span><span class="p">);</span> </span></span><span class="line hl"><span class="cl"> <span class="c1">// Rides: 3</span> </span></span><span class="line hl"><span class="cl"> </span></span><span class="line hl"><span class="cl"> <span class="kt">var</span> <span class="n">crashes</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">HashIncrement</span><span class="p">(</span><span class="s">"bike:1"</span><span class="p">,</span> <span class="s">"crashes"</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">$"Crashes: {crashes}"</span><span class="p">);</span> </span></span><span class="line hl"><span class="cl"> <span class="c1">// Crashes: 1</span> </span></span><span class="line hl"><span class="cl"> </span></span><span class="line hl"><span class="cl"> <span class="kt">var</span> <span class="n">owners</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">HashIncrement</span><span class="p">(</span><span class="s">"bike:1"</span><span class="p">,</span> <span class="s">"owners"</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">$"Owners: {owners}"</span><span class="p">);</span> </span></span><span class="line hl"><span class="cl"> <span class="c1">// Owners: 1</span> </span></span><span class="line hl"><span class="cl"> </span></span><span class="line hl"><span class="cl"> <span class="kt">var</span> <span class="n">stats</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">HashGet</span><span class="p">(</span><span class="s">"bike:1"</span><span class="p">,</span> <span class="k">new</span> <span class="n">RedisValue</span><span class="p">[]</span> <span class="p">{</span> <span class="s">"crashes"</span><span class="p">,</span> <span class="s">"owners"</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">$"Bike stats: crashes={stats[0]}, owners={stats[1]}"</span><span class="p">);</span> </span></span><span class="line hl"><span class="cl"> <span class="c1">// Bike stats: crashes=1, owners=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> <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_hash_tutorial-stepincrby_get_mget')" 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_hash_tutorial-stepincrby_get_mget" 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/HashExample.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> </li> </ul> <h2 id="field-expiration"> Field expiration </h2> <p> New in Redis Community Edition 7.4 is the ability to specify an expiration time or a time-to-live (TTL) value for individual hash fields. This capability is comparable to <a href="/docs/latest/develop/use/keyspace/#key-expiration"> key expiration </a> and includes a number of similar commands. </p> <p> Use the following commands to set either an exact expiration time or a TTL value for specific fields: </p> <ul> <li> <a href="/docs/latest/commands/hexpire/"> <code> HEXPIRE </code> </a> : set the remaining TTL in seconds. </li> <li> <a href="/docs/latest/commands/hpexpire/"> <code> HPEXPIRE </code> </a> : set the remaining TTL in milliseconds. </li> <li> <a href="/docs/latest/commands/hexpireat/"> <code> HEXPIREAT </code> </a> : set the expiration time to a timestamp <sup id="fnref:1"> <a class="footnote-ref" href="#fn:1" role="doc-noteref"> 1 </a> </sup> specified in seconds. </li> <li> <a href="/docs/latest/commands/hpexpireat/"> <code> HPEXPIREAT </code> </a> : set the expiration time to a timestamp specified in milliseconds. </li> </ul> <p> Use the following commands to retrieve either the exact time when or the remaining TTL until specific fields will expire: </p> <ul> <li> <a href="/docs/latest/commands/hexpiretime/"> <code> HEXPIRETIME </code> </a> : get the expiration time as a timestamp in seconds. </li> <li> <a href="/docs/latest/commands/hpexpiretime/"> <code> HPEXPIRETIME </code> </a> : get the expiration time as a timestamp in milliseconds. </li> <li> <a href="/docs/latest/commands/httl/"> <code> HTTL </code> </a> : get the remaining TTL in seconds. </li> <li> <a href="/docs/latest/commands/hpttl/"> <code> HPTTL </code> </a> : get the remaining TTL in milliseconds. </li> </ul> <p> Use the following command to remove the expiration of specific fields: </p> <ul> <li> <a href="/docs/latest/commands/hpersist/"> <code> HPERSIST </code> </a> : remove the expiration. </li> </ul> <h3 id="common-field-expiration-use-cases"> Common field expiration use cases </h3> <ol> <li> <p> <strong> Event Tracking </strong> : Use a hash key to store events from the last hour. Set each event's TTL to one hour. Use <code> HLEN </code> to count events from the past hour. </p> </li> <li> <p> <strong> Fraud Detection </strong> : Create a hash with hourly counters for events. Set each field's TTL to 48 hours. Query the hash to get the number of events per hour for the last 48 hours. </p> </li> <li> <p> <strong> Customer Session Management </strong> : Store customer data in hash keys. Create a new hash key for each session and add a session field to the customer’s hash key. Expire both the session key and the session field in the customer’s hash key automatically when the session expires. </p> </li> <li> <p> <strong> Active Session Tracking </strong> : Store all active sessions in a hash key. Set each session's TTL to expire automatically after inactivity. Use <code> HLEN </code> to count active sessions. </p> </li> </ol> <h3 id="field-expiration-examples"> Field expiration examples </h3> <p> Support for hash field expiration in the official client libraries is not yet available, but you can test hash field expiration now with beta versions of the <a href="https://github.com/redis/redis-py"> Python (redis-py) </a> and <a href="https://github.com/redis/jedis"> Java (Jedis) </a> client libraries. </p> <p> Following are some Python examples that demonstrate how to use field expiration. </p> <p> Consider a hash data set for storing sensor data that has the following structure: </p> <div class="highlight"> <pre class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">event</span> <span class="o">=</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="s1">'air_quality'</span><span class="p">:</span> <span class="mi">256</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s1">'battery_level'</span><span class="p">:</span><span class="mi">89</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">r</span><span class="o">.</span><span class="n">hset</span><span class="p">(</span><span class="s1">'sensor:sensor1'</span><span class="p">,</span> <span class="n">mapping</span><span class="o">=</span><span class="n">event</span><span class="p">)</span> </span></span></code></pre> </div> <p> In the examples below, you will likely need to refresh the <code> sensor:sensor1 </code> key after its fields expire. </p> <p> Set and retrieve the TTL for multiple fields in a hash: </p> <div class="highlight"> <pre class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="c1"># set the TTL for two hash fields to 60 seconds</span> </span></span><span class="line"><span class="cl"><span class="n">r</span><span class="o">.</span><span class="n">hexpire</span><span class="p">(</span><span class="s1">'sensor:sensor1'</span><span class="p">,</span> <span class="mi">60</span><span class="p">,</span> <span class="s1">'air_quality'</span><span class="p">,</span> <span class="s1">'battery_level'</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="n">ttl</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">httl</span><span class="p">(</span><span class="s1">'sensor:sensor1'</span><span class="p">,</span> <span class="s1">'air_quality'</span><span class="p">,</span> <span class="s1">'battery_level'</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">ttl</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="c1"># prints [60, 60]</span> </span></span></code></pre> </div> <p> Set and retrieve a hash field's TTL in milliseconds: </p> <div class="highlight"> <pre class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="c1"># set the TTL of the 'air_quality' field in milliseconds</span> </span></span><span class="line"><span class="cl"><span class="n">r</span><span class="o">.</span><span class="n">hpexpire</span><span class="p">(</span><span class="s1">'sensor:sensor1'</span><span class="p">,</span> <span class="mi">60000</span><span class="p">,</span> <span class="s1">'air_quality'</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="c1"># and retrieve it</span> </span></span><span class="line"><span class="cl"><span class="n">pttl</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">hpttl</span><span class="p">(</span><span class="s1">'sensor:sensor1'</span><span class="p">,</span> <span class="s1">'air_quality'</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">pttl</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="c1"># prints [59994] # your actual value may vary</span> </span></span></code></pre> </div> <p> Set and retrieve a hash field’s expiration timestamp: </p> <div class="highlight"> <pre class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="c1"># set the expiration of 'air_quality' to now + 24 hours</span> </span></span><span class="line"><span class="cl"><span class="c1"># (similar to setting the TTL to 24 hours)</span> </span></span><span class="line"><span class="cl"><span class="n">r</span><span class="o">.</span><span class="n">hexpireat</span><span class="p">(</span><span class="s1">'sensor:sensor1'</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="n">datetime</span><span class="o">.</span><span class="n">now</span><span class="p">()</span> <span class="o">+</span> <span class="n">timedelta</span><span class="p">(</span><span class="n">hours</span><span class="o">=</span><span class="mi">24</span><span class="p">),</span> </span></span><span class="line"><span class="cl"> <span class="s1">'air_quality'</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="c1"># and retrieve it</span> </span></span><span class="line"><span class="cl"><span class="n">expire_time</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">hexpiretime</span><span class="p">(</span><span class="s1">'sensor:sensor1'</span><span class="p">,</span> <span class="s1">'air_quality'</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">expire_time</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="c1"># prints [1717668041] # your actual value may vary</span> </span></span></code></pre> </div> <h2 id="performance"> Performance </h2> <p> Most Redis hash commands are O(1). </p> <p> A few commands, such as <a href="/docs/latest/commands/hkeys/"> <code> HKEYS </code> </a> , <a href="/docs/latest/commands/hvals/"> <code> HVALS </code> </a> , <a href="/docs/latest/commands/hgetall/"> <code> HGETALL </code> </a> , and most of the expiration-related commands, are O(n), where <em> n </em> is the number of field-value pairs. </p> <h2 id="limits"> Limits </h2> <p> Every hash can store up to 4,294,967,295 (2^32 - 1) field-value pairs. In practice, your hashes are limited only by the overall memory on the VMs hosting your Redis deployment. </p> <h2 id="learn-more"> Learn more </h2> <ul> <li> <a href="https://www.youtube.com/watch?v=-KdITaRkQ-U"> Redis Hashes Explained </a> is a short, comprehensive video explainer covering Redis hashes. </li> <li> <a href="https://university.redis.com/courses/ru101/"> Redis University's RU101 </a> covers Redis hashes in detail. </li> </ul> <div class="footnotes" role="doc-endnotes"> <hr/> <ol> <li id="fn:1"> <p> all timestamps are specified in seconds or milliseconds since the <a href="https://en.wikipedia.org/wiki/Unix_time"> Unix epoch </a> . <a class="footnote-backref" href="#fnref:1" role="doc-backlink"> ↩︎ </a> </p> </li> </ol> </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/develop/data-types/hashes/"/> <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/statistics/cluster-metrics/.html
<section class="prose w-full py-12 max-w-none"> <h1> Cluster metrics </h1> <p class="text-lg -mt-5 mb-10"> Documents the cluster metrics used with Redis Enterprise Software REST API calls. </p> <table> <thead> <tr> <th> Metric name </th> <th> Type </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> available_flash </td> <td> float </td> <td> Sum of available flash in all nodes (bytes) </td> </tr> <tr> <td> available_memory </td> <td> float </td> <td> Sum of available memory in all nodes (bytes) </td> </tr> <tr> <td> avg_latency </td> <td> float </td> <td> Average latency of requests handled by all cluster endpoints (micro-sec); returned only when there is traffic </td> </tr> <tr> <td> bigstore_free </td> <td> float </td> <td> Sum of free space of backend flash (used by flash DB's BigRedis) on all cluster nodes (bytes); only returned when BigRedis is enabled </td> </tr> <tr> <td> bigstore_iops </td> <td> float </td> <td> Rate of I/O operations against backend flash for all shards which are part of a flash-based DB (BigRedis) in the cluster (ops/sec); returned only when BigRedis is enabled </td> </tr> <tr> <td> bigstore_kv_ops </td> <td> float </td> <td> Rate of value read/write operations against back-end flash for all shards which are part of a flash based DB (BigRedis) in cluster (ops/sec); only returned when BigRedis is enabled </td> </tr> <tr> <td> bigstore_throughput </td> <td> float </td> <td> Throughput I/O operations against backend flash for all shards which are part of a flash-based DB (BigRedis) in the cluster (bytes/sec); only returned when BigRedis is enabled </td> </tr> <tr> <td> conns </td> <td> float </td> <td> Total number of clients connected to all cluster endpoints </td> </tr> <tr> <td> cpu_idle </td> <td> float </td> <td> CPU idle time portion, the value is weighted between all nodes based on number of cores in each node (0-1, multiply by 100 to get percent) </td> </tr> <tr> <td> cpu_system </td> <td> float </td> <td> CPU time portion spent in kernel on the cluster, the value is weighted between all nodes based on number of cores in each node (0-1, multiply by 100 to get percent) </td> </tr> <tr> <td> cpu_user </td> <td> float </td> <td> CPU time portion spent by users-pace processes on the cluster. The value is weighted between all nodes based on number of cores in each node (0-1, multiply by 100 to get percent). </td> </tr> <tr> <td> egress_bytes </td> <td> float </td> <td> Sum of rate of outgoing network traffic on all cluster nodes (bytes/sec) </td> </tr> <tr> <td> ephemeral_storage_avail </td> <td> float </td> <td> Sum of disk space available to Redis Enterprise processes on configured ephemeral disk on all cluster nodes (bytes) </td> </tr> <tr> <td> ephemeral_storage_free </td> <td> float </td> <td> Sum of free disk space on configured ephemeral disk on all cluster nodes (bytes) </td> </tr> <tr> <td> free_memory </td> <td> float </td> <td> Sum of free memory in all cluster nodes (bytes) </td> </tr> <tr> <td> ingress_bytes </td> <td> float </td> <td> Sum of rate of incoming network traffic on all cluster nodes (bytes/sec) </td> </tr> <tr> <td> persistent_storage_avail </td> <td> float </td> <td> Sum of disk space available to Redis Enterprise processes on configured persistent disk on all cluster nodes (bytes) </td> </tr> <tr> <td> persistent_storage_free </td> <td> float </td> <td> Sum of free disk space on configured persistent disk on all cluster nodes (bytes) </td> </tr> <tr> <td> provisional_flash </td> <td> float </td> <td> Sum of provisional flash in all nodes (bytes) </td> </tr> <tr> <td> provisional_memory </td> <td> float </td> <td> Sum of provisional memory in all nodes (bytes) </td> </tr> <tr> <td> total_req </td> <td> float </td> <td> Request rate handled by all endpoints on the cluster (ops/sec) </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/statistics/cluster-metrics/"/> <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/security/access-control/data-access-control/create-assign-users/.html
<section class="prose w-full py-12 max-w-none"> <h1> Create and edit database users </h1> <p class="text-lg -mt-5 mb-10"> Create a database user and assign it a role. </p> <p> Before you create a database user, you must <a href="/docs/latest/operate/rc/security/access-control/data-access-control/create-roles/"> create a data access role </a> to assign to that user. </p> <h2 id="create-a-user"> Create a user </h2> <p> To create a user: </p> <ol> <li> <p> Go to <strong> Data Access Control </strong> from the <a href="https://cloud.redis.io/#/"> Redis Cloud console </a> menu. </p> <a href="/docs/latest/images/rc/data-access-control-menu.png" sdata-lightbox="/images/rc/data-access-control-menu.png"> <img alt="Menu for database access control." src="/docs/latest/images/rc/data-access-control-menu.png" width="200px"/> </a> </li> <li> <p> Select the <strong> Users </strong> tab. </p> <a href="/docs/latest/images/rc/data-access-control-users-no-users.png" sdata-lightbox="/images/rc/data-access-control-users-no-users.png"> <img alt="User configuration area." src="/docs/latest/images/rc/data-access-control-users-no-users.png"/> </a> </li> <li> <p> Select <code> + </code> to create a new user. </p> <a href="/docs/latest/images/rc/data-access-control-users-add-or-edit.png" sdata-lightbox="/images/rc/data-access-control-users-add-or-edit.png"> <img alt="User add or edit." src="/docs/latest/images/rc/data-access-control-users-add-or-edit.png" width="300px"/> </a> </li> <li> <p> Enter a username in the <strong> Username </strong> field. </p> <a href="/docs/latest/images/rc/data-access-control-users-add.png" sdata-lightbox="/images/rc/data-access-control-users-add.png"> <img alt="User add username." src="/docs/latest/images/rc/data-access-control-users-add.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> An error occurs if a user tries to connect to a memcached database with the username <code> admin </code> . Do not use <code> admin </code> for a username if the user will be connecting to a memcached database. </div> </div> </li> <li> <p> Select a <a href="/docs/latest/operate/rc/security/access-control/data-access-control/create-roles/"> <strong> Role </strong> </a> from the list. </p> <a href="/docs/latest/images/rc/data-access-control-users-add-role.png" sdata-lightbox="/images/rc/data-access-control-users-add-role.png"> <img alt="User select role." src="/docs/latest/images/rc/data-access-control-users-add-role.png" width="300px"/> </a> </li> <li> <p> Enter and confirm the user's password. ACL user passwords must be between 8 and 128 characters long. </p> <p> Then, select the check mark to save the user. </p> <a href="/docs/latest/images/rc/data-access-control-users-password-and-finish.png" sdata-lightbox="/images/rc/data-access-control-users-password-and-finish.png"> <img alt="User add password and finish." src="/docs/latest/images/rc/data-access-control-users-password-and-finish.png" width="300px"/> </a> </li> </ol> <h2 id="assign-roles-to-existing-users"> Assign roles to existing users </h2> <p> To assign a data access role to an existing user: </p> <ol> <li> <p> Go to <strong> Data Access Control </strong> from the <a href="https://cloud.redis.io/#/"> Redis Cloud console </a> menu. </p> <a href="/docs/latest/images/rc/data-access-control-menu.png" sdata-lightbox="/images/rc/data-access-control-menu.png"> <img alt="Menu for database access control." src="/docs/latest/images/rc/data-access-control-menu.png" width="200px"/> </a> </li> <li> <p> Select the <strong> Users </strong> tab. </p> <a href="/docs/latest/images/rc/data-access-control-users.png" sdata-lightbox="/images/rc/data-access-control-users.png"> <img alt="User configuration area." src="/docs/latest/images/rc/data-access-control-users.png"/> </a> </li> <li> <p> Point to the user and select the pencil icon when it appears. </p> </li> <li> <p> Select a <a href="/docs/latest/operate/rc/security/access-control/data-access-control/create-roles/"> <strong> Role </strong> </a> from the list. </p> <a href="/docs/latest/images/rc/data-access-control-users-add-or-edit.png" sdata-lightbox="/images/rc/data-access-control-users-add-or-edit.png"> <img alt="User add or edit." src="/docs/latest/images/rc/data-access-control-users-add-or-edit.png" width="300px"/> </a> </li> <li> <p> Select the check mark to assign the role to the user. </p> <a href="/docs/latest/images/rc/data-access-control-users-add-role.png" sdata-lightbox="/images/rc/data-access-control-users-add-role.png"> <img alt="User select role." src="/docs/latest/images/rc/data-access-control-users-add-role.png" width="300px"/> </a> </li> <li> <p> Select the check mark to save the user. </p> <a href="/docs/latest/images/rc/data-access-control-users-password-and-finish.png" sdata-lightbox="/images/rc/data-access-control-users-password-and-finish.png"> <img alt="User add password and finish." src="/docs/latest/images/rc/data-access-control-users-password-and-finish.png" width="300px"/> </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/rc/security/access-control/data-access-control/create-assign-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/rc/subscriptions/.html
<section class="prose w-full py-12 max-w-none"> <h1> Manage subscriptions </h1> <p> This page helps you manage your Redis Cloud subscriptions; it briefly compares available plans and shows where to find help with common tasks. </p> <h2 id="subscription-plans"> Subscription plans </h2> <p> As of April 2024, Redis Cloud supports the following subscription plans: </p> <ul> <li> <a href="#free-rce"> Free Redis Cloud Essentials </a> </li> <li> <a href="#paid-rce"> Paid Redis Cloud Essentials </a> </li> <li> <a href="#redis-cloud-pro"> Redis Cloud Pro </a> </li> </ul> <p> Here's a quick comparison of each plan: </p> <table> <thead> <tr> <th style="text-align:left"> Feature </th> <th style="text-align:center"> Redis Cloud Essentials (free) </th> <th style="text-align:center"> Redis Cloud Essentials (paid) </th> <th style="text-align:center"> Redis Cloud Pro </th> </tr> </thead> <tbody> <tr> <td style="text-align:left"> Memory size </td> <td style="text-align:center"> 30 MB </td> <td style="text-align:center"> 250 MB-12 GB </td> <td style="text-align:center"> 50 TB </td> </tr> <tr> <td style="text-align:left"> Concurrent connections </td> <td style="text-align:center"> 30 </td> <td style="text-align:center"> 256-10000 </td> <td style="text-align:center"> Unlimited </td> </tr> <tr> <td style="text-align:left"> Security </td> <td style="text-align:center"> Role-based auth <br/> Password protection <br/> Encryption in transit </td> <td style="text-align:center"> Role-based auth <br/> Password protection <br/> TLS auth <br/> Encryption in transit </td> <td style="text-align:center"> Role-based auth <br/> Password protection <br/> TLS auth <br/> Encryption in transit <br/> Encryption at rest </td> </tr> <tr> <td style="text-align:left"> REST API </td> <td style="text-align:center"> No </td> <td style="text-align:center"> Yes </td> <td style="text-align:center"> Yes </td> </tr> <tr> <td style="text-align:left"> Selected additional features <br/> <br/> <br/> </td> <td style="text-align:center"> </td> <td style="text-align:center"> Replication <br/> Auto-failover <br/> </td> <td style="text-align:center"> Dedicated accounts <br/> Auto Tiering <br/> Active/Active <br/> </td> </tr> </tbody> </table> <p> To learn more, see <a href="https://redis.io/pricing/"> Redis Cloud Pricing </a> . </p> <h3 id="free-rce"> Free Redis Cloud Essentials </h3> <p> Free plans are a type of Redis Cloud Essentials plans designed for training purposes and prototyping. They can be seamlessly upgraded to other Redis Cloud Essentials plans with no data loss. </p> <h3 id="paid-rce"> Paid Redis Cloud Essentials </h3> <p> Redis Cloud Essentials is cost-efficient and designed for low-throughput scenarios. It support a range of availability, persistence, and backup options. Pricing supports low throughput workloads. See <a href="/docs/latest/operate/rc/subscriptions/view-essentials-subscription/essentials-plan-details/"> Redis Cloud Essentials plans </a> for a list of available plans. </p> <h3 id="redis-cloud-pro"> Redis Cloud Pro </h3> <p> Redis Cloud Pro supports more databases, larger databases, greater throughput, and unlimited connections compared to Redis Cloud Essentials. Hosted in dedicated VPCs, they feature high-availability in a single or multi-AZ, Active-Active, Auto-Tiering, clustering, data persistence, and configurable backups. Pricing is "pay as you go" to support any dataset size or throughput. </p> <p> Redis Cloud Pro annual plans support the same features as Redis Cloud Pro but at significant savings. Annual plans also provide Premium support. The underlying commitment applies to all workloads across multiple providers and regions. </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/subscriptions/"/> <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/redisstack/redisstack-6.2.6-release-notes/.html
<section class="prose w-full py-12 max-w-none"> <h1> Redis Stack 6.2.6 release notes </h1> <p class="text-lg -mt-5 mb-10"> Redis Stack 6.2.6 release notes. </p> <h2 id="redis-stack-server-626-v17-october-2024"> Redis Stack Server 6.2.6-v17 (October 2024) </h2> <p> This is a maintenance release for Redis Stack Server 6.2.6 </p> <p> Update urgency: <code> SECURITY </code> : there are security fixes in the release. </p> <p> <a href="https://hub.docker.com/r/redis/redis-stack"> Docker </a> | <a href="https://redis.io/downloads/#stack"> Download </a> </p> <h3 id="headlines"> Headlines: </h3> <p> This version includes security fixes for the <strong> Redis </strong> server, addressing potential vulnerabilities such as an RCE when using Lua library components, and a denial-of-service (DoS) risk due to unbounded pattern matching. Additionally, this maintenance release includes the latest version of <strong> Redis Insight </strong> . </p> <h3 id="details"> Details: </h3> <p> <strong> Security and privacy </strong> </p> <ul> <li> <strong> Redis </strong> : <ul> <li> (CVE-2024-31449) Lua library commands may lead to stack overflow and potential RCE. </li> <li> (CVE-2024-31228) Potential Denial-of-service due to unbounded pattern matching. </li> </ul> </li> </ul> <p> <strong> Redis version </strong> </p> <ul> <li> <a href="https://github.com/redis/redis/releases/tag/6.2.16"> Redis 6.2.16 </a> </li> </ul> <p> <strong> Module versions </strong> </p> <ul> <li> <strong> <a href="https://github.com/RediSearch/RediSearch/releases/tag/v2.6.20"> RediSearch 2.6.20 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisJSON/RedisJSON/releases/tag/v2.4.9"> RedisJSON 2.4.9 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisGraph/RedisGraph/releases/tag/v2.10.15"> RedisGraph 2.10.12 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/releases/tag/v1.8.14"> RedisTimeSeries 1.8.14 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisBloom/RedisBloom/releases/tag/v2.4.9"> RedisBloom 2.4.9 </a> </strong> </li> </ul> <p> <strong> Recommended Client Libraries </strong> </p> <ul> <li> Java <ul> <li> <a href="https://github.com/redis/jedis/releases/tag/v5.2.0"> Jedis 5.2.0 or greater </a> </li> <li> <a href="https://github.com/redis/redis-om-spring/releases/tag/v0.9.5"> redis-om-spring 0.9.5 or greater </a> </li> </ul> </li> <li> Python <ul> <li> <a href="https://github.com/redis/redis-py/releases/tag/v5.1.0"> redis-py 5.1.0 or greater </a> </li> <li> <a href="https://github.com/redis/redis-om-python/releases/tag/v0.3.2"> redis-om-python 0.3.2 or greater </a> </li> </ul> </li> <li> NodeJS <ul> <li> <a href="https://github.com/redis/node-redis/releases/tag/redis%404.7.0"> node-redis 4.7.0 or greater </a> </li> <li> <a href="https://github.com/redis/redis-om-node/releases/tag/v0.2.0"> redis-om-node 0.2.0 or greater </a> </li> </ul> </li> <li> .NET <ul> <li> <a href="https://github.com/redis/redis-om-dotnet/releases/tag/v0.7.4"> redis-om-dotnet 0.7.4 or greater </a> </li> <li> <a href="https://github.com/redis/NRedisStack/releases/tag/v0.13.0"> NRedisStack 0.13.0 or greater </a> </li> </ul> </li> <li> Go <ul> <li> <a href="https://github.com/redis/go-redis/releases/tag/v9.6.1"> go-redis 9.6.1 or greater </a> </li> <li> <a href="https://github.com/redis/rueidis/releases/tag/v1.0.47"> rueidis 1.0.47 or greater </a> </li> </ul> </li> </ul> <p> Compatible with <a href="https://redis.io/download"> Redis Insight </a> . The docker image redis/redis-stack for this version is bundled with <a href="https://github.com/RedisInsight/RedisInsight/releases/tag/2.58.0"> Redis Insight 2.58 </a> . </p> <p> Note: version numbers follow the pattern: </p> <p> <code> x.y.z-b </code> </p> <ul> <li> <code> x.y </code> Redis major version </li> <li> <code> z </code> increases with even numbers as a module x.y version increases. </li> <li> <code> b </code> denotes a patch to Redis or a module (any <code> z </code> of Redis or modules). <code> b </code> will consist of a <code> v </code> + numeric value. </li> </ul> <h2 id="redis-stack-server-626-v16-august-2024"> Redis Stack Server 6.2.6-v16 (August 2024) </h2> <p> This is a maintenance release for Redis Stack Server 6.2.6 </p> <p> Update urgency: <code> MODERATE </code> : Program an upgrade of the server, but it's not urgent. </p> <h3 id="headlines-1"> Headlines: </h3> <p> The updated <strong> search and query </strong> version introduces several new features and bug fixes. This new release of Redis Stack 6.2.6 also includes updated versions of <strong> JSON </strong> and <strong> time series </strong> data structures, each incorporating several bug fixes. </p> <p> This maintenance release also contains the latest version of <strong> RedisInsight </strong> . </p> <h3 id="details-1"> Details: </h3> <p> <strong> Improvements </strong> </p> <ul> <li> <strong> Search and query </strong> : <ul> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4793"> #4793 </a> - Add character validations to simple string replies and escape it when required(MOD-7258) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4769"> #4769 </a> - Indicate which value is missing on the error message at the aggregation pipeline (MOD-7201) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4746"> #4746 </a> - <code> GROUPBY </code> recursion cleanup (MOD-7245) </li> </ul> </li> </ul> <p> <strong> Bug Fixes </strong> </p> <ul> <li> <p> <strong> Search and query </strong> : </p> <ul> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4755"> #4755 </a> - Correct return the maximum value for negative values when using <code> MAX </code> reducer (MOD-7252) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4733"> #4733 </a> - Separators ignored when escaping backslash <code> \ </code> after the escaped character such as in <code> hello\\,world </code> ignoring <code> , </code> (MOD-7240) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4717"> #4717 </a> - Sorting by multiple fields as in <code> SORTBY 2 @field1 @field2 </code> was ignoring the subsequent field (MOD-7206) </li> </ul> </li> <li> <p> <strong> Time series </strong> : </p> <ul> <li> <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/pull/1607"> #1607 </a> Potential crash after deleting and recreating a source key of a compaction rule (MOD-7338) </li> <li> <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/pull/1610"> #1610 </a> <code> COUNT </code> argument accepts non-positive values (MOD-5413) </li> </ul> </li> </ul> <p> <strong> Redis version </strong> </p> <ul> <li> <a href="https://github.com/redis/redis/releases/tag/6.2.14"> Redis 6.2.14 </a> </li> </ul> <p> <strong> Module versions </strong> </p> <ul> <li> <strong> <a href="https://github.com/RediSearch/RediSearch/releases/tag/v2.6.20"> RediSearch 2.6.20 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisJSON/RedisJSON/releases/tag/v2.4.9"> RedisJSON 2.4.9 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisGraph/RedisGraph/releases/tag/v2.10.15"> RedisGraph 2.10.12 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/releases/tag/v1.8.14"> RedisTimeSeries 1.8.14 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisBloom/RedisBloom/releases/tag/v2.4.9"> RedisBloom 2.4.9 </a> </strong> </li> </ul> <p> <strong> Recommended Client Libraries </strong> </p> <ul> <li> Java <ul> <li> <a href="https://github.com/redis/jedis/releases/tag/v5.1.4"> Jedis 5.1.4 or greater </a> </li> <li> <a href="https://github.com/redis/redis-om-spring/releases/tag/v0.9.4"> redis-om-spring 0.9.4 or greater </a> </li> </ul> </li> <li> Python <ul> <li> <a href="https://github.com/redis/redis-py/releases/tag/v5.0.9"> redis-py 5.0.9 or greater </a> </li> <li> <a href="https://github.com/redis/redis-om-python/releases/tag/v0.3.1"> redis-om-python 0.3.1 or greater </a> </li> </ul> </li> <li> NodeJS <ul> <li> <a href="https://github.com/redis/node-redis/releases/tag/redis%404.7.0"> node-redis 4.7.0 or greater </a> </li> <li> <a href="https://github.com/redis/redis-om-node/releases/tag/v0.2.0"> redis-om-node 0.2.0 or greater </a> </li> </ul> </li> <li> .NET <ul> <li> <a href="https://github.com/redis/redis-om-dotnet/releases/tag/v0.7.4"> redis-om-dotnet 0.7.4 or greater </a> </li> <li> <a href="https://github.com/redis/NRedisStack/releases/tag/v0.12.0"> NRedisStack 0.12.0 or greater </a> </li> </ul> </li> <li> Go <ul> <li> <a href="https://github.com/redis/go-redis/releases/tag/v9.6.1"> go-redis 9.6.1 or greater </a> </li> <li> <a href="https://github.com/redis/rueidis/releases/tag/v1.0.43"> rueidis 1.0.43 or greater </a> </li> </ul> </li> </ul> <p> Compatible with <a href="https://redis.io/download"> Redis Insight </a> . The docker image redis/redis-stack for this version is bundled with <a href="https://github.com/RedisInsight/RedisInsight/releases/tag/2.54.0"> Redis Insight 2.54 </a> . </p> <p> Note: version numbers follow the pattern: </p> <p> <code> x.y.z-b </code> </p> <ul> <li> <code> x.y </code> Redis major version </li> <li> <code> z </code> increases with even numbers as a module x.y version increases. </li> <li> <code> b </code> denotes a patch to Redis or a module (any <code> z </code> of Redis or modules). <code> b </code> will consist of a <code> v </code> + numeric value. </li> </ul> <h2 id="redis-stack-server-626-v15-june-2024"> Redis Stack Server 6.2.6-v15 (June 2024) </h2> <p> This is a maintenance release for Redis Stack Server 6.2.6 </p> <p> Update urgency: <code> MODERATE </code> : Program an upgrade of the server, but it's not urgent. </p> <h3 id="headlines-2"> Headlines: </h3> <p> Redis Stack 6.2.6-v15 introduces an updated <strong> search and query </strong> capability with several enhancements and bug fixes. The updated <strong> search and query </strong> version features improved memory reporting that accounts for additional memory consumed by <code> TAG </code> and <code> TEXT </code> tries. Also, it includes additional fields in the <code> FT.INFO </code> command when used within a cluster. This maintenance release also contains the latest version of <strong> RedisInsight </strong> . </p> <h3 id="details-2"> Details: </h3> <p> <strong> Improvements </strong> </p> <ul> <li> <strong> Search and query </strong> : <ul> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4599"> #4599 </a> - Report additional memory consumed by the <code> TAG </code> and <code> TEXT </code> tries (MOD-5902) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4688"> #4688 </a> - Add missing <code> FT.INFO </code> fields when used within a cluster (MOD-6920) </li> </ul> </li> </ul> <p> <strong> Bug Fixes </strong> </p> <ul> <li> <strong> Search and query </strong> : <ul> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4616"> #4616 </a> - Shards become unresponsive when using <code> FT.AGGREGATE </code> with <code> APPLY 'split(...)' </code> (MOD-6759) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4557"> #4557 </a> - <code> FT.EXPLAIN </code> returns additional <code> } </code> when querying using wildcards (MOD-6768) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4647"> #4647 </a> - <code> FT.DROPINDEX </code> with <code> DD </code> flag deleted keys in one AA cluster but not the others (MOD-1855) </li> </ul> </li> </ul> <p> <strong> Redis version </strong> </p> <ul> <li> <a href="https://github.com/redis/redis/releases/tag/6.2.14"> Redis 6.2.14 </a> </li> </ul> <p> <strong> Module versions </strong> </p> <ul> <li> <strong> <a href="https://github.com/RediSearch/RediSearch/releases/tag/v2.6.19"> RediSearch 2.6.19 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisJSON/RedisJSON/releases/tag/v2.4.9"> RedisJSON 2.4.9 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisGraph/RedisGraph/releases/tag/v2.10.15"> RedisGraph 2.10.12 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/releases/tag/v1.8.13"> RedisTimeSeries 1.8.13 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisBloom/RedisBloom/releases/tag/v2.4.9"> RedisBloom 2.4.9 </a> </strong> </li> </ul> <p> <strong> Recommended Client Libraries </strong> </p> <ul> <li> Java <ul> <li> <a href="https://github.com/redis/jedis/releases/tag/v5.1.3"> Jedis 5.1.3 or later </a> </li> <li> <a href="https://github.com/redis/redis-om-spring/releases/tag/v0.9.1"> redis-om-spring 0.9.1 or later </a> </li> </ul> </li> <li> Python <ul> <li> <a href="https://github.com/redis/redis-py/releases/tag/v5.0.5"> redis-py 5.0.5 or later </a> </li> <li> <a href="https://github.com/redis/redis-om-python/releases/tag/v0.3.1"> redis-om-python 0.3.1 or later </a> </li> </ul> </li> <li> NodeJS <ul> <li> <a href="https://github.com/redis/node-redis/releases/tag/redis%404.6.14"> node-redis 4.6.14 or later </a> </li> <li> <a href="https://github.com/redis/redis-om-node/releases/tag/v0.2.0"> redis-om-node 0.2.0 or later </a> </li> </ul> </li> <li> .NET <ul> <li> <a href="https://github.com/redis/redis-om-dotnet/releases/tag/v0.7.1"> redis-om-dotnet 0.7.1 or later </a> </li> <li> <a href="https://github.com/redis/NRedisStack/releases/tag/v0.12.0"> NRedisStack 0.12.0 or later </a> </li> </ul> </li> <li> Go <ul> <li> <a href="https://github.com/redis/go-redis/releases/tag/v9.5.2"> go-redis 9.5.2 or later </a> </li> <li> <a href="https://github.com/redis/rueidis/releases/tag/v1.0.38"> rueidis 1.0.38 or later </a> </li> </ul> </li> </ul> <p> Compatible with <a href="https://redis.io/download"> Redis Insight </a> . The docker image redis/redis-stack for this version is bundled with <a href="https://github.com/RedisInsight/RedisInsight/releases/tag/2.50.0"> Redis Insight 2.50 </a> . </p> <p> Note: version numbers follow the pattern: </p> <p> <code> x.y.z-b </code> </p> <ul> <li> <code> x.y </code> Redis major version </li> <li> <code> z </code> increases with even numbers as a module x.y version increases. </li> <li> <code> b </code> denotes a patch to Redis or a module (any <code> z </code> of Redis or modules). <code> b </code> will consist of a <code> v </code> + numeric value. </li> </ul> <h2 id="downloads"> Downloads </h2> <ul> <li> macOS: <a href="https://packages.redis.io/redis-stack/redis-stack-server-6.2.6-v15.catalina.x86_64.zip"> x86_64 </a> , <a href="https://packages.redis.io/redis-stack/redis-stack-server-6.2.6-v15.monterey.arm64.zip"> arm64 </a> </li> <li> AppImage: <a href="https://packages.redis.io/redis-stack/redis-stack-server-6.2.6-v15-x86_64.AppImage"> x86_64 </a> </li> <li> Ubuntu: <a href="https://packages.redis.io/redis-stack/redis-stack-server-6.2.6-v15.bionic.x86_64.tar.gz"> Bionic x86_64 </a> , <a href="https://packages.redis.io/redis-stack/redis-stack-server-6.2.6-v15.bionic.arm64.tar.gz"> Bionic arm64 </a> , <a href="https://packages.redis.io/redis-stack/redis-stack-server-6.2.6-v15.focal.x86_64.tar.gz"> Focal x86_64 </a> , <a href="https://packages.redis.io/redis-stack/redis-stack-server-6.2.6-v15.focal.arm64.tar.gz"> Focal arm64 </a> , <a href="https://packages.redis.io/redis-stack/redis-stack-server-6.2.6-v15.x86_64.snap"> Snap x86_64 </a> , <a href="https://packages.redis.io/redis-stack/redis-stack-server-6.2.6-v15.arm64.snap"> Snap arm64 </a> , <a href="https://packages.redis.io/redis-stack/redis-stack-server-6.2.6-v15.jammy.x86_64.tar.gz"> Jammy x86_64 </a> , <a href="https://packages.redis.io/redis-stack/redis-stack-server-6.2.6-v15.jammy.arm64.tar.gz"> Jammy arm64 </a> </li> <li> Debian: <a href="https://packages.redis.io/redis-stack/redis-stack-server-6.2.6-v15.bullseye.x86_64.tar.gz"> Bullseye x86_64 </a> </li> <li> RHEL 7/CentOS Linux 7: <a href="https://packages.redis.io/redis-stack/redis-stack-server-6.2.6-v15.rhel7.x86_64.tar.gz"> x86_64 </a> </li> <li> RHEL 8/CentOS Linux 8: <a href="https://packages.redis.io/redis-stack/redis-stack-server-6.2.6-v15.rhel8.x86_64.tar.gz"> x86_64 </a> </li> <li> Redis Stack on <a href="https://hub.docker.com/u/redis"> Dockerhub </a> : <a href="https://hub.docker.com/r/redis/redis-stack"> x86_64 and arm64 </a> </li> <li> Redis Stack server on <a href="https://hub.docker.com/u/redis"> Dockerhub </a> : <a href="https://hub.docker.com/r/redis/redis-stack-server"> x86_64 and arm64 </a> </li> </ul> <h2 id="redis-stack-server-626-v14-april-2024"> Redis Stack Server 6.2.6-v14 (April 2024) </h2> <p> This is a maintenance release for Redis Stack Server 6.2.6 </p> <p> Update urgency: <code> HIGH </code> : There is a critical bug that may affect a subset of users. Upgrade! </p> <h3 id="headlines-3"> Headlines: </h3> <p> This version contains the latest <strong> search and query </strong> capability with several improvements and bug fixes, including a critical bug fix. This release also includes the latest <strong> JSON </strong> data structure with a fix for a potential crash, and the <strong> time series </strong> data structure with more detailed LibMR error messages and a fix for a potential crash. It also contains the latest version of <strong> RedisInsight </strong> . </p> <h3 id="details-3"> Details: </h3> <p> <strong> Improvements </strong> </p> <ul> <li> <p> <strong> Search and query </strong> : </p> <ul> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4502"> #4502 </a> Handle error properly when trying to execute Search commands on cluster setup as part of <code> MULTI </code> / <code> EXEC </code> or LUA script (MOD-6541) </li> </ul> </li> <li> <p> <strong> Time series </strong> : </p> <ul> <li> <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/pull/1593"> #1593 </a> More detailed LibMR error messages </li> </ul> </li> </ul> <p> <strong> Bug Fixes </strong> </p> <ul> <li> <p> <strong> Search and query </strong> : </p> <ul> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4524"> #4524 </a> <code> FT.CURSOR READ </code> in a numeric query causing a crash (MOD-6597) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4543"> #4543 </a> <code> FT.SEARCH </code> accessing an inexistent memory address causes a crash if using deprecated <code> FT.ADD </code> command (MOD-6599) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4535"> #4535 </a> <code> FT.PROFILE </code> with incorrect arguments could cause a crash on cluster setup (MOD-6791) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4540"> #4540 </a> Unfree memory from an existing RDB while re-indexing loading a new RDB could cause a crash (MOD-6831, 6810) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4485"> #4485 </a> Some parameter settings using just prefixes instead of full values were working (MOD-6709) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4557"> #4557 </a> Additional " <code> } </code> " on wildcards replies for <code> FT.EXPLAIN </code> (MOD-6768) </li> </ul> </li> <li> <p> <strong> JSON </strong> : </p> <ul> <li> <a href="https://github.com/RedisJSON/RedisJSON/pull/1192"> #1192 </a> Crashes with numeric values greater than i64::MAX (MOD-6501, MOD-4551, MOD-4856, MOD-5714) </li> </ul> </li> <li> <p> <strong> Time series </strong> : </p> <ul> <li> <a href="https://github.com/RedisGears/LibMR/pull/51"> LibMR#51 </a> Crash on SSL initialization failure (MOD-5647) </li> </ul> </li> </ul> <p> <strong> Redis version </strong> </p> <ul> <li> <a href="https://github.com/redis/redis/releases/tag/6.2.14"> Redis 6.2.14 </a> </li> </ul> <p> <strong> Module versions </strong> </p> <ul> <li> <strong> <a href="https://github.com/RediSearch/RediSearch/releases/tag/v2.6.18"> RediSearch 2.6.18 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisJSON/RedisJSON/releases/tag/v2.4.9"> RedisJSON 2.4.9 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisGraph/RedisGraph/releases/tag/v2.10.15"> RedisGraph 2.10.12 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/releases/tag/v1.8.13"> RedisTimeSeries 1.8.13 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisBloom/RedisBloom/releases/tag/v2.4.9"> RedisBloom 2.4.9 </a> </strong> </li> </ul> <p> <strong> Recommended Client Libraries </strong> </p> <ul> <li> Java <ul> <li> <a href="https://github.com/redis/jedis/releases/tag/v5.1.2"> Jedis 5.1.2 or later </a> </li> <li> <a href="https://github.com/redis/redis-om-spring/releases/tag/v0.8.9"> redis-om-spring 0.8.9 or later </a> </li> </ul> </li> <li> Python <ul> <li> <a href="https://github.com/redis/redis-py/releases/tag/v5.0.3"> redis-py 5.0.3 or later </a> </li> <li> <a href="https://github.com/redis/redis-om-python/releases/tag/v0.2.2"> redis-om-python 0.2.2 or later </a> </li> </ul> </li> <li> NodeJS <ul> <li> <a href="https://github.com/redis/node-redis/releases/tag/redis%404.6.13"> node-redis 4.6.13 or later </a> </li> <li> <a href="https://github.com/redis/redis-om-node/releases/tag/v0.2.0"> redis-om-node 0.2.0 or later </a> </li> </ul> </li> <li> .NET <ul> <li> <a href="https://github.com/redis/redis-om-dotnet/releases/tag/v0.6.1"> redis-om-dotnet 0.6.1 or later </a> </li> <li> <a href="https://github.com/redis/NRedisStack/releases/tag/v0.12.0"> NRedisStack 0.12.0 or later </a> </li> </ul> </li> <li> Go <ul> <li> <a href="https://github.com/redis/go-redis/releases/tag/v9.5.1"> go-redis 9.5.1 or later </a> </li> <li> <a href="https://github.com/redis/rueidis/releases/tag/v1.0.33"> rueidis 1.0.33 or later </a> </li> </ul> </li> </ul> <p> Compatible with <a href="https://redis.io/download"> RedisInsight </a> . The docker image redis/redis-stack for this version is bundled with <a href="https://github.com/RedisInsight/RedisInsight/releases/tag/2.46.0"> RedisInsight 2.46 </a> . </p> <p> Note: version numbers follow the pattern: </p> <p> <code> x.y.z-b </code> </p> <ul> <li> <code> x.y </code> Redis major version </li> <li> <code> z </code> increases with even numbers as a module x.y version increases. </li> <li> <code> b </code> denotes a patch to Redis or a module (any <code> z </code> of Redis or modules). <code> b </code> will consist of a <code> v </code> + numeric value. </li> </ul> <h2 id="downloads-1"> Downloads </h2> <ul> <li> macOS: <a href="https://packages.redis.io/redis-stack/redis-stack-server-6.2.6-v14.catalina.x86_64.zip"> x86_64 </a> , <a href="https://packages.redis.io/redis-stack/redis-stack-server-6.2.6-v14.monterey.arm64.zip"> arm64 </a> </li> <li> AppImage: <a href="https://packages.redis.io/redis-stack/redis-stack-server-6.2.6-v14-x86_64.AppImage"> x86_64 </a> </li> <li> Ubuntu: <a href="https://packages.redis.io/redis-stack/redis-stack-server-6.2.6-v14.bionic.x86_64.tar.gz"> Bionic x86_64 </a> , <a href="https://packages.redis.io/redis-stack/redis-stack-server-6.2.6-v14.bionic.arm64.tar.gz"> Bionic arm64 </a> , <a href="https://packages.redis.io/redis-stack/redis-stack-server-6.2.6-v14.focal.x86_64.tar.gz"> Focal x86_64 </a> , <a href="https://packages.redis.io/redis-stack/redis-stack-server-6.2.6-v14.focal.arm64.tar.gz"> Focal arm64 </a> , <a href="https://packages.redis.io/redis-stack/redis-stack-server-6.2.6-v14.x86_64.snap"> Snap x86_64 </a> , <a href="https://packages.redis.io/redis-stack/redis-stack-server-6.2.6-v14.arm64.snap"> Snap arm64 </a> , <a href="https://packages.redis.io/redis-stack/redis-stack-server-6.2.6-v14.jammy.x86_64.tar.gz"> Jammy x86_64 </a> , <a href="https://packages.redis.io/redis-stack/redis-stack-server-6.2.6-v14.jammy.arm64.tar.gz"> Jammy arm64 </a> </li> <li> Debian: <a href="https://packages.redis.io/redis-stack/redis-stack-server-6.2.6-v14.bullseye.x86_64.tar.gz"> Bullseye x86_64 </a> </li> <li> RHEL 7/CentOS Linux 7: <a href="https://packages.redis.io/redis-stack/redis-stack-server-6.2.6-v14.rhel7.x86_64.tar.gz"> x86_64 </a> </li> <li> RHEL 8/CentOS Linux 8: <a href="https://packages.redis.io/redis-stack/redis-stack-server-6.2.6-v14.rhel8.x86_64.tar.gz"> x86_64 </a> </li> <li> Redis Stack on <a href="https://hub.docker.com/u/redis"> Dockerhub </a> : <a href="https://hub.docker.com/r/redis/redis-stack"> x86_64 and arm64 </a> </li> <li> Redis Stack server on <a href="https://hub.docker.com/u/redis"> Dockerhub </a> : <a href="https://hub.docker.com/r/redis/redis-stack-server"> x86_64 and arm64 </a> </li> </ul> <h2 id="redis-stack-server-626-v13-march-2024"> Redis Stack Server 6.2.6-v13 (March 2024) </h2> <p> This is a maintenance release for Redis Stack Server 6.2.6 </p> <p> Update urgency: <code> MODERATE </code> : Program an upgrade of the server, but it's not urgent. </p> <h3 id="headlines-4"> Headlines: </h3> <p> This version contains the latest <strong> search and query </strong> capability and <strong> probabilistic </strong> data structures with several bug fixes. It also contains the latest version of <strong> RedisInsight </strong> . </p> <h3 id="details-4"> Details: </h3> <p> <strong> Bug Fixes </strong> </p> <ul> <li> <p> <strong> Search and query </strong> : </p> <ul> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4477"> #4477 </a> Split <code> INFIX </code> and <code> SUFFIX </code> report on <code> FT.EXPLAIN </code> and <code> FT.EXPLAINCLI </code> (MOD-6186) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4468"> #4468 </a> Memory leak upon suffix query for a <code> TAG </code> indexed with <code> WITHSUFFIXTRIE </code> (MOD-6644) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4407"> #4407 </a> Clustered <code> FT.SEARCH </code> hangs forever without replying when an invalid topology is found (MOD-6557) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4359"> #4359 </a> Searching for a synonym will iterate in the same group multiple times, causing a performance hit (MOD-6490) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4310"> #4310 </a> Memory tracking on cluster setups causing high memory usage and potentially Out-of-Memory (MOD-6123, MOD-5639) </li> </ul> </li> <li> <p> <strong> Probabilistic data structures </strong> : </p> <ul> <li> <a href="https://github.com/RedisBloom/RedisBloom/issues/753"> #753 </a> Potential crash on <code> CMS.MERGE </code> when using invalid arguments </li> </ul> </li> </ul> <p> <strong> Redis version </strong> </p> <ul> <li> <a href="https://github.com/redis/redis/releases/tag/6.2.14"> Redis 6.2.14 </a> </li> </ul> <p> <strong> Module versions </strong> </p> <ul> <li> <strong> <a href="https://github.com/RediSearch/RediSearch/releases/tag/v2.6.16"> RediSearch 2.6.16 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisJSON/RedisJSON/releases/tag/v2.4.8"> RedisJSON 2.4.8 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisGraph/RedisGraph/releases/tag/v2.10.15"> RedisGraph 2.10.12 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/releases/tag/v1.8.12"> RedisTimeSeries 1.8.12 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisBloom/RedisBloom/releases/tag/v2.4.9"> RedisBloom 2.4.9 </a> </strong> </li> </ul> <p> <strong> Recommended Client Libraries </strong> </p> <ul> <li> Java <ul> <li> <a href="https://github.com/redis/jedis/releases/tag/v5.1.1"> Jedis 5.1.1 or greater </a> </li> <li> <a href="https://github.com/redis/redis-om-spring/releases/tag/v0.8.8"> redis-om-spring 0.8.8 or greater </a> </li> </ul> </li> <li> Python <ul> <li> <a href="https://github.com/redis/redis-py/releases/tag/v5.0.2"> redis-py 5.0.2 or greater </a> </li> <li> <a href="https://github.com/redis/redis-om-python/releases/tag/v0.2.1"> redis-om-python 0.2.1 or greater </a> </li> </ul> </li> <li> NodeJS <ul> <li> <a href="https://github.com/redis/node-redis/releases/tag/redis%404.6.13"> node-redis 4.6.13 or greater </a> </li> <li> <a href="https://github.com/redis/redis-om-node/releases/tag/v0.2.0"> redis-om-node 0.2.0 or greater </a> </li> </ul> </li> <li> .NET <ul> <li> <a href="https://github.com/redis/redis-om-dotnet/releases/tag/v0.6.1"> redis-om-dotnet 0.6.1 or greater </a> </li> <li> <a href="https://github.com/redis/NRedisStack/releases/tag/v0.11.0"> NRedisStack 0.11.0 or greater </a> </li> </ul> </li> <li> Go <ul> <li> <a href="https://github.com/redis/go-redis/releases/tag/v9.5.1"> go-redis 9.5.1 or greater </a> </li> <li> <a href="https://github.com/redis/rueidis/releases/tag/v1.0.31"> rueidis 1.0.31 or greater </a> </li> </ul> </li> </ul> <p> Compatible with <a href="https://redis.io/download"> RedisInsight </a> . The docker image redis/redis-stack for this version is bundled with <a href="https://github.com/RedisInsight/RedisInsight/releases/tag/2.44.0"> RedisInsight 2.44 </a> . </p> <p> Note: version numbers follow the pattern: </p> <p> <code> x.y.z-b </code> </p> <ul> <li> <code> x.y </code> Redis major version </li> <li> <code> z </code> increases with even numbers as a module x.y version increases. </li> <li> <code> b </code> denotes a patch to Redis or a module (any <code> z </code> of Redis or modules). <code> b </code> will consist of a <code> v </code> + numeric value. </li> </ul> <h2 id="downloads-2"> Downloads </h2> <ul> <li> macOS: <a href="https://packages.redis.io/redis-stack/redis-stack-server-6.2.6-v13.catalina.x86_64.zip"> x86_64 </a> , <a href="https://packages.redis.io/redis-stack/redis-stack-server-6.2.6-v13.monterey.arm64.zip"> arm64 </a> </li> <li> AppImage: <a href="https://packages.redis.io/redis-stack/redis-stack-server-6.2.6-v13-x86_64.AppImage"> x86_64 </a> </li> <li> Ubuntu: <a href="https://packages.redis.io/redis-stack/redis-stack-server-6.2.6-v13.bionic.x86_64.tar.gz"> Bionic x86_64 </a> , <a href="https://packages.redis.io/redis-stack/redis-stack-server-6.2.6-v13.bionic.arm64.tar.gz"> Bionic arm64 </a> , <a href="https://packages.redis.io/redis-stack/redis-stack-server-6.2.6-v13.focal.x86_64.tar.gz"> Focal x86_64 </a> , <a href="https://packages.redis.io/redis-stack/redis-stack-server-6.2.6-v13.focal.arm64.tar.gz"> Focal arm64 </a> , <a href="https://packages.redis.io/redis-stack/redis-stack-server-6.2.6-v13.x86_64.snap"> Snap x86_64 </a> , <a href="https://packages.redis.io/redis-stack/redis-stack-server-6.2.6-v13.arm64.snap"> Snap arm64 </a> , <a href="https://packages.redis.io/redis-stack/redis-stack-server-6.2.6-v13.jammy.x86_64.tar.gz"> Jammy x86_64 </a> , <a href="https://packages.redis.io/redis-stack/redis-stack-server-6.2.6-v13.jammy.arm64.tar.gz"> Jammy arm64 </a> </li> <li> Debian: <a href="https://packages.redis.io/redis-stack/redis-stack-server-6.2.6-v13.bullseye.x86_64.tar.gz"> Bullseye x86_64 </a> </li> <li> RHEL 7/CentOS Linux 7: <a href="https://packages.redis.io/redis-stack/redis-stack-server-6.2.6-v13.rhel7.x86_64.tar.gz"> x86_64 </a> </li> <li> RHEL 8/CentOS Linux 8: <a href="https://packages.redis.io/redis-stack/redis-stack-server-6.2.6-v13.rhel8.x86_64.tar.gz"> x86_64 </a> </li> <li> Redis Stack on <a href="https://hub.docker.com/u/redis"> Dockerhub </a> : <a href="https://hub.docker.com/r/redis/redis-stack"> x86_64 and arm64 </a> </li> <li> Redis Stack server on <a href="https://hub.docker.com/u/redis"> Dockerhub </a> : <a href="https://hub.docker.com/r/redis/redis-stack-server"> x86_64 and arm64 </a> </li> </ul> <h2 id="redis-stack-server-626-v12-january-2024"> Redis Stack Server 6.2.6-v12 (January 2024) </h2> <p> This is a maintenance release for Redis Stack Server 6.2.6 </p> <p> Update urgency: <code> HIGH </code> : There is a critical bug fixed in the probabilistic data structures that may affect a subset of users. Upgrade! </p> <h3 id="headlines-5"> Headlines: </h3> <p> This maintenance release contains the new version of <strong> probabilistic </strong> data structures with a critical bug fix, the new version of <strong> JSON </strong> data structure with added support for CBL-Mariner 2, and a fix to add keyspace notifications for <code> JSON.TOGGLE </code> . It also contains the latest version of <strong> RedisInsight </strong> . </p> <h3 id="details-5"> Details: </h3> <p> <strong> Improvements </strong> </p> <ul> <li> <strong> JSON </strong> : <ul> <li> <a href="https://github.com/RedisJSON/RedisJSON/pull/1149"> #1149 </a> Added support for CBL-Mariner 2 </li> </ul> </li> </ul> <p> <strong> Bug Fixes </strong> </p> <ul> <li> <p> <strong> JSON </strong> : </p> <ul> <li> <a href="https://github.com/RedisJSON/RedisJSON/pull/1025"> #1025 </a> <code> JSON.TOGGLE </code> - missing keyspace notification </li> </ul> </li> <li> <p> <strong> Probabilistic data structures </strong> : </p> <ul> <li> <a href="https://github.com/RedisBloom/RedisBloom/pull/727"> #727 </a> Potential crash on <code> CF.LOADCHUNK </code> (MOD-6344) - Additional fixes </li> </ul> </li> </ul> <p> <strong> Redis version </strong> </p> <ul> <li> <a href="https://github.com/redis/redis/releases/tag/6.2.14"> Redis 6.2.14 </a> </li> </ul> <p> <strong> Module versions </strong> </p> <ul> <li> <strong> <a href="https://github.com/RediSearch/RediSearch/releases/tag/v2.6.15"> RediSearch 2.6.15 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisJSON/RedisJSON/releases/tag/v2.4.8"> RedisJSON 2.4.8 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisGraph/RedisGraph/releases/tag/v2.10.12"> RedisGraph 2.10.12 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/releases/tag/v1.8.12"> RedisTimeSeries 1.8.12 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisBloom/RedisBloom/releases/tag/v2.4.8"> RedisBloom 2.4.8 </a> </strong> </li> </ul> <p> <strong> Recommended Client Libraries </strong> </p> <ul> <li> Java <ul> <li> <a href="https://github.com/redis/jedis/releases/tag/v5.1.0"> Jedis 5.1.0 or greater </a> </li> <li> <a href="https://github.com/redis/redis-om-spring/releases/tag/v0.8.8"> redis-om-spring 0.8.8 or greater </a> </li> </ul> </li> <li> Python <ul> <li> <a href="https://github.com/redis/redis-py/releases/tag/v5.0.1"> redis-py 5.0.1 or greater </a> </li> <li> <a href="https://github.com/redis/redis-om-python/releases/tag/v0.2.1"> redis-om-python 0.2.1 or greater </a> </li> </ul> </li> <li> NodeJS <ul> <li> <a href="https://github.com/redis/node-redis/releases/tag/redis%404.6.12"> node-redis 4.6.12 or greater </a> </li> <li> <a href="https://github.com/redis/redis-om-node/releases/tag/v0.2.0"> redis-om-node 0.2.0 or greater </a> </li> </ul> </li> <li> .NET <ul> <li> <a href="https://github.com/redis/redis-om-dotnet/releases/tag/v0.6.1"> redis-om-dotnet 0.6.1 or greater </a> </li> <li> <a href="https://github.com/redis/NRedisStack/releases/tag/v0.11.0"> NRedisStack 0.11.0 or greater </a> </li> </ul> </li> <li> Go <ul> <li> <a href="https://github.com/redis/go-redis/releases/tag/v9.4.0"> go-redis 9.4.0 or greater </a> </li> <li> <a href="https://github.com/redis/rueidis/releases/tag/v1.0.27"> rueidis 1.0.27 or greater </a> </li> </ul> </li> </ul> <p> Compatible with <a href="https://redis.io/download"> RedisInsight </a> . The docker image redis/redis-stack for this version is bundled with <a href="https://github.com/RedisInsight/RedisInsight/releases/tag/2.40.0"> RedisInsight 2.40 </a> . </p> <p> Note: version numbers follow the pattern: </p> <p> <code> x.y.z-b </code> </p> <ul> <li> <code> x.y </code> Redis major version </li> <li> <code> z </code> increases with even numbers as a module x.y version increases. </li> <li> <code> b </code> denotes a patch to Redis or a module (any <code> z </code> of Redis or modules). <code> b </code> will consist of a <code> v </code> + numeric value. </li> </ul> <h2 id="redis-stack-server-626-v11-january-2024"> Redis Stack Server 6.2.6-v11 (January 2024) </h2> <p> This is a maintenance release for Redis Stack Server 6.2.6 </p> <p> Update urgency: <code> SECURITY </code> : there are security fixes in the release. </p> <h3 id="headlines-6"> Headlines: </h3> <p> This version contains the latest <strong> time series data </strong> structure with a security fix to not expose internal commands, a fix for potential crashes when using an invalid argument value, and support for CBL-Mariner 2. The new Redis Stack version introduces security fixes for <strong> probabilistic data structures </strong> to avoid potential crashes. It also includes the latest <strong> search and query </strong> capability with several bug fixes and improvements. This version contains the latest version of <strong> RedisInsight </strong> . </p> <h3 id="details-6"> Details: </h3> <p> <strong> Security and privacy </strong> </p> <ul> <li> <p> <strong> Time series </strong> : </p> <ul> <li> <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/pull/1506"> #1506 </a> ​​ Don’t expose internal commands (MOD-5643) </li> </ul> </li> <li> <p> <strong> Probabilistic data structures </strong> : </p> <ul> <li> <a href="https://github.com/RedisBloom/RedisBloom/issues/721"> #721 </a> Potential crash on <code> CF.RESERVE </code> (MOD-6343) </li> <li> <a href="https://github.com/RedisBloom/RedisBloom/issues/722"> #722 </a> Potential crash on <code> CF.LOADCHUNK </code> (MOD-6344) </li> </ul> </li> </ul> <p> <strong> Improvements </strong> </p> <ul> <li> <p> <strong> Search and query </strong> : </p> <ul> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4176"> #4176 </a> Initialization of the maximum numeric value range leading to a better balance of the index leaf splitting (MOD-6232) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4123"> #4123 </a> Possibly problematic index name alias check-in command multiplexing (MOD-5945) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4195"> #4195 </a> Query optimisation when predicate contains multiple <code> INTERSECTION </code> (AND) of <code> UNION </code> (OR) (MOD-5910) </li> </ul> </li> <li> <p> <strong> Time series </strong> : </p> <ul> <li> <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/pull/1516"> #1516 </a> Added support for CBL-Mariner 2 </li> </ul> </li> </ul> <p> <strong> Bug Fixes </strong> </p> <ul> <li> <p> <strong> Search and query </strong> : </p> <ul> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4244"> #4244 </a> , <a href="https://github.com/RediSearch/RediSearch/pull/4255"> #4255 </a> Profiling <code> FT.AGGREGATE </code> using the <code> WITHCURSOR </code> flag cause a crash due to timeout (MOD-5512) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4238"> #4238 </a> Memory excessively growing on databases caused by unbalanced nodes on inverted index trie (MOD-5880, MOD-5952, MOD-6003) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/3995"> #3995 </a> <code> FT.CURSOR READ </code> with geo queries causing a crash when data is updated between the cursor reads (MOD-5646) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4155"> #4155 </a> <code> FT.SEARCH </code> not responding when using TLS encryption on Amazon Linux 2 (MOD-6012) </li> </ul> </li> <li> <p> <strong> Time series </strong> : </p> <ul> <li> <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/issues/1494"> #1494 </a> Potential crash when using an invalid argument value </li> </ul> </li> </ul> <p> <strong> Redis version </strong> </p> <ul> <li> <a href="https://github.com/redis/redis/releases/tag/6.2.14"> Redis 6.2.14 </a> </li> </ul> <p> <strong> Module versions </strong> </p> <ul> <li> <strong> <a href="https://github.com/RediSearch/RediSearch/releases/tag/v2.6.15"> RediSearch 2.6.15 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisJSON/RedisJSON/releases/tag/v2.4.7"> RedisJSON 2.4.7 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisGraph/RedisGraph/releases/tag/v2.10.12"> RedisGraph 2.10.12 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/releases/tag/v1.8.12"> RedisTimeSeries 1.8.12 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisBloom/RedisBloom/releases/tag/v2.4.7"> RedisBloom 2.4.7 </a> </strong> </li> </ul> <p> <strong> Recommended Client Libraries </strong> </p> <ul> <li> Java <ul> <li> <a href="https://github.com/redis/jedis/releases/tag/v5.1.0"> Jedis 5.1.0 or greater </a> </li> <li> <a href="https://github.com/redis/redis-om-spring/releases/tag/v0.8.7"> redis-om-spring 0.8.7 or greater </a> </li> </ul> </li> <li> Python <ul> <li> <a href="https://github.com/redis/redis-py/releases/tag/v5.0.1"> redis-py 5.0.1 or greater </a> </li> <li> <a href="https://github.com/redis/redis-om-python/releases/tag/v0.2.1"> redis-om-python 0.2.1 or greater </a> </li> </ul> </li> <li> NodeJS <ul> <li> <a href="https://github.com/redis/node-redis/releases/tag/redis%404.6.12"> node-redis 4.6.12 or greater </a> </li> <li> <a href="https://github.com/redis/redis-om-node/releases/tag/v0.2.0"> redis-om-node 0.2.0 or greater </a> </li> </ul> </li> <li> .NET <ul> <li> <a href="https://github.com/redis/redis-om-dotnet/releases/tag/v0.6.1"> redis-om-dotnet 0.6.1 or greater </a> </li> <li> <a href="https://github.com/redis/NRedisStack/releases/tag/v0.11.0"> NRedisStack 0.11.0 or greater </a> </li> </ul> </li> <li> Go <ul> <li> <a href="https://github.com/redis/go-redis/releases/tag/v9.4.0"> go-redis 9.4.0 or greater </a> </li> <li> <a href="https://github.com/redis/rueidis/releases/tag/v1.0.26"> rueidis 1.0.26 or greater </a> </li> </ul> </li> </ul> <p> Compatible with <a href="https://redis.io/download"> RedisInsight </a> . The docker image redis/redis-stack for this version is bundled with <a href="https://github.com/RedisInsight/RedisInsight/releases/tag/2.40.0"> RedisInsight 2.40 </a> . </p> <p> Note: version numbers follow the pattern: </p> <p> <code> x.y.z-b </code> </p> <ul> <li> <code> x.y </code> Redis major version </li> <li> <code> z </code> increases with even numbers as a module x.y version increases. </li> <li> <code> b </code> denotes a patch to Redis or a module (any <code> z </code> of Redis or modules). <code> b </code> will consist of a <code> v </code> + numeric value. </li> </ul> <h2 id="redis-stack-server-626-v10-november-2023"> Redis Stack Server 6.2.6-v10 (November 2023) </h2> <p> This is a maintenance release for Redis Stack Server 6.2.6 </p> <p> Update urgency: <code> SECURITY </code> : there are security fixes in the release. </p> <h3 id="headlines-7"> Headlines: </h3> <p> This version contains a security fix for the Redis server to avoid bypassing desired Unix socket permissions on startup. It also includes the latest Search and Query capability with a fix to limit the maximum phonetic length and several bug fixes. This version contains the latest version of RedisInsight. </p> <h3 id="details-7"> Details: </h3> <p> <strong> Security and privacy: </strong> </p> <ul> <li> <p> <strong> Redis </strong> : </p> <ul> <li> (CVE-2023-45145) The wrong order of <code> listen(2) </code> and <code> chmod(2) </code> calls creates a race condition that can be used by another process to bypass desired Unix socket permissions on startup. </li> </ul> </li> <li> <p> <strong> Search and Query </strong> : </p> <ul> <li> <a href="https://github.com/RediSearch/RediSearch/pull/3844"> #3844 </a> Limits maximum phonetic length avoiding to be exploited (MOD 5767) </li> </ul> </li> </ul> <p> <strong> Bug Fixes </strong> </p> <ul> <li> <strong> Search and Query </strong> : <ul> <li> <a href="https://github.com/RediSearch/RediSearch/pull/3771"> #3771 </a> Broken lower and upper <code> APPLY </code> functions in <code> FT.AGGREGATE </code> on <code> DIALECT 3 </code> (MOD-5041) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/3910"> #3910 </a> Heavy document updates causing memory growth once memory blocks weren't properly released (MOD-5181) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/3853"> #3853 </a> Queries with <code> WITHCURSOR </code> making memory growth since <code> CURSOR </code> wasn't invalidated in the shards (MOD-5580) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/3752"> #3752 </a> Setting low <code> MAXIDLE </code> parameter value in <code> FT.AGGREGATE </code> causes a crash (MOD-5608) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/3823"> #3823 </a> <code> APPLY </code> or <code> FILTER </code> expression causing a leak (MOD-5751) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/3837"> #3837 </a> Connection using TLS fails on Redis (MOD-5768) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/3856"> #3856 </a> Adding new nodes to OSS cluster causing a crash (MOD-5778) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/3854"> #3854 </a> Vector range query could cause Out-of-Memory due a memory corruption (MOD-5791) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/3892"> #3892 </a> After cleaning the index the GC could cause corruption on unique values (MOD-5815) </li> </ul> </li> </ul> <p> <strong> Redis version </strong> </p> <ul> <li> <a href="https://github.com/redis/redis/releases/tag/6.2.14"> Redis 6.2.14 </a> </li> </ul> <p> <strong> Module versions </strong> </p> <ul> <li> <strong> <a href="https://github.com/RediSearch/RediSearch/releases/tag/v2.6.14"> RediSearch 2.6.14 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisJSON/RedisJSON/releases/tag/v2.4.7"> RedisJSON 2.4.7 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisGraph/RedisGraph/releases/tag/v2.10.12"> RedisGraph 2.10.12 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/releases/tag/v1.8.11"> RedisTimeSeries 1.8.11 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisBloom/RedisBloom/releases/tag/v2.4.5"> RedisBloom 2.4.5 </a> </strong> </li> </ul> <p> <strong> Recommended Client Libraries </strong> </p> <ul> <li> Java <ul> <li> <a href="https://github.com/redis/jedis/releases/tag/v5.0.2"> Jedis 5.0.2 or greater </a> </li> <li> <a href="https://github.com/redis/redis-om-spring/releases/tag/v0.8.7"> redis-om-spring 0.8.7 or greater </a> </li> </ul> </li> <li> Python <ul> <li> <a href="https://github.com/redis/redis-py/releases/tag/v5.0.1"> redis-py 5.0.1 or greater </a> </li> <li> <a href="https://github.com/redis/redis-om-python/releases/tag/v0.2.1"> redis-om-python 0.2.1 or greater </a> </li> </ul> </li> <li> NodeJS <ul> <li> <a href="https://github.com/redis/node-redis/releases/tag/redis%404.6.10"> node-redis 4.6.10 or greater </a> </li> <li> <a href="https://github.com/redis/redis-om-node/releases/tag/v0.2.0"> redis-om-node 0.2.0 or greater </a> </li> </ul> </li> <li> .NET <ul> <li> <a href="https://github.com/redis/redis-om-dotnet/releases/tag/v0.5.4"> redis-om-dotnet 0.5.4 or greater </a> </li> <li> <a href="https://github.com/redis/NRedisStack/releases/tag/v0.10.1"> NRedisStack 0.10.1 or greater </a> </li> </ul> </li> <li> Go <ul> <li> <a href="https://github.com/redis/go-redis/releases/tag/v9.3.0"> go-redis 9.3.0 or greater </a> </li> <li> <a href="https://github.com/redis/rueidis/releases/tag/v1.0.22"> rueidis 1.0.22 or greater </a> </li> </ul> </li> </ul> <p> Compatible with <a href="https://redis.io/download"> RedisInsight </a> . The docker image redis/redis-stack for this version is bundled with <a href="https://github.com/RedisInsight/RedisInsight/releases/tag/2.36.0"> RedisInsight 2.36 </a> . </p> <p> Note: version numbers follow the pattern: </p> <p> <code> x.y.z-b </code> </p> <ul> <li> <code> x.y </code> Redis major version </li> <li> <code> z </code> increases with even numbers as a module x.y version increases. </li> <li> <code> b </code> denotes a patch to Redis or a module (any <code> z </code> of Redis or modules). <code> b </code> will consist of a <code> v </code> + numeric value. </li> </ul> <h2 id="downloads-3"> Downloads </h2> <ul> <li> macOS: <a href="https://packages.redis.io/redis-stack/redis-stack-server-6.2.6-v10.catalina.x86_64.zip"> x86_64 </a> , <a href="https://packages.redis.io/redis-stack/redis-stack-server-6.2.6-v10.monterey.arm64.zip"> arm64 </a> </li> <li> AppImage: <a href="https://packages.redis.io/redis-stack/redis-stack-server-6.2.6-v10-x86_64.AppImage"> x86_64 </a> </li> <li> Ubuntu: <a href="https://packages.redis.io/redis-stack/redis-stack-server-6.2.6-v10.bionic.x86_64.tar.gz"> Bionic x86_64 </a> , <a href="https://packages.redis.io/redis-stack/redis-stack-server-6.2.6-v10.bionic.arm64.tar.gz"> Bionic arm64 </a> , <a href="https://packages.redis.io/redis-stack/redis-stack-server-6.2.6-v10.focal.x86_64.tar.gz"> Focal x86_64 </a> , <a href="https://packages.redis.io/redis-stack/redis-stack-server-6.2.6-v10.focal.arm64.tar.gz"> Focal arm64 </a> , <a href="https://packages.redis.io/redis-stack/redis-stack-server-6.2.6-v10.x86_64.snap"> Snap x86_64 </a> , <a href="https://packages.redis.io/redis-stack/redis-stack-server-6.2.6-v10.arm64.snap"> Snap arm64 </a> , <a href="https://packages.redis.io/redis-stack/redis-stack-server-6.2.6-v10.jammy.x86_64.tar.gz"> Jammy x86_64 </a> , <a href="https://packages.redis.io/redis-stack/redis-stack-server-6.2.6-v10.jammy.arm64.tar.gz"> Jammy arm64 </a> </li> <li> Debian: <a href="https://packages.redis.io/redis-stack/redis-stack-server-6.2.6-v10.bullseye.x86_64.tar.gz"> Bullseye x86_64 </a> </li> <li> RHEL 7/CentOS Linux 7: <a href="https://packages.redis.io/redis-stack/redis-stack-server-6.2.6-v10.rhel7.x86_64.tar.gz"> x86_64 </a> </li> <li> RHEL 8/CentOS Linux 8: <a href="https://packages.redis.io/redis-stack/redis-stack-server-6.2.6-v10.rhel8.x86_64.tar.gz"> x86_64 </a> </li> <li> Redis Stack on <a href="https://hub.docker.com/u/redis"> Dockerhub </a> : <a href="https://hub.docker.com/r/redis/redis-stack"> x86_64 and arm64 </a> </li> <li> Redis Stack server on <a href="https://hub.docker.com/u/redis"> Dockerhub </a> : <a href="https://hub.docker.com/r/redis/redis-stack-server"> x86_64 and arm64 </a> </li> </ul> <h2 id="redis-stack-server-626-v9-july-2023"> Redis Stack Server 6.2.6-v9 (July 2023) </h2> <p> This is a maintenance release for Redis Stack Server 6.2.6 </p> <p> Update urgency: <code> HIGH </code> : There is a critical bug that may affect a subset of users. Upgrade! </p> <h3 id="headlines-8"> Headlines: </h3> <p> This version contains the latest Search and Query capability v. 2.6.12, time series v. 1.8.11, and graph v. 2.10.12 with fixes and improvements. It also includes the latest version of RedisInsight. </p> <h3 id="details-8"> Details: </h3> <p> <strong> Improvements </strong> </p> <ul> <li> <p> <strong> Search and Query </strong> : </p> <ul> <li> <a href="https://github.com/RediSearch/RediSearch/pull/3628"> #3628 </a> Background indexing scanning performance </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/3259"> #3259 </a> Allow alias name beginning with <code> as </code> </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/3641"> #3641 </a> Indexing sanitizing trigger in heavily data updates scenario </li> </ul> </li> <li> <p> <strong> Time series </strong> : </p> <ul> <li> <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/issues/1476"> #1476 </a> Significant performance improvement when using multiple label filters ( <code> TS.MGET </code> , <code> TS.MRANGE </code> , <code> TS.MREVRANGE </code> , and <code> TS.QUERYINDEX </code> ) </li> </ul> </li> </ul> <p> <strong> Bug Fixes </strong> </p> <ul> <li> <p> <strong> Search and Query </strong> : </p> <ul> <li> <a href="https://github.com/RediSearch/RediSearch/pull/3557"> #3557 </a> <code> TIMEOUT </code> configuration on <code> FT.AGGREGATE </code> query being ignored </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/3552"> #3552 </a> <code> FT.CURSOR READ </code> on <code> JSON </code> numeric queries not returning results </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/3606"> #3606 </a> Update numeric inverted index <code> numEntries </code> avoiding excessive memory consumption </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/3597"> #3597 </a> Duplicating alias as output name on <code> FT.AGGREGATE </code> reducer ( <code> REDUCE </code> argument) isn't return results </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/3654"> #3654 </a> Added check for @ prefix on <code> GROUPBY </code> fields returnig an error instead of wrong results </li> </ul> </li> <li> <p> <strong> Time series </strong> : </p> <ul> <li> <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/issues/1486"> #1486 </a> When using <code> LATEST </code> , results may contain samples earlier than <code> fromTimestamp </code> ( <code> TS.RANGE </code> , <code> TS.REVRANGE </code> , <code> TS.MRANGE </code> , and <code> TS.MREVRANGE </code> ) </li> <li> <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/pull/1471"> #1471 </a> Potential crash on <code> TS.MRANGE </code> when aggregating millions of time series </li> <li> <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/pull/1469"> #1469 </a> Potential memory leak in <code> TS.MRANGE </code> after eviction </li> </ul> </li> <li> <p> <strong> Graph </strong> : </p> <ul> <li> <a href="https://github.com/RedisGraph/RedisGraph/pull/3129"> #3129 </a> Crash on certain queries ( <code> INDEX SCAN </code> followed by <code> DEL </code> followed by <code> SET </code> ) </li> </ul> </li> </ul> <p> <strong> Redis version </strong> </p> <ul> <li> <a href="https://github.com/redis/redis/blob/6.2.13/00-RELEASENOTES"> Redis 6.2.13 </a> </li> </ul> <p> <strong> Module versions </strong> </p> <ul> <li> <strong> <a href="https://github.com/RediSearch/RediSearch/releases/tag/v2.6.12"> RediSearch 2.6.12 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisJSON/RedisJSON/releases/tag/v2.4.7"> RedisJSON 2.4.7 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisGraph/RedisGraph/releases/tag/v2.10.12"> RedisGraph 2.10.12 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/releases/tag/v1.8.11"> RedisTimeSeries 1.8.11 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisBloom/RedisBloom/releases/tag/v2.4.5"> RedisBloom 2.4.5 </a> </strong> </li> </ul> <p> <strong> Recommended Client Libraries </strong> </p> <ul> <li> Java <ul> <li> <a href="https://github.com/redis/jedis/releases/tag/v4.4.3"> Jedis 4.4.3 or greater </a> </li> <li> <a href="https://github.com/redis/redis-om-spring/releases/tag/v0.8.4"> redis-om-spring 0.8.4 or greater </a> </li> </ul> </li> <li> Python <ul> <li> <a href="https://github.com/redis/redis-py/releases/tag/v4.6.0"> redis-py 4.6.0 or greater </a> </li> <li> <a href="https://github.com/redis/redis-om-python/releases/tag/v0.1.2"> redis-om-python 0.1.2 or greater </a> </li> </ul> </li> <li> NodeJS <ul> <li> <a href="https://github.com/redis/node-redis/releases/tag/redis%404.6.7"> node-redis 4.6.7 or greater </a> </li> <li> <a href="https://github.com/redis/redis-om-node/releases/tag/v0.2.0"> redis-om-node 0.2.0 or greater </a> </li> </ul> </li> <li> .NET <ul> <li> <a href="https://github.com/redis/redis-om-dotnet/releases/tag/v0.5.2"> redis-om-dotnet 0.5.2 or greater </a> </li> <li> <a href="https://github.com/redis/NRedisStack/releases/tag/v0.8.0"> NRedisStack 0.8.0 or greater </a> </li> </ul> </li> </ul> <p> Compatible with <a href="https://redis.io/download"> RedisInsight </a> . The docker image redis/redis-stack for this version is bundled with <a href="https://github.com/RedisInsight/RedisInsight/releases/tag/2.28.0"> RedisInsight 2.28 </a> . </p> <p> Note: version numbers follow the pattern: </p> <p> <code> x.y.z-b </code> </p> <ul> <li> <code> x.y </code> Redis major version </li> <li> <code> z </code> increases with even numbers as a module x.y version increases. </li> <li> <code> b </code> denotes a patch to Redis or a module (any <code> z </code> of Redis or modules). <code> b </code> will consist of a <code> v </code> + numeric value. </li> </ul> <h2 id="redis-stack-server-626-v8-july-2023"> Redis Stack Server 6.2.6-v8 (July 2023) </h2> <p> This is a maintenance release for Redis Stack Server 6.2.6 </p> <p> Update urgency: <code> SECURITY </code> : there are security fixes in the release. </p> <h3 id="headlines-9"> Headlines: </h3> <p> This version contains security improvements for the Redis server. </p> <h3 id="details-9"> Details: </h3> <p> <strong> Improvements </strong> </p> <ul> <li> <strong> Redis </strong> : <ul> <li> ( <a href="https://github.com/redis/redis/security/advisories/GHSA-p8x2-9v9q-c838"> CVE-2022-24834 </a> ) 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. </li> <li> ( <a href="https://github.com/redis/redis/security/advisories/GHSA-4cfx-h9gq-xpx3"> CVE-2023-36824 </a> ) 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 COMMAND GETKEYS* and validation of key names in ACL rules. </li> </ul> </li> </ul> <p> <strong> Bug Fixes </strong> </p> <ul> <li> <strong> Redis </strong> : <ul> <li> <a href="https://github.com/redis/redis/pull/12276"> #12276 </a> Re-enable downscale rehashing while there is a fork child </li> </ul> </li> </ul> <p> <strong> Redis version </strong> </p> <ul> <li> <a href="https://github.com/redis/redis/blob/6.2.13/00-RELEASENOTES"> Redis 6.2.13 </a> </li> </ul> <p> <strong> Module versions </strong> </p> <ul> <li> <strong> <a href="https://github.com/RediSearch/RediSearch/releases/tag/v2.6.9"> RediSearch 2.6.9 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisJSON/RedisJSON/releases/tag/v2.4.7"> RedisJSON 2.4.7 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisGraph/RedisGraph/releases/tag/v2.10.10"> RedisGraph 2.10.10 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/releases/tag/v1.8.10"> RedisTimeSeries 1.8.10 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisBloom/RedisBloom/releases/tag/v2.4.5"> RedisBloom 2.4.5 </a> </strong> </li> </ul> <p> <strong> Recommended Client Libraries </strong> </p> <ul> <li> Java <ul> <li> <a href="https://github.com/redis/jedis/releases/tag/v4.3.1"> Jedis 4.3.1 or greater </a> </li> <li> <a href="https://github.com/redis/redis-om-spring"> redis-om-spring </a> </li> </ul> </li> <li> Python <ul> <li> <a href="https://github.com/redis/redis-py/releases/tag/v4.5.4"> redis-py 4.5.4 or greater </a> </li> <li> <a href="https://github.com/redis/redis-om-python"> redis-om-python </a> </li> </ul> </li> <li> NodeJS <ul> <li> <a href="https://www.npmjs.com/package/redis"> node-redis 4.6.5 or greater </a> </li> <li> <a href="https://github.com/redis/redis-om-node"> redis-om-node </a> </li> </ul> </li> <li> .NET <ul> <li> <a href="https://github.com/redis/redis-om-dotnet"> redis-om-dotnet </a> </li> <li> <a href="https://github.com/redis/NRedisStack"> NRedisStack </a> </li> </ul> </li> </ul> <p> Compatible with <a href="https://redis.io/download"> RedisInsight </a> . The docker image redis/redis-stack for this version is bundled with <a href="https://github.com/RedisInsight/RedisInsight/releases/"> RedisInsight </a> . </p> <p> Note: version numbers follow the pattern: </p> <p> <code> x.y.z-b </code> </p> <ul> <li> <code> x.y </code> Redis major version </li> <li> <code> z </code> increases with even numbers as a module x.y version increases. </li> <li> <code> b </code> denotes a patch to Redis or a module (any <code> z </code> of Redis or modules). <code> b </code> will consist of a <code> v </code> + numeric value. </li> </ul> <h2 id="redis-stack-server-626-v7-april-2023"> Redis Stack Server 6.2.6-v7 (April 2023) </h2> <p> This is a maintenance release for Redis Stack Server 6.2.6 </p> <p> Update urgency: <code> SECURITY </code> : there are security fixes in the release. </p> <h3 id="headlines-10"> Headlines: </h3> <p> This version contains the latest RediSearch 2.6.9, RedisJSON 2.4.7, RedisGraph 2.10.10, RedisTimeSeries 1.8.10, and RedisBloom 2.4.5, RedisInsight 2.22 and new Redis server 6.2.12 with fixes to security issues. </p> <h3 id="details-10"> Details: </h3> <p> <strong> Improvements </strong> : </p> <ul> <li> Redis <a href="https://github.com/redis/redis/pull/12057"> #12057 </a> Authenticated users can use the <a href="https://redis.io/commands/hincrbyfloat/"> HINCRBYFLOAT </a> command to create an invalid hash field that will crash Redis on access </li> <li> RediSearch <a href="https://github.com/RediSearch/RediSearch/pull/3430"> #3430 </a> Improve <code> min-max heap </code> structure for better readability and performance </li> <li> RediSearch <a href="https://github.com/RediSearch/RediSearch/pull/3450"> #3450 </a> Display <code> NOHL </code> option in <code> FT.INFO </code> command </li> <li> RediSearch <a href="https://github.com/RediSearch/RediSearch/pull/3534"> #3534 </a> Vector Similarity 0.6.1: Improve multi-value index deletion logic <a href="https://github.com/RedisAI/VectorSimilarity/pull/346"> (#346) </a> </li> </ul> <p> <strong> Bug Fixes </strong> </p> <ul> <li> RediSearch <a href="https://github.com/RediSearch/RediSearch/pull/3468"> #3468 </a> KNN searching for 0 vectors with a filter resulted in crash </li> <li> RediSearch <a href="https://github.com/RediSearch/RediSearch/pull/3499"> #3499 </a> <code> MAXSEARCHRESULTS </code> set to <code> 0 </code> causing <code> FT.SEARCH </code> crash </li> <li> RediSearch <a href="https://github.com/RediSearch/RediSearch/pull/3494"> #3494 </a> Removing <code> MAXSEARCHRESULTS </code> limit causes crash on <code> FT.AGGREGATE </code> </li> <li> RediSearch <a href="https://github.com/RediSearch/RediSearch/pull/3504"> #3504 </a> Uninitialised vector similarity query parameter bug </li> <li> RedisJSON <a href="https://github.com/RedisJSON/RedisJSON/issues/947"> #947 </a> Using array slice operator ( <code> [start🔚step] </code> ) with step <code> 0 </code> causes crash </li> <li> RedisGraph <a href="https://github.com/RedisGraph/RedisGraph/issues/3038"> #3038 </a> Potential crash when a query with a <code> UNION </code> clause sets or modifies an indexed property </li> <li> RedisGraph <a href="https://github.com/RedisGraph/RedisGraph/issues/2631"> #2631 </a> , <a href="https://github.com/RedisGraph/RedisGraph/issues/2968"> #2968 </a> Potential crash on certain <code> MATCH </code> clauses where label filters are used </li> <li> RedisGraph <a href="https://github.com/RedisGraph/RedisGraph/issues/2957"> #2957 </a> Label filters in expressions such as <code> WITH n MATCH (n:X) </code> are ignored </li> <li> RedisGraph <a href="https://github.com/RedisGraph/RedisGraph/issues/2931"> #2931 </a> , <a href="https://github.com/RedisGraph/RedisGraph/issues/3027"> #3027 </a> Wrong overflow error message </li> <li> RedisTimeSeries <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/issues/1455"> #1455 </a> <a href="https://redis.io/commands/ts.add/"> TS.ADD </a> - optional arguments are not replicated </li> </ul> <p> <strong> Redis version </strong> </p> <ul> <li> <a href="https://github.com/redis/redis/blob/6.2.12/00-RELEASENOTES"> Redis 6.2.12 </a> </li> </ul> <p> <strong> Module versions </strong> </p> <ul> <li> <strong> <a href="https://github.com/RediSearch/RediSearch/releases/tag/v2.6.9"> RediSearch 2.6.9 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisJSON/RedisJSON/releases/tag/v2.4.7"> RedisJSON 2.4.7 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisGraph/RedisGraph/releases/tag/v2.10.10"> RedisGraph 2.10.10 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/releases/tag/v1.8.10"> RedisTimeSeries 1.8.10 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisBloom/RedisBloom/releases/tag/v2.4.5"> RedisBloom 2.4.5 </a> </strong> </li> </ul> <p> <strong> Recommended Client Libraries </strong> </p> <ul> <li> Java <ul> <li> <a href="https://github.com/redis/jedis/releases/tag/v4.3.1"> Jedis 4.3.1 or greater </a> </li> <li> <a href="https://github.com/redis/redis-om-spring"> redis-om-spring </a> </li> </ul> </li> <li> Python <ul> <li> <a href="https://github.com/redis/redis-py/releases/tag/v4.5.4"> redis-py 4.5.4 or greater </a> </li> <li> <a href="https://github.com/redis/redis-om-python"> redis-om-python </a> </li> </ul> </li> <li> NodeJS <ul> <li> <a href="https://www.npmjs.com/package/redis"> node-redis 4.6.5 or greater </a> </li> <li> <a href="https://github.com/redis/redis-om-node"> redis-om-node </a> </li> </ul> </li> <li> .NET <ul> <li> <a href="https://github.com/redis/redis-om-dotnet"> redis-om-dotnet </a> </li> <li> <a href="https://github.com/redis/NRedisStack"> NRedisStack </a> </li> </ul> </li> </ul> <p> Compatible with the latest <a href="https://redis.io/download"> RedisInsight </a> . The docker image redis/redis-stack for this version is bundled with <a href="https://github.com/RedisInsight/RedisInsight/releases/tag/2.22.1"> RedisInsight 2.22 </a> . </p> <p> Note: version numbers follow the pattern: </p> <p> <code> x.y.z-b </code> </p> <ul> <li> <code> x.y </code> Redis major version </li> <li> <code> z </code> increases with even numbers as a module x.y version increases. </li> <li> <code> b </code> denotes a patch to Redis or a module (any <code> z </code> of Redis or modules). <code> b </code> will consist of a <code> v </code> + numeric value. </li> </ul> <h2 id="redis-stack-server-626-v6-march-2023"> Redis Stack Server 6.2.6-v6 (March 2023) </h2> <p> This is a maintenance release for Redis Stack Server 6.2.6 </p> <p> Update urgency: <code> MODERATE </code> : Program an upgrade of the server, but it's not urgent. </p> <h3 id="headlines-11"> Headlines: </h3> <p> This version contains the latest RedisTimeSeries 1.8.9 with bugs fixed. </p> <h3 id="details-11"> Details: </h3> <p> <strong> Bug Fixes </strong> </p> <ul> <li> RedisTimeSeries <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/pull/1421"> #1421 </a> Potential crash after deleting from a time series with an <code> AVG </code> compaction </li> <li> RedisTimeSeries <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/pull/1422"> #1422 </a> Incorrectly return an error when deleting from a time series with a compaction and with no expiry </li> </ul> <p> <strong> Redis version </strong> </p> <ul> <li> <a href="https://github.com/redis/redis/blob/6.2.11/00-RELEASENOTES"> Redis 6.2.11 </a> </li> </ul> <p> <strong> Module versions </strong> </p> <ul> <li> <strong> <a href="https://github.com/RediSearch/RediSearch/releases/tag/v2.6.6"> RediSearch 2.6.6 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisJSON/RedisJSON/releases/tag/v2.4.6"> RedisJSON 2.4.6 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisGraph/RedisGraph/releases/tag/v2.10.9"> RedisGraph 2.10.9 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/releases/tag/v1.8.9"> RedisTimeSeries 1.8.9 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisBloom/RedisBloom/releases/tag/v2.4.5"> RedisBloom 2.4.5 </a> </strong> </li> </ul> <p> <strong> Recommended Client Libraries </strong> </p> <ul> <li> Java <ul> <li> <a href="https://github.com/redis/jedis/releases/tag/v4.3.1"> Jedis 4.3.1 or greater </a> </li> <li> <a href="https://github.com/redis/redis-om-spring"> redis-om-spring </a> </li> </ul> </li> <li> Python <ul> <li> <a href="https://github.com/redis/redis-py/releases/tag/v4.4.0"> redis-py 4.4.0 or greater </a> </li> <li> <a href="https://github.com/redis/redis-om-python"> redis-om-python </a> </li> </ul> </li> <li> NodeJS <ul> <li> <a href="https://www.npmjs.com/package/redis"> node-redis 4.5.0 or greater </a> </li> <li> <a href="https://github.com/redis/redis-om-node"> redis-om-node </a> </li> </ul> </li> <li> .NET <ul> <li> <a href="https://github.com/redis/redis-om-dotnet"> redis-om-dotnet </a> </li> <li> <a href="https://github.com/redis/NRedisStack"> NRedisStack </a> </li> </ul> </li> </ul> <p> Compatible with the latest <a href="https://redis.io/download"> RedisInsight </a> . The docker image redis/redis-stack for this version is bundled with <a href="https://github.com/RedisInsight/RedisInsight/releases/tag/2.20.0"> RedisInsight 2.20 </a> . </p> <p> Note: version numbers follow the pattern: </p> <p> <code> x.y.z-b </code> </p> <ul> <li> <code> x.y </code> Redis major version </li> <li> <code> z </code> increases with even numbers as a module x.y version increases. </li> <li> <code> b </code> denotes a patch to Redis or a module (any <code> z </code> of Redis or modules). <code> b </code> will consist of a <code> v </code> + numeric value. </li> </ul> <h2 id="redis-stack-server-626-v5-march-2023"> Redis Stack Server 6.2.6-v5 (March 2023) </h2> <p> This is a maintenance release for Redis Stack Server 6.2.6 </p> <p> Update urgency: <code> HIGH </code> : There is a critical bug that may affect a subset of users. Upgrade! </p> <h3 id="headlines-12"> Headlines: </h3> <p> This version contains the latest RediSearch 2.6.6, RedisJSON 2.4.6, RedisGraph 2.10.9, RedisTimeSeries 1.8.8, RedisBloom 2.4.5, and RedisInsight 2.20 with improvements and bugs fixed. </p> <h3 id="details-12"> Details: </h3> <p> <strong> Improvements </strong> </p> <ul> <li> RediSearch <a href="https://github.com/RediSearch/RediSearch/pull/3397"> #3397 </a> Improve the Vecsim initial capacity default value </li> <li> RediSearch and RedisJSON <a href="https://github.com/RediSearch/RediSearch/pull/3418"> #3418 </a> Add support to OS Amazon Linux 2 </li> <li> RediSearch and RedisJSON - Add full OS list on RAMP file </li> <li> RedisBloom - Internal changes for supporting future Redis Enterprise releases </li> </ul> <p> <strong> Bug Fixes </strong> </p> <ul> <li> RediSearch <a href="https://github.com/RediSearch/RediSearch/pull/3403"> #3403 </a> Fix suffix and prefix matching when using <code> CASESENSITIVE </code> flag </li> <li> RedisJSON <a href="https://github.com/RedisJSON/RedisJSON/pull/912"> #912 </a> Fix actual memory usage calculation </li> <li> RedisGraph <a href="https://github.com/RedisGraph/RedisGraph/issues/2880"> #2880 </a> Potential crash when using <code> WITH * </code> expressions </li> <li> RedisGraph <a href="https://github.com/RedisGraph/RedisGraph/issues/2917"> #2917 </a> Potential crash when using <code> CASE </code> expressions </li> <li> RedisGraph <a href="https://github.com/RedisGraph/RedisGraph/issues/2836"> #2836 </a> Potential crash on <code> *0 </code> variable-length path </li> <li> RedisGraph <a href="https://github.com/RedisGraph/RedisGraph/issues/2916"> #2916 </a> Potential crash when executing concurrent queries that utilize full-text indices </li> <li> RedisTimeSeries <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/issues/1290"> #1290 </a> Potential crash when using <code> FILTER_BY_TS </code> </li> <li> RedisTimeSeries <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/pull/1397"> #1397 </a> Memory leak when trying to create an already existing key </li> </ul> <p> <strong> Redis version </strong> </p> <ul> <li> <a href="https://github.com/redis/redis/blob/6.2.11/00-RELEASENOTES"> Redis 6.2.11 </a> </li> </ul> <p> <strong> Module versions </strong> </p> <ul> <li> <strong> <a href="https://github.com/RediSearch/RediSearch/releases/tag/v2.6.6"> RediSearch 2.6.6 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisJSON/RedisJSON/releases/tag/v2.4.6"> RedisJSON 2.4.6 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisGraph/RedisGraph/releases/tag/v2.10.9"> RedisGraph 2.10.9 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/releases/tag/v1.8.8"> RedisTimeSeries 1.8.8 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisBloom/RedisBloom/releases/tag/v2.4.5"> RedisBloom 2.4.5 </a> </strong> </li> </ul> <p> <strong> Recommended Client Libraries </strong> </p> <ul> <li> Java <ul> <li> <a href="https://github.com/redis/jedis/releases/tag/v4.3.1"> Jedis 4.3.1 or greater </a> </li> <li> <a href="https://github.com/redis/redis-om-spring"> redis-om-spring </a> </li> </ul> </li> <li> Python <ul> <li> <a href="https://github.com/redis/redis-py/releases/tag/v4.4.0"> redis-py 4.4.0 or greater </a> </li> <li> <a href="https://github.com/redis/redis-om-python"> redis-om-python </a> </li> </ul> </li> <li> NodeJS <ul> <li> <a href="https://www.npmjs.com/package/redis"> node-redis 4.5.0 or greater </a> </li> <li> <a href="https://github.com/redis/redis-om-node"> redis-om-node </a> </li> </ul> </li> <li> .NET <ul> <li> <a href="https://github.com/redis/redis-om-dotnet"> redis-om-dotnet </a> </li> <li> <a href="https://github.com/redis/NRedisStack"> NRedisStack </a> </li> </ul> </li> </ul> <p> Compatible with the latest <a href="https://redis.io/download"> RedisInsight </a> . The docker image redis/redis-stack for this version is bundled with <a href="https://github.com/RedisInsight/RedisInsight/releases/tag/2.20.0"> RedisInsight 2.20 </a> . </p> <p> Note: version numbers follow the pattern: </p> <p> <code> x.y.z-b </code> </p> <ul> <li> <code> x.y </code> Redis major version </li> <li> <code> z </code> increases with even numbers as a module x.y version increases. </li> <li> <code> b </code> denotes a patch to Redis or a module (any <code> z </code> of Redis or modules). <code> b </code> will consist of a <code> v </code> + numeric value. </li> </ul> <h2 id="redis-stack-server-626-v4-february-2023"> Redis Stack Server 6.2.6-v4 (February 2023) </h2> <p> This is a maintenance release for Redis Stack Server 6.2.6 </p> <p> Update urgency: <code> LOW </code> : No need to upgrade unless there are new features you want to use. </p> <h3 id="headlines-13"> Headlines: </h3> <p> This version contains the latest RedisJSON 2.4.5 with support for Ubuntu 20 - Focal Fossa OS. </p> <p> <strong> Module versions </strong> </p> <ul> <li> <strong> <a href="https://github.com/RediSearch/RediSearch/releases/tag/v2.6.5"> RediSearch 2.6.5 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisJSON/RedisJSON/releases/tag/v2.4.5"> RedisJSON 2.4.5 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisGraph/RedisGraph/releases/tag/v2.10.8"> RedisGraph 2.10.8 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/releases/tag/v1.8.5"> RedisTimeSeries 1.8.5 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisBloom/RedisBloom/releases/tag/v2.4.4"> RedisBloom 2.4.4 </a> </strong> </li> </ul> <p> <strong> Recommended Client Libraries </strong> </p> <ul> <li> Java <ul> <li> <a href="https://github.com/redis/jedis/releases/tag/v4.3.1"> Jedis 4.3.1 or greater </a> </li> <li> <a href="https://github.com/redis/redis-om-spring"> redis-om-spring </a> </li> </ul> </li> <li> Python <ul> <li> <a href="https://github.com/redis/redis-py/releases/tag/v4.4.0"> redis-py 4.4.0 or greater </a> </li> <li> <a href="https://github.com/redis/redis-om-python"> redis-om-python </a> </li> </ul> </li> <li> NodeJS <ul> <li> <a href="https://www.npmjs.com/package/redis"> node-redis 4.5.0 or greater </a> </li> <li> <a href="https://github.com/redis/redis-om-node"> redis-om-node </a> </li> </ul> </li> <li> .NET <ul> <li> <a href="https://github.com/redis/redis-om-dotnet"> redis-om-dotnet </a> </li> <li> <a href="https://github.com/redis/NRedisStack"> NRedisStack </a> </li> </ul> </li> </ul> <p> Compatible with the latest <a href="https://redis.io/download"> RedisInsight </a> . The docker image redis/redis-stack for this version is bundled with <a href="https://github.com/RedisInsight/RedisInsight/releases/tag/2.18.0"> RedisInsight 2.18 </a> . </p> <p> Note: version numbers follow the pattern: </p> <p> <code> x.y.z-b </code> </p> <ul> <li> <code> x.y </code> Redis major version </li> <li> <code> z </code> increases with even numbers as a module x.y version increases. </li> <li> <code> b </code> denotes a patch to Redis or a module (any <code> z </code> of Redis or modules). <code> b </code> will consist of a <code> v </code> + numeric value. </li> </ul> <h2 id="redis-stack-server-626-v3-february-2023"> Redis Stack Server 6.2.6-v3 (February 2023) </h2> <p> This is a maintenance release for Redis Stack Server 6.2.6 </p> <p> Update urgency: <code> HIGH </code> : There is a critical bug that may affect a subset of users. Upgrade! </p> <h3 id="headlines-14"> Headlines: </h3> <p> This version contains the latest RediSearch 2.6.5, RedisJSON 2.4.4, RedisGraph 2.10.8, RedisBloom 2.4.4, and RedisInsight 2.18 with new features and bugs fixed. </p> <h3 id="details-13"> Details: </h3> <p> <strong> Improvements </strong> </p> <ul> <li> RediSearch <a href="https://github.com/RediSearch/RediSearch/pull/3361"> #3361 </a> Enable the use of IPv6 for all cluster and module communication </li> <li> RedisJSON <a href="https://github.com/RedisJSON/RedisJSON/pull/813"> #813 </a> - Improve the errors messages in modules <a href="https://github.com/RedisJSON/RedisJSON/issues/725"> #725 </a> </li> <li> RedisJSON <a href="https://github.com/RedisJSON/RedisJSON/pull/918"> #918 </a> - Add IPv6 on the capability list </li> <li> RedisGraph <a href="https://github.com/RedisGraph/RedisGraph/pull/2790"> #2790 </a> Improved performance by disabling SuiteSparse:GraphBLAS' global free pool </li> <li> RedisGraph <a href="https://github.com/RedisGraph/RedisGraph/pull/2758"> #2758 </a> Improved edge deletion performance </li> <li> RedisGraph <a href="https://github.com/RedisGraph/RedisGraph/issues/2781"> #2781 </a> <code> indegree </code> and <code> outdegree </code> now also accept an argument which is a list of labels </li> <li> RedisBloom <a href="https://github.com/RedisBloom/RedisBloom/issues/389"> #389 </a> Introduce <code> BF.CARD </code> to retrieve the cardinality of a Bloom filter or 0 when such key does not exist </li> </ul> <p> <strong> Bug Fixes </strong> </p> <ul> <li> RediSearch <a href="https://github.com/RediSearch/RediSearch/pull/3354"> #3354 </a> Library update preventing a crash during cluster failover </li> <li> RediSearch <a href="https://github.com/RediSearch/RediSearch/pull/3357"> #3357 </a> Handling division by zero in expressions preventing nodes to restart </li> <li> RediSearch <a href="https://github.com/RediSearch/RediSearch/pull/3332"> #3332 </a> Fix wildcards * queries on <code> DIALECT 2 </code> and <code> DIALECT 3 </code> </li> <li> RedisJSON <a href="https://github.com/RedisJSON/RedisJSON/pull/919"> #919 </a> Possible failure loading <code> .rdb </code> files </li> <li> RedisGraph <a href="https://github.com/RedisGraph/RedisGraph/issues/2777"> #2777 </a> , <a href="https://github.com/RedisGraph/RedisGraph/issues/2841"> #2841 </a> Potential crash when sending queries from multiple connections and timeout is not 0 </li> <li> RedisGraph <a href="https://github.com/RedisGraph/RedisGraph/issues/2844"> #2844 </a> Potential partial results when same parametrized query is running from multiple connections </li> <li> RedisGraph <a href="https://github.com/RedisGraph/RedisGraph/issues/2739"> #2739 </a> , <a href="https://github.com/RedisGraph/RedisGraph/issues/2774"> #2774 </a> Paths with exact variable length &gt;1 are not matched </li> <li> RedisGraph <a href="https://github.com/RedisGraph/RedisGraph/issues/2794"> #2794 </a> <code> toInteger </code> and <code> toIntegerOrNull </code> don't convert Booleans </li> <li> RedisGraph <a href="https://github.com/RedisGraph/RedisGraph/issues/2798"> #2798 </a> <code> right </code> and <code> left </code> should reply with an error when <code> length </code> is null </li> <li> RedisGraph <a href="https://github.com/RedisGraph/RedisGraph/issues/2809"> #2809 </a> <code> TIMEOUT_MAX </code> configuration parameter in not enforced when <code> TIMEOUT_DEFAULT </code> is 0 </li> <li> RedisGraph <a href="https://github.com/RedisGraph/RedisGraph/issues/2780"> #2780 </a> <code> indegree </code> and <code> outdegree </code> - relationships are counted more than once when same relationship type is supplied more than once </li> <li> RedisBloom <a href="https://github.com/RedisBloom/RedisBloom/issues/609"> #609 </a> <code> CF.INFO </code> - incorrect information for large filters </li> </ul> <p> <strong> Redis version </strong> </p> <ul> <li> <a href="https://github.com/redis/redis/blob/6.2.10/00-RELEASENOTES"> Redis 6.2.10 </a> </li> </ul> <p> <strong> Module versions </strong> </p> <ul> <li> <strong> <a href="https://github.com/RediSearch/RediSearch/releases/tag/v2.6.5"> RediSearch 2.6.5 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisJSON/RedisJSON/releases/tag/v2.4.4"> RedisJSON 2.4.4 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisGraph/RedisGraph/releases/tag/v2.10.8"> RedisGraph 2.10.8 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/releases/tag/v1.8.5"> RedisTimeSeries 1.8.5 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisBloom/RedisBloom/releases/tag/v2.4.4"> RedisBloom 2.4.4 </a> </strong> </li> </ul> <p> <strong> Recommended Client Libraries </strong> </p> <ul> <li> Java <ul> <li> <a href="https://github.com/redis/jedis/releases/tag/v4.3.1"> Jedis 4.3.1 or greater </a> </li> <li> <a href="https://github.com/redis/redis-om-spring"> redis-om-spring </a> </li> </ul> </li> <li> Python <ul> <li> <a href="https://github.com/redis/redis-py/releases/tag/v4.4.0"> redis-py 4.4.0 or greater </a> </li> <li> <a href="https://github.com/redis/redis-om-python"> redis-om-python </a> </li> </ul> </li> <li> NodeJS <ul> <li> <a href="https://www.npmjs.com/package/redis"> node-redis 4.5.0 or greater </a> </li> <li> <a href="https://github.com/redis/redis-om-node"> redis-om-node </a> </li> </ul> </li> <li> .NET <ul> <li> <a href="https://www.nuget.org/packages/nredisstack/"> nredisstack 0.5.0 or greater </a> </li> <li> <a href="https://github.com/redis/redis-om-dotnet"> redis-om-dotnet </a> </li> </ul> </li> </ul> <p> Compatible with the latest <a href="https://redis.io/download"> RedisInsight </a> . The docker image redis/redis-stack for is bundled with <a href="https://github.com/RedisInsight/RedisInsight/releases/tag/2.18.0"> RedisInsight 2.18 </a> . </p> <p> Note: version numbers follow the pattern: </p> <p> <code> x.y.z-b </code> </p> <ul> <li> <code> x.y </code> Redis major version </li> <li> <code> z </code> increases with even numbers as a module x.y version increases. </li> <li> <code> b </code> denotes a patch to Redis or a module (any <code> z </code> of Redis or modules). <code> b </code> will consist of a <code> v </code> + numeric value. </li> </ul> <h2 id="redis-stack-server-626-v2--january-2023"> Redis Stack Server 6.2.6-v2 (January 2023) </h2> <p> This is a maintenance release for Redis Stack Server 6.2.6 </p> <p> Update urgency: <code> HIGH </code> : There is a critical bug that may affect a subset of users. Upgrade! </p> <h3 id="headlines-15"> Headlines: </h3> <p> This version contains the latest RedisInsight 2.16 and RedisTimeSeries 1.8.5 with bugs fixed. </p> <h3 id="details-14"> Details: </h3> <p> <strong> Bug Fixes </strong> </p> <ul> <li> RedisTimeSeries <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/pull/1388"> #1388 </a> Potential crash when upgrading from v1.6 to 1.8 if there are compactions with <code> min </code> or <code> max </code> aggregation </li> </ul> <p> <strong> Redis version </strong> (no changes) </p> <ul> <li> <a href="https://github.com/redis/redis/blob/6.2.7/00-RELEASENOTES"> Redis 6.2.8 </a> </li> </ul> <p> <strong> Module versions </strong> </p> <ul> <li> <strong> <a href="https://github.com/RediSearch/RediSearch/releases/tag/v2.6.4"> RediSearch 2.6.4 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisJSON/RedisJSON/releases/tag/v2.4.3"> RedisJSON 2.4.3 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisGraph/RedisGraph/releases/tag/v2.10.5"> RedisGraph 2.10.5 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/releases/tag/v1.8.5"> RedisTimeSeries 1.8.5 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisBloom/RedisBloom/releases/tag/v2.4.3"> RedisBloom 2.4.3 </a> </strong> </li> </ul> <p> <strong> Recommended Client Libraries </strong> </p> <ul> <li> Java <ul> <li> <a href="https://github.com/redis/jedis/releases/tag/v4.3.1"> Jedis 4.3.1 or greater </a> </li> <li> <a href="https://github.com/redis/redis-om-spring"> redis-om-spring </a> </li> </ul> </li> <li> Python <ul> <li> <a href="https://github.com/redis/redis-py/releases/tag/v4.4.0"> redis-py 4.4.0 or greater </a> </li> <li> <a href="https://github.com/redis/redis-om-python"> redis-om-python </a> </li> </ul> </li> <li> NodeJS <ul> <li> <a href="https://www.npmjs.com/package/redis"> node-redis 4.5.0 or greater </a> </li> <li> <a href="https://github.com/redis/redis-om-node"> redis-om-node </a> </li> </ul> </li> <li> .NET <ul> <li> <a href="https://github.com/redis/redis-om-dotnet"> redis-om-dotnet </a> </li> </ul> </li> </ul> <p> Compatible with the latest <a href="https://redis.io/download"> RedisInsight </a> . The docker image redis/redis-stack for this version is bundled with <a href="https://github.com/RedisInsight/RedisInsight/releases/tag/2.16.0"> RedisInsight 2.16 </a> . </p> <p> Note: version numbers follow the pattern: </p> <p> <code> x.y.z-b </code> </p> <ul> <li> <code> x.y </code> Redis major version </li> <li> <code> z </code> increases with even numbers as a module x.y version increases. </li> <li> <code> b </code> denotes a patch to Redis or a module (any <code> z </code> of Redis or modules). <code> b </code> will consist of a <code> v </code> + numeric value. </li> </ul> <h2 id="redis-stack-626-v1-january-2023"> Redis Stack 6.2.6-v1 (January 2023) </h2> <p> This is a maintenance release for Redis Stack Server 6.2.6 </p> <p> Update urgency: <code> HIGH </code> : There is a critical bug that may affect a subset of users. Upgrade! </p> <h3 id="headlines-16"> Headlines: </h3> <p> This version contains the latest RediSearch 2.6.4, RedisJSON 2.4.3, RedisGraph 2.10.5, and RedisTimeSeries 1.8.4 with new features and bugs fixed. </p> <h3 id="details-15"> Details: </h3> <p> <strong> Improvements </strong> </p> <ul> <li> RediSearch <a href="https://github.com/RediSearch/RediSearch/pull/3256"> #3256 </a> Support IPv6 on cluster set command </li> <li> RediSearch <a href="https://github.com/RediSearch/RediSearch/pull/3194"> #3194 </a> Add the query dialects that are in use to <code> FT.INFO </code> and <code> INFO MODULE </code> commands </li> <li> RediSearch <a href="https://github.com/RediSearch/RediSearch/pull/3258"> #3258 </a> Add the module version and Redis version to <code> INFO MODULE </code> </li> <li> RedisJSON <a href="https://github.com/RedisJSON/RedisJSON/pull/892"> #892 </a> Allow <code> JSON.ARRINDEX </code> with none scalar values </li> <li> RedisGraph <a href="https://github.com/RedisGraph/RedisGraph/pull/2757"> #2757 </a> Improved performance of <code> indegree </code> and <code> outdegree </code> </li> <li> RedisGraph <a href="https://github.com/RedisGraph/RedisGraph/issues/2681"> #2681 </a> Fixed some error messages </li> <li> RedisGraph <a href="https://github.com/RedisGraph/RedisGraph/issues/2740"> #2740 </a> Don’t show partial results for timed-out <a href="https://redis.io/commands/graph.profile/"> GRAPH.PROFILE </a> </li> <li> RedisTimeSeries <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/issues/1215"> #1215 </a> OSS cluster: Support TLS and IPv6; Introduce new configuration parameter: <a href="https://redis.io/docs/stack/timeseries/configuration/#oss_global_password"> OSS_GLOBAL_PASSWORD </a> </li> </ul> <p> <strong> Bug Fixes </strong> </p> <ul> <li> RediSearch <a href="https://github.com/RediSearch/RediSearch/pull/3289"> #3289 </a> Potential crash when querying multiple fields </li> <li> RediSearch <a href="https://github.com/RediSearch/RediSearch/pull/3279"> #3279 </a> Potential crash when querying using wildcard * on TAG field </li> <li> RedisJSON <a href="https://github.com/RedisJSON/RedisJSON/pull/890"> #890 </a> JSONPath ignores any filter condition beyond the second </li> <li> RedisGraph <a href="https://github.com/RedisGraph/RedisGraph/pull/2754"> #2754 </a> Partial sync may hang </li> <li> RedisTimeSeries <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/pull/1360"> #1360 </a> Potential crash when upgrading from v1.6 to 1.8 if there are compactions with <code> min </code> or <code> min </code> aggregation </li> <li> RedisTimeSeries <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/issues/1370"> #1370 </a> Potential crash when using <a href="https://redis.io/commands/ts.revrange/"> TS.REVRANGE </a> or <a href="https://redis.io/commands/ts.mrevrange/"> TS.MREVRANGE </a> with aggregation </li> <li> RedisTimeSeries <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/pull/1347"> #1347 </a> When adding samples with <a href="https://redis.io/commands/ts.add/"> TS.ADD </a> or <a href="https://redis.io/commands/ts.madd/"> TS.MADD </a> using * as timestamp, the timestamp could differ between master and replica shards </li> </ul> <p> <strong> Redis version </strong> (no changes) </p> <ul> <li> <a href="https://github.com/redis/redis/blob/6.2.8/00-RELEASENOTES"> Redis 6.2.8 </a> </li> </ul> <p> <strong> Module versions </strong> </p> <ul> <li> <strong> <a href="https://github.com/RediSearch/RediSearch/releases/tag/v2.6.4"> RediSearch 2.6.4 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisJSON/RedisJSON/releases/tag/v2.4.3"> RedisJSON 2.4.3 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisGraph/RedisGraph/releases/tag/v2.10.5"> RedisGraph 2.10.5 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/releases/tag/v1.8.4"> RedisTimeSeries 1.8.4 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisBloom/RedisBloom/releases/tag/v2.4.3"> RedisBloom 2.4.3 (v2.4.3) </a> </strong> </li> </ul> <p> <strong> Recommended Client Libraries </strong> </p> <ul> <li> Java <ul> <li> <a href="https://github.com/redis/jedis/releases/tag/v4.3.1"> Jedis 4.3.1 or greater </a> </li> <li> <a href="https://github.com/redis/redis-om-spring"> redis-om-spring </a> </li> </ul> </li> <li> Python <ul> <li> <a href="https://github.com/redis/redis-py/releases/tag/v4.4.0"> redis-py 4.4.0 or greater </a> </li> <li> <a href="https://github.com/redis/redis-om-python"> redis-om-python </a> </li> </ul> </li> <li> NodeJS <ul> <li> <a href="https://www.npmjs.com/package/redis"> node-redis 4.5.0 or greater </a> </li> <li> <a href="https://github.com/redis/redis-om-node"> redis-om-node </a> </li> </ul> </li> <li> .NET <ul> <li> <a href="https://github.com/redis/redis-om-dotnet"> redis-om-dotnet </a> </li> </ul> </li> </ul> <p> Compatible with <a href="https://redis.io/download"> RedisInsight </a> . The docker image redis/redis-stack for this version is bundled with <a href="https://github.com/RedisInsight/RedisInsight/releases/tag/2.14.0"> RedisInsight 2.14 </a> . </p> <p> Note: version numbers follow the pattern: </p> <p> <code> x.y.z-b </code> </p> <ul> <li> <code> x.y </code> Redis major version </li> <li> <code> z </code> increases with even numbers as a module x.y version increases. </li> <li> <code> b </code> denotes a patch to Redis or a module (any <code> z </code> of Redis or modules). <code> b </code> will consist of a <code> v </code> + numeric value. </li> </ul> <h2 id="redis-stack-server-626-v0-december-2022"> Redis Stack Server 6.2.6-v0 (December 2022) </h2> <p> This is a GA release of Redis Stack version 6.2.6 </p> <h3 id="headlines-17"> Headlines: </h3> <ul> <li> Query &amp; Search: <ul> <li> multi-value index and query for: text, tag, numeric, geo and vector! </li> <li> suffix search <code> *vatore </code> and wildcard search <code> ant?rez </code> </li> <li> support for FP64 vectors and range queries from a given vector </li> </ul> </li> <li> New faster JSONPath parser </li> <li> New probabilistic data structure: t-digest </li> <li> New path-finding algorithms <code> algo.SPpaths </code> and <code> algo.SSpaths </code> for Graph </li> <li> Support for gap filling for Time series </li> </ul> <h3 id="details-16"> Details: </h3> <p> <strong> RediSearch </strong> introduces the following features: </p> <ul> <li> Support for <a href="https://redis.io/docs/stack/search/reference/query_syntax/#wildcard-matching"> wildcard queries </a> for TEXT and TAG fields, where <ul> <li> <code> ? </code> matches any single character </li> <li> <code> * </code> matches zero or more characters </li> <li> use <code> ' </code> and <code> \ </code> for escaping, other special characters are ignored </li> <li> Optimized wildcard query support (i.e., suffix trie) </li> </ul> </li> <li> Multi-value indexing and querying <ul> <li> Multi-value text search - perform full-text search on <a href="https://redis.io/docs/stack/search/indexing_json/#index-json-arrays-as-tag"> array of string or on a JSONPath </a> leading to multiple strings </li> <li> Support for Geo, Vector, Numeric, Tag </li> <li> Return JSON rather than scalars from multi-value attributes. This is enabled via Dialect 3 in order not to break existing applications. </li> <li> Support indexing and querying of multi-value JSONPath attributes and/or arrays (requires JSON &gt;2.4.1) </li> <li> Support for <code> SORTABLE </code> fields on JSON in an implicit un-normalized form (UNF) </li> </ul> </li> <li> Vector similarity 0.5.1: <ul> <li> Better space optimization selection </li> <li> Aligning index capacity with block size </li> <li> Support FLOAT64 as vector data type </li> <li> Range query support </li> <li> Support query attributes for vector queries </li> </ul> </li> </ul> <p> <strong> RedisJSON </strong> introduces the following features: </p> <ul> <li> Add JSONPath filter the regexp match operator </li> <li> Support legacy JSONpath with dollar <code> $ </code> </li> <li> A new JSONPath library which enhances the performance of parsing any JSONPath expression in RedisJSON. </li> <li> Floating point numbers which become round numbers due to some operation, for example by <code> JSON.NUMINCRBY </code> , will now return as a floating point with a trailing <code> .0 </code> , e.g., instead of just <code> 42 </code> , now <code> 42.0 </code> will be returned. </li> </ul> <p> <strong> RedisBloom </strong> introduces the following new features: </p> <ul> <li> A new sketch data structure: t-digest. t-digest is a sketch data structure for estimating quantiles based on a data stream or a large dataset of values. As for other sketch data structures, t-digest requires sublinear space and has controllable space-accuracy tradeoffs. </li> </ul> <p> <strong> RedisGraph </strong> introduces the following new features: </p> <ul> <li> New path-finding algorithms: <ul> <li> The <code> algo.SPpaths </code> procedure returns one, <em> n </em> , or all minimal-weight, optionally bounded-cost, optionally bounded-length paths between a given pair of nodes. </li> <li> The <code> algo.SSpaths </code> procedure returns one, <em> n </em> , or all minimal-weight, optionally bounded-cost, optionally bounded-length paths from a given node. </li> </ul> </li> <li> Introduce <code> SET </code> for adding node labels and <code> REMOVE </code> for removing node labels, node properties, and edge properties </li> <li> Support deleting paths with <code> DELETE </code> </li> <li> Introduce <code> toBoolean </code> , <code> toBooleanOrNull </code> , <code> toFloatOrNull </code> , <code> toIntegerOrNull </code> , <code> toStringOrNull </code> , <code> toBooleanList </code> , <code> toFloatList </code> , <code> toIntegerList </code> , <code> toStringList </code> , <code> properties </code> , <code> split </code> , <code> last </code> , <code> isEmpty </code> , <code> e </code> , <code> exp </code> , <code> log </code> , <code> log10 </code> , <code> sin </code> , <code> cos </code> , <code> tan </code> , <code> cot </code> , <code> asin </code> , <code> acos </code> , <code> atan </code> , <code> atan2 </code> , <code> degrees </code> , <code> radians </code> , <code> pi </code> , and <code> haversin </code> functions. </li> <li> Graph slow log can be reset with <code> GRAPH.SLOWLOG g RESET </code> </li> <li> Queries are now atomic ( <em> Atomicity </em> is the guarantee that each query either succeeds or fails with no side effects). Whenever a failure occurs, the query effect is rolled-back from an undo-log. </li> </ul> <p> <strong> RedisTimeSeries </strong> introduces the following new features: </p> <ul> <li> Introduction of a new aggregator: <code> twa </code> (time-weighted average) </li> <li> Introduction of a new optional <code> EMPTY </code> flag to <code> TS.RANGE </code> , <code> TS.REVRANGE </code> , <code> TS.MRANGE </code> , and <code> TS.MREVRANGE </code> to retrieve aggregations for empty buckets as well. </li> <li> Gap-filling: Using <code> EMPTY </code> when the aggregator is <code> twa </code> allows estimating the average of a continuous signal even for empty buckets based on linear interpolation of previous and next samples. Using <code> EMPTY </code> when the aggregator is <code> last </code> would repeat the value of the previous sample when the bucket is empty. </li> <li> Introduction of a new optional <code> BUCKETTIMESTAMP </code> parameter to <code> TS.RANGE </code> , <code> TS.REVRANGE </code> , <code> TS.MRANGE </code> , and <code> TS.MREVRANGE </code> . It is now possible to report the start time, the end time, or the mid time for each bucket. </li> <li> Introduction of a new optional <code> alignTimestamp </code> parameter to <code> TS.CREATERULE </code> and to <code> COMPACTION_POLICY </code> configuration parameter. It is now possible to define alignment for compaction rules, so one can, for example, aggregate daily events from 06:00 to 06:00 the next day. </li> <li> Introduction of additional reducer types in <code> GROUPBY </code> ( <code> TS.MRANGE </code> , and <code> TS.MREVRANGE </code> ): <code> avg </code> , <code> range </code> , <code> count </code> , <code> std.p </code> , <code> std.s </code> , <code> var.p </code> , and <code> var.s </code> </li> <li> Introduction of a new optional <code> LATEST </code> flag to <code> TS.GET </code> , <code> TS.MGET </code> , <code> TS.RANGE </code> , <code> TS.REVRANGE </code> , <code> TS.MRANGE </code> , and <code> TS.MREVRANGE </code> . it is possible to retrieve the latest (possibly partial) bucket as well. </li> </ul> <p> <strong> Bug Fixes </strong> (since 6.2.6-RC1): </p> <ul> <li> RediSearch <a href="https://github.com/RediSearch/RediSearch/pull/3098"> #3098 </a> Wrong return value in Geo query </li> <li> RediSearch <a href="https://github.com/RediSearch/RediSearch/pull/3230"> #3230 </a> Precalculated number of replies must be equal to actual number </li> <li> RediSearch <a href="https://github.com/RediSearch/RediSearch/pull/3171"> #3171 </a> Shard of DB with RedisSearch 2.4.8/11 got restarted by node_wd </li> <li> RediSearch <a href="https://github.com/RediSearch/RediSearch/pull/3197"> #3197 </a> RediSearch 2.4.15 crashed </li> <li> RediSearch <a href="https://github.com/RediSearch/RediSearch/pull/3197"> #3197 </a> failure to create temporary indices </li> <li> RedisJSON <a href="https://github.com/RedisJSON/RedisJSON/pull/850"> #850 </a> Allow repetition of filter relation instead of optional </li> <li> RedisGraph <a href="https://github.com/RedisGraph/RedisGraph/pull/2695"> #2695 </a> Potential crash on certain write queries </li> <li> RedisGraph <a href="https://github.com/RedisGraph/RedisGraph/pull/2724"> #2724 </a> Potential crash when setting property values based on nonexistent properties </li> <li> RedisGraph <a href="https://github.com/RedisGraph/RedisGraph/issues/2460"> #2460 </a> , <a href="https://github.com/RedisGraph/RedisGraph/issues/2637"> #2637 </a> , <a href="https://github.com/RedisGraph/RedisGraph/issues/2680"> #2680 </a> Crash on invalid queries </li> <li> RedisGraph <a href="https://github.com/RedisGraph/RedisGraph/pull/2672"> #2672 </a> Wrong matching result on multiple labels </li> <li> RedisGraph <a href="https://github.com/RedisGraph/RedisGraph/issues/2643"> #2643 </a> Duplicate reports when matching relationship type <code> :R|R </code> </li> <li> RedisGraph <a href="https://github.com/RedisGraph/RedisGraph/issues/2687"> #2687 </a> , <a href="https://github.com/RedisGraph/RedisGraph/issues/2414"> #2414 </a> Error when <code> UNWIND </code> ing relationships </li> <li> RedisGraph <a href="https://github.com/RedisGraph/RedisGraph/issues/2636"> #2636 </a> <code> MERGE </code> … <code> ON </code> ... - cannot remove property by setting it to null </li> <li> RedisGraph <a href="https://github.com/RedisGraph/RedisGraph/pull/2710"> #2710 </a> Undo-log fix </li> <li> RedisGraph <a href="https://github.com/RedisGraph/RedisGraph/pull/2435"> #2435 </a> Incorrect result when comparing a value to NaN </li> <li> RedisGraph <a href="https://github.com/RedisGraph/RedisGraph/pull/2497"> #2497 </a> Incorrect result when comparing a value to null </li> <li> RedisGraph <a href="https://github.com/RedisGraph/RedisGraph/issues/2676"> #2676 </a> <code> sqrt </code> , <code> log </code> , <code> log10 </code> - incorrect result for negative values </li> <li> RedisGraph <a href="https://github.com/RedisGraph/RedisGraph/issues/2213"> #2213 </a> Division and Modulo by zero - wrong behavior </li> <li> RedisTimeSeries <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/issues/1333"> #1333 </a> Potential crash when aggregating over a compaction with the <code> avg </code> aggregator and the <code> LATEST </code> flag </li> </ul> <p> <strong> Redis version </strong> (no changes) </p> <ul> <li> <a href="https://github.com/redis/redis/blob/6.2.7/00-RELEASENOTES"> Redis 6.2.7 </a> </li> </ul> <p> <strong> Module versions </strong> </p> <ul> <li> <strong> <a href="https://github.com/RediSearch/RediSearch/releases/tag/v2.6.3"> RediSearch 2.6.3 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisJSON/RedisJSON/releases/tag/v2.4.2"> RedisJSON 2.4.2 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisGraph/RedisGraph/releases/tag/v2.10.4"> RedisGraph 2.10.4 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/releases/tag/v1.8.3"> RedisTimeSeries 1.8.3 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisBloom/RedisBloom/releases/tag/v2.4.3"> RedisBloom 2.4.3 </a> </strong> </li> </ul> <p> <strong> Recommended Client Libraries (no changes) </strong> </p> <ul> <li> Java <ul> <li> <a href="https://github.com/redis/jedis/releases/tag/v4.2.0"> Jedis 4.2.0 or greater </a> </li> <li> <a href="https://github.com/redis/redis-om-spring"> redis-om-spring </a> </li> </ul> </li> <li> Python <ul> <li> <a href="https://github.com/redis/redis-py/releases/tag/v4.3.1"> redis-py 4.3.1 or greater </a> </li> <li> <a href="https://github.com/redis/redis-om-python"> redis-om-python </a> </li> </ul> </li> <li> NodeJS <ul> <li> <a href="https://www.npmjs.com/package/redis"> node-redis 4.4.0 or greater </a> </li> <li> <a href="https://github.com/redis/redis-om-node"> redis-om-node </a> </li> </ul> </li> <li> .NET <ul> <li> <a href="https://github.com/redis/redis-om-dotnet"> redis-om-dotnet </a> </li> </ul> </li> </ul> <p> Compatible with the latest <a href="https://redis.io/download"> RedisInsight </a> . The docker image redis/redis-stack for this version is bundled with <a href="https://github.com/RedisInsight/RedisInsight/releases/tag/2.14.0"> RedisInsight 2.14 </a> . </p> <p> Note: version numbers follow the pattern: </p> <p> <code> x.y.z-b </code> </p> <ul> <li> <code> x.y </code> Redis major version </li> <li> <code> z </code> increases with even numbers as a module x.y version increases. </li> <li> <code> b </code> denotes a patch to Redis or a module (any <code> z </code> of Redis or modules). <code> b </code> will consist of a <code> v </code> + numeric value. </li> </ul> <h2 id="redis-stack-server-626-rc1-november-2022"> Redis Stack Server 6.2.6-RC1 (November 2022) </h2> <p> This is a Release Candidate of Redis Stack Server 6.2.6 </p> <h3 id="headlines-18"> Headlines: </h3> <ul> <li> Query &amp; Search: <ul> <li> multi-value index and query for: text, tag, numeric, geo and vector! </li> <li> affix search <code> *oolman </code> and wildcard search <code> y?fta* </code> </li> <li> support for FP64 vectors </li> </ul> </li> <li> New faster JSONPath parser </li> <li> New probabilistic data structure: t-digest </li> <li> New path-finding algorithms <code> algo.SPpaths </code> and <code> algo.SSpaths </code> for Graph </li> <li> Support for gap filling for Time series </li> </ul> <h3 id="details-17"> Details: </h3> <p> <strong> RediSearch </strong> introduces the following features: </p> <ul> <li> the ability to search using wildcard queries for TEXT and TAG fields. This enables the frequently asked feature of affix search and includes optimized wildcard query support : <ul> <li> <code> ? </code> matches any single character </li> <li> <code> * </code> matches zero or more characters </li> <li> use <code> ’ </code> and <code> \ </code> for escaping, other special characters are ignored </li> </ul> </li> <li> Multi-value indexing and querying of attributes for any attribute type ( <a href="https://redis.io/docs/stack/search/indexing_json/#index-json-arrays-as-text"> Text </a> , <a href="https://redis.io/docs/stack/search/indexing_json/#index-json-arrays-as-tag"> Tag </a> , <a href="https://redis.io/docs/stack/search/indexing_json/#index-json-arrays-as-numeric"> Numeric </a> , <a href="https://redis.io/docs/stack/search/indexing_json/#index-json-arrays-as-geo"> Geo </a> and <a href="https://redis.io/docs/stack/search/indexing_json/#index-json-arrays-as-vector"> Vector </a> ) defined by a <a href="https://redis.io/docs/stack/json/path/"> JSONPath </a> leading to an array: <ul> <li> Multi-value text search - perform full-text search on <a href="https://redis.io/docs/stack/search/indexing_json/#index-json-arrays-as-tag"> array of string or on a JSONPath </a> leading to multiple strings </li> <li> Return JSON rather than scalars from multi-value attributes. This is enabled via Dialect 3 in order not to break existing applications. </li> <li> Support for <code> SORTABLE </code> fields on JSON in an implicit un-normalized form (UNF) </li> </ul> </li> <li> Support for indexing double-precision floating-point vectors and range queries from a given vector: <ul> <li> Better space optimization selection </li> <li> Aligning index capacity with block size </li> <li> Support FLOAT64 as vector data type </li> <li> Range query support </li> <li> Support query attributes for vector queries </li> </ul> </li> </ul> <p> <strong> RedisJSON </strong> introduces the following features: </p> <ul> <li> A new JSONPath library which enhances the performance of parsing any JSONPath expression in RedisJSON. </li> </ul> <p> <strong> RedisBloom </strong> introduces the following new features: </p> <ul> <li> A new sketch data structure: t-digest. t-digest is a sketch data structure for estimating quantiles based on a data stream or a large dataset of values. As for other sketch data structures, t-digest requires sublinear space and has controllable space-accuracy tradeoffs. </li> </ul> <p> <strong> RedisGraph </strong> introduces the following new features: </p> <ul> <li> New path-finding algorithms: <ul> <li> The <code> algo.SPpaths </code> procedure returns one, <em> n </em> , or all minimal-weight, optionally bounded-cost, optionally bounded-length paths between a given pair of nodes. </li> <li> The <code> algo.SSpaths </code> procedure returns one, <em> n </em> , or all minimal-weight, optionally bounded-cost, optionally bounded-length paths from a given node. </li> </ul> </li> <li> Introduce <code> SET </code> for adding node labels and <code> REMOVE </code> for removing node labels, node properties, and edge properties </li> <li> Support deleting paths with <code> DELETE </code> </li> <li> Introduce <code> toBoolean </code> , <code> toBooleanOrNull </code> , <code> toFloatOrNull </code> , <code> toIntegerOrNull </code> , <code> toStringOrNull </code> , <code> toBooleanList </code> , <code> toFloatList </code> , <code> toIntegerList </code> , <code> toStringList </code> , <code> properties </code> , <code> split </code> , <code> last </code> , <code> isEmpty </code> , <code> e </code> , <code> exp </code> , <code> log </code> , <code> log10 </code> , <code> sin </code> , <code> cos </code> , <code> tan </code> , <code> cot </code> , <code> asin </code> , <code> acos </code> , <code> atan </code> , <code> atan2 </code> , <code> degrees </code> , <code> radians </code> , <code> pi </code> , and <code> haversin </code> functions. </li> <li> Graph slow log can be reset with <code> GRAPH.SLOWLOG g RESET </code> (also added in 2.8.20) </li> <li> Queries are now atomic ( <em> Atomicity </em> is the guarantee that each query either succeeds or fails with no side effects). Whenever a failure occurs, the query effect is rolled-back from an undo-log. </li> </ul> <p> <strong> RedisTimeSeries </strong> introduces the following new features: </p> <ul> <li> Introduction of a new aggregator: <code> twa </code> (time-weighted average) </li> <li> Introduction of a new optional <code> EMPTY </code> flag to <code> TS.RANGE </code> , <code> TS.REVRANGE </code> , <code> TS.MRANGE </code> , and <code> TS.MREVRANGE </code> to retrieve aggregations for empty buckets as well. </li> <li> Gap-filling: Using <code> EMPTY </code> when the aggregator is <code> twa </code> allows estimating the average of a continuous signal even for empty buckets based on linear interpolation of previous and next samples. Using <code> EMPTY </code> when the aggregator is <code> last </code> would repeat the value of the previous sample when the bucket is empty. </li> <li> Introduction of a new optional <code> BUCKETTIMESTAMP </code> parameter to <code> TS.RANGE </code> , <code> TS.REVRANGE </code> , <code> TS.MRANGE </code> , and <code> TS.MREVRANGE </code> . It is now possible to report the start time, the end time, or the mid time for each bucket. </li> <li> Introduction of a new optional <code> alignTimestamp </code> parameter to <code> TS.CREATERULE </code> and to <code> COMPACTION_POLICY </code> configuration parameter. It is now possible to define alignment for compaction rules, so one can, for example, aggregate daily events from 06:00 to 06:00 the next day. </li> <li> Introduction of additional reducer types in <code> GROUPBY </code> ( <code> TS.MRANGE </code> , and <code> TS.MREVRANGE </code> ): <code> avg </code> , <code> range </code> , <code> count </code> , <code> std.p </code> , <code> std.s </code> , <code> var.p </code> , and <code> var.s </code> </li> <li> Introduction of a new optional <code> LATEST </code> flag to <code> TS.GET </code> , <code> TS.MGET </code> , <code> TS.RANGE </code> , <code> TS.REVRANGE </code> , <code> TS.MRANGE </code> , and <code> TS.MREVRANGE </code> . it is possible to retrieve the latest (possibly partial) bucket as well. </li> </ul> <p> <strong> Redis version </strong> (no changes) </p> <ul> <li> <a href="https://github.com/redis/redis/blob/6.2.7/00-RELEASENOTES"> Redis 6.2.7 </a> </li> </ul> <p> <strong> Module versions </strong> </p> <ul> <li> <strong> <a href="https://github.com/RediSearch/RediSearch/releases/tag/v2.6.1"> RediSearch 2.6.1 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisJSON/RedisJSON/releases/tag/v2.4.0"> RedisJSON 2.4.0 </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisGraph/RedisGraph/releases/tag/v2.10.2"> RedisGraph 2.10-RC1 (v2.10.2) </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/releases/tag/v1.8.2"> RedisTimeSeries 1.8-RC3 (v1.8.2) </a> </strong> </li> <li> <strong> <a href="https://github.com/RedisBloom/RedisBloom/releases/tag/v2.4.2"> RedisBloom 2.4-RC3 (v2.4.2) </a> </strong> </li> </ul> <p> <strong> Recommended Client Libraries (no changes) </strong> </p> <ul> <li> Java <ul> <li> <a href="https://github.com/redis/jedis/releases/tag/v4.2.0"> Jedis 4.2.0 or greater </a> </li> <li> <a href="https://github.com/redis/redis-om-spring"> redis-om-spring </a> </li> </ul> </li> <li> Python <ul> <li> <a href="https://github.com/redis/redis-py/releases/tag/v4.3.1"> redis-py 4.3.1 or greater </a> </li> <li> <a href="https://github.com/redis/redis-om-python"> redis-om-python </a> </li> </ul> </li> <li> NodeJS <ul> <li> <a href="https://www.npmjs.com/package/redis"> node-redis 4.4.0 or greater </a> </li> <li> <a href="https://github.com/redis/redis-om-node"> redis-om-node </a> </li> </ul> </li> <li> .NET <ul> <li> <a href="https://github.com/redis/redis-om-dotnet"> redis-om-dotnet </a> </li> </ul> </li> </ul> <p> Compatible with the latest <a href="https://redis.io/download"> RedisInsight </a> . The docker image redis/redis-stack for this version is bundled with RedisInsight 2.12.0. </p> <p> Note: version numbers follow the pattern: </p> <p> <code> x.y.z-b </code> </p> <ul> <li> <code> x.y </code> Redis major version </li> <li> <code> z </code> increases with even numbers as a module x.y version increases. </li> <li> <code> b </code> denotes a patch to Redis or a module (any <code> z </code> of Redis or modules). <code> b </code> will consist of a <code> v </code> + numeric value. </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/release-notes/redisstack/redisstack-6.2.6-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/commands/debug/.html
<section class="prose w-full py-12"> <h1 class="command-name"> DEBUG </h1> <div class="font-semibold text-redis-ink-900"> Syntax </div> <pre class="command-syntax">DEBUG</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.0.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> @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> The <code> DEBUG </code> command is an internal command. It is meant to be used for developing and testing Redis. </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/debug/"/> <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/replica-of/replicaof-repeatedly-fails/.html
<section class="prose w-full py-12 max-w-none"> <h1> Replica Of Repeatedly Fails </h1> <p class="text-lg -mt-5 mb-10"> Troubleshoot when the Replica Of process repeatedly fails and restarts. </p> <p> <strong> Problem </strong> : The Replica Of process repeatedly fails and restarts </p> <p> <strong> Diagnostic </strong> : A log entry in the Redis log of the source database shows repeated failures and restarts. </p> <p> <strong> Cause </strong> : The Redis "client-output-buffer-limit" setting on the source database is configured to a relatively small value, which causes the connection drop. </p> <p> <strong> Resolution </strong> : Reconfigure the buffer on the source database to a bigger value: </p> <ul> <li> <p> If the source is a Redis database on a Redis Enterprise Software cluster, increase the replica buffer size of the <strong> source database </strong> with: </p> <p> <code> rladmin tune db &lt; db:id | name &gt; slave_buffer &lt; value &gt; </code> </p> </li> <li> <p> If the source is a Redis database not on a Redis Enterprise Software cluster, use the <a href="http://redis.io/commands/config-set"> config set </a> command through <code> redis-cli </code> to increase the client output buffer size of the <strong> source database </strong> with: </p> <p> <code> config set client-output-buffer-limit "slave &lt;hard_limit&gt; &lt;soft_limit&gt; &lt;soft_seconds&gt;" </code> </p> </li> </ul> <p> <strong> Additional information </strong> : <a href="https://redislabs.com/blog/top-redis-headaches-for-devops-replication-buffer"> Top Redis Headaches for DevOps - Replication Buffer </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/replica-of/replicaof-repeatedly-fails/"/> <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.dropindex.html
<section class="prose w-full py-12"> <h1 class="command-name"> FT.DROPINDEX </h1> <div class="font-semibold text-redis-ink-900"> Syntax </div> <pre class="command-syntax">FT.DROPINDEX index [DD] </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 2.0.0 </a> </dd> <dt class="font-semibold text-redis-ink-900 m-0"> Time complexity: </dt> <dd class="m-0"> O(1) or O(N) if documents are deleted, where N is the number of keys in the keyspace </dd> </dl> <p> Delete an index </p> <p> <a href="#examples"> Examples </a> </p> <h2 id="required-arguments"> Required arguments </h2> <details open=""> <summary> <code> index </code> </summary> <p> is full-text index name. You must first create the index using <a href="/docs/latest/commands/ft.create/"> <code> FT.CREATE </code> </a> . </p> </details> <h2 id="optional-arguments"> Optional arguments </h2> <details open=""> <summary> <code> DD </code> </summary> <p> drop index operation that, if set, deletes the actual document keys. <code> FT.DROPINDEX index DD </code> is an asynchronous operation. </p> <p> By default, FT.DROPINDEX does not delete the documents associated with the index. Adding the <code> DD </code> option deletes the documents as well. If an index creation is still running ( <a href="/docs/latest/commands/ft.create/"> <code> FT.CREATE </code> </a> is running asynchronously), only the document hashes that have already been indexed are deleted. The document hashes left to be indexed remain in the database. To check the completion of the indexing, use <a href="/docs/latest/commands/ft.info/"> <code> FT.INFO </code> </a> . </p> </details> <h2 id="return"> Return </h2> <p> FT.DROPINDEX 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> Delete an index </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&gt; FT.DROPINDEX idx DD </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.create/"> <code> FT.CREATE </code> </a> | <a href="/docs/latest/commands/ft.info/"> <code> FT.INFO </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.dropindex/"/> <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/groupcluster.html
<section class="prose w-full py-12"> <h1> Commands </h1> </section>
https://redis.io/docs/latest/commands/expire/.html
<section class="prose w-full py-12"> <h1 class="command-name"> EXPIRE </h1> <div class="font-semibold text-redis-ink-900"> Syntax </div> <pre class="command-syntax">EXPIRE key 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.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> @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> Set a timeout on <code> key </code> . After the timeout has expired, the key will automatically be deleted. A key with an associated timeout is often said to be <em> volatile </em> in Redis terminology. </p> <p> The timeout will only be cleared by commands that delete or overwrite the contents of the key, including <a href="/docs/latest/commands/del/"> <code> DEL </code> </a> , <a href="/docs/latest/commands/set/"> <code> SET </code> </a> , <a href="/docs/latest/commands/getset/"> <code> GETSET </code> </a> and all the <code> *STORE </code> commands. This means that all the operations that conceptually <em> alter </em> the value stored at the key without replacing it with a new one will leave the timeout untouched. For instance, incrementing the value of a key with <a href="/docs/latest/commands/incr/"> <code> INCR </code> </a> , pushing a new value into a list with <a href="/docs/latest/commands/lpush/"> <code> LPUSH </code> </a> , or altering the field value of a hash with <a href="/docs/latest/commands/hset/"> <code> HSET </code> </a> are all operations that will leave the timeout untouched. </p> <p> The timeout can also be cleared, turning the key back into a persistent key, using the <a href="/docs/latest/commands/persist/"> <code> PERSIST </code> </a> command. </p> <p> If a key is renamed with <a href="/docs/latest/commands/rename/"> <code> RENAME </code> </a> , the associated time to live is transferred to the new key name. </p> <p> If a key is overwritten by <a href="/docs/latest/commands/rename/"> <code> RENAME </code> </a> , like in the case of an existing key <code> Key_A </code> that is overwritten by a call like <code> RENAME Key_B Key_A </code> , it does not matter if the original <code> Key_A </code> had a timeout associated or not, the new key <code> Key_A </code> will inherit all the characteristics of <code> Key_B </code> . </p> <p> Note that calling <code> EXPIRE </code> / <a href="/docs/latest/commands/pexpire/"> <code> PEXPIRE </code> </a> with a non-positive timeout or <a href="/docs/latest/commands/expireat/"> <code> EXPIREAT </code> </a> / <a href="/docs/latest/commands/pexpireat/"> <code> PEXPIREAT </code> </a> with a time in the past will result in the key being <a href="/commands/del"> deleted </a> rather than expired (accordingly, the emitted <a href="/develop/use/keyspace-notifications"> key event </a> will be <code> del </code> , not <code> expired </code> ). </p> <h2 id="options"> Options </h2> <p> The <code> EXPIRE </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="refreshing-expires"> Refreshing expires </h2> <p> It is possible to call <code> EXPIRE </code> using as argument a key that already has an existing expire set. In this case the time to live of a key is <em> updated </em> to the new value. There are many useful applications for this, an example is documented in the <em> Navigation session </em> pattern section below. </p> <h2 id="differences-in-redis-prior-213"> Differences in Redis prior 2.1.3 </h2> <p> In Redis versions prior <strong> 2.1.3 </strong> altering a key with an expire set using a command altering its value had the effect of removing the key entirely. This semantics was needed because of limitations in the replication layer that are now fixed. </p> <p> <code> EXPIRE </code> would return 0 and not alter the timeout for a key with a timeout set. </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_generic-stepexpire"> <input checked="" class="radiotab w-0 h-0" data-lang="redis-cli" id="redis-cli_cmds_generic-stepexpire" name="cmds_generic-stepexpire" 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_generic-stepexpire" title="Open example"> &gt;_ Redis CLI </label> <div aria-labelledby="tab-cmds_generic-stepexpire" class="panel order-last hidden w-full mt-0 relative" id="panel_redis-cli_cmds_generic-stepexpire" role="tabpanel" tabindex="0"> <div class="highlight"> <pre class="chroma"><code class="language-plaintext" data-lang="plaintext"><span class="line hl"><span class="cl">&gt; SET mykey "Hello" </span></span><span class="line hl"><span class="cl">"OK" </span></span><span class="line hl"><span class="cl">&gt; EXPIRE mykey 10 </span></span><span class="line hl"><span class="cl">(integer) 1 </span></span><span class="line hl"><span class="cl">&gt; TTL mykey </span></span><span class="line hl"><span class="cl">(integer) 10 </span></span><span class="line hl"><span class="cl">&gt; SET mykey "Hello World" </span></span><span class="line hl"><span class="cl">"OK" </span></span><span class="line hl"><span class="cl">&gt; TTL mykey </span></span><span class="line hl"><span class="cl">(integer) -1 </span></span><span class="line hl"><span class="cl">&gt; EXPIRE mykey 10 XX </span></span><span class="line hl"><span class="cl">(integer) 0 </span></span><span class="line hl"><span class="cl">&gt; TTL mykey </span></span><span class="line hl"><span class="cl">(integer) -1 </span></span><span class="line hl"><span class="cl">&gt; EXPIRE mykey 10 NX </span></span><span class="line hl"><span class="cl">(integer) 1 </span></span><span class="line hl"><span class="cl">&gt; TTL mykey </span></span><span class="line hl"><span class="cl">(integer) 10</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_generic-stepexpire')" 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_generic-stepexpire" name="cmds_generic-stepexpire" 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_generic-stepexpire" title="Open example"> Python </label> <div aria-labelledby="tab-cmds_generic-stepexpire" class="panel order-last hidden w-full mt-0 relative" id="panel_Python_cmds_generic-stepexpire" 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">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">set</span><span class="p">(</span><span class="s2">"key1"</span><span class="p">,</span> <span class="s2">"Hello"</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"># &gt;&gt;&gt; True</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">set</span><span class="p">(</span><span class="s2">"key2"</span><span class="p">,</span> <span class="s2">"World"</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"># &gt;&gt;&gt; True</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">delete</span><span class="p">(</span><span class="s2">"key1"</span><span class="p">,</span> <span class="s2">"key2"</span><span class="p">,</span> <span class="s2">"key3"</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"># &gt;&gt;&gt; 2</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">set</span><span class="p">(</span><span class="s2">"mykey"</span><span class="p">,</span> <span class="s2">"Hello"</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"># &gt;&gt;&gt; True</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">expire</span><span class="p">(</span><span class="s2">"mykey"</span><span class="p">,</span> <span class="mi">10</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"># &gt;&gt;&gt; True</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">ttl</span><span class="p">(</span><span class="s2">"mykey"</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"># &gt;&gt;&gt; 10</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">set</span><span class="p">(</span><span class="s2">"mykey"</span><span class="p">,</span> <span class="s2">"Hello World"</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"># &gt;&gt;&gt; True</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">ttl</span><span class="p">(</span><span class="s2">"mykey"</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"># &gt;&gt;&gt; -1</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">expire</span><span class="p">(</span><span class="s2">"mykey"</span><span class="p">,</span> <span class="mi">10</span><span class="p">,</span> <span class="n">xx</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"># &gt;&gt;&gt; False</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">ttl</span><span class="p">(</span><span class="s2">"mykey"</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"># &gt;&gt;&gt; -1</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">expire</span><span class="p">(</span><span class="s2">"mykey"</span><span class="p">,</span> <span class="mi">10</span><span class="p">,</span> <span class="n">nx</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"># &gt;&gt;&gt; True</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">ttl</span><span class="p">(</span><span class="s2">"mykey"</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"># &gt;&gt;&gt; 10</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">set</span><span class="p">(</span><span class="s2">"mykey"</span><span class="p">,</span> <span class="s2">"Hello"</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"># &gt;&gt;&gt; True</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">expire</span><span class="p">(</span><span class="s2">"mykey"</span><span class="p">,</span> <span class="mi">10</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"># &gt;&gt;&gt; True</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">ttl</span><span class="p">(</span><span class="s2">"mykey"</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"># &gt;&gt;&gt; 10</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">sadd</span><span class="p">(</span><span class="s2">"myset"</span><span class="p">,</span> <span class="o">*</span><span class="nb">set</span><span class="p">([</span><span class="mi">1</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="s2">"foo"</span><span class="p">,</span> <span class="s2">"foobar"</span><span class="p">,</span> <span class="s2">"feelsgood"</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"># &gt;&gt;&gt; 6</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="nb">list</span><span class="p">(</span><span class="n">r</span><span class="o">.</span><span class="n">sscan_iter</span><span class="p">(</span><span class="s2">"myset"</span><span class="p">,</span> <span class="n">match</span><span class="o">=</span><span class="s2">"f*"</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"># &gt;&gt;&gt; ['foobar', 'foo', 'feelsgood']</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">cursor</span><span class="p">,</span> <span class="n">key</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">scan</span><span class="p">(</span><span class="n">cursor</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">match</span><span class="o">=</span><span class="s1">'*11*'</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">cursor</span><span class="p">,</span> <span class="n">key</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="n">cursor</span><span class="p">,</span> <span class="n">key</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">scan</span><span class="p">(</span><span class="n">cursor</span><span class="p">,</span> <span class="n">match</span><span class="o">=</span><span class="s1">'*11*'</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">cursor</span><span class="p">,</span> <span class="n">key</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="n">cursor</span><span class="p">,</span> <span class="n">key</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">scan</span><span class="p">(</span><span class="n">cursor</span><span class="p">,</span> <span class="n">match</span><span class="o">=</span><span class="s1">'*11*'</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">cursor</span><span class="p">,</span> <span class="n">key</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="n">cursor</span><span class="p">,</span> <span class="n">key</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">scan</span><span class="p">(</span><span class="n">cursor</span><span class="p">,</span> <span class="n">match</span><span class="o">=</span><span class="s1">'*11*'</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">cursor</span><span class="p">,</span> <span class="n">key</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="n">cursor</span><span class="p">,</span> <span class="n">keys</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">scan</span><span class="p">(</span><span class="n">cursor</span><span class="p">,</span> <span class="n">match</span><span class="o">=</span><span class="s1">'*11*'</span><span class="p">,</span> <span class="n">count</span><span class="o">=</span><span class="mi">1000</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">cursor</span><span class="p">,</span> <span class="n">keys</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="n">res</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">geoadd</span><span class="p">(</span><span class="s2">"geokey"</span><span class="p">,</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="s2">"value"</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"># &gt;&gt;&gt; 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">"zkey"</span><span class="p">,</span> <span class="p">{</span><span class="s2">"value"</span><span class="p">:</span> <span class="mi">1000</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"># &gt;&gt;&gt; 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">type</span><span class="p">(</span><span class="s2">"geokey"</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"># &gt;&gt;&gt; zset</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">type</span><span class="p">(</span><span class="s2">"zkey"</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"># &gt;&gt;&gt; zset</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="n">cursor</span><span class="p">,</span> <span class="n">keys</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">scan</span><span class="p">(</span><span class="n">cursor</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">_type</span><span class="o">=</span><span class="s2">"zset"</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">keys</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="c1"># &gt;&gt;&gt; ['zkey', 'geokey']</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">hset</span><span class="p">(</span><span class="s2">"myhash"</span><span class="p">,</span> <span class="n">mapping</span><span class="o">=</span><span class="p">{</span><span class="s2">"a"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span> <span class="s2">"b"</span><span class="p">:</span> <span class="mi">2</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"># &gt;&gt;&gt; 2</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="n">cursor</span><span class="p">,</span> <span class="n">keys</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">hscan</span><span class="p">(</span><span class="s2">"myhash"</span><span class="p">,</span> <span class="mi">0</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">keys</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="c1"># &gt;&gt;&gt; {'a': '1', 'b': '2'}</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="n">cursor</span><span class="p">,</span> <span class="n">keys</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">hscan</span><span class="p">(</span><span class="s2">"myhash"</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="n">no_values</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">keys</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="c1"># &gt;&gt;&gt; ['a', 'b']</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_Python_cmds_generic-stepexpire')" 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_generic-stepexpire" 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_generic.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_generic-stepexpire" name="cmds_generic-stepexpire" 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_generic-stepexpire" title="Open example"> Node.js </label> <div aria-labelledby="tab-cmds_generic-stepexpire" class="panel order-last hidden w-full mt-0 relative" id="panel_Nodejs_cmds_generic-stepexpire" 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="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">delRes1</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">set</span><span class="p">(</span><span class="s1">'key1'</span><span class="p">,</span> <span class="s1">'Hello'</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">delRes1</span><span class="p">);</span> <span class="c1">// OK </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">delRes2</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">set</span><span class="p">(</span><span class="s1">'key2'</span><span class="p">,</span> <span class="s1">'World'</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">delRes2</span><span class="p">);</span> <span class="c1">// OK </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">delRes3</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">del</span><span class="p">([</span><span class="s1">'key1'</span><span class="p">,</span> <span class="s1">'key2'</span><span class="p">,</span> <span class="s1">'key3'</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">delRes3</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 hl"><span class="cl"><span class="kr">const</span> <span class="nx">expireRes1</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">set</span><span class="p">(</span><span class="s1">'mykey'</span><span class="p">,</span> <span class="s1">'Hello'</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">expireRes1</span><span class="p">);</span> <span class="c1">// OK </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">expireRes2</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">expire</span><span class="p">(</span><span class="s1">'mykey'</span><span class="p">,</span> <span class="mi">10</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">expireRes2</span><span class="p">);</span> <span class="c1">// true </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">expireRes3</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">ttl</span><span class="p">(</span><span class="s1">'mykey'</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">expireRes3</span><span class="p">);</span> <span class="c1">// 10 </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">expireRes4</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">set</span><span class="p">(</span><span class="s1">'mykey'</span><span class="p">,</span> <span class="s1">'Hello World'</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">expireRes4</span><span class="p">);</span> <span class="c1">// OK </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">expireRes5</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">ttl</span><span class="p">(</span><span class="s1">'mykey'</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">expireRes5</span><span class="p">);</span> <span class="c1">// -1 </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">expireRes6</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">expire</span><span class="p">(</span><span class="s1">'mykey'</span><span class="p">,</span> <span class="mi">10</span><span class="p">,</span> <span class="s2">"XX"</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">expireRes6</span><span class="p">);</span> <span class="c1">// false </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">expireRes7</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">ttl</span><span class="p">(</span><span class="s1">'mykey'</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">expireRes7</span><span class="p">);</span> <span class="c1">// -1 </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">expireRes8</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">expire</span><span class="p">(</span><span class="s1">'mykey'</span><span class="p">,</span> <span class="mi">10</span><span class="p">,</span> <span class="s2">"NX"</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">expireRes8</span><span class="p">);</span> <span class="c1">// true </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">expireRes9</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">ttl</span><span class="p">(</span><span class="s1">'mykey'</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">expireRes9</span><span class="p">);</span> <span class="c1">// 10 </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">ttlRes1</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">set</span><span class="p">(</span><span class="s1">'mykey'</span><span class="p">,</span> <span class="s1">'Hello'</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">ttlRes1</span><span class="p">);</span> <span class="c1">// OK </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">ttlRes2</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">expire</span><span class="p">(</span><span class="s1">'mykey'</span><span class="p">,</span> <span class="mi">10</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">ttlRes2</span><span class="p">);</span> <span class="c1">// true </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">ttlRes3</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">ttl</span><span class="p">(</span><span class="s1">'mykey'</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">ttlRes3</span><span class="p">);</span> <span class="c1">// 10 </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">scan1Res1</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">sAdd</span><span class="p">(</span><span class="s1">'myset'</span><span class="p">,</span> <span class="p">[</span><span class="s1">'1'</span><span class="p">,</span> <span class="s1">'2'</span><span class="p">,</span> <span class="s1">'3'</span><span class="p">,</span> <span class="s1">'foo'</span><span class="p">,</span> <span class="s1">'foobar'</span><span class="p">,</span> <span class="s1">'feelsgood'</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">scan1Res1</span><span class="p">);</span> <span class="c1">// 6 </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">scan1Res2</span> <span class="o">=</span> <span class="p">[];</span> </span></span><span class="line"><span class="cl"><span class="k">for</span> <span class="kr">await</span> <span class="p">(</span><span class="kr">const</span> <span class="nx">value</span> <span class="k">of</span> <span class="nx">client</span><span class="p">.</span><span class="nx">sScanIterator</span><span class="p">(</span><span class="s1">'myset'</span><span class="p">,</span> <span class="p">{</span> <span class="nx">MATCH</span><span class="o">:</span> <span class="s1">'f*'</span> <span class="p">}))</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="nx">scan1Res2</span><span class="p">.</span><span class="nx">push</span><span class="p">(</span><span class="nx">value</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">scan1Res2</span><span class="p">);</span> <span class="c1">// ['foo', 'foobar', 'feelsgood'] </span></span></span><span class="line"><span class="cl"><span class="c1"></span> </span></span><span class="line"><span class="cl"><span class="kd">let</span> <span class="nx">cursor</span> <span class="o">=</span> <span class="s1">'0'</span><span class="p">;</span> </span></span><span class="line"><span class="cl"><span class="kd">let</span> <span class="nx">scanResult</span><span class="p">;</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="nx">scanResult</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">scan</span><span class="p">(</span><span class="nx">cursor</span><span class="p">,</span> <span class="p">{</span> <span class="nx">MATCH</span><span class="o">:</span> <span class="s1">'*11*'</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">scanResult</span><span class="p">.</span><span class="nx">cursor</span><span class="p">,</span> <span class="nx">scanResult</span><span class="p">.</span><span class="nx">keys</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="nx">scanResult</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">scan</span><span class="p">(</span><span class="nx">scanResult</span><span class="p">.</span><span class="nx">cursor</span><span class="p">,</span> <span class="p">{</span> <span class="nx">MATCH</span><span class="o">:</span> <span class="s1">'*11*'</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">scanResult</span><span class="p">.</span><span class="nx">cursor</span><span class="p">,</span> <span class="nx">scanResult</span><span class="p">.</span><span class="nx">keys</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="nx">scanResult</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">scan</span><span class="p">(</span><span class="nx">scanResult</span><span class="p">.</span><span class="nx">cursor</span><span class="p">,</span> <span class="p">{</span> <span class="nx">MATCH</span><span class="o">:</span> <span class="s1">'*11*'</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">scanResult</span><span class="p">.</span><span class="nx">cursor</span><span class="p">,</span> <span class="nx">scanResult</span><span class="p">.</span><span class="nx">keys</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="nx">scanResult</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">scan</span><span class="p">(</span><span class="nx">scanResult</span><span class="p">.</span><span class="nx">cursor</span><span class="p">,</span> <span class="p">{</span> <span class="nx">MATCH</span><span class="o">:</span> <span class="s1">'*11*'</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">scanResult</span><span class="p">.</span><span class="nx">cursor</span><span class="p">,</span> <span class="nx">scanResult</span><span class="p">.</span><span class="nx">keys</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="nx">scanResult</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">scan</span><span class="p">(</span><span class="nx">scanResult</span><span class="p">.</span><span class="nx">cursor</span><span class="p">,</span> <span class="p">{</span> <span class="nx">MATCH</span><span class="o">:</span> <span class="s1">'*11*'</span><span class="p">,</span> <span class="nx">COUNT</span><span class="o">:</span> <span class="mi">1000</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">scanResult</span><span class="p">.</span><span class="nx">cursor</span><span class="p">,</span> <span class="nx">scanResult</span><span class="p">.</span><span class="nx">keys</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">scan3Res1</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">geoAdd</span><span class="p">(</span><span class="s1">'geokey'</span><span class="p">,</span> <span class="p">{</span> <span class="nx">longitude</span><span class="o">:</span> <span class="mi">0</span><span class="p">,</span> <span class="nx">latitude</span><span class="o">:</span> <span class="mi">0</span><span class="p">,</span> <span class="nx">member</span><span class="o">:</span> <span class="s1">'value'</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">scan3Res1</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="kr">const</span> <span class="nx">scan3Res2</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="s1">'zkey'</span><span class="p">,</span> <span class="p">[{</span> <span class="nx">score</span><span class="o">:</span> <span class="mi">1000</span><span class="p">,</span> <span class="nx">value</span><span class="o">:</span> <span class="s1">'value'</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">scan3Res2</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="kr">const</span> <span class="nx">scan3Res3</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">type</span><span class="p">(</span><span class="s1">'geokey'</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">scan3Res3</span><span class="p">);</span> <span class="c1">// zset </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">scan3Res4</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">type</span><span class="p">(</span><span class="s1">'zkey'</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">scan3Res4</span><span class="p">);</span> <span class="c1">// zset </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">scan3Res5</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">scan</span><span class="p">(</span><span class="s1">'0'</span><span class="p">,</span> <span class="p">{</span> <span class="nx">TYPE</span><span class="o">:</span> <span class="s1">'zset'</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">scan3Res5</span><span class="p">.</span><span class="nx">keys</span><span class="p">);</span> <span class="c1">// ['zkey', 'geokey'] </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">scan4Res1</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hSet</span><span class="p">(</span><span class="s1">'myhash'</span><span class="p">,</span> <span class="p">{</span> <span class="nx">a</span><span class="o">:</span> <span class="mi">1</span><span class="p">,</span> <span class="nx">b</span><span class="o">:</span> <span class="mi">2</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">scan4Res1</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="kr">const</span> <span class="nx">scan4Res2</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hScan</span><span class="p">(</span><span class="s1">'myhash'</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">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">scan4Res2</span><span class="p">.</span><span class="nx">tuples</span><span class="p">);</span> <span class="c1">// [{field: 'a', value: '1'}, {field: 'b', value: '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">scan4Res3</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hScan</span><span class="p">(</span><span class="s1">'myhash'</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="p">{</span> <span class="nx">COUNT</span><span class="o">:</span> <span class="mi">10</span> <span class="p">});</span> </span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">items</span> <span class="o">=</span> <span class="nx">scan4Res3</span><span class="p">.</span><span class="nx">tuples</span><span class="p">.</span><span class="nx">map</span><span class="p">((</span><span class="nx">item</span><span class="p">)</span> <span class="p">=&gt;</span> <span class="nx">item</span><span class="p">.</span><span class="nx">field</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">items</span><span class="p">);</span> <span class="c1">// ['a', 'b'] </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_generic-stepexpire')" 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_generic-stepexpire" 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-generic.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_generic-stepexpire" name="cmds_generic-stepexpire" 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_generic-stepexpire" title="Open example"> Java </label> <div aria-labelledby="tab-cmds_generic-stepexpire" class="panel order-last hidden w-full mt-0 relative" id="panel_Java_cmds_generic-stepexpire" 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">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.args.ExpiryOption</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">CmdsGenericExample</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 class="n">String</span> <span class="n">delResult1</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">set</span><span class="o">(</span><span class="s">"key1"</span><span class="o">,</span> <span class="s">"Hello"</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">delResult1</span><span class="o">);</span> <span class="c1">// &gt;&gt;&gt; OK </span></span></span><span class="line"><span class="cl"><span class="c1"></span> </span></span><span class="line"><span class="cl"> <span class="n">String</span> <span class="n">delResult2</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">set</span><span class="o">(</span><span class="s">"key2"</span><span class="o">,</span> <span class="s">"World"</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">delResult2</span><span class="o">);</span> <span class="c1">// &gt;&gt;&gt; OK </span></span></span><span class="line"><span class="cl"><span class="c1"></span> </span></span><span class="line"><span class="cl"> <span class="kt">long</span> <span class="n">delResult3</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">del</span><span class="o">(</span><span class="s">"key1"</span><span class="o">,</span> <span class="s">"key2"</span><span class="o">,</span> <span class="s">"key3"</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">delResult3</span><span class="o">);</span> <span class="c1">// &gt;&gt;&gt; 2 </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 'del' 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">String</span> <span class="n">expireResult1</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">set</span><span class="o">(</span><span class="s">"mykey"</span><span class="o">,</span> <span class="s">"Hello"</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">expireResult1</span><span class="o">);</span> <span class="c1">// &gt;&gt;&gt; OK </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="kt">long</span> <span class="n">expireResult2</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">expire</span><span class="o">(</span><span class="s">"mykey"</span><span class="o">,</span> <span class="mi">10</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">expireResult2</span><span class="o">);</span> <span class="c1">// &gt;&gt;&gt; 1 </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="kt">long</span> <span class="n">expireResult3</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">ttl</span><span class="o">(</span><span class="s">"mykey"</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">expireResult3</span><span class="o">);</span> <span class="c1">// &gt;&gt;&gt; 10 </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">String</span> <span class="n">expireResult4</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">set</span><span class="o">(</span><span class="s">"mykey"</span><span class="o">,</span> <span class="s">"Hello World"</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">expireResult4</span><span class="o">);</span> <span class="c1">// &gt;&gt;&gt; OK </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="kt">long</span> <span class="n">expireResult5</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">ttl</span><span class="o">(</span><span class="s">"mykey"</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">expireResult5</span><span class="o">);</span> <span class="c1">// &gt;&gt;&gt; -1 </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="kt">long</span> <span class="n">expireResult6</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">expire</span><span class="o">(</span><span class="s">"mykey"</span><span class="o">,</span> <span class="mi">10</span><span class="o">,</span> <span class="n">ExpiryOption</span><span class="o">.</span><span class="na">XX</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">expireResult6</span><span class="o">);</span> <span class="c1">// &gt;&gt;&gt; 0 </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="kt">long</span> <span class="n">expireResult7</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">ttl</span><span class="o">(</span><span class="s">"mykey"</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">expireResult7</span><span class="o">);</span> <span class="c1">// &gt;&gt;&gt; -1 </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="kt">long</span> <span class="n">expireResult8</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">expire</span><span class="o">(</span><span class="s">"mykey"</span><span class="o">,</span> <span class="mi">10</span><span class="o">,</span> <span class="n">ExpiryOption</span><span class="o">.</span><span class="na">NX</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">expireResult8</span><span class="o">);</span> <span class="c1">// &gt;&gt;&gt; 1 </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="kt">long</span> <span class="n">expireResult9</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">ttl</span><span class="o">(</span><span class="s">"mykey"</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">expireResult9</span><span class="o">);</span> <span class="c1">// &gt;&gt;&gt; 10 </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 'expire' 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">String</span> <span class="n">ttlResult1</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">set</span><span class="o">(</span><span class="s">"mykey"</span><span class="o">,</span> <span class="s">"Hello"</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">ttlResult1</span><span class="o">);</span> <span class="c1">// &gt;&gt;&gt; OK </span></span></span><span class="line"><span class="cl"><span class="c1"></span> </span></span><span class="line"><span class="cl"> <span class="kt">long</span> <span class="n">ttlResult2</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">expire</span><span class="o">(</span><span class="s">"mykey"</span><span class="o">,</span> <span class="mi">10</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">ttlResult2</span><span class="o">);</span> <span class="c1">// &gt;&gt;&gt; 1 </span></span></span><span class="line"><span class="cl"><span class="c1"></span> </span></span><span class="line"><span class="cl"> <span class="kt">long</span> <span class="n">ttlResult3</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">ttl</span><span class="o">(</span><span class="s">"mykey"</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">ttlResult3</span><span class="o">);</span> <span class="c1">// &gt;&gt;&gt; 10 </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 'ttl' 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_generic-stepexpire')" 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_generic-stepexpire" 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/CmdsGenericExample.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_generic-stepexpire" name="cmds_generic-stepexpire" 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_generic-stepexpire" title="Open example"> Go </label> <div aria-labelledby="tab-cmds_generic-stepexpire" class="panel order-last hidden w-full mt-0 relative" id="panel_Go_cmds_generic-stepexpire" 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 class="s">"math"</span> </span></span><span class="line"><span class="cl"> <span class="s">"time"</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_del_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">&amp;</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">delResult1</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">Set</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"key1"</span><span class="p">,</span> <span class="s">"Hello"</span><span class="p">,</span> <span class="mi">0</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">delResult1</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; OK </span></span></span><span class="line"><span class="cl"><span class="c1"></span> </span></span><span class="line"><span class="cl"> <span class="nx">delResult2</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">Set</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"key2"</span><span class="p">,</span> <span class="s">"World"</span><span class="p">,</span> <span class="mi">0</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">delResult2</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; OK </span></span></span><span class="line"><span class="cl"><span class="c1"></span> </span></span><span class="line"><span class="cl"> <span class="nx">delResult3</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">Del</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"key1"</span><span class="p">,</span> <span class="s">"key2"</span><span class="p">,</span> <span class="s">"key3"</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">delResult3</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; 2 </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_expire_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">&amp;</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">expireResult1</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">Set</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"mykey"</span><span class="p">,</span> <span class="s">"Hello"</span><span class="p">,</span> <span class="mi">0</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">expireResult1</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; OK </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">expireResult2</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">Expire</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"mykey"</span><span class="p">,</span> <span class="mi">10</span><span class="o">*</span><span class="nx">time</span><span class="p">.</span><span class="nx">Second</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">expireResult2</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; true </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">expireResult3</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">TTL</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"mykey"</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">math</span><span class="p">.</span><span class="nf">Round</span><span class="p">(</span><span class="nx">expireResult3</span><span class="p">.</span><span class="nf">Seconds</span><span class="p">()))</span> <span class="c1">// &gt;&gt;&gt; 10 </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">expireResult4</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">Set</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"mykey"</span><span class="p">,</span> <span class="s">"Hello World"</span><span class="p">,</span> <span class="mi">0</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">expireResult4</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; OK </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">expireResult5</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">TTL</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"mykey"</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">expireResult5</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; -1ns </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">expireResult6</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">ExpireXX</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"mykey"</span><span class="p">,</span> <span class="mi">10</span><span class="o">*</span><span class="nx">time</span><span class="p">.</span><span class="nx">Second</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">expireResult6</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; false </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">expireResult7</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">TTL</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"mykey"</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">expireResult7</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; -1ns </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">expireResult8</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">ExpireNX</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"mykey"</span><span class="p">,</span> <span class="mi">10</span><span class="o">*</span><span class="nx">time</span><span class="p">.</span><span class="nx">Second</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">expireResult8</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; true </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">expireResult9</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">TTL</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"mykey"</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">math</span><span class="p">.</span><span class="nf">Round</span><span class="p">(</span><span class="nx">expireResult9</span><span class="p">.</span><span class="nf">Seconds</span><span class="p">()))</span> <span class="c1">// &gt;&gt;&gt; 10 </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_ttl_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">&amp;</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">ttlResult1</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">Set</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"mykey"</span><span class="p">,</span> <span class="s">"Hello"</span><span class="p">,</span> <span class="mi">10</span><span class="o">*</span><span class="nx">time</span><span class="p">.</span><span class="nx">Second</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">ttlResult1</span><span class="p">)</span> <span class="c1">// &gt;&gt;&gt; OK </span></span></span><span class="line"><span class="cl"><span class="c1"></span> </span></span><span class="line"><span class="cl"> <span class="nx">ttlResult2</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">TTL</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="s">"mykey"</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">math</span><span class="p">.</span><span class="nf">Round</span><span class="p">(</span><span class="nx">ttlResult2</span><span class="p">.</span><span class="nf">Seconds</span><span class="p">()))</span> <span class="c1">// &gt;&gt;&gt; 10 </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_generic-stepexpire')" 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_generic-stepexpire" 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_generic_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_generic-stepexpire" name="cmds_generic-stepexpire" 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_generic-stepexpire" title="Open example"> C# </label> <div aria-labelledby="tab-cmds_generic-stepexpire" class="panel order-last hidden w-full mt-0 relative" id="panel_Csharp_cmds_generic-stepexpire" 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">CmdsGenericExample</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 'copy' 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">delResult1</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">StringSet</span><span class="p">(</span><span class="s">"key1"</span><span class="p">,</span> <span class="s">"Hello"</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">delResult1</span><span class="p">);</span> <span class="c1">// &gt;&gt;&gt; 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">delResult2</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">StringSet</span><span class="p">(</span><span class="s">"key2"</span><span class="p">,</span> <span class="s">"World"</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">delResult2</span><span class="p">);</span> <span class="c1">// &gt;&gt;&gt; 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">delResult3</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">KeyDelete</span><span class="p">(</span><span class="k">new</span> <span class="n">RedisKey</span><span class="p">[]</span> <span class="p">{</span> <span class="s">"key1"</span><span class="p">,</span> <span class="s">"key2"</span><span class="p">,</span> <span class="s">"key3"</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">delResult3</span><span class="p">);</span> <span class="c1">// &gt;&gt;&gt; 2</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'del' 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 'dump' 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 'exists' step.</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line hl"><span class="cl"> <span class="kt">bool</span> <span class="n">expireResult1</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">StringSet</span><span class="p">(</span><span class="s">"mykey"</span><span class="p">,</span> <span class="s">"Hello"</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="n">expireResult1</span><span class="p">);</span> <span class="c1">// &gt;&gt;&gt; true</span> </span></span><span class="line hl"><span class="cl"> </span></span><span class="line hl"><span class="cl"> <span class="kt">bool</span> <span class="n">expireResult2</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">KeyExpire</span><span class="p">(</span><span class="s">"mykey"</span><span class="p">,</span> <span class="k">new</span> <span class="n">TimeSpan</span><span class="p">(</span><span class="m">0</span><span class="p">,</span> <span class="m">0</span><span class="p">,</span> <span class="m">10</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="n">expireResult2</span><span class="p">);</span> <span class="c1">// &gt;&gt;&gt; true</span> </span></span><span class="line hl"><span class="cl"> </span></span><span class="line hl"><span class="cl"> <span class="n">TimeSpan</span> <span class="n">expireResult3</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">KeyTimeToLive</span><span class="p">(</span><span class="s">"mykey"</span><span class="p">)</span> <span class="p">??</span> <span class="n">TimeSpan</span><span class="p">.</span><span class="n">Zero</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="n">Math</span><span class="p">.</span><span class="n">Round</span><span class="p">(</span><span class="n">expireResult3</span><span class="p">.</span><span class="n">TotalSeconds</span><span class="p">));</span> <span class="c1">// &gt;&gt;&gt; 10</span> </span></span><span class="line hl"><span class="cl"> </span></span><span class="line hl"><span class="cl"> <span class="kt">bool</span> <span class="n">expireResult4</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">StringSet</span><span class="p">(</span><span class="s">"mykey"</span><span class="p">,</span> <span class="s">"Hello World"</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="n">expireResult4</span><span class="p">);</span> <span class="c1">// &gt;&gt;&gt; true</span> </span></span><span class="line hl"><span class="cl"> </span></span><span class="line hl"><span class="cl"> <span class="n">TimeSpan</span> <span class="n">expireResult5</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">KeyTimeToLive</span><span class="p">(</span><span class="s">"mykey"</span><span class="p">)</span> <span class="p">??</span> <span class="n">TimeSpan</span><span class="p">.</span><span class="n">Zero</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="n">Math</span><span class="p">.</span><span class="n">Round</span><span class="p">(</span><span class="n">expireResult5</span><span class="p">.</span><span class="n">TotalSeconds</span><span class="p">).</span><span class="n">ToString</span><span class="p">());</span> <span class="c1">// &gt;&gt;&gt; 0</span> </span></span><span class="line hl"><span class="cl"> </span></span><span class="line hl"><span class="cl"> <span class="kt">bool</span> <span class="n">expireResult6</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">KeyExpire</span><span class="p">(</span><span class="s">"mykey"</span><span class="p">,</span> <span class="k">new</span> <span class="n">TimeSpan</span><span class="p">(</span><span class="m">0</span><span class="p">,</span> <span class="m">0</span><span class="p">,</span> <span class="m">10</span><span class="p">),</span> <span class="n">ExpireWhen</span><span class="p">.</span><span class="n">HasExpiry</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="n">expireResult6</span><span class="p">);</span> <span class="c1">// &gt;&gt;&gt; false</span> </span></span><span class="line hl"><span class="cl"> </span></span><span class="line hl"><span class="cl"> <span class="n">TimeSpan</span> <span class="n">expireResult7</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">KeyTimeToLive</span><span class="p">(</span><span class="s">"mykey"</span><span class="p">)</span> <span class="p">??</span> <span class="n">TimeSpan</span><span class="p">.</span><span class="n">Zero</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="n">Math</span><span class="p">.</span><span class="n">Round</span><span class="p">(</span><span class="n">expireResult7</span><span class="p">.</span><span class="n">TotalSeconds</span><span class="p">));</span> <span class="c1">// &gt;&gt;&gt; 0</span> </span></span><span class="line hl"><span class="cl"> </span></span><span class="line hl"><span class="cl"> <span class="kt">bool</span> <span class="n">expireResult8</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">KeyExpire</span><span class="p">(</span><span class="s">"mykey"</span><span class="p">,</span> <span class="k">new</span> <span class="n">TimeSpan</span><span class="p">(</span><span class="m">0</span><span class="p">,</span> <span class="m">0</span><span class="p">,</span> <span class="m">10</span><span class="p">),</span> <span class="n">ExpireWhen</span><span class="p">.</span><span class="n">HasNoExpiry</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="n">expireResult8</span><span class="p">);</span> <span class="c1">// &gt;&gt;&gt; true</span> </span></span><span class="line hl"><span class="cl"> </span></span><span class="line hl"><span class="cl"> <span class="n">TimeSpan</span> <span class="n">expireResult9</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">KeyTimeToLive</span><span class="p">(</span><span class="s">"mykey"</span><span class="p">)</span> <span class="p">??</span> <span class="n">TimeSpan</span><span class="p">.</span><span class="n">Zero</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="n">Math</span><span class="p">.</span><span class="n">Round</span><span class="p">(</span><span class="n">expireResult9</span><span class="p">.</span><span class="n">TotalSeconds</span><span class="p">));</span> <span class="c1">// &gt;&gt;&gt; 10</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'expire' 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 'expireat' 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 'expiretime' 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 'keys' 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 'migrate' 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 'move' 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 'object_encoding' 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 'object_freq' 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 'object_idletime' 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 'object_refcount' 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 'persist' 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 'pexpire' 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 'pexpireat' 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 'pexpiretime' 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 'pttl' 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 'randomkey' 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 'rename' 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 'renamenx' 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 'restore' 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 'scan1' 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 'scan2' 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 'scan3' 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 'scan4' 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 'sort' 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 'sort_ro' 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 'touch' 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">ttlResult1</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">StringSet</span><span class="p">(</span><span class="s">"mykey"</span><span class="p">,</span> <span class="s">"Hello"</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">ttlResult1</span><span class="p">);</span> <span class="c1">// &gt;&gt;&gt; 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">ttlResult2</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">KeyExpire</span><span class="p">(</span><span class="s">"mykey"</span><span class="p">,</span> <span class="k">new</span> <span class="n">TimeSpan</span><span class="p">(</span><span class="m">0</span><span class="p">,</span> <span class="m">0</span><span class="p">,</span> <span class="m">10</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">ttlResult2</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="n">TimeSpan</span> <span class="n">ttlResult3</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">KeyTimeToLive</span><span class="p">(</span><span class="s">"mykey"</span><span class="p">)</span> <span class="p">??</span> <span class="n">TimeSpan</span><span class="p">.</span><span class="n">Zero</span><span class="p">;</span> </span></span><span class="line"><span class="cl"> <span class="kt">string</span> <span class="n">ttlRes</span> <span class="p">=</span> <span class="n">Math</span><span class="p">.</span><span class="n">Round</span><span class="p">(</span><span class="n">ttlResult3</span><span class="p">.</span><span class="n">TotalSeconds</span><span class="p">).</span><span class="n">ToString</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">Math</span><span class="p">.</span><span class="n">Round</span><span class="p">(</span><span class="n">ttlResult3</span><span class="p">.</span><span class="n">TotalSeconds</span><span class="p">));</span> <span class="c1">// &gt;&gt;&gt; 10</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'ttl' 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 'type' 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 'unlink' 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 'wait' 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 'waitaof' 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_generic-stepexpire')" 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_generic-stepexpire" 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/CmdsGenericExample.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&gt; SET mykey "Hello" "OK" redis&gt; EXPIRE mykey 10 (integer) 1 redis&gt; TTL mykey (integer) 10 redis&gt; SET mykey "Hello World" "OK" redis&gt; TTL mykey (integer) -1 redis&gt; EXPIRE mykey 10 XX (integer) 0 redis&gt; TTL mykey (integer) -1 redis&gt; EXPIRE mykey 10 NX (integer) 1 redis&gt; TTL mykey (integer) 10 </pre> <div class="prompt" style=""> <span> redis&gt; </span> <input autocomplete="off" name="prompt" spellcheck="false" type="text"/> </div> </form> <h2 id="pattern-navigation-session"> Pattern: Navigation session </h2> <p> Imagine you have a web service and you are interested in the latest N pages <em> recently </em> visited by your users, such that each adjacent page view was not performed more than 60 seconds after the previous. Conceptually you may consider this set of page views as a <em> Navigation session </em> of your user, that may contain interesting information about what kind of products he or she is looking for currently, so that you can recommend related products. </p> <p> You can easily model this pattern in Redis using the following strategy: every time the user does a page view you call the following commands: </p> <pre tabindex="0"><code>MULTI RPUSH pagewviews.user:&lt;userid&gt; http://..... EXPIRE pagewviews.user:&lt;userid&gt; 60 EXEC </code></pre> <p> If the user will be idle more than 60 seconds, the key will be deleted and only subsequent page views that have less than 60 seconds of difference will be recorded. </p> <p> This pattern is easily modified to use counters using <a href="/docs/latest/commands/incr/"> <code> INCR </code> </a> instead of lists using <a href="/docs/latest/commands/rpush/"> <code> RPUSH </code> </a> . </p> <h2 id="appendix-redis-expires"> Appendix: Redis expires </h2> <h3 id="keys-with-an-expire"> Keys with an expire </h3> <p> Normally Redis keys are created without an associated time to live. The key will simply live forever, unless it is removed by the user in an explicit way, for instance using the <a href="/docs/latest/commands/del/"> <code> DEL </code> </a> command. </p> <p> The <code> EXPIRE </code> family of commands is able to associate an expire to a given key, at the cost of some additional memory used by the key. When a key has an expire set, Redis will make sure to remove the key when the specified amount of time elapsed. </p> <p> The key time to live can be updated or entirely removed using the <code> EXPIRE </code> and <a href="/docs/latest/commands/persist/"> <code> PERSIST </code> </a> command (or other strictly related commands). </p> <h3 id="expire-accuracy"> Expire accuracy </h3> <p> In Redis 2.4 the expire might not be pin-point accurate, and it could be between zero to one seconds out. </p> <p> Since Redis 2.6 the expire error is from 0 to 1 milliseconds. </p> <h3 id="expires-and-persistence"> Expires and persistence </h3> <p> Keys expiring information is stored as absolute Unix timestamps (in milliseconds in case of Redis version 2.6 or greater). This means that the time is flowing even when the Redis instance is not active. </p> <p> For expires to work well, the computer time must be taken stable. If you move an RDB file from two computers with a big desync in their clocks, funny things may happen (like all the keys loaded to be expired at loading time). </p> <p> Even running instances will always check the computer clock, so for instance if you set a key with a time to live of 1000 seconds, and then set your computer time 2000 seconds in the future, the key will be expired immediately, instead of lasting for 1000 seconds. </p> <h3 id="how-redis-expires-keys"> How Redis expires keys </h3> <p> Redis keys are expired in two ways: a passive way and an active way. </p> <p> A key is passively expired when a client tries to access it and the key is timed out. </p> <p> However, this is not enough as there are expired keys that will never be accessed again. These keys should be expired anyway, so periodically, Redis tests a few keys at random amongst the set of keys with an expiration. All the keys that are already expired are deleted from the keyspace. </p> <h3 id="how-expires-are-handled-in-the-replication-link-and-aof-file"> How expires are handled in the replication link and AOF file </h3> <p> In order to obtain a correct behavior without sacrificing consistency, when a key expires, a <a href="/docs/latest/commands/del/"> <code> DEL </code> </a> operation is synthesized in both the AOF file and gains all the attached replicas nodes. This way the expiration process is centralized in the master instance, and there is no chance of consistency errors. </p> <p> However while the replicas connected to a master will not expire keys independently (but will wait for the <a href="/docs/latest/commands/del/"> <code> DEL </code> </a> coming from the master), they'll still take the full state of the expires existing in the dataset, so when a replica is elected to master it will be able to expire the keys independently, fully acting as a master. </p> <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/expire/"/> <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/triggers/user_functions/.html
<section class="prose w-full py-12 max-w-none"> <h1> User functions </h1> <p class="text-lg -mt-5 mb-10"> Execute JavaScript functions via <code> TFCALL </code> or <code> TFCALLASYNC </code> </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> All <code> TFCALL </code> command arguments that follow the function name are passed to the function callback. The following example shows how to implement a simple function that returns the value of a key of type string or hash: </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></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="s1">'my_get'</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">key_name</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">client</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="s1">'type'</span><span class="p">,</span> <span class="nx">key_name</span><span class="p">)</span> <span class="o">==</span> <span class="s1">'string'</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="s1">'get'</span><span class="p">,</span> <span class="nx">key_name</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">if</span> <span class="p">(</span><span class="nx">client</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="s1">'type'</span><span class="p">,</span> <span class="nx">key_name</span><span class="p">)</span> <span class="o">==</span> <span class="s1">'hash'</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="s1">'hgetall'</span><span class="p">,</span> <span class="nx">key_name</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">throw</span> <span class="s2">"Unsupported type"</span><span class="p">;</span> </span></span><span class="line"><span class="cl"><span class="p">});</span> </span></span></code></pre> </div> <p> Example of running the preceding function: </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&gt; <span class="nb">set</span> x <span class="m">1</span> </span></span><span class="line"><span class="cl">OK </span></span><span class="line"><span class="cl">127.0.0.1:6379&gt; TFCALL lib.my_get <span class="m">1</span> x </span></span><span class="line"><span class="cl"><span class="s2">"1"</span> </span></span><span class="line"><span class="cl">127.0.0.1:6379&gt; hset h a b x y </span></span><span class="line"><span class="cl"><span class="o">(</span>integer<span class="o">)</span> <span class="m">2</span> </span></span><span class="line"><span class="cl">127.0.0.1:6379&gt; TFCALL lib.my_get <span class="m">1</span> h </span></span><span class="line"><span class="cl">1<span class="o">)</span> <span class="s2">"a"</span> </span></span><span class="line"><span class="cl">2<span class="o">)</span> <span class="s2">"b"</span> </span></span><span class="line"><span class="cl">3<span class="o">)</span> <span class="s2">"x"</span> </span></span><span class="line"><span class="cl">4<span class="o">)</span> <span class="s2">"y"</span> </span></span></code></pre> </div> <p> It is also possible to get all the function arguments as a <code> JS </code> array. This is how we can extend the above example to accept multiple keys and return their values: </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></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="s1">'my_get'</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="p">...</span><span class="nx">keys</span><span class="p">){</span> </span></span><span class="line"><span class="cl"> <span class="kd">var</span> <span class="nx">results</span> <span class="o">=</span> <span class="p">[];</span> </span></span><span class="line"><span class="cl"> <span class="nx">keys</span><span class="p">.</span><span class="nx">forEach</span><span class="p">((</span><span class="nx">key_name</span><span class="p">)=&gt;</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">client</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="s1">'type'</span><span class="p">,</span> <span class="nx">key_name</span><span class="p">)</span> <span class="o">==</span> <span class="s1">'string'</span><span class="p">)</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">push</span><span class="p">(</span><span class="nx">client</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="s1">'get'</span><span class="p">,</span> <span class="nx">key_name</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="p">}</span> </span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="p">(</span><span class="nx">client</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="s1">'type'</span><span class="p">,</span> <span class="nx">key_name</span><span class="p">)</span> <span class="o">==</span> <span class="s1">'hash'</span><span class="p">)</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">push</span><span class="p">(</span><span class="nx">client</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="s1">'hgetall'</span><span class="p">,</span> <span class="nx">key_name</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="p">}</span> </span></span><span class="line"><span class="cl"> <span class="nx">results</span><span class="p">.</span><span class="nx">push</span><span class="p">(</span><span class="s2">"Unsupported type"</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="k">return</span> <span class="nx">results</span><span class="p">;</span> </span></span><span class="line"><span class="cl"> </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&gt; TFCALL foo.my_get <span class="m">2</span> x h </span></span><span class="line"><span class="cl">1<span class="o">)</span> <span class="s2">"1"</span> </span></span><span class="line"><span class="cl">2<span class="o">)</span> 1<span class="o">)</span> <span class="s2">"a"</span> </span></span><span class="line"><span class="cl"> 2<span class="o">)</span> <span class="s2">"b"</span> </span></span><span class="line"><span class="cl"> 3<span class="o">)</span> <span class="s2">"x"</span> </span></span><span class="line"><span class="cl"> 4<span class="o">)</span> <span class="s2">"y"</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/triggers/user_functions/"/> <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/crdb_tasks/.html
<section class="prose w-full py-12 max-w-none"> <h1> CRDB tasks requests </h1> <p class="text-lg -mt-5 mb-10"> Active-Active database task status requests </p> <table> <thead> <tr> <th> Method </th> <th> Path </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> <a href="#get-crdb_task"> GET </a> </td> <td> <code> /v1/crdb_tasks/{task_id} </code> </td> <td> Get the status of an executed task </td> </tr> </tbody> </table> <h2 id="get-crdb_task"> Get task status </h2> <pre><code>GET /v1/crdb_tasks/{task_id} </code></pre> <p> Get the status of an executed task. </p> <p> The status of a completed task is kept for 500 seconds by default. </p> <h3 id="get-request"> Request </h3> <h4 id="example-http-request"> Example HTTP request </h4> <pre><code>GET /crdb_tasks/1 </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> X-Result-TTL </td> <td> integer </td> <td> Task time to live </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> task_id </td> <td> string </td> <td> Task ID </td> </tr> </tbody> </table> <h3 id="get-response"> Response </h3> <p> Returns a <a href="/docs/latest/operate/rs/7.4/references/rest-api/objects/crdb_task/"> CRDB task object </a> . </p> <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> Task status. </td> </tr> <tr> <td> <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2"> 401 Unauthorized </a> </td> <td> Unauthorized request. Invalid credentials </td> </tr> <tr> <td> <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5"> 404 Not Found </a> </td> <td> Task not found. </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/crdb_tasks/"/> <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/ts.alter.html
<section class="prose w-full py-12"> <h1 class="command-name"> TS.ALTER </h1> <div class="font-semibold text-redis-ink-900"> Syntax </div> <pre class="command-syntax">TS.ALTER key [RETENTION retentionPeriod] [CHUNK_SIZE size] [DUPLICATE_POLICY policy] [IGNORE ignoreMaxTimediff ignoreMaxValDiff] [LABELS [label value ...]] </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/timeseries"> TimeSeries 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 number of labels requested to update </dd> </dl> <p> Update the retention, chunk size, duplicate policy, and labels of an existing time series </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 name for the time series. </p> </details> <p> <note> <b> Note: </b> This command alters only the specified element. For example, if you specify only <code> RETENTION </code> and <code> LABELS </code> , the chunk size and the duplicate policy are not altered. </note> </p> <h2 id="optional-arguments"> Optional arguments </h2> <details open=""> <summary> <code> RETENTION retentionPeriod </code> </summary> <p> is maximum retention period, compared to the maximum existing timestamp, in milliseconds. See <code> RETENTION </code> in <a href="/docs/latest/commands/ts.create/"> <code> TS.CREATE </code> </a> . </p> </details> <details open=""> <summary> <code> CHUNK_SIZE size </code> </summary> <p> is the initial allocation size, in bytes, for the data part of each new chunk. Actual chunks may consume more memory. See <code> CHUNK_SIZE </code> in <a href="/docs/latest/commands/ts.create/"> <code> TS.CREATE </code> </a> . Changing this value does not affect existing chunks. </p> </details> <details open=""> <summary> <code> DUPLICATE_POLICY policy </code> </summary> <p> is policy for handling multiple samples with identical timestamps. See <code> DUPLICATE_POLICY </code> in <a href="/docs/latest/commands/ts.create/"> <code> TS.CREATE </code> </a> . </p> </details> <details open=""> <summary> <code> IGNORE ignoreMaxTimediff ignoreMaxValDiff </code> </summary> <p> is the policy for handling duplicate samples. See <code> IGNORE </code> in <a href="/docs/latest/commands/ts.create/"> <code> TS.CREATE </code> </a> . </p> </details> <details open=""> <summary> <code> LABELS [{label value}...] </code> </summary> <p> is set of label-value pairs that represent metadata labels of the key and serve as a secondary index. </p> <p> If <code> LABELS </code> is specified, the given label list is applied. Labels that are not present in the given list are removed implicitly. Specifying <code> LABELS </code> with no label-value pairs removes all existing labels. See <code> LABELS </code> in <a href="/docs/latest/commands/ts.create/"> <code> TS.CREATE </code> </a> . </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/#simple-strings"> Simple string reply </a> - <code> OK </code> if executed correctly </li> <li> [] on error (invalid arguments, wrong key type, key does not exist, etc.) </li> </ul> <h2 id="examples"> Examples </h2> <details open=""> <summary> <b> Alter a temperature time series </b> </summary> <p> Create a temperature time series. </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&gt; TS.CREATE temperature:2:32 RETENTION <span class="m">60000</span> DUPLICATE_POLICY MAX LABELS sensor_id <span class="m">2</span> area_id <span class="m">32</span> </span></span><span class="line"><span class="cl">OK</span></span></code></pre> </div> <p> Alter the labels in the time series. </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&gt; TS.ALTER temperature:2:32 LABELS sensor_id <span class="m">2</span> area_id <span class="m">32</span> sub_area_id <span class="m">15</span> </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/ts.create/"> <code> TS.CREATE </code> </a> </p> <h2 id="related-topics"> Related topics </h2> <p> <a href="/docs/latest/develop/data-types/timeseries/"> RedisTimeSeries </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/ts.alter/"/> <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.mget.html
<section class="prose w-full py-12"> <h1 class="command-name"> JSON.MGET </h1> <div class="font-semibold text-redis-ink-900"> Syntax </div> <pre class="command-syntax">JSON.MGET key [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(M*N) when path is evaluated to a single value where M is the number of keys and N is the size of the value, O(N1+N2+...+Nm) when path is evaluated to multiple values where m is the number of keys and Ni is the size of the i-th key </dd> </dl> <p> Return the values at <code> path </code> from multiple <code> key </code> arguments </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 cluster mode is enabled, all specified keys must reside on the same <a href="https://redis.io/docs/latest/operate/oss_and_stack/reference/cluster-spec/#key-distribution-model"> hash slot </a> . </div> </div> <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. Returns <code> null </code> for nonexistent paths. </p> </details> <h2 id="return"> Return </h2> <p> JSON.MGET returns an array of bulk string replies specified as the JSON serialization of the value at each key's path. 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> <details open=""> <summary> <b> Return the values at <code> path </code> from multiple <code> key </code> arguments </b> </summary> <p> Create two JSON documents. </p> <div class="highlight"> <pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">redis&gt; JSON.SET doc1 $ <span class="s1">'{"a":1, "b": 2, "nested": {"a": 3}, "c": null}'</span> </span></span><span class="line"><span class="cl">OK </span></span><span class="line"><span class="cl">redis&gt; JSON.SET doc2 $ <span class="s1">'{"a":4, "b": 5, "nested": {"a": 6}, "c": null}'</span> </span></span><span class="line"><span class="cl">OK</span></span></code></pre> </div> <p> Get values from all arguments in the documents. </p> <div class="highlight"> <pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">redis&gt; JSON.MGET doc1 doc2 $..a </span></span><span class="line"><span class="cl">1<span class="o">)</span> <span class="s2">"[1,3]"</span> </span></span><span class="line"><span class="cl">2<span class="o">)</span> <span class="s2">"[4,6]"</span></span></span></code></pre> </div> </details> <h2 id="see-also"> See also </h2> <p> <a href="/docs/latest/commands/json.set/"> <code> JSON.SET </code> </a> | <a href="/docs/latest/commands/json.get/"> <code> JSON.GET </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.mget/"/> <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/connect/.html
<section class="prose w-full py-12 max-w-none"> <h1> Connect to your Active-Active databases </h1> <p class="text-lg -mt-5 mb-10"> How to connect to an Active-Active database using redis-cli or a sample Python application. </p> <p> With the Redis database created, you are ready to connect to your database to store data. You can use one of the following ways to test connectivity to your database: </p> <ul> <li> Connect with redis-cli, the built-in command-line tool </li> <li> Connect with a <em> Hello World </em> application written in Python </li> </ul> <p> Remember we have two member Active-Active databases that are available for connections and concurrent reads and writes. The member Active-Active databases are using bi-directional replication to for the global Active-Active database. </p> <a href="/docs/latest/images/rs/crdb-diagram.png" sdata-lightbox="/images/rs/crdb-diagram.png"> <img src="/docs/latest/images/rs/crdb-diagram.png"/> </a> <h3 id="connecting-using-rediscli"> Connecting using redis-cli </h3> <p> redis-cli is a simple command-line tool to interact with redis database. </p> <ol> <li> <p> To use redis-cli on port 12000 from the node 1 terminal, run: </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">redis-cli -p <span class="m">12000</span> </span></span></code></pre> </div> </li> <li> <p> Store and retrieve a key in the database to test the connection with these commands: </p> <ul> <li> <code> set key1 123 </code> </li> <li> <code> get key1 </code> </li> </ul> <p> The output of the command looks like this: </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">127.0.0.1:12000&gt; <span class="nb">set</span> key1 <span class="m">123</span> </span></span><span class="line"><span class="cl">OK </span></span><span class="line"><span class="cl">127.0.0.1:12000&gt; get key1 </span></span><span class="line"><span class="cl"><span class="s2">"123"</span> </span></span></code></pre> </div> </li> <li> <p> Enter the terminal of node 1 in cluster 2, run the redis-cli, and retrieve key1. </p> <p> The output of the commands looks like this: </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">$ redis-cli -p <span class="m">12000</span> </span></span><span class="line"><span class="cl">127.0.0.1:12000&gt; get key1 </span></span><span class="line"><span class="cl"><span class="s2">"123"</span> </span></span></code></pre> </div> </li> </ol> <h3 id="connecting-using-_hello-world_-application-in-python"> Connecting using <em> Hello World </em> application in Python </h3> <p> A simple python application running on the host machine can also connect to the 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> Before you continue, you must have python and <a href="https://github.com/andymccurdy/redis-py#installation"> redis-py </a> (python library for connecting to Redis) configured on the host machine running the container. </div> </div> <ol> <li> <p> In the command-line terminal, create a new file called "redis_test.py" </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">vi redis_test.py </span></span></code></pre> </div> </li> <li> <p> Paste this code into the "redis_test.py" file. </p> <p> This application stores a value in key1 in cluster 1, gets that value from key1 in cluster 1, and gets the value from key1 in cluster 2. </p> <div class="highlight"> <pre class="chroma"><code class="language-py" data-lang="py"><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 class="n">rp1</span> <span class="o">=</span> <span class="n">redis</span><span class="o">.</span><span class="n">StrictRedis</span><span class="p">(</span><span class="n">host</span><span class="o">=</span><span class="s1">'localhost'</span><span class="p">,</span> <span class="n">port</span><span class="o">=</span><span class="mi">12000</span><span class="p">,</span> <span class="n">db</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="n">rp2</span> <span class="o">=</span> <span class="n">redis</span><span class="o">.</span><span class="n">StrictRedis</span><span class="p">(</span><span class="n">host</span><span class="o">=</span><span class="s1">'localhost'</span><span class="p">,</span> <span class="n">port</span><span class="o">=</span><span class="mi">12002</span><span class="p">,</span> <span class="n">db</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="nb">print</span> <span class="p">(</span><span class="s2">"set key1 123 in cluster 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">rp1</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s1">'key1'</span><span class="p">,</span> <span class="s1">'123'</span><span class="p">))</span> </span></span><span class="line"><span class="cl"><span class="nb">print</span> <span class="p">(</span><span class="s2">"get key1 cluster 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">rp1</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'key1'</span><span class="p">))</span> </span></span><span class="line"><span class="cl"><span class="nb">print</span> <span class="p">(</span><span class="s2">"get key1 from cluster 2"</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">rp2</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'key1'</span><span class="p">))</span> </span></span></code></pre> </div> </li> <li> <p> To run the "redis_test.py" application, run: </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">python redis_test.py </span></span></code></pre> </div> <p> If the connection is successful, the output of the application looks like: </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl"><span class="nb">set</span> key1 <span class="m">123</span> in cluster <span class="m">1</span> </span></span><span class="line"><span class="cl">True </span></span><span class="line"><span class="cl">get key1 cluster <span class="m">1</span> </span></span><span class="line"><span class="cl"><span class="s2">"123"</span> </span></span><span class="line"><span class="cl">get key1 from cluster <span class="m">2</span> </span></span><span class="line"><span class="cl"><span class="s2">"123"</span> </span></span></code></pre> </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/databases/active-active/connect/"/> <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/redisinsight/install/.html
<section class="prose w-full py-12 max-w-none"> <h1> Install Redis Insight </h1> <p class="text-lg -mt-5 mb-10"> Install Redis Insight on AWS, Docker, Kubernetes, and desktop </p> <p> This is a an installation guide. You'll learn how to install Redis Insight on Amazon Web Services (AWS), Docker, and Kubernetes. </p> <nav> <a href="/docs/latest/operate/redisinsight/install/install-on-desktop/"> Install on desktop </a> <p> How to install Redis Insight on the desktop </p> <a href="/docs/latest/operate/redisinsight/install/install-on-docker/"> Install on Docker </a> <p> How to install Redis Insight on Docker </p> <a href="/docs/latest/operate/redisinsight/install/install-on-k8s/"> Install on Kubernetes </a> <p> How to install Redis Insight on Kubernetes </p> <a href="/docs/latest/operate/redisinsight/install/install-on-aws/"> Install on AWS EC2 </a> <p> How to install Redis Insight on AWS EC2 </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/redisinsight/install/"/> <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/check_result/.html
<section class="prose w-full py-12 max-w-none"> <h1> Check result object </h1> <p class="text-lg -mt-5 mb-10"> An object that contains the results of a cluster check </p> <p> Cluster check result </p> <table> <thead> <tr> <th> Name </th> <th> Type/Value </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> cluster_test_result </td> <td> boolean </td> <td> Indication if any of the tests failed </td> </tr> <tr> <td> nodes </td> <td> <pre><code> [{ "node_uid": integer, "result": boolean, "error": string }, ...] </code></pre> </td> <td> Nodes results </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/check_result/"/> <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.reserve.html
<section class="prose w-full py-12"> <h1 class="command-name"> TOPK.RESERVE </h1> <div class="font-semibold text-redis-ink-900"> Syntax </div> <pre class="command-syntax">TOPK.RESERVE key topk [width depth decay]</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(1) </dd> </dl> <p> Initializes a TopK with specified parameters. </p> <h3 id="parameters"> Parameters </h3> <ul> <li> <strong> key </strong> : Key under which the sketch is to be found. </li> <li> <strong> topk </strong> : Number of top occurring items to keep. </li> </ul> <p> Optional parameters </p> <ul> <li> <strong> width </strong> : Number of counters kept in each array. (Default 8) </li> <li> <strong> depth </strong> : Number of arrays. (Default 7) </li> <li> <strong> decay </strong> : The probability of reducing a counter in an occupied bucket. It is raised to power of it's counter (decay ^ bucket[i].counter). Therefore, as the counter gets higher, the chance of a reduction is being reduced. (Default 0.9) </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&gt; TOPK.RESERVE topk 50 2000 7 0.925 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/topk.reserve/"/> <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.quantile/.html
<section class="prose w-full py-12"> <h1 class="command-name"> TDIGEST.QUANTILE </h1> <div class="font-semibold text-redis-ink-900"> Syntax </div> <pre class="command-syntax">TDIGEST.QUANTILE key quantile [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 quantiles specified. </dd> </dl> <p> Returns, for each input fraction, an estimation of the value (floating point) that is smaller than the given fraction of observations. </p> <p> Multiple quantiles can be retrieved in a single call. </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> quantile </code> </summary> is the input fraction (between 0 and 1 inclusively) </details> <h2 id="return-value"> Return value </h2> <p> <a href="/docs/latest/develop/reference/protocol-spec/#arrays"> Array reply </a> - an array of estimates (floating-point) populated with value_1, value_2, ..., value_N. </p> <ul> <li> Return an accurate result when <code> quantile </code> is 0 (the value of the smallest observation) </li> <li> Return an accurate result when <code> quantile </code> is 1 (the value of the largest observation) </li> </ul> <p> All values are '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&gt; 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&gt; TDIGEST.ADD t <span class="m">1</span> <span class="m">2</span> <span class="m">2</span> <span class="m">3</span> <span class="m">3</span> <span class="m">3</span> <span class="m">4</span> <span class="m">4</span> <span class="m">4</span> <span class="m">4</span> <span class="m">5</span> <span class="m">5</span> <span class="m">5</span> <span class="m">5</span> <span class="m">5</span> </span></span><span class="line"><span class="cl">OK </span></span><span class="line"><span class="cl">redis&gt; TDIGEST.QUANTILE t <span class="m">0</span> 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 <span class="m">1</span> </span></span><span class="line"><span class="cl"> 1<span class="o">)</span> <span class="s2">"1"</span> </span></span><span class="line"><span class="cl"> 2<span class="o">)</span> <span class="s2">"2"</span> </span></span><span class="line"><span class="cl"> 3<span class="o">)</span> <span class="s2">"3"</span> </span></span><span class="line"><span class="cl"> 4<span class="o">)</span> <span class="s2">"3"</span> </span></span><span class="line"><span class="cl"> 5<span class="o">)</span> <span class="s2">"4"</span> </span></span><span class="line"><span class="cl"> 6<span class="o">)</span> <span class="s2">"4"</span> </span></span><span class="line"><span class="cl"> 7<span class="o">)</span> <span class="s2">"4"</span> </span></span><span class="line"><span class="cl"> 8<span class="o">)</span> <span class="s2">"5"</span> </span></span><span class="line"><span class="cl"> 9<span class="o">)</span> <span class="s2">"5"</span> </span></span><span class="line"><span class="cl">10<span class="o">)</span> <span class="s2">"5"</span> </span></span><span class="line"><span class="cl">11<span class="o">)</span> <span class="s2">"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.quantile/"/> <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.type/.html
<section class="prose w-full py-12"> <h1 class="command-name"> JSON.TYPE </h1> <div class="font-semibold text-redis-ink-900"> Syntax </div> <pre class="command-syntax">JSON.TYPE 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(1) when path is evaluated to a single value, O(N) when path is evaluated to multiple values, where N is the size of the key </dd> </dl> <p> Report the type of JSON value at <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. </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 null if the <code> key </code> or <code> path </code> do not exist. </p> </details> <h2 id="return"> Return </h2> <p> JSON.TYPE returns an array of string replies for each path, specified as the value's type. 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&gt; JSON.SET doc $ <span class="s1">'{"a":2, "nested": {"a": true}, "foo": "bar"}'</span> </span></span><span class="line"><span class="cl">OK </span></span><span class="line"><span class="cl">redis&gt; JSON.TYPE doc $..foo </span></span><span class="line"><span class="cl">1<span class="o">)</span> <span class="s2">"string"</span> </span></span><span class="line"><span class="cl">redis&gt; JSON.TYPE doc $..a </span></span><span class="line"><span class="cl">1<span class="o">)</span> <span class="s2">"integer"</span> </span></span><span class="line"><span class="cl">2<span class="o">)</span> <span class="s2">"boolean"</span> </span></span><span class="line"><span class="cl">redis&gt; JSON.TYPE doc $..dummy </span></span><span class="line"><span class="cl"><span class="o">(</span>empty array<span class="o">)</span></span></span></code></pre> </div> <h2 id="see-also"> See also </h2> <p> <a href="/docs/latest/commands/json.set/"> <code> JSON.SET </code> </a> | <a href="/docs/latest/commands/json.arrlen/"> <code> JSON.ARRLEN </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.type/"/> <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/client-pause/.html
<section class="prose w-full py-12"> <h1 class="command-name"> CLIENT PAUSE </h1> <div class="font-semibold text-redis-ink-900"> Syntax </div> <pre class="command-syntax">CLIENT PAUSE timeout [WRITE | ALL]</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(1) </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> <code> @connection </code> <span class="mr-1 last:hidden"> , </span> </dd> </dl> <p> <code> CLIENT PAUSE </code> is a connections control command able to suspend all the Redis clients for the specified amount of time (in milliseconds). </p> <p> The command performs the following actions: </p> <ul> <li> It stops processing all the pending commands from normal and pub/sub clients for the given mode. However interactions with replicas will continue normally. Note that clients are formally paused when they try to execute a command, so no work is taken on the server side for inactive clients. </li> <li> However it returns OK to the caller ASAP, so the <code> CLIENT PAUSE </code> command execution is not paused by itself. </li> <li> When the specified amount of time has elapsed, all the clients are unblocked: this will trigger the processing of all the commands accumulated in the query buffer of every client during the pause. </li> </ul> <p> Client pause currently supports two modes: </p> <ul> <li> <code> ALL </code> : This is the default mode. All client commands are blocked. </li> <li> <code> WRITE </code> : Clients are only blocked if they attempt to execute a write command. </li> </ul> <p> For the <code> WRITE </code> mode, some commands have special behavior: </p> <ul> <li> <a href="/docs/latest/commands/eval/"> <code> EVAL </code> </a> / <a href="/docs/latest/commands/evalsha/"> <code> EVALSHA </code> </a> : Will block client for all scripts. </li> <li> <a href="/docs/latest/commands/publish/"> <code> PUBLISH </code> </a> : Will block client. </li> <li> <a href="/docs/latest/commands/pfcount/"> <code> PFCOUNT </code> </a> : Will block client. </li> <li> <a href="/docs/latest/commands/wait/"> <code> WAIT </code> </a> : Acknowledgments will be delayed, so this command will appear blocked. </li> </ul> <p> This command is useful as it makes able to switch clients from a Redis instance to another one in a controlled way. For example during an instance upgrade the system administrator could do the following: </p> <ul> <li> Pause the clients using <code> CLIENT PAUSE </code> </li> <li> Wait a few seconds to make sure the replicas processed the latest replication stream from the master. </li> <li> Turn one of the replicas into a master. </li> <li> Reconfigure clients to connect with the new master. </li> </ul> <p> Since Redis 6.2, the recommended mode for client pause is <code> WRITE </code> . This mode will stop all replication traffic, can be aborted with the <a href="/docs/latest/commands/client-unpause/"> <code> CLIENT UNPAUSE </code> </a> command, and allows reconfiguring the old master without risking accepting writes after the failover. This is also the mode used during cluster failover. </p> <p> For versions before 6.2, it is possible to send <code> CLIENT PAUSE </code> in a MULTI/EXEC block together with the <code> INFO replication </code> command in order to get the current master offset at the time the clients are blocked. This way it is possible to wait for a specific offset in the replica side in order to make sure all the replication stream was processed. </p> <p> Since Redis 3.2.10 / 4.0.0, this command also prevents keys to be evicted or expired during the time clients are paused. This way the dataset is guaranteed to be static not just from the point of view of clients not being able to write, but also from the point of view of internal operations. </p> <h2 id="behavior-change-history"> Behavior change history </h2> <ul> <li> <code> &gt;= 3.2.0 </code> : Client pause prevents client pause and key eviction as well. </li> </ul> <h2 id="resp2resp3-reply"> RESP2/RESP3 Reply </h2> <a href="../../develop/reference/protocol-spec#simple-strings"> Simple string reply </a> : <code> OK </code> or an error if the timeout is invalid. <br/> <h2> History </h2> <ul> <li> Starting with Redis version 6.2.0: <code> CLIENT PAUSE WRITE </code> mode added along with the <code> mode </code> option. </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/client-pause/"/> <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/planning/.html
<section class="prose w-full py-12 max-w-none"> <h1> Considerations for planning Active-Active databases </h1> <p class="text-lg -mt-5 mb-10"> Information about Active-Active database to take into consideration while planning a deployment, such as compatibility, limitations, and special configuration </p> <p> In Redis Enterprise, Active-Active geo-distribution is based on <a href="https://en.wikipedia.org/wiki/Conflict-free_replicated_data_type"> conflict-free replicated data type (CRDT) technology </a> . Compared to databases without geo-distribution, Active-Active databases have more complex replication and networking, as well as a different data type. </p> <p> Because of the complexities of Active-Active databases, there are special considerations to keep in mind while planning your Active-Active database. </p> <p> See <a href="/docs/latest/operate/rs/databases/active-active/"> Active-Active Redis </a> for more information about geo-distributed replication. For more info on other high availability features, see <a href="/docs/latest/operate/rs/databases/durability-ha/"> Durability and high availability </a> . </p> <h2 id="participating-clusters"> Participating clusters </h2> <p> You need at least <a href="/docs/latest/operate/rs/clusters/new-cluster-setup/"> two participating clusters </a> for an Active-Active database. If your database requires more than ten participating clusters, contact Redis support. You can <a href="/docs/latest/operate/rs/databases/active-active/manage/#participating-clusters/"> add or remove participating clusters </a> after database creation. </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 an Active-Active database <a href="/docs/latest/operate/rs/databases/auto-tiering/"> runs on flash memory </a> , you cannot add participating clusters that run on RAM only. </div> </div> <p> Changes made from the Cluster Manager UI to an Active-Active database configuration only apply to the cluster you are editing. For global configuration changes across all clusters, use the <code> crdb-cli </code> command-line utility. </p> <h2 id="memory-limits"> Memory limits </h2> <p> Database memory limits define the maximum size of your database across all database replicas and <a href="/docs/latest/operate/rs/references/terminology/#redis-instance-shard"> shards </a> on the cluster. Your memory limit also determines the number of shards. </p> <p> Besides your dataset, the memory limit must also account for replication, Active-Active metadata, and module overhead. These features can increase your database size, sometimes increasing it by two times or more. </p> <p> Factors to consider when sizing your database: </p> <ul> <li> <strong> dataset size </strong> : you want your limit to be above your dataset size to leave room for overhead. </li> <li> <strong> database throughput </strong> : high throughput needs more shards, leading to a higher memory limit. </li> <li> <a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/"> <strong> modules </strong> </a> : using modules with your database can consume more memory. </li> <li> <a href="/docs/latest/operate/rs/databases/durability-ha/clustering/"> <strong> database clustering </strong> </a> : enables you to spread your data into shards across multiple nodes (scale out). </li> <li> <a href="/docs/latest/operate/rs/databases/durability-ha/replication/"> <strong> database replication </strong> </a> : enabling replication doubles memory consumption </li> <li> <a href="/docs/latest/operate/rs/databases/active-active/"> <strong> Active-Active replication </strong> </a> : enabling Active-Active replication requires double the memory of regular replication, which can be up to two times (2x) the original data size per instance. </li> <li> <a href="/docs/latest/operate/rs/databases/active-active/manage/#replication-backlog/"> <strong> database replication backlog </strong> </a> for synchronization between shards. By default, this is set to 1% of the database size. </li> <li> <a href="/docs/latest/operate/rs/databases/active-active/manage/"> <strong> Active-Active replication backlog </strong> </a> for synchronization between clusters. By default, this is set to 1% of the database size. </li> </ul> <p> It's also important to know Active-Active databases have a lower threshold for activating the eviction policy, because it requires propagation to all participating clusters. The eviction policy starts to evict keys when one of the Active-Active instances reaches 80% of its memory limit. </p> <p> For more information on memory limits, see <a href="/docs/latest/operate/rs/databases/memory-performance/"> Memory and performance </a> or <a href="/docs/latest/operate/rs/databases/memory-performance/memory-limit/"> Database memory limits </a> . </p> <h2 id="networking"> Networking </h2> <p> Network requirements for Active-Active databases include: </p> <ul> <li> A VPN between each network that hosts a cluster with an instance (if your database spans WAN). </li> <li> A network connection to <a href="#network-ports"> several ports </a> on each cluster from all nodes in all participating clusters. </li> <li> A <a href="#network-time-service"> network time service </a> running on each node in all clusters. </li> </ul> <p> Networking between the clusters must be configured before creating an Active-Active database. The setup will fail if there is no connectivity between the clusters. </p> <h3 id="network-ports"> Network ports </h3> <p> Every node must have access to the REST API ports of every other node as well as other ports for proxies, VPNs, and the Cluster Manager UI. See <a href="/docs/latest/operate/rs/networking/port-configurations/"> Network port configurations </a> for more details. These ports should be allowed through firewalls that may be positioned between the clusters. </p> <h3 id="network-time-service"> Network Time Service </h3> <p> Active-Active databases require a time service like NTP or Chrony to make sure the clocks on all cluster nodes are synchronized. This is critical to avoid problems with internal cluster communications that can impact your data integrity. </p> <p> See <a href="/docs/latest/operate/rs/clusters/configure/sync-clocks/"> Synchronizing cluster node clocks </a> for more information. </p> <h2 id="redis-modules"> Redis modules </h2> <p> Several Redis modules are compatible with Active-Active databases. Find the list of <a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/enterprise-capabilities/"> compatible Redis modules </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"> Note: </div> Starting with v6.2.18, you can index, query, and perform full-text searches of nested JSON documents in Active-Active databases by combining RedisJSON and RediSearch. </div> </div> <p> </p> <h2 id="limitations"> Limitations </h2> <p> Active-Active databases have the following limitations: </p> <ul> <li> An existing database can't be changed into an Active-Active database. To move data from an existing database to an Active-Active database, you must <a href="/docs/latest/operate/rs/databases/active-active/create/"> create a new Active-Active database </a> and <a href="/docs/latest/operate/rs/databases/import-export/migrate-to-active-active/"> migrate the data </a> . </li> <li> <a href="/docs/latest/operate/rs/databases/durability-ha/discovery-service/"> Discovery service </a> is not supported with Active-Active databases. Active-Active databases require FQDNs or <a href="/docs/latest/operate/rs/networking/mdns/"> mDNS </a> . </li> <li> The <code> FLUSH </code> command is not supported from the CLI. To flush your database, use the API or Cluster Manager UI. </li> <li> The <code> UNLINK </code> command is a blocking command for all types of keys. </li> <li> Cross slot multi commands (such as <code> MSET </code> ) are not supported with Active-Active databases. </li> <li> The hashing policy can't be changed after database creation. </li> <li> If an Active-Active database <a href="/docs/latest/operate/rs/databases/auto-tiering/"> runs on flash memory </a> , you cannot add participating clusters that run on RAM only. </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/planning/"/> <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/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/references/cli-utilities/rladmin/"> <code> rladmin </code> </a> or the <a href="/docs/latest/operate/rs/references/rest-api/"> REST API </a> . </p> <ul> <li> <p> <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 encrypt_pkeys enabled </span></span></code></pre> </div> </li> <li> <p> <a href="/docs/latest/operate/rs/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/references/cli-utilities/rladmin/"> <code> rladmin </code> </a> or the <a href="/docs/latest/operate/rs/references/rest-api/"> REST API </a> . </p> <ul> <li> <p> <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 encrypt_pkeys disabled </span></span></code></pre> </div> </li> <li> <p> <a href="/docs/latest/operate/rs/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/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/commands/tdigest.cdf/.html
<section class="prose w-full py-12"> <h1 class="command-name"> TDIGEST.CDF </h1> <div class="font-semibold text-redis-ink-900"> Syntax </div> <pre class="command-syntax">TDIGEST.CDF key value [value ...]</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 values specified. </dd> </dl> <p> Returns, for each input value, an estimation of the fraction (floating-point) of (observations smaller than the given value + half the observations equal to the given value). </p> <p> Multiple fractions can be retrieved in a single call. </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> value </code> </summary> is value for which the CDF (Cumulative Distribution Function) should be retrieved. </details> <h2 id="return-value"> Return value </h2> <p> <a href="/docs/latest/develop/reference/protocol-spec/#arrays"> Array reply </a> - the command returns an array of floating-points populated with fraction_1, fraction_2, ..., fraction_N. </p> <p> All values are '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&gt; 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&gt; TDIGEST.ADD t <span class="m">1</span> <span class="m">2</span> <span class="m">2</span> <span class="m">3</span> <span class="m">3</span> <span class="m">3</span> <span class="m">4</span> <span class="m">4</span> <span class="m">4</span> <span class="m">4</span> <span class="m">5</span> <span class="m">5</span> <span class="m">5</span> <span class="m">5</span> <span class="m">5</span> </span></span><span class="line"><span class="cl">OK </span></span><span class="line"><span class="cl">redis&gt; TDIGEST.CDF t <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 class="m">5</span> <span class="m">6</span> </span></span><span class="line"><span class="cl">1<span class="o">)</span> <span class="s2">"0"</span> </span></span><span class="line"><span class="cl">2<span class="o">)</span> <span class="s2">"0.033333333333333333"</span> </span></span><span class="line"><span class="cl">3<span class="o">)</span> <span class="s2">"0.13333333333333333"</span> </span></span><span class="line"><span class="cl">4<span class="o">)</span> <span class="s2">"0.29999999999999999"</span> </span></span><span class="line"><span class="cl">5<span class="o">)</span> <span class="s2">"0.53333333333333333"</span> </span></span><span class="line"><span class="cl">6<span class="o">)</span> <span class="s2">"0.83333333333333337"</span> </span></span><span class="line"><span class="cl">7<span class="o">)</span> <span class="s2">"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/tdigest.cdf/"/> <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.6-release-notes/.html
<section class="prose w-full py-12 max-w-none"> <h1> RedisTimeSeries 1.6 release notes </h1> <p class="text-lg -mt-5 mb-10"> Added support for aggregating across multiple time series (multi-key). Can compute queries such as “the maximum observed value of a set of time series” server-side instead of client-side. </p> <h2 id="requirements"> Requirements </h2> <p> RedisTimeSeries v1.6.19 requires: </p> <ul> <li> Minimum Redis compatibility version (database): 6.0.16 </li> <li> Minimum Redis Enterprise Software version (cluster): 6.2.8 </li> </ul> <h2 id="v1619-february-2023"> v1.6.19 (February 2023) </h2> <p> This is a maintenance release for RedisTimeSeries 1.6. </p> <p> Update urgency: <code> MODERATE </code> : Program an upgrade of the server, but it's not urgent. </p> <p> Details: </p> <ul> <li> <p> Bug fixes: </p> <ul> <li> <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/issues/1397"> #1397 </a> Memory leak when trying to create an already existing key (MOD-4724, RED-93418) </li> </ul> </li> </ul> <h2 id="v1617-july-2022"> v1.6.17 (July 2022) </h2> <p> This is a maintenance release for RedisTimeSeries 1.6. </p> <p> Update urgency: <code> HIGH </code> : There is a critical bug that may affect a subset of users. Upgrade! </p> <p> Details: </p> <ul> <li> <p> Bug fixes: </p> <ul> <li> <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/pull/1240"> #1240 </a> Compaction rules are not saved to <a href="https://docs.redis.com/latest/rs/databases/redis-on-flash"> RoF </a> (Redis Enterprise) </li> </ul> </li> </ul> <h2 id="v1616-june-2022"> v1.6.16 (June 2022) </h2> <p> This is a maintenance release for RedisTimeSeries 1.6. </p> <p> Update urgency: <code> HIGH </code> : There is a critical bug that may affect a subset of users. Upgrade! </p> <p> Details: </p> <ul> <li> <p> Features: </p> <ul> <li> <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/pull/1193"> #1193 </a> Commands that don’t execute on the main thread now appear in <a href="/docs/latest/commands/slowlog/"> SLOWLOG </a> </li> </ul> </li> <li> <p> Bug fixes: </p> <ul> <li> <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/pull/1203"> #1203 </a> Compaction rules are not replicated (Replica Of) on Redis Enterprise </li> <li> <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/issues/1204"> #1204 </a> When the last sample is deleted with <a href="/docs/latest/commands/ts.del"> <code> TS.DEL </code> </a> , it may still be accessible with <a href="/docs/latest/commands/ts.get"> <code> TS.GET </code> </a> </li> <li> <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/pull/1226"> #1226 </a> <a href="/docs/latest/commands/ts.mrange"> <code> TS.MRANGE </code> </a> , <a href="/docs/latest/commands/ts.mrevrange"> <code> TS.MREVRANGE </code> </a> : on a multi-shard environment, some chunks may be skipped </li> </ul> </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> New RDB version (v5). RDB files created with 1.6.16 are not backward compatible. </div> </div> <h2 id="v1613-june-2022"> v1.6.13 (June 2022) </h2> <p> This is a maintenance release for RedisTimeSeries 1.6. </p> <p> Update urgency: <code> HIGH </code> : There is a critical bug that may affect a subset of users. Upgrade! </p> <p> Details: </p> <ul> <li> <p> Bug fixes: </p> <ul> <li> <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/issues/1176"> #1176 </a> , <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/pull/1187"> #1187 </a> When executing <a href="/docs/latest/commands/ts.del"> <code> DEL </code> </a> , chunk index could be set to a wrong value and cause some data to be inaccessible </li> <li> <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/pull/1180"> #1180 </a> When executing <a href="/docs/latest/commands/ts.madd"> <code> MADD </code> </a> , make sure that only successful insertions are replicated </li> </ul> </li> </ul> <h2 id="v1611-may-2022"> v1.6.11 (May 2022) </h2> <p> This is a maintenance release for RedisTimeSeries 1.6. </p> <p> Update urgency: <code> HIGH </code> : There is a critical bug that may affect a subset of users. Upgrade! </p> <p> Details: </p> <ul> <li> <p> Bug fixes: </p> <ul> <li> <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/pull/1166"> #1166 </a> Stop forwarding multi-shard commands during cluster resharding and upgrade (MOD-3154) </li> <li> <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/pull/1165"> #1165 </a> Stop forwarding multi-shard commands during transactions ( <code> MULTI EXEC </code> ) (MOD-3182) </li> <li> <a href="https://github.com/RedisGears/LibMR"> LibMR </a> : Fixed crash on multi-shard commands in some rare scenarios (MOD-3182) </li> </ul> </li> </ul> <h2 id="v1610-may-2022"> v1.6.10 (May 2022) </h2> <p> This is a maintenance release for RedisTimeSeries 1.6. </p> <p> Update urgency: <code> MODERATE </code> : Program an upgrade of the server, but it's not urgent. </p> <p> Details: </p> <ul> <li> <p> Bug fixes: </p> <ul> <li> <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/pull/1074"> #1074 </a> <a href="/docs/latest/commands/ts.range"> <code> RANGE </code> </a> , <a href="/docs/latest/commands/ts.revrange"> <code> REVRANGE </code> </a> , <a href="/docs/latest/commands/ts.mrange"> <code> MRANGE </code> </a> , and <a href="/docs/latest/commands/ts.mrevrange"> <code> MREVRANGE </code> </a> : Possibly incorrect result when using <code> ALIGN </code> and aggregating a bucket with a timestamp close to 0 </li> <li> <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/pull/1094"> #1094 </a> <a href="https://github.com/RedisGears/LibMR"> LibMR </a> : Potential memory leak; memory release delay </li> <li> <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/pull/1127"> #1127 </a> Memory leak on <a href="/docs/latest/commands/ts.range"> <code> RANGE </code> </a> and <a href="/docs/latest/commands/ts.revrange"> <code> REVRANGE </code> </a> when argument parsing fails </li> <li> <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/pull/1096"> #1096 </a> <a href="/docs/latest/commands/ts.range"> <code> RANGE </code> </a> , <a href="/docs/latest/commands/ts.revrange"> <code> REVRANGE </code> </a> , <a href="/docs/latest/commands/ts.mrange"> <code> MRANGE </code> </a> , and <a href="/docs/latest/commands/ts.mrevrange"> <code> MREVRANGE </code> </a> : Using <code> FILTER_BY_TS </code> without specifying timestamps now returns an error as expected </li> </ul> </li> </ul> <h2 id="v169-february-2022"> v1.6.9 (February 2022) </h2> <p> This is a maintenance release for RedisTimeSeries 1.6. </p> <p> Update urgency: <code> MODERATE </code> : Program an upgrade of the server, but it's not urgent. </p> <p> Details: </p> <ul> <li> <p> Security and privacy: </p> <ul> <li> <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/pull/1061"> #1061 </a> Internode communications encryption: support passphrases for PEM files </li> </ul> </li> <li> <p> Bug fixes: </p> <ul> <li> <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/pull/1056"> #1056 </a> Return an error when a shard is down (in v1.6.8, returned an empty result) </li> </ul> </li> </ul> <h2 id="v16-ga-v168-january-2022"> v1.6 GA (v1.6.8) (January 2022) </h2> <p> This is the General Availability release of RedisTimeSeries 1.6. </p> <h3 id="highlights"> Highlights </h3> <p> RedisTimeSeries 1.6 adds support for aggregating across multiple time series (multi-key). Before this version, queries such as “the maximum observed value of a set of time series” needed to be calculated client-side. Such queries can now be computed server-side, leveraging the heart of RedisGears ( <a href="https://github.com/RedisGears/LibMR"> LibMR </a> ) for clustered databases. </p> <h3 id="whats-new-in-16"> What's new in 1.6 </h3> <ul> <li> <p> Introduction of <code> GROUPBY </code> and <code> REDUCE </code> in <code> TS.MRANGE </code> and <code> TS.MREVRANGE </code> to add support for "multi-key aggregation" and support for such aggregations spanning multiple shards, leveraging <a href="https://github.com/RedisGears/LibMR"> LibMR </a> . Currently, we support <code> min </code> , <code> max </code> , and <code> sum </code> as reducers and grouping by a label. </p> </li> <li> <p> <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/pull/722"> #722 </a> , <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/pull/275"> #275 </a> Filter results using <code> FILTER_BY_TS </code> by providing a list of timestamps and <code> FILTER_BY_VALUE </code> by providing a <code> min </code> and a <code> max </code> value ( <code> TS.RANGE </code> , <code> TS.REVRANGE </code> , <code> TS.MRANGE </code> , and <code> TS.MREVRANGE </code> ). </p> </li> <li> <p> <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/pull/603"> #603 </a> , <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/pull/611"> #611 </a> , <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/pull/841"> #841 </a> Introduction of TS.DEL which allows deleting samples in a time series within two timestamps (inclusive). </p> </li> <li> <p> <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/pull/762"> #762 </a> Limit the number of returned labels in the response of read commands ( <code> TS.MRANGE </code> , <code> TS.MREVRANGE </code> , and <code> TS.MGET </code> ) using <code> SELECTED_LABELS </code> . This can be a significant performance improvement when returning a large number of series. </p> </li> <li> <p> <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/pull/655"> #655 </a> , <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/pull/801"> #801 </a> Ability to align the aggregation buckets with the requested start, end, or specific timestamp on aggregation queries using <code> ALIGN </code> ( <code> TS.RANGE </code> , <code> TS.REVRANGE </code> , <code> TS.MRANGE </code> , and <code> TS.MREVRANGE </code> ). </p> </li> <li> <p> <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/pull/675"> #675 </a> Add keyspace notifications for all CRUD commands. Check out <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/blob/master/tests/flow/test_ts_keyspace.py"> this test </a> for the details. </p> </li> <li> <p> <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/pull/882"> #882 </a> <a href="https://docs.redis.com/latest/rs/databases/redis-on-flash//#:~:text=Redis%20on%20Flash%20%20offers,dedicated%20flash%20memory%20(SSD)."> Auto Tiering </a> support. </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/oss_and_stack/stack-with-enterprise/release-notes/redistimeseries/redistimeseries-1.6-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/operate/rs/databases/active-active/develop/app-failover-active-active/.html
<section class="prose w-full py-12 max-w-none"> <h1> Application failover with Active-Active databases </h1> <p class="text-lg -mt-5 mb-10"> How to failover your application to connect to a remote replica. </p> <p> Active-Active Redis deployments don't have a built-in failover or failback mechanism for application connections. An application deployed with an Active-Active database connects to a replica of the database that is geographically nearby. If that replica is not available, the application can failover to a remote replica, and failback again if necessary. In this article we explain how this process works. </p> <p> Active-Active connection failover can improve data availability, but can negatively impact data consistency. Active-Active replication, like Redis replication, is asynchronous. An application that fails over to another replica can miss write operations. If the failed replica saved the write operations in persistent storage, then the write operations are processed when the failed replica recovers. </p> <h2 id="detecting-failure"> Detecting Failure </h2> <p> Your application can detect two types of failure: </p> <ol> <li> <strong> Local failures </strong> - The local replica is down or otherwise unavailable </li> <li> <strong> Replication failures </strong> - The local replica is available but fails to replicate to or from remote replicas </li> </ol> <h3 id="local-failures"> Local Failures </h3> <p> Local failure is detected when the application is unable to connect to the database endpoint for any reason. Reasons for a local failure can include: multiple node failures, configuration errors, connection refused, connection timed out, unexpected protocol level errors. </p> <h3 id="replication-failures"> Replication Failures </h3> <p> Replication failures are more difficult to detect reliably without causing false positives. Replication failures can include: network split, replication configuration issues, remote replica failures. </p> <p> The most reliable method for health-checking replication is by using the Redis publish/subscribe (pub/sub) mechanism. </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> Note that this document does not suggest that Redis pub/sub is reliable in the common sense. Messages can get lost in certain conditions, but that is acceptable in this case because typically the application determines that replication is down only after not being able to deliver a number of messages over a period of time. </div> </div> <p> When you use the pub/sub data type to detect failures, the application: </p> <ol> <li> Connects to all replicas and subscribes to a dedicated channel for each replica. </li> <li> Connects to all replicas and periodically publishes a uniquely identifiable message. </li> <li> Monitors received messages and ensures that it is able to receive its own messages within a predetermined window of time. </li> </ol> <p> You can also use known dataset changes to monitor the reliability of the replication stream, but pub/sub is preferred method because: </p> <ol> <li> It does not involve dataset changes. </li> <li> It does not make any assumptions about the dataset. </li> <li> Pub/sub messages are delivered as replicated effects and are a more reliable indicator of a live replication link. In certain cases, dataset keys may appear to be modified even if the replication link fails. This happens because keys may receive updates through full-state replication (re-sync) or through online replication of effects. </li> </ol> <h2 id="impact-of-sharding-on-failure-detection"> Impact of sharding on failure detection </h2> <p> If your sharding configuration is symmetric, make sure to use at least one key (PUB/SUB channels or real dataset key) per shard. Shards are replicated individually and are vulnerable to failure. Symmetric sharding configurations have the same number of shards and hash slots for all replicas. We do not recommend an asymmetric sharding configuration, which requires at least one key per hash slot that intersects with a pair of shards. </p> <p> To make sure that there is at least one key per shard, the application should: </p> <ol> <li> Use the Cluster API to retrieve the database sharding configuration. </li> <li> Compute a number of key names, such that there is one key per shard. </li> <li> Use those key names as channel names for the pub/sub mechanism. </li> </ol> <h3 id="failing-over"> Failing over </h3> <p> When the application needs to failover to another replica, it should simply re-establish its connections with the endpoint on the remote replica. Because Active/Active and Redis replication are asynchronous, the remote endpoint may not have all of the locally performed and acknowledged writes. </p> <p> It's best if your application doesn't read its own recent writes. Those writes can be either: </p> <ol> <li> Lost forever, if the local replica has an event such as a double failure or loss of persistent files. </li> <li> Temporarily unavailable, but will be available at a later time if the local replica's failure is temporary. </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 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> Sample code that maps a hash slot to a key name can be found in this Python script.</div> </div> ---> <h2 id="failback-decision"> Failback decision </h2> <p> Your application can use the same checks described above to continue monitoring the state of the failed replica after failover. </p> <p> To monitor the state of a replica during the failback process, you must make sure the replica is available, re-synced with the remote replicas, and not in stale mode. The PUB/SUB mechanism is an effective way to monitor this. </p> <p> Dataset-based mechanisms are potentially less reliable for several reasons: </p> <ol> <li> In order to determine that a local replica is not stale, it is not enough to simply read keys from it. You must also attempt to write to it. </li> <li> As stated above, remote writes for some keys appear in the local replica before the replication link is back up and while the replica is still in stale mode. </li> <li> A replica that was never written to never becomes stale, so on startup it is immediately ready but serves stale data for a longer period of time. </li> </ol> <h2 id="replica-configuration-changes"> Replica Configuration Changes </h2> <p> All failover and failback operations should be done strictly on the application side, and should not involve changes to the Active-Active configuration. The only valid case for re-configuring the Active-Active deployment and removing a replica is when memory consumption becomes too high because garbage collection cannot be performed. Once a replica is removed, it can only be re-joined as a new replica and it loses any writes that were not converged. </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/app-failover-active-active/"/> <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/redisjson/.html
<section class="prose w-full py-12 max-w-none"> <h1> RedisJSON release notes </h1> <p class="text-lg -mt-5 mb-10"> RedisJSON release notes for version 2.8 and earlier </p> <table> <thead> <tr> <th style="text-align:left"> Version (Release date) </th> <th style="text-align:left"> Major changes </th> <th style="text-align:left"> Min Redis <br/> version </th> <th style="text-align:left"> Min cluster <br/> version </th> </tr> </thead> <tbody> <tr> <td style="text-align:left"> <a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redisjson/redisjson-2.8-release-notes/"> v2.8 (July 2024) </a> </td> <td style="text-align:left"> RedisJSON 2.8 introduces bug fixes. </td> <td style="text-align:left"> 7.4 </td> <td style="text-align:left"> 7.6 (TBD) </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redisjson/redisjson-2.6-release-notes/"> v2.6 (July 2023) </a> </td> <td style="text-align:left"> RESP3 support. New commands JSON.MERGE and JSON.MSET. </td> <td style="text-align:left"> 7.2 </td> <td style="text-align:left"> 7.2.4 </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redisjson/redisjson-2.4-release-notes/"> v2.4 (November 2022) </a> </td> <td style="text-align:left"> Low-level API changes in order to support the multi-value indexing and querying support that comes with RediSearch 2.6. RediSearch 2.6 comes with multi-value indexing and querying of attributes for any attribute type (Text, Tag, Numeric, Geo and Vector) defined by a JSONPath leading to an array or to multiple scalar values. </td> <td style="text-align:left"> 6.0.16 </td> <td style="text-align:left"> 6.2.18 </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redisjson/redisjson-2.2-release-notes/"> v2.2 (July 2022) </a> </td> <td style="text-align:left"> Preview of Active-Active support for JSON. </td> <td style="text-align:left"> 6.0.0 </td> <td style="text-align:left"> 6.2.12 </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redisjson/redisjson-2.0-release-notes/"> v2.0 (November 2021) </a> </td> <td style="text-align:left"> Index JSON documents. JSONPath support. Commands operate on multiple paths. </td> <td style="text-align:left"> 6.0.0 </td> <td style="text-align:left"> 6.0.0 </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redisjson/redisjson-1.0-release-notes/"> v1.0 (December 2017) </a> </td> <td style="text-align:left"> Serialization cache for JSON.GET. </td> <td style="text-align:left"> 4.0.0 </td> <td style="text-align:left"> 5.0.0 </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/release-notes/redisjson/"/> <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/verify/.html
<section class="prose w-full py-12 max-w-none"> <h1> rladmin verify </h1> <p class="text-lg -mt-5 mb-10"> Prints verification reports for the cluster. </p> <p> Prints verification reports for the cluster. </p> <h2 id="verify-balance"> <code> verify balance </code> </h2> <p> Prints a balance report that displays all of the unbalanced endpoints or nodes in the cluster. </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">rladmin verify balance <span class="o">[</span> node &lt;ID&gt; <span class="o">]</span> </span></span></code></pre> </div> <p> The <a href="/docs/latest/operate/rs/databases/configure/proxy-policy/#proxy-policies"> proxy policy </a> determines which nodes or endpoints to report as unbalanced. </p> <p> A node is unbalanced if: </p> <ul> <li> <code> all-nodes </code> proxy policy and the node has no endpoint </li> </ul> <p> An endpoint is unbalanced in the following cases: </p> <ul> <li> <code> single </code> proxy policy and one of the following is true: <ul> <li> Shard placement is <a href="/docs/latest/operate/rs/databases/memory-performance/shard-placement-policy/#sparse-shard-placement-policy"> <code> sparse </code> </a> and none of the master shards are on the node </li> <li> Shard placement is <a href="/docs/latest/operate/rs/databases/memory-performance/shard-placement-policy/#dense-shard-placement-policy"> <code> dense </code> </a> and some master shards are on a different node from the endpoint </li> </ul> </li> <li> <code> all-master-shards </code> proxy policy and one of the following is true: <ul> <li> None of the master shards are on the node </li> <li> Some master shards are on a different node from the endpoint </li> </ul> </li> </ul> <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> Specify a node ID to return a balance table for that node only (optional) </td> </tr> </tbody> </table> <h3 id="returns"> Returns </h3> <p> Returns a table of unbalanced endpoints and nodes in the cluster. </p> <h3 id="examples"> Examples </h3> <p> Verify all nodes: </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">$ rladmin verify balance </span></span><span class="line"><span class="cl">The table presents all of the unbalanced endpoints/nodes in the cluster </span></span><span class="line"><span class="cl">BALANCE: </span></span><span class="line"><span class="cl">NODE:ID DB:ID NAME ENDPOINT:ID PROXY_POLICY LOCAL SHARDS TOTAL SHARDS </span></span></code></pre> </div> <p> Verify a specific node: </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">$ rladmin verify balance node <span class="m">1</span> </span></span><span class="line"><span class="cl">The table presents all of the unbalanced endpoints/nodes in the cluster </span></span><span class="line"><span class="cl">BALANCE: </span></span><span class="line"><span class="cl">NODE:ID DB:ID NAME ENDPOINT:ID PROXY_POLICY LOCAL SHARDS TOTAL SHARDS </span></span></code></pre> </div> <h2 id="verify-rack_aware"> <code> verify rack_aware </code> </h2> <p> Verifies that the cluster complies with the rack awareness policy and reports any discovered rack collisions, if <a href="/docs/latest/operate/rs/clusters/configure/rack-zone-awareness/"> rack-zone awareness </a> is enabled. </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">rladmin verify rack_aware </span></span></code></pre> </div> <h3 id="parameters-1"> Parameters </h3> <p> None </p> <h3 id="returns-1"> Returns </h3> <p> Returns whether the cluster is rack aware. If rack awareness is enabled, it returns any rack collisions. </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 verify rack_aware </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl">Cluster policy is not configured <span class="k">for</span> rack awareness. </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/verify/"/> <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/api/.html
<section class="prose w-full py-12 max-w-none"> <h1> Redis Cloud REST API </h1> <p class="text-lg -mt-5 mb-10"> Describes the Redis Cloud REST API and links to additional info </p> <p> The <a href="https://api.redislabs.com/v1/swagger-ui.html"> Redis Cloud REST API </a> helps you manage your Redis Cloud databases programmatically. </p> <p> You can use the API to: </p> <ul> <li> Create or manage databases </li> <li> Define or change hosting credentials </li> <li> Audit access via logs </li> <li> Backup or import databases </li> </ul> <h2 id="get-started"> Get started </h2> <ol> <li> <a href="/docs/latest/operate/rc/api/get-started/enable-the-api/"> Enable the API </a> </li> <li> <a href="/docs/latest/operate/rc/api/get-started/"> Authenticate and authorize </a> </li> <li> <a href="/docs/latest/operate/rc/api/get-started/manage-api-keys/"> Create API keys </a> </li> <li> <a href="/docs/latest/operate/rc/api/get-started/use-rest-api/"> Use the API </a> </li> <li> <a href="/docs/latest/operate/rc/api/get-started/process-lifecycle/"> Learn the API lifecycle </a> </li> <li> <a href="/docs/latest/operate/rc/api/examples/manage-subscriptions/"> Create and manage subscriptions </a> </li> </ol> <h2 id="examples"> Examples </h2> <ol> <li> <a href="/docs/latest/operate/rc/api/examples/manage-subscriptions/"> Manage subscriptions </a> </li> <li> Database examples <ul> <li> <a href="/docs/latest/operate/rc/api/examples/create-database/"> Create database </a> </li> <li> <a href="/docs/latest/operate/rc/api/examples/update-database/"> Update database </a> </li> <li> <a href="/docs/latest/operate/rc/api/examples/back-up-and-import-data/"> Back up and import data </a> </li> </ul> </li> <li> <a href="/docs/latest/operate/rc/api/examples/manage-cloud-accounts/"> Manage cloud accounts </a> </li> <li> <a href="/docs/latest/operate/rc/api/examples/dryrun-cost-estimates/"> Estimate costs </a> </li> <li> <a href="/docs/latest/operate/rc/api/examples/view-account-information/"> View account info </a> </li> </ol> <h2 id="more-info"> More info </h2> <ul> <li> Use the <a href="/docs/latest/operate/rc/api/get-started/use-rest-api/"> Redis Cloud API </a> </li> <li> <a href="https://api.redislabs.com/v1/swagger-ui.html"> Full API Reference </a> </li> <li> Secure <a href="/docs/latest/operate/rc/api/get-started/"> authentication and authorization </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/api/"/> <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/services_configuration/mdns_server/.html
<section class="prose w-full py-12 max-w-none"> <h1> MDNS server object </h1> <p class="text-lg -mt-5 mb-10"> Documents the mdns_server 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 multicast DNS server </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/services_configuration/mdns_server/"/> <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/replica_sources-alerts/.html
<section class="prose w-full py-12 max-w-none"> <h1> Database replica sources alerts requests </h1> <p class="text-lg -mt-5 mb-10"> Replica source 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-replica-sources-alerts"> GET </a> </td> <td> <code> /v1/bdbs/replica_sources/alerts </code> </td> <td> Get all replica sources alert states for all BDBs </td> </tr> <tr> <td> <a href="#get-bdbs-replica-sources-alerts"> GET </a> </td> <td> <code> /v1/bdbs/replica_sources/alerts/{uid} </code> </td> <td> Get all replica sources alert states for a BDB </td> </tr> <tr> <td> <a href="#get-bdbs-replica_source-all-alerts"> GET </a> </td> <td> <code> /v1/bdbs/replica_sources/alerts/{uid}/{replica_src_id} </code> </td> <td> Get all alert states for a replica source </td> </tr> <tr> <td> <a href="#get-bdbs-replica-source-alert"> GET </a> </td> <td> <code> /v1/bdbs/replica_sources/alerts/{uid}/{replica_src_id}/{alert} </code> </td> <td> Get a replica source alert state </td> </tr> </tbody> </table> <h2 id="get-all-bdbs-replica-sources-alerts"> Get all DBs replica sources alert states </h2> <pre><code>GET /v1/bdbs/replica_sources/alerts </code></pre> <p> Get all alert states for all replica sources of all BDBs. </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/replica_sources/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 alerts states for each BDB. </p> <p> See <a href="/docs/latest/operate/rs/references/rest-api/objects/alert/"> REST API alerts overview </a> for a description of the alert state object. </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">"replica_src_syncer_connection_error"</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-replica-sources-alerts"> Get DB replica source alert states </h2> <pre><code>GET /v1/bdbs/replica_sources/alerts/{int: uid} </code></pre> <p> Get all alert states for all replica sources of a specific bdb. </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-all-replica-alerts"> Request </h3> <h4 id="example-http-request-1"> Example HTTP request </h4> <pre><code>GET /bdbs/replica_sources/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> <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> </tbody> </table> <h3 id="get-response-all-replica-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">"replica_src_syncer_connection_error"</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-all-replica-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-replica_source-all-alerts"> Get replica source alert states </h2> <pre><code>GET /v1/bdbs/replica_sources/alerts/{int: uid}/{int: replica_src_id} </code></pre> <p> Get all alert states for a specific replica source of a bdb. </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-replica-alerts"> Request </h3> <h4 id="example-http-request-2"> Example HTTP request </h4> <pre><code>GET /bdbs/replica_sources/alerts/1/2 </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-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 database </td> </tr> <tr> <td> replica_src_id </td> <td> integer </td> <td> The ID of the replica source in this BDB </td> </tr> </tbody> </table> <h3 id="get-response-replica-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-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">"replica_src_syncer_connection_error"</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-replica-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-replica-source-alert"> Get replica source alert state </h2> <pre><code>GET /v1/bdbs/replica_sources/alerts/{int: uid}/{int: replica_src_id}/{alert} </code></pre> <p> Get a replica source alert state of a specific bdb. </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/#view_bdb_alerts"> view_bdb_alerts </a> </td> </tr> </tbody> </table> <h3 id="get-request-alert"> Request </h3> <h4 id="example-http-request-3"> Example HTTP request </h4> <pre><code>GET /bdbs/replica_sources/alerts/1/2/replica_src_syncer_connection_error </code></pre> <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-2"> 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> replica_src_id </td> <td> integer </td> <td> The ID of the replica source in this BDB </td> </tr> <tr> <td> alert </td> <td> string </td> <td> The alert name </td> </tr> </tbody> </table> <h3 id="get-response-alert"> Response </h3> <p> Returns an <a href="/docs/latest/operate/rs/references/rest-api/objects/alert/"> alert state object </a> . </p> <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">"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-alert"> 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> <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/replica_sources-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/operate/rc/databases/create-database/.html
<section class="prose w-full py-12 max-w-none"> <h1> Create a database </h1> <p> A database is the heart of any Redis Cloud deployment. </p> <p> The process for Creating a database depends on the type of <a href="/docs/latest/operate/rc/subscriptions/"> subscription plan </a> you need. </p> <p> An <strong> Essentials </strong> plan is a fixed monthly price for a single database. It is cost-efficient and designed for low-throughput scenarios. It supports a range of availability, persistence, and backup options. Pricing supports low throughput workloads. </p> <ul> <li> <a href="/docs/latest/operate/rc/databases/create-database/create-essentials-database/"> Create an Essentials database </a> </li> </ul> <p> A <strong> Pro </strong> plan is an hourly price based on capacity. It supports more databases, larger databases, greater throughput, and unlimited connections. </p> <ul> <li> <a href="/docs/latest/operate/rc/databases/create-database/create-pro-database-new/"> Create a Pro database with a new subscription </a> </li> <li> <a href="/docs/latest/operate/rc/databases/create-database/create-pro-database-existing/"> Create a Pro database in an existing subscription </a> </li> <li> <a href="/docs/latest/operate/rc/databases/create-database/create-active-active-database/"> Create an Active-Active database </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/databases/create-database/"/> <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/hashtag/.html
<section class="prose w-full py-12 max-w-none"> <h1> Hashtag </h1> <p class="text-lg -mt-5 mb-10"> Returns a string that maps to the current shard. </p> <div class="highlight"> <pre class="chroma"><code class="language-java" data-lang="java"><span class="line"><span class="cl"><span class="kd">public</span> <span class="kd">static</span> <span class="n">java</span><span class="o">.</span><span class="na">lang</span><span class="o">.</span><span class="na">String</span> <span class="nf">hashtag</span><span class="o">()</span> </span></span></code></pre> </div> <p> Returns a string that maps to the current shard according to the cluster slot mapping. </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 can use the <code> hashtag </code> function when you need to create a key that resides on the current shard. </div> </div> <h2 id="parameters"> Parameters </h2> <p> None </p> <h2 id="returns"> Returns </h2> <p> Returns a string that maps to the current shard. </p> <h2 id="example"> Example </h2> <p> The following example uses the <code> hashtag </code> function to calculate the hslot. The string maps to the current shard. </p> <div class="highlight"> <pre class="chroma"><code class="language-java" data-lang="java"><span class="line"><span class="cl"><span class="n">GearsBuilder</span><span class="o">.</span><span class="na">execute</span><span class="o">(</span> </span></span><span class="line"><span class="cl"> <span class="s">"SET"</span><span class="o">,</span> </span></span><span class="line"><span class="cl"> <span class="n">String</span><span class="o">.</span><span class="na">format</span><span class="o">(</span><span class="s">"key{%s}"</span><span class="o">,</span> <span class="n">GearsBuilder</span><span class="o">.</span><span class="na">hashtag</span><span class="o">()),</span> </span></span><span class="line"><span class="cl"> <span class="s">"1"</span> </span></span><span class="line"><span class="cl"><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/oss_and_stack/stack-with-enterprise/gears-v1/jvm/classes/gearsbuilder/hashtag/"/> <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/db-upgrade/.html
<section class="prose w-full py-12 max-w-none"> <h1> Change database upgrade configuration </h1> <p class="text-lg -mt-5 mb-10"> Configure cluster-wide policies that affect default database upgrades. </p> <p> Database upgrade configuration includes cluster-wide policies that affect default database upgrades. </p> <h2 id="edit-upgrade-configuration"> Edit upgrade configuration </h2> <p> To edit database upgrade configuration using the Cluster Manager UI: </p> <ol> <li> <p> On the <strong> Databases </strong> screen, select <a href="/docs/latest/images/rs/buttons/button-toggle-actions-vertical.png#no-click" sdata-lightbox="/images/rs/buttons/button-toggle-actions-vertical.png#no-click"> <img alt="Toggle actions button" class="inline" src="/docs/latest/images/rs/buttons/button-toggle-actions-vertical.png#no-click" width="22px"/> </a> to open a list of additional actions. </p> </li> <li> <p> Select <strong> Upgrade configuration </strong> . </p> </li> <li> <p> Change database <a href="#upgrade-config-settings"> upgrade configuration settings </a> . </p> </li> <li> <p> Select <strong> Save </strong> . </p> </li> </ol> <h2 id="upgrade-config-settings"> Upgrade configuration settings </h2> <h3 id="database-shard-parallel-upgrade"> Database shard parallel upgrade </h3> <p> To change the number of shards upgraded in parallel during database upgrades, use one of the following methods: </p> <ul> <li> <p> Cluster Manager UI – Edit <strong> Database shard parallel upgrade </strong> in <a href="#edit-upgrade-configuration"> <strong> Upgrade configuration </strong> </a> </p> </li> <li> <p> <a href="/docs/latest/operate/rs/references/cli-utilities/rladmin/tune/#tune-cluster"> rladmin tune cluster </a> : </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">rladmin tune cluster parallel_shards_upgrade <span class="o">{</span> all <span class="p">|</span> &lt;integer&gt; <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 cluster policy </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/policy </span></span><span class="line"><span class="cl"><span class="o">{</span> <span class="s2">"parallel_shards_upgrade"</span>: &lt;integer&gt; <span class="o">}</span> </span></span></code></pre> </div> </li> </ul> <h3 id="resp3-support"> RESP3 support </h3> <p> The cluster-wide option <code> resp3_default </code> determines the default value of the <code> resp3 </code> option, which enables or deactivates RESP3 for a database, upon upgrading a database to version 7.2 or later. <code> resp3_default </code> is set to <code> enabled </code> by default. </p> <p> To change <code> resp3_default </code> to <code> disabled </code> , use one of the following methods: </p> <ul> <li> <p> Cluster Manager UI – Edit <strong> RESP3 support </strong> in <a href="#edit-upgrade-configuration"> <strong> Upgrade configuration </strong> </a> </p> </li> <li> <p> <a href="/docs/latest/operate/rs/references/cli-utilities/rladmin/tune/#tune-cluster"> rladmin tune cluster </a> : </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">rladmin tune cluster resp3_default <span class="o">{</span> enabled <span class="p">|</span> disabled <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 cluster policy </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/policy </span></span><span class="line"><span class="cl"><span class="o">{</span> <span class="s2">"resp3_default"</span>: &lt;boolean&gt; <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/databases/configure/db-upgrade/"/> <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-december-2018/.html
<section class="prose w-full py-12 max-w-none"> <h1> Redis Enterprise Software Release Notes 5.4 (December 2018) </h1> <p> Redis Enterprise Software (RS) 5.4 is now available. RS 5.4 adds support for Redis 5.0 (GA) with the new Redis Streams data type. </p> <h2 id="overview"> Overview </h2> <p> You can upgrade to RS 5.4 from RS 5.0 and above according to the <a href="/docs/latest/operate/rs/installing-upgrading/upgrading/"> upgrade instructions </a> . If you have a version older than 5.0, you should first upgrade to version 5.2 (or at least 5.0). </p> <h2 id="new-features"> New features </h2> <h3 id="redis-50-ga---redis-streams"> Redis 5.0 GA - Redis Streams </h3> <p> RS 5.4 adds support for Redis 5.0 (GA version- 5.0.2), which introduces the new <a href="/docs/latest/develop/data-types/streams/"> Redis Streams </a> data type. Redis Streams models a log data structure in-memory and implements additional powerful operations, such as Consumer Groups. </p> <h3 id="redis-graph-module"> Redis graph module </h3> <p> Starting from RS 5.4, Redis Graph, a new Redis Enterprise Module that introduces the world's fastest graph database, is an integral part of Redis Enterprise package. </p> <p> RedisGraph is the first queryable <a href="https://github.com/opencypher/openCypher/blob/master/docs/property-graph-model.adoc"> Property Graph </a> database to use <a href="https://en.wikipedia.org/wiki/Sparse_matrix"> sparse matrices </a> to represent the <a href="https://en.wikipedia.org/wiki/Adjacency_matrix"> adjacency matrix </a> in graphs and <a href="http://faculty.cse.tamu.edu/davis/GraphBLAS.html"> linear algebra </a> to query the graph. </p> <h3 id="activeactive-redis-crdb-creation-in-nonclustering-mode"> Active-Active Redis (CRDB) - Creation in non-clustering mode </h3> <p> In RS 5.4 you can <a href="/docs/latest/operate/rs/databases/active-active/create/"> create Active-Active databases (CRDBs) </a> in a non-clustering mode. As a result, the following creation options are allowed: </p> <ol> <li> Clustering mode - Creates a CRDB that consists of any number of shards in a clustering mode and is subject to <a href="/docs/latest/operate/rs/databases/durability-ha/clustering/"> multi-key commands limitations </a> . </li> <li> Non-clustering mode - Creates a CRDB that consists of one shard only in a non-clustering mode so that <a href="/docs/latest/operate/rs/databases/durability-ha/clustering/"> multi-key command limitations </a> do not apply. </li> </ol> <h3 id="high-availability-for-replica-shards"> High availability for replica shards </h3> <p> When <a href="/docs/latest/operate/rs/databases/configure/replica-ha/"> replica high availability </a> is enabled and a master shard fails, a replica (formerly <em> slave </em> ) shard is automatically promoted to a master shard to maintain data availability. This creates a single point of failure until a new replica shard is manually created. </p> <p> RS 5.4 expands the high availability capabilities by adding the ability to automatically avoid this single point of failure by configuring the cluster to automatically migrate the replica shard to another available node. In practice, replica migration creates a new replica shard and replicates the data from the master shard to the new replica shard. </p> <p> * <em> Note that just as is the case with the Redis open-source project, Redis is in the process of changing the "master-replica" terminology to "master-replica" everywhere, including within our documentation. </em> </p> <h2 id="additional-capabilities"> Additional capabilities </h2> <ul> <li> Support for new operating systems- Ubuntu 18.04 and RHEL 7.6. </li> </ul> <h2 id="product-version-lifecycle"> Product version lifecycle </h2> <ul> <li> The End of Life (EOL) for Redis Enterprise Software 4.5.X was November 30th, 2018, in accordance with our <a href="/docs/latest/operate/rs/installing-upgrading/product-lifecycle/"> published policy </a> . We recommend that customers with version 4.5 or below upgrade to the latest version. </li> </ul> <h2 id="important-fixes"> Important fixes </h2> <ul> <li> RS23616 - Fixed a failure when updating the memory limit of RoF database. </li> <li> RS22871 - Fixed a certificate verify failure after nodes upgrade. </li> <li> RS2862 - Improved admin console performance in case multiple browsers or windows are directed to the admin console. </li> <li> RS22751 - Fixed an issue in the backup process which caused temporary service outage. </li> <li> RS22636 - Fixed Redis process failure when a ReJSON Module's command is executed. </li> <li> RS22601 - Fixed a failure during shard migration procedure. </li> <li> RS22478 - Fixed a failure in replica-of process between two databases with ReBloom Module. </li> <li> RS21974 - SMTP username and password are not mandatory in the email server settings when there is no need for authentication. </li> <li> RS21801 - Fixed admin console issues when cluster is configured with FIPS compliance. </li> <li> RS21772 - Fixed a failure when trying to update a database's endpoint policy to all-master-shards. </li> <li> RS19842 - Updated permissions of some internal files. </li> <li> RS19433 - Improved RAM eviction process for RoF databases. </li> <li> RS18875 - Added the ability to upgrade database gradually, few shards at a time. </li> <li> RS15207 - Fixed a failure during re-shard operation. </li> </ul> <h2 id="known-limitations"> Known limitations </h2> <h3 id="installation"> Installation </h3> <ul> <li> In default Ubuntu 18.04 installations, port 53 is in use by systemd-resolved (DNS server). In such a case, the system configuration must be changed to make this port available before running RS installation. </li> </ul> <h3 id="upgrade"> Upgrade </h3> <ul> <li> Before you upgrade a database with the 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 on that DB </a> to 1.4.2 or higher. We recommend that you upgrade the RediSearch module before you upgrade the cluster to RS 5.4. </li> <li> Node upgrade fails if SSL certificates were configured in version 5.0.2 and above by updating the certificates on the disk instead of using the new API. For assistance with this issue, please <a href="https://redislabs.com/company/support/"> contact Redis support </a> . </li> </ul> <h3 id="cluster-api"> Cluster API </h3> <ul> <li> Removed the deprecated argument <code> backup_path </code> from cluster API. To create or update BDBs, please use <code> backup_location </code> . </li> </ul> <h3 id="redis-commands"> Redis commands </h3> <ul> <li> The capability of disabling specific Redis commands does not work on Redis Module specific commands. </li> <li> The CLIENT ID command cannot guarantee incremental IDs between clients that connect to different nodes under multi proxy policies. </li> <li> The length of the socket_path variable, which is defined in a node, cannot exceed 88 characters. </li> <li> CLIENT UNBLOCK command is not supported in RS 5.4. </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-december-2018/"/> <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/develop/data-types/.html
<section class="prose w-full py-12 max-w-none"> <h1> Data types for Active-Active databases </h1> <p class="text-lg -mt-5 mb-10"> Introduction to differences in data types between standalone and Active-Active Redis databases. </p> <p> Active-Active databases use conflict-free replicated data types (CRDTs). From a developer perspective, most supported data types work the same for Active-Active and standard Redis databases. However, a few methods also come with specific requirements in Active-Active databases. </p> <p> Even though they look identical to standard Redis data types, there are specific rules that govern the handling of conflicting concurrent writes for each data type. </p> <p> As conflict handling rules differ between data types, some commands have slightly different requirements in Active-Active databases versus standard Redis databases. </p> <p> See the following articles 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/rs/7.4/databases/active-active/develop/data-types/"/> <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/decrby/.html
<section class="prose w-full py-12"> <h1 class="command-name"> DECRBY </h1> <div class="font-semibold text-redis-ink-900"> Syntax </div> <pre class="command-syntax">DECRBY key decrement</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.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> @string </code> <span class="mr-1 last:hidden"> , </span> <code> @fast </code> <span class="mr-1 last:hidden"> , </span> </dd> </dl> <p> The <code> DECRBY </code> command reduces the value stored at the specified <code> key </code> by the specified <code> decrement </code> . If the key does not exist, it is initialized with a value of <code> 0 </code> before performing the operation. If the key's value is not of the correct type or cannot be represented as an integer, an error is returned. This operation is limited to 64-bit signed integers. </p> <p> See <a href="/docs/latest/commands/incr/"> <code> INCR </code> </a> for extra information on increment/decrement operations. </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&gt; SET mykey "10" "OK" redis&gt; DECRBY mykey 3 (integer) 7 </pre> <div class="prompt" style=""> <span> redis&gt; </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 value of the key after decrementing it. <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/decrby/"/> <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/get-started/.html
<section class="prose w-full py-12 max-w-none"> <h1> Community Edition </h1> <p class="text-lg -mt-5 mb-10"> Get started with Redis Community Edition </p> <p> Redis is an <a href="/docs/latest/develop/get-started/data-store/"> in-memory data store </a> used by millions of developers as a cache, <a href="/docs/latest/develop/get-started/vector-database/"> vector database </a> , <a href="/docs/latest/develop/get-started/document-database/"> document database </a> , <a href="/docs/latest/develop/data-types/streams/"> streaming engine </a> , and message broker. Redis has built-in replication and different levels of <a href="/docs/latest/operate/oss_and_stack/management/persistence/"> on-disk persistence </a> . It supports complex <a href="/docs/latest/develop/data-types/"> data types </a> (for example, strings, hashes, lists, sets, sorted sets, and JSON), with atomic operations defined on those data types. </p> <p> You can install Redis from source, from an executable for your OS, or bundled with Redis Stack and Redis Insight which include popular features and monitoring. </p> <ul> <li> <a href="/docs/latest/operate/oss_and_stack/install/install-redis/install-redis-on-linux/"> Install Redis on Linux </a> </li> <li> <a href="/docs/latest/operate/oss_and_stack/install/install-redis/install-redis-on-mac-os/"> Install Redis on macOS </a> </li> <li> <a href="/docs/latest/operate/oss_and_stack/install/install-redis/install-redis-on-windows/"> Install Redis on Windows </a> </li> <li> <a href="/docs/latest/operate/oss_and_stack/install/install-stack/"> Install Redis with Redis Stack and Redis Insight </a> </li> <li> <a href="/docs/latest/operate/oss_and_stack/install/install-stack/docker/"> Run Redis Stack on Docker </a> </li> <li> <a href="/docs/latest/operate/oss_and_stack/install/install-redis/install-redis-from-source/"> Install Redis from Source </a> </li> </ul> <h2 id="use-cases"> Use cases </h2> <p> The following quick start guides will show you how to use Redis for the following specific purposes: </p> <ul> <li> <a href="/docs/latest/develop/get-started/data-store/"> Data structure store </a> </li> <li> <a href="/docs/latest/develop/get-started/document-database/"> Document database </a> </li> <li> <a href="/docs/latest/develop/get-started/vector-database/"> Vector database </a> </li> <li> <a href="/docs/latest/develop/get-started/redis-in-ai/"> AI agents and chatbots </a> </li> <li> <a href="/docs/latest/develop/get-started/rag/"> Retrieval Augmented Generation (RAG) with Redis </a> </li> </ul> <h2 id="data-integration-tools-libraries-and-frameworks"> Data integration tools, libraries, and frameworks </h2> <ul> <li> <a href="/docs/latest/develop/clients/"> Client API libraries </a> </li> <li> <a href="/docs/latest/integrate/redis-data-integration/"> Redis Data Integration </a> </li> <li> <a href="/docs/latest/integrate/redisvl/"> Redis vector library for Python </a> </li> <li> <a href="/docs/latest/integrate/amazon-bedrock/"> Redis Cloud with Amazon Bedrock </a> </li> <li> <a href="/docs/latest/integrate/redisom-for-net/"> Object-mapping for .NET </a> </li> <li> <a href="/docs/latest/integrate/spring-framework-cache/"> Spring Data Redis for Java </a> </li> </ul> <p> You can find a complete list of integrations on the <a href="/docs/latest/integrate/"> integrations and frameworks hub </a> . </p> <p> To learn more, refer to the <a href="/docs/latest/develop/"> develop with Redis </a> documentation. </p> <h2 id="deployment-options"> Deployment options </h2> <p> You can deploy Redis with the following methods: </p> <ul> <li> As a service by using <a href="/docs/latest/operate/rc/"> Redis Cloud </a> , the fastest way to deploy Redis on your preferred cloud platform. </li> <li> By installing <a href="/docs/latest/operate/rs/"> Redis Enterprise Software </a> in an on-premises data center or on Cloud infrastructure. </li> <li> On a variety Kubernetes distributions by using the <a href="/docs/latest/operate/kubernetes/"> Redis Enterprise operator for Kubernetes </a> . </li> </ul> <p> The following guides will help you to get started with your preferred deployment method. </p> <p> Get started with <strong> <a href="/docs/latest/operate/rc/"> Redis Cloud </a> </strong> by creating a database: </p> <ul> <li> The <a href="/docs/latest/operate/rc/rc-quickstart/"> Redis Cloud quick start </a> helps you create a free database. (Start here if you're new.) </li> <li> <a href="/docs/latest/operate/rc/databases/create-database/create-essentials-database/"> Create an Essentials database </a> with a memory limit up to 12 GB. </li> <li> <a href="/docs/latest/operate/rc/databases/create-database/create-pro-database-new/"> Create a Pro database </a> that suits your workload and offers seamless scaling. </li> </ul> <p> Install a <strong> <a href="/docs/latest/operate/rs/"> Redis Enterprise Software </a> </strong> cluster: </p> <ul> <li> <a href="/docs/latest/operate/rs/installing-upgrading/quickstarts/redis-enterprise-software-quickstart/"> Redis Enterprise on Linux quick start </a> </li> <li> <a href="/docs/latest/operate/rs/installing-upgrading/quickstarts/docker-quickstart/"> Redis Enterprise on Docker quick start </a> </li> <li> <a href="/docs/latest/operate/rs/databases/active-active/get-started/"> Get started with Redis Enterprise's Active-Active feature </a> </li> <li> <a href="/docs/latest/operate/rs/installing-upgrading/"> Install and upgrade Redis Enterprise </a> </li> </ul> <p> Leverage <strong> <a href="/docs/latest/operate/kubernetes/"> Redis Enterprise for Kubernetes </a> </strong> to simply deploy a Redis Enterprise cluster on Kubernetes: </p> <ul> <li> <a href="/docs/latest/operate/kubernetes/deployment/quick-start/"> Deploy Redis Enterprise for Kubernetes </a> </li> <li> <a href="/docs/latest/operate/kubernetes/deployment/openshift/"> Deploy Redis Enterprise for Kubernetes with OpenShift </a> </li> </ul> <p> To learn more, refer to the <a href="/docs/latest/operate/"> Redis products </a> documentation. </p> <h2 id="provisioning-and-observability-tools"> Provisioning and observability tools </h2> <ul> <li> <a href="/docs/latest/integrate/pulumi-provider-for-redis-cloud/"> Pulumi provider for Redis Cloud </a> </li> <li> <a href="/docs/latest/integrate/terraform-provider-for-redis-cloud/"> Terraform provider for Redis Cloud </a> </li> <li> <a href="/docs/latest/integrate/prometheus-with-redis-cloud/"> Prometheus and Grafana with Redis Cloud </a> </li> <li> <a href="/docs/latest/integrate/prometheus-with-redis-enterprise/"> Prometheus and Grafana with Redis Enterprise </a> </li> </ul> <p> You can find a complete list of integrations on the <a href="/docs/latest/integrate/"> libraries and tools hub </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/get-started/"/> <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/run/.html
<section class="prose w-full py-12 max-w-none"> <h1> Run </h1> <p class="text-lg -mt-5 mb-10"> Runs the pipeline of functions immediately. </p> <div class="highlight"> <pre class="chroma"><code class="language-java" data-lang="java"><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></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="kd">public</span> <span class="kt">void</span> <span class="n">run</span><span class="err">​</span><span class="o">(</span><span class="kt">boolean</span> <span class="n">jsonSerialize</span><span class="o">,</span> <span class="kt">boolean</span> <span class="n">collect</span><span class="o">)</span> </span></span></code></pre> </div> <p> Runs the pipeline of functions immediately upon execution. It will only run once. </p> <h2 id="parameters"> Parameters </h2> <table> <thead> <tr> <th> Name </th> <th> Type </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> collect </td> <td> boolean </td> <td> Whether or not to collect the results from the entire cluster before returning them </td> </tr> <tr> <td> jsonSerialize </td> <td> boolean </td> <td> Whether or not to serialize the results to JSON before returning them </td> </tr> </tbody> </table> <h2 id="returns"> Returns </h2> <p> None </p> <h2 id="example"> Example </h2> <div class="highlight"> <pre class="chroma"><code class="language-java" data-lang="java"><span class="line"><span class="cl"><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 class="na">run</span><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/oss_and_stack/stack-with-enterprise/gears-v1/jvm/classes/gearsbuilder/run/"/> <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/develop-for-aa/.html
<section class="prose w-full py-12 max-w-none"> <h1> Develop applications with Active-Active databases </h1> <p class="text-lg -mt-5 mb-10"> Overview of how developing applications differs for Active-Active databases from standalone Redis databases. </p> <p> Developing geo-distributed, multi-master applications can be difficult. Application developers may have to understand a large number of race conditions between updates to various sites, network, and cluster failures that could reorder the events and change the outcome of the updates performed across geo-distributed writes. </p> <p> Active-Active databases (formerly known as CRDB) are geo-distributed databases that span multiple Redis Enterprise Software (RS) clusters. Active-Active databases depend on multi-master replication (MMR) and Conflict-free Replicated Data Types (CRDTs) to power a simple development experience for geo-distributed applications. Active-Active databases allow developers to use existing Redis data types and commands, but understand the developers intent and automatically handle conflicting concurrent writes to the same key across multiple geographies. For example, developers can simply use the INCR or INCRBY method in Redis in all instances of the geo-distributed application, and Active-Active databases handle the additive nature of INCR to reflect the correct final value. The following example displays a sequence of events over time : t1 to t9. This Active-Active database has two member Active-Active databases : member CRDB1 and member CRDB2. The local operations executing in each member Active-Active database is listed under the member Active-Active database name. The "Sync" even represent the moment where synchronization catches up to distribute all local member Active-Active database updates to other participating clusters and other member Active-Active databases. </p> <table> <thead> <tr> <th style="text-align:center"> <strong> Time </strong> </th> <th style="text-align:center"> <strong> Member CRDB1 </strong> </th> <th style="text-align:center"> <strong> Member CRDB2 </strong> </th> </tr> </thead> <tbody> <tr> <td style="text-align:center"> t1 </td> <td style="text-align:center"> INCRBY key1 7 </td> <td style="text-align:center"> </td> </tr> <tr> <td style="text-align:center"> t2 </td> <td style="text-align:center"> </td> <td style="text-align:center"> INCRBY key1 3 </td> </tr> <tr> <td style="text-align:center"> t3 </td> <td style="text-align:center"> GET key1 <br/> 7 </td> <td style="text-align:center"> GET key1 <br/> 3 </td> </tr> <tr> <td style="text-align:center"> t4 </td> <td style="text-align:center"> — Sync — </td> <td style="text-align:center"> — Sync — </td> </tr> <tr> <td style="text-align:center"> t5 </td> <td style="text-align:center"> GET key1 <br/> 10 </td> <td style="text-align:center"> GET key1 <br/> 10 </td> </tr> <tr> <td style="text-align:center"> t6 </td> <td style="text-align:center"> DECRBY key1 3 </td> <td style="text-align:center"> </td> </tr> <tr> <td style="text-align:center"> t7 </td> <td style="text-align:center"> </td> <td style="text-align:center"> INCRBY key1 6 </td> </tr> <tr> <td style="text-align:center"> t8 </td> <td style="text-align:center"> — Sync — </td> <td style="text-align:center"> — Sync — </td> </tr> <tr> <td style="text-align:center"> t9 </td> <td style="text-align:center"> GET key1 <br/> 13 </td> <td style="text-align:center"> GET key1 <br/> 13 </td> </tr> </tbody> </table> <p> Databases provide various approaches to address some of these concerns: </p> <ul> <li> Active-Passive Geo-distributed deployments: With active-passive distributions, all writes go to an active cluster. Redis Enterprise provides a "Replica Of" capability that provides a similar approach. This can be employed when the workload is heavily balanced towards read and few writes. However, WAN performance and availability is quite flaky and traveling large distances for writes take away from application performance and availability. </li> <li> Two-phase Commit (2PC): This approach is designed around a protocol that commits a transaction across multiple transaction managers. Two-phase commit provides a consistent transactional write across regions but fails transactions unless all participating transaction managers are "available" at the time of the transaction. The number of messages exchanged and its cross-regional availability requirement make two-phase commit unsuitable for even moderate throughputs and cross-geo writes that go over WANs. </li> <li> Sync update with Quorum-based writes: This approach synchronously coordinates a write across majority number of replicas across clusters spanning multiple regions. However, just like two-phase commit, number of messages exchanged and its cross-regional availability requirement make geo-distributed quorum writes unsuitable for moderate throughputs and cross geo writes that go over WANs. </li> <li> Last-Writer-Wins (LWW) Conflict Resolution: Some systems provide simplistic conflict resolution for all types of writes where the system clocks are used to determine the winner across conflicting writes. LWW is lightweight and can be suitable for simpler data. However, LWW can be destructive to updates that are not necessarily conflicting. For example adding a new element to a set across two geographies concurrently would result in only one of these new elements appearing in the final result with LWW. </li> <li> MVCC (multi-version concurrency control): MVCC systems maintain multiple versions of data and may expose ways for applications to resolve conflicts. Even though MVCC system can provide a flexible way to resolve conflicting writes, it comes at a cost of great complexity in the development of a solution. </li> </ul> <p> Even though types and commands in Active-Active databases look identical to standard Redis types and commands, the underlying types in RS are enhanced to maintain more metadata to create the conflict-free data type experience. This section explains what you need to know about developing with Active-Active databases on Redis Enterprise Software. </p> <h2 id="lua-scripts"> Lua scripts </h2> <p> Active-Active databases support Lua scripts, but unlike standard Redis, Lua scripts always execute in effects replication mode. There is currently no way to execute them in script-replication mode. </p> <h2 id="eviction"> Eviction </h2> <p> The default policy for Active-Active databases is <em> noeviction </em> mode. Redis Enterprise version 6.0.20 and later support all eviction policies for Active-Active databases, unless <a href="/docs/latest/operate/rs/databases/auto-tiering/"> Auto Tiering </a> (previously known as Redis on Flash) is enabled. For details, see <a href="/docs/latest/operate/rs/databases/memory-performance/eviction-policy/#active-active-database-eviction"> eviction for Active-Active databases </a> . </p> <h2 id="expiration"> Expiration </h2> <p> Expiration is supported with special multi-master semantics. </p> <p> If a key's expiration time is changed at the same time on different members of the Active-Active database, the longer extended time set via TTL on a key is preserved. As an example: </p> <p> If this command was performed on key1 on cluster #1 </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">127.0.0.1:6379&gt; EXPIRE key1 <span class="m">10</span> </span></span></code></pre> </div> <p> And if this command was performed on key1 on cluster #2 </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">127.0.0.1:6379&gt; EXPIRE key1 <span class="m">50</span> </span></span></code></pre> </div> <p> The EXPIRE command setting the key to 50 would win. </p> <p> And if this command was performed on key1 on cluster #3: </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">127.0.0.1:6379&gt; PERSIST key1 </span></span></code></pre> </div> <p> It would win out of the three clusters hosting the Active-Active database as it sets the TTL on key1 to an infinite time. </p> <p> The replica responsible for the "winning" expire value is also responsible to expire the key and propagate a DEL effect when this happens. A "losing" replica is from this point on not responsible for expiring the key, unless another EXPIRE command resets the TTL. Furthermore, a replica that is NOT the "owner" of the expired value: </p> <ul> <li> <p> Silently ignores the key if a user attempts to access it in READ mode, e.g. treating it as if it was expired but not propagating a DEL. </p> </li> <li> <p> Expires it (sending a DEL) before making any modifications if a user attempts to access it in WRITE mode. </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> Expiration values are in the range of [0, 2^49] for Active-Active databases and [0, 2^64] for non Active-Active databases. </div> </div> </li> </ul> <h2 id="outofmemory-oom"> Out-of-Memory (OOM) </h2> <p> If a member Active-Active database is in an out of memory situation, that member is marked "inconsistent" by RS, the member stops responding to user traffic, and the syncer initiates full reconciliation with other peers in the Active-Active database. </p> <h2 id="active-active-database-key-counts"> Active-Active Database Key Counts </h2> <p> Keys are counted differently for Active-Active databases: </p> <ul> <li> DBSIZE (in <code> shard-cli dbsize </code> ) reports key header instances that represent multiple potential values of a key before a replication conflict is resolved. </li> <li> expired_keys (in <code> bdb-cli info </code> ) can be more than the keys count in DBSIZE (in <code> shard-cli dbsize </code> ) because expires are not always removed when a key becomes a tombstone. A tombstone is a key that is logically deleted but still takes memory until it is collected by the garbage collector. </li> <li> The Expires average TTL (in <code> bdb-cli info </code> ) is computed for local expires only. </li> </ul> <h2 id="info"> INFO </h2> <p> The INFO command has an additional crdt section which provides advanced troubleshooting information (applicable to support etc.): </p> <table> <thead> <tr> <th> <strong> Section </strong> </th> <th> <strong> Field </strong> </th> <th> <strong> Description </strong> </th> </tr> </thead> <tbody> <tr> <td> <strong> CRDT Context </strong> </td> <td> crdt_config_version </td> <td> Currently active Active-Active database configuration version. </td> </tr> <tr> <td> </td> <td> crdt_slots </td> <td> Hash slots assigned and reported by this shard. </td> </tr> <tr> <td> </td> <td> crdt_replid </td> <td> Unique Replica/Shard IDs. </td> </tr> <tr> <td> </td> <td> crdt_clock </td> <td> Clock value of local vector clock. </td> </tr> <tr> <td> </td> <td> crdt_ovc </td> <td> Locally observed Active-Active database vector clock. </td> </tr> <tr> <td> <strong> Peers </strong> </td> <td> A list of currently connected Peer Replication peers. This is similar to the slaves list reported by Redis. </td> <td> </td> </tr> <tr> <td> <strong> Backlogs </strong> </td> <td> A list of Peer Replication backlogs currently maintained. Typically in a full mesh topology only a single backlog is used for all peers, as the requested Ids are identical. </td> <td> </td> </tr> <tr> <td> <strong> CRDT Stats </strong> </td> <td> crdt_sync_full </td> <td> Number of inbound full synchronization processes performed. </td> </tr> <tr> <td> </td> <td> crdt_sync_partial_ok </td> <td> Number of partial (backlog based) re-synchronization processes performed. </td> </tr> <tr> <td> </td> <td> crdt_sync_partial-err </td> <td> Number of partial re-synchronization processes failed due to exhausted backlog. </td> </tr> <tr> <td> </td> <td> crdt_merge_reqs </td> <td> Number of inbound merge requests processed. </td> </tr> <tr> <td> </td> <td> crdt_effect_reqs </td> <td> Number of inbound effect requests processed. </td> </tr> <tr> <td> </td> <td> crdt_ovc_filtered_effect_reqs </td> <td> Number of inbound effect requests filtered due to old vector clock. </td> </tr> <tr> <td> </td> <td> crdt_gc_pending </td> <td> Number of elements pending garbage collection. </td> </tr> <tr> <td> </td> <td> crdt_gc_attempted </td> <td> Number of attempts to garbage collect tombstones. </td> </tr> <tr> <td> </td> <td> crdt_gc_collected </td> <td> Number of tombstones garbaged collected successfully. </td> </tr> <tr> <td> </td> <td> crdt_gc_gvc_min </td> <td> The minimal globally observed vector clock, as computed locally from all received observed clocks. </td> </tr> <tr> <td> </td> <td> crdt_stale_released_with_merge </td> <td> Indicates last stale flag transition was a result of a complete full sync. </td> </tr> <tr> <td> <strong> CRDT Replicas </strong> </td> <td> A list of crdt_replica &lt;uid&gt; entries, each describes the known state of a remote instance with the following fields: </td> <td> </td> </tr> <tr> <td> </td> <td> config_version </td> <td> Last configuration version reported. </td> </tr> <tr> <td> </td> <td> shards </td> <td> Number of shards. </td> </tr> <tr> <td> </td> <td> slots </td> <td> Total number of hash slots. </td> </tr> <tr> <td> </td> <td> slot_coverage </td> <td> A flag indicating remote shards provide full coverage (i.e. all shards are alive). </td> </tr> <tr> <td> </td> <td> max_ops_lag </td> <td> Number of local operations not yet observed by the least updated remote shard </td> </tr> <tr> <td> </td> <td> min_ops_lag </td> <td> Number of local operations not yet observed by the most updated remote shard </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/databases/active-active/develop/develop-for-aa/"/> <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/zscan/.html
<section class="prose w-full py-12"> <h1 class="command-name"> ZSCAN </h1> <div class="font-semibold text-redis-ink-900"> Syntax </div> <pre class="command-syntax">ZSCAN key cursor [MATCH pattern] [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"> 2.8.0 </dd> <dt class="font-semibold text-redis-ink-900 m-0"> Time complexity: </dt> <dd class="m-0"> O(1) for every call. O(N) for a complete iteration, including enough command calls for the cursor to return back to 0. N is the number of elements inside the collection. </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> See <a href="/docs/latest/commands/scan/"> <code> SCAN </code> </a> for <code> ZSCAN </code> documentation. </p> <h2 id="resp2resp3-reply"> RESP2/RESP3 Reply </h2> <a href="../../develop/reference/protocol-spec#arrays"> Array reply </a> : cursor and scan response in array form. <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/zscan/"/> <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-add-context/.html
<section class="prose w-full py-12 max-w-none"> <h1> redis-di add-context </h1> <p class="text-lg -mt-5 mb-10"> Adds a new context </p> <h2 id="usage"> Usage </h2> <pre tabindex="0"><code>Usage: redis-di add-context [OPTIONS] CONTEXT_NAME </code></pre> <h2 id="options"> Options </h2> <ul> <li> <p> <code> context_name </code> (REQUIRED): </p> <ul> <li> Type: STRING </li> <li> Default: <code> none </code> </li> <li> Usage: <code> context-name </code> </li> </ul> </li> <li> <p> <code> loglevel </code> : </p> <ul> <li> Type: Choice(['DEBUG', 'INFO', 'WARN', 'ERROR', 'CRITICAL']) </li> <li> Default: <code> info </code> </li> <li> Usage: <code> --loglevel -log-level </code> </li> </ul> </li> <li> <p> <code> cluster_host </code> (REQUIRED): </p> <ul> <li> Type: STRING </li> <li> Default: <code> none </code> </li> <li> Usage: <code> --cluster-host </code> </li> </ul> <p> Host/IP of Redis Enterprise Cluster (service name in case of k8s) </p> </li> <li> <p> <code> cluster_api_port </code> (REQUIRED): </p> <ul> <li> Type: &lt;IntRange 1000&lt;=x&lt;=65535&gt; </li> <li> Default: <code> 9443 </code> </li> <li> Usage: <code> --cluster-api-port </code> </li> </ul> <p> API Port of Redis Enterprise Cluster </p> </li> <li> <p> <code> cluster_user </code> (REQUIRED): </p> <ul> <li> Type: STRING </li> <li> Default: <code> none </code> </li> <li> Usage: <code> --cluster-user </code> </li> </ul> <p> Redis Enterprise Cluster username with either DB Member, Cluster Member or Cluster Admin roles </p> </li> <li> <p> <code> rdi_host </code> (REQUIRED): </p> <ul> <li> Type: STRING </li> <li> Default: <code> none </code> </li> <li> Usage: <code> --rdi-host </code> </li> </ul> <p> Host/IP of Write-behind Database </p> </li> <li> <p> <code> rdi_port </code> (REQUIRED): </p> <ul> <li> Type: &lt;IntRange 1000&lt;=x&lt;=65535&gt; </li> <li> Default: <code> none </code> </li> <li> Usage: <code> --rdi-port </code> </li> </ul> <p> Port of Write-behind Database </p> </li> <li> <p> <code> rdi_key </code> : </p> <ul> <li> Type: STRING </li> <li> Default: <code> none </code> </li> <li> Usage: <code> --rdi-key </code> </li> </ul> <p> Private key file to authenticate with </p> </li> <li> <p> <code> rdi_cert </code> : </p> <ul> <li> Type: STRING </li> <li> Default: <code> none </code> </li> <li> Usage: <code> --rdi-cert </code> </li> </ul> <p> Client certificate file to authenticate with </p> </li> <li> <p> <code> rdi_cacert </code> : </p> <ul> <li> Type: STRING </li> <li> Default: <code> none </code> </li> <li> Usage: <code> --rdi-cacert </code> </li> </ul> <p> CA certificate file to verify with </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 add-context [OPTIONS] CONTEXT_NAME Adds a new context Options: -log-level, --loglevel [DEBUG|INFO|WARN|ERROR|CRITICAL] [default: INFO] --cluster-host TEXT Host/IP of Redis Enterprise Cluster (service name in case of k8s) [required] --cluster-api-port INTEGER RANGE API Port of Redis Enterprise Cluster [default: 9443; 1000&lt;=x&lt;=65535; required] --cluster-user TEXT Redis Enterprise Cluster username with either DB Member, Cluster Member or Cluster Admin roles [required] --rdi-host TEXT Host/IP of Write-behind Database [required] --rdi-port INTEGER RANGE Port of Write-behind Database [1000&lt;=x&lt;=65535; required] --rdi-key TEXT Private key file to authenticate with --rdi-cert TEXT Client certificate file to authenticate with --rdi-cacert TEXT CA certificate file to verify with --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/write-behind/reference/cli/redis-di-add-context/"/> <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/grouptransactions.html
<section class="prose w-full py-12"> <h1> Commands </h1> </section>
https://redis.io/docs/latest/operate/kubernetes/active-active/.html
<section class="prose w-full py-12 max-w-none"> <h1> Active-Active databases </h1> <p class="text-lg -mt-5 mb-10"> Content related to Active-Active Redis Enterprise databases for Kubernetes. </p> <p> On Kubernetes, Redis Enterprise <a href="/docs/latest/operate/rs/databases/active-active/"> Active-Active </a> databases provide read and write access to the same dataset from different Kubernetes clusters. </p> <h2 id="active-active-setup-methods"> Active-Active setup methods </h2> <p> There are two methods for creating an Active-Active database with Redis Enterprise for Kubernetes: </p> <ul> <li> The <code> RedisEnterpriseActiveActiveDatabase </code> (REAADB) custom resource is available for versions 6.4.2 and later. </li> <li> The <code> crdb-cli </code> method is available for versions 6.4.2 or earlier. </li> </ul> <p> We recommend creating new Active-Active databases using the RedisEnterpriseActiveActiveDatabase (REAADB) custom resource. This allows you to manage your Active-Active database with the operator and ensures you have the latest features and functionality. </p> <h3 id="active-active-controller-method"> Active-Active controller method </h3> <p> Versions 6.4.2-6 or later fully support the Active-Active controller. Some of these features were available as a preview in 6.4.2-4 and 6.4.2-5. Please upgrade to 6.4.2-6 for the full set of general availability features and bug fixes. </p> <p> This setup method includes the following steps: </p> <ol> <li> Gather REC credentials and <a href="/docs/latest/operate/kubernetes/active-active/prepare-clusters/"> prepare participating clusters </a> . </li> <li> Create <a href="/docs/latest/operate/kubernetes/active-active/create-reaadb/#create-rerc"> <code> RedisEnterpriseRemoteCluster </code> (RERC) </a> resources. </li> <li> Create <a href="/docs/latest/operate/kubernetes/active-active/create-reaadb/#create-reaadb"> <code> RedisEnterpriseActiveActiveDatabase </code> (REAADB) </a> resource. </li> </ol> <h3 id="crdb-cli-method"> <code> crdb-cli </code> method </h3> <p> For versions 6.4.2 or earlier, this Active-Active setup method includes the following steps: </p> <ol> <li> Install and configure an ingress. </li> <li> Gather configuration details. </li> <li> Add the <code> ActiveActive </code> field to the REC spec. </li> <li> Create the database with the <code> crdb-cli </code> tool. </li> </ol> <h2 id="redis-enterprise-active-active-controller-for-kubernetes"> Redis Enterprise Active-Active controller for Kubernetes </h2> <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 features are supported for general availability in releases 6.4.2-6 and later. </div> </div> <p> <a href="/docs/latest/operate/rs/databases/active-active/"> Active-Active </a> databases give you read-and-write access to Redis Enterprise clusters (REC) in different Kubernetes clusters or namespaces. Active-Active deployments managed by the Redis Enterprise operator require two additional custom resources: Redis Enterprise Active-Active database (REAADB) and Redis Enterprise remote cluster (RERC). </p> <p> To create an Active-Active Redis Enterprise deployment for Kubernetes with these new features, first <a href="/docs/latest/operate/kubernetes/active-active/prepare-clusters/"> prepare participating clusters </a> then <a href="/docs/latest/operate/kubernetes/active-active/create-reaadb/"> create an Active-Active database </a> . </p> <h3 id="preview-versions"> Preview versions </h3> <p> If you are using a preview version of these features (operator version 6.4.2-4 or 6.4.2-5), you'll need to enable the Active-Active controller with the following steps. You need to do this only once per cluster. We recommend using the fully supported 6.4.2-6 version. </p> <ol> <li> <p> Download the custom resource definitions (CRDs) for the most recent release (6.4.2-4) from <a href="https://github.com/RedisLabs/redis-enterprise-k8s-docs/tree/master/crds"> redis-enterprise-k8s-docs Github </a> . </p> </li> <li> <p> Apply the new CRDs for the Redis Enterprise Active-Active database (REAADB) and Redis Enterprise remote cluster (RERC) to install those controllers. </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">kubectl apply -f crds/reaadb_crd.yaml </span></span><span class="line"><span class="cl">kubectl apply -f crds/rerc_crd.yaml </span></span></code></pre> </div> </li> <li> <p> Enable the Active-Active and remote cluster controllers on the operator ConfigMap. </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">kubectl patch cm operator-environment-config --type merge --patch <span class="s2">"{\"data\": \ </span></span></span><span class="line"><span class="cl"><span class="s2">{\"ACTIVE_ACTIVE_DATABASE_CONTROLLER_ENABLED\":\"true\", \ </span></span></span><span class="line"><span class="cl"><span class="s2">\"REMOTE_CLUSTER_CONTROLLER_ENABLED\":\"true\"}}"</span> </span></span></code></pre> </div> </li> </ol> <h3 id="reaadb-custom-resource"> REAADB custom resource </h3> <p> Redis Enterprise Active-Active database (REAADB) contains a link to the RERC for each participating cluster, and provides configuration and status to the management plane. </p> <p> For a full list of fields and options, see the <a href="/docs/latest/operate/kubernetes/reference/redis_enterprise_active_active_database_api/"> REAADB API reference </a> . </p> <h3 id="rerc-custom-resource"> RERC custom resource </h3> <p> Redis Enterprise remote cluster (RERC) custom resource contains configuration details for all the participating clusters. </p> <p> For a full list of fields and options, see the <a href="/docs/latest/operate/kubernetes/reference/redis_enterprise_remote_cluster_api/"> RERC API reference </a> . </p> <h3 id="limitations"> Limitations </h3> <ul> <li> Existing Redis databases cannot be migrated to a REAADB. (DOC-3594) </li> <li> Admission is not blocking REAADB with <code> shardCount </code> which exceeds license quota. (RED-96301) Workaround: Fix the problems with the REAADB and reapply. </li> <li> The <code> &lt;rec-name&gt;/&lt;rec-namespace&gt; </code> value must be unique for each RERC resource. (RED-96302) </li> <li> Only global database options are supported, no support for specifying configuration per location. </li> <li> No support for migration from old ( <code> crdb-cli </code> ) Active-Active database method to new Active-Active controller. </li> <li> No support for REAADB with participating clusters co-located within the same Kubernetes cluster, except for a single designated local participating cluster. </li> </ul> <h2 id="more-info"> More info </h2> <p> For more general information about Active-Active, see the <a href="/docs/latest/operate/rs/databases/active-active/"> Redis Enterprise Software docs </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/kubernetes/active-active/"/> <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/groupgeo.html
<section class="prose w-full py-12"> <h1> Commands </h1> </section>
https://redis.io/docs/latest/develop/tools/insight/release-notes/v1.5.0/.html
<section class="prose w-full py-12"> <h1> RedisInsight v1.5, May 2020 </h1> <p class="text-lg -mt-5 mb-10"> New tool for RedisGears, Multi-line query builder and improved suppport of Redis 6 ACLs </p> <p> This is the General Availability Release of RedisInsight 1.5 (v1.5.0)! </p> <h3 id="headlines"> Headlines </h3> <ul> <li> Added beta support for <a href="https://oss.redislabs.com/redisgears/"> RedisGears module </a> </li> <li> Added multi-line query editing for RediSearch, RedisGraph and Timeseries </li> <li> Improved support of Redis 6 ACLs </li> </ul> <h3 id="full-details"> Full details: </h3> <ul> <li> <p> Features </p> <ul> <li> Core: <ul> <li> Improved support for Redis 6 managing ACL permissions for each different capabilities </li> </ul> </li> <li> Gears: <ul> <li> Beta support for <a href="https://oss.redislabs.com/redisgears/"> Redis Gears module </a> <ul> <li> Explore the latest executed functions and analyze the results or errors </li> <li> Manage registered functions and get execution summary </li> <li> Code, build and execute functions </li> </ul> </li> </ul> </li> <li> RediSearch: <ul> <li> Multi-line for building queries </li> </ul> </li> <li> RedisGraph: <ul> <li> Multi-line for building queries </li> </ul> </li> <li> Timeseries: <ul> <li> Multi-line for building queries </li> </ul> </li> </ul> </li> <li> <p> Bug Fixes: </p> <ul> <li> Configuration: <ul> <li> Fixed issue not showing the list of modules </li> </ul> </li> <li> Search: <ul> <li> Fixed issue preventing users to see all documents matching a search query </li> <li> Fixed issue with retrieving the search indexes in case of large database </li> </ul> </li> </ul> </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/v1.5.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/operate/rc/security/database-security/tls-ssl/.html
<section class="prose w-full py-12 max-w-none"> <h1> Transport Layer Security (TLS) </h1> <p class="text-lg -mt-5 mb-10"> Enable TLS to encrypt data communications between applications and Redis databases. </p> <p> Transport Layer Security (TLS) uses encryption to secure <a href="https://en.wikipedia.org/wiki/Transport_Layer_Security"> network communications </a> . </p> <p> Paid Redis Cloud Essentials plans and Redis Cloud Pro plans can use TLS to encrypt data communications between applications and Redis databases. </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> TLS is not available for Free Redis Cloud Essentials plans. </div> </div> <h2 id="use-tls-with-redis-cloud"> Use TLS with Redis Cloud </h2> <p> TLS is not enabled by default. </p> <h3 id="tls-recommendations"> TLS recommendations </h3> <p> Because TLS has an impact on performance, you need to determine whether the security benefits of TLS are worth the performance impact. TLS recommendations depend on the subscription plan and whether clients connect to your database using public or private endpoints. </p> <p> This table shows TLS recommendations: </p> <table> <thead> <tr> <th> Subscription </th> <th> Public endpoint </th> <th> Private endpoint </th> </tr> </thead> <tbody> <tr> <td> Redis Cloud Essentials </td> <td> Enable TLS </td> <td> N/A </td> </tr> <tr> <td> Redis Cloud Pro </td> <td> Enable TLS </td> <td> Enable TLS if security outweighs performance impact </td> </tr> </tbody> </table> <h3 id="client-authentication"> Client authentication </h3> <p> When you enable TLS, you can optionally require client authentication (also known as "mutual authentication"). If enabled, all clients must present a valid client certificate when they connect to the database. </p> <p> Client authentication is not required by Redis Cloud; however, it is strongly recommended. </p> <h3 id="enable-tls"> Enable TLS </h3> <p> To enable TLS for a Redis Cloud database: </p> <ol> <li> <p> Select <strong> Databases </strong> from the <a href="https://cloud.redis.io/"> Redis Cloud console </a> menu and then select your database from the list. </p> </li> <li> <p> From the database's <strong> Configuration </strong> screen, select the <strong> Edit database </strong> button: </p> <a href="/docs/latest/images/rc/button-database-edit.png" sdata-lightbox="/images/rc/button-database-edit.png"> <img alt="The Edit database button lets you change selected database properties." src="/docs/latest/images/rc/button-database-edit.png" width="140px"/> </a> </li> <li> <p> In the <strong> Security </strong> section, use the <strong> Transport layer security (TLS) </strong> toggle to enable TLS: </p> <a href="/docs/latest/images/rc/database-details-configuration-tab-security-tls-toggle.png" sdata-lightbox="/images/rc/database-details-configuration-tab-security-tls-toggle.png"> <img alt="Use the Transport Layer Security toggle to enable TLS." src="/docs/latest/images/rc/database-details-configuration-tab-security-tls-toggle.png" width="200px"/> </a> </li> <li> <p> Select the <strong> Download server certificate </strong> button to download the Redis Cloud certificate bundle <code> redis_ca.pem </code> : </p> <a href="/docs/latest/images/rc/button-database-config-security-server-ca-download.png" sdata-lightbox="/images/rc/button-database-config-security-server-ca-download.png"> <img alt="Use the Download server certificate button to download the Redis Cloud CA certificates." src="/docs/latest/images/rc/button-database-config-security-server-ca-download.png" width="250px"/> </a> </li> <li> <p> Decide whether you want to require client authentication: </p> <ul> <li> <p> If you only want clients that present a valid certificate to be able to connect, continue to the next step. </p> </li> <li> <p> If you do not want to require client authentication, skip to the final step to apply your changes. </p> </li> </ul> </li> <li> <p> To require client authentication, select the <strong> Mutual TLS (require client authentication) </strong> checkbox. </p> </li> <li> <p> Select <strong> Add client certificate </strong> to add a certificate. </p> <a href="/docs/latest/images/rc/mtls-add-client-certificate.png" sdata-lightbox="/images/rc/mtls-add-client-certificate.png"> <img alt="The Add client certificate button." src="/docs/latest/images/rc/mtls-add-client-certificate.png" width="200px"/> </a> </li> <li> <p> Either provide an <a href="https://en.wikipedia.org/wiki/X.509"> X.509 client certificate </a> or chain in PEM format for your client or select <strong> Generate </strong> to create one: </p> <a href="/docs/latest/images/rc/database-details-configuration-tab-security-tls-client-auth-certificate.png" sdata-lightbox="/images/rc/database-details-configuration-tab-security-tls-client-auth-certificate.png"> <img alt="Provide or generate a certificate for Mutual TLS." src="/docs/latest/images/rc/database-details-configuration-tab-security-tls-client-auth-certificate.png"/> </a> <ul> <li> <p> If you generate your certificate from the Redis Cloud console, a <strong> Download certificate </strong> button will appear after it is generated. Select it to download the certificate. </p> <a href="/docs/latest/images/rc/mtls-download-certificate.png" sdata-lightbox="/images/rc/mtls-download-certificate.png"> <img alt="The Download certificate button." src="/docs/latest/images/rc/mtls-download-certificate.png"/> </a> <p> The download contains: </p> <ul> <li> <p> <code> redis-db-&lt;database_id&gt;.crt </code> – the certificate's public key. </p> </li> <li> <p> <code> redis-db-&lt;database_id&gt;.key </code> – the certificate's private key. </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 must download the certificate using the button at this point. After your changes have been applied, the full bundle of public and private keys will no longer be available for download. </div> </div> </li> <li> <p> If you provide a client certificate or a certificate chain, you will see the certificate details before you save your changes. </p> <a href="/docs/latest/images/rc/mtls-certificate-details.png" sdata-lightbox="/images/rc/mtls-certificate-details.png"> <img alt="The Download certificate button." src="/docs/latest/images/rc/mtls-certificate-details.png"/> </a> </li> </ul> </li> <li> <p> You can select <strong> Add client certificate </strong> again to add another certificate. </p> <a href="/docs/latest/images/rc/mtls-add-client-certificate.png" sdata-lightbox="/images/rc/mtls-add-client-certificate.png"> <img alt="The Add client certificate button." src="/docs/latest/images/rc/mtls-add-client-certificate.png" width="200px"/> </a> </li> <li> <p> To apply your changes and enable TLS, select the <strong> Save database </strong> button: </p> <a href="/docs/latest/images/rc/button-database-save.png" sdata-lightbox="/images/rc/button-database-save.png"> <img alt="Use the Save database button to save database changes." src="/docs/latest/images/rc/button-database-save.png" width="140px"/> </a> </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> <ul> <li> <p> When you enable or turn off TLS, the change applies to new connections but does not affect existing connections. Clients must close existing connections and reconnect to apply the change. </p> </li> <li> <p> Once you've enabled TLS, all client connections to your database must use TLS. Unencrypted connections will no longer be permitted. </p> </li> </ul> </div> </div> <h2 id="connect-over-tls"> Connect over TLS </h2> <p> To connect to a Redis Cloud database over TLS, you need: </p> <ul> <li> A Redis client that supports TLS </li> <li> Redis Cloud CA certificates </li> </ul> <h3 id="download-certificates"> Download CA certificates </h3> <p> If you don't have the Redis Cloud CA certificates, you can download them from the Redis Cloud console: </p> <ol> <li> <p> Either select <strong> Account Settings </strong> from the Redis Cloud console menu or go to the database's <strong> Configuration </strong> screen. </p> </li> <li> <p> Go to the <strong> Security </strong> section. </p> </li> <li> <p> For <strong> Redis Cloud certificate authority </strong> , either: </p> <ul> <li> <p> Select the <strong> Download </strong> button to download the certificates from <strong> Account Settings </strong> : </p> <a href="/docs/latest/images/rc/button-account-settings-security-ca-download.png" sdata-lightbox="/images/rc/button-account-settings-security-ca-download.png"> <img alt="Use the Download button to download the Redis Cloud CA certificates." src="/docs/latest/images/rc/button-account-settings-security-ca-download.png" width="140px"/> </a> </li> <li> <p> Select the <strong> Download server certificate </strong> button to download the certificates from the database's <strong> Configuration </strong> screen: </p> <a href="/docs/latest/images/rc/button-database-config-security-server-ca-download.png" sdata-lightbox="/images/rc/button-database-config-security-server-ca-download.png"> <img alt="Use the Download server certificate button to download the Redis Cloud CA certificates." src="/docs/latest/images/rc/button-database-config-security-server-ca-download.png" width="250px"/> </a> </li> </ul> </li> </ol> <p> The download contains a file called <code> redis_ca.pem </code> , which includes the following certificates: </p> <ul> <li> <p> Self-signed Redis Cloud Essentials plan Root CA (deprecated but still in use) </p> </li> <li> <p> Self-signed Redis Cloud Pro plan Root CA and intermediate CA (deprecated but still in use) </p> </li> <li> <p> Publicly trusted GlobalSign Root CA </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> The downloaded PEM file contains multiple certificates. Make sure to import <strong> all </strong> certificates to your client trust store. If your client code is not implemented properly, it may only import the first certificate. </div> </div> <p> To inspect the certificates in <code> redis_ca.pem </code> , run the <code> keytool </code> command: </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">keytool -printcert -file ./redis_ca.pem <span class="p">|</span> grep <span class="s2">"Owner:"</span> </span></span></code></pre> </div> <p> You can add <code> redis_ca.pem </code> to the trust store or pass it directly to a Redis client. </p> <p> If your database requires client authentication, you also need the public ( <code> redis_user.crt </code> ) and private ( <code> redis_user_private.key </code> ) client keys. See <a href="#enable-tls"> Enable TLS </a> for details. </p> <h3 id="connect-with-the-redis-cli"> Connect with the Redis CLI </h3> <p> Here's how to use the <a href="/docs/latest/operate/rs/references/cli-utilities/redis-cli/"> Redis CLI </a> to connect to a TLS-enabled Redis Cloud database. </p> <p> Endpoint and port details are available from the <strong> Databases </strong> list or the database's <strong> Configuration </strong> screen. </p> <h4 id="without-client-authentication"> Without client authentication </h4> <p> If your database doesn't require client authentication, then provide the Redis Cloud CA certificate bundle ( <code> redis_ca.pem </code> ) when you connect: </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">redis-cli -h &lt;endpoint&gt; -p &lt;port&gt; --tls --cacert redis_ca.pem </span></span></code></pre> </div> <h4 id="with-client-authentication"> With client authentication </h4> <p> If your database requires client authentication, then you also need to provide your client's private and public keys: </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">redis-cli -h &lt;endpoint&gt; -p &lt;port&gt; --tls --cacert redis_ca.pem <span class="se">\ </span></span></span><span class="line"><span class="cl"><span class="se"></span> --cert redis_user.crt --key redis_user_private.key </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/rc/security/database-security/tls-ssl/"/> <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/configure/proxy-policy/.html
<section class="prose w-full py-12 max-w-none"> <h1> Configure proxy policy </h1> <p> Redis Enterprise Software (RS) provides high-performance data access through a proxy process that manages and optimizes access to shards within the RS cluster. Each node contains a single proxy process. Each proxy can be active and take incoming traffic or it can be passive and wait for failovers. </p> <h2 id="proxy-policies"> Proxy policies </h2> <p> A database can have one of these proxy policies: </p> <table> <thead> <tr> <th> <strong> Proxy Policy </strong> </th> <th> <strong> Description </strong> </th> </tr> </thead> <tbody> <tr> <td> Single </td> <td> There is only a single proxy that is bound to the database. This is the default database configuration and preferable in most use cases. </td> </tr> <tr> <td> All Master Shards </td> <td> There are multiple proxies that are bound to the database, one on each node that hosts a database master shard. This mode fits most use cases that require multiple proxies. </td> </tr> <tr> <td> All Nodes </td> <td> There are multiple proxies that are bound to the database, one on each node in the cluster, regardless of whether or not there is a shard from this database on the node. This mode should be used only in special cases, such as <a href="/docs/latest/operate/rs/7.4/networking/cluster-lba-setup/"> using a load balancer </a> . </td> </tr> </tbody> </table> <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> Manual intervention is also available via the rladmin bind add and remove commands. </div> </div> <h2 id="database-configuration"> Database configuration </h2> <p> A database can be configured with a proxy policy using rladmin bind. </p> <p> Warning: Any configuration update which causes existing proxies to be unbounded can cause existing client connections to get disconnected. </p> <p> You can run rladmin to control and view the existing settings for proxy configuration. </p> <p> The <strong> info </strong> command on cluster returns the existing proxy policy for sharded and non-sharded (single shard) databases. </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">$ rladmin info cluster </span></span><span class="line"><span class="cl">cluster configuration: </span></span><span class="line"><span class="cl">   repl_diskless: enabled </span></span><span class="line"><span class="cl"> default_non_sharded_proxy_policy: single </span></span><span class="line"><span class="cl">   default_sharded_proxy_policy: single </span></span><span class="line"><span class="cl">   default_shards_placement: dense </span></span><span class="line"><span class="cl">   default_shards_overbooking: disabled </span></span><span class="line"><span class="cl">   default_fork_evict_ram: enabled </span></span><span class="line"><span class="cl">   default_redis_version: 3.2 </span></span><span class="line"><span class="cl">   redis_migrate_node_threshold: 0KB <span class="o">(</span><span class="m">0</span> bytes<span class="o">)</span> </span></span><span class="line"><span class="cl">   redis_migrate_node_threshold_percent: <span class="m">8</span> <span class="o">(</span>%<span class="o">)</span> </span></span><span class="line"><span class="cl">   redis_provision_node_threshold: 0KB <span class="o">(</span><span class="m">0</span> bytes<span class="o">)</span> </span></span><span class="line"><span class="cl">   redis_provision_node_threshold_percent: <span class="m">12</span> <span class="o">(</span>%<span class="o">)</span> </span></span><span class="line"><span class="cl">   max_simultaneous_backups: <span class="m">4</span> </span></span><span class="line"><span class="cl">   watchdog profile: local-network </span></span></code></pre> </div> <p> You can configure the proxy policy using the <code> bind </code> command in rladmin. The following command is an example that changes the bind policy for a database named "db1" with an endpoint id "1:1" to "All Master Shards" proxy policy. </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">rladmin <span class="nb">bind</span> db db1 endpoint 1:1 policy all-master-shards </span></span></code></pre> </div> <p> The next command performs the same task using the database id in place of the name. The id of this database is "1". </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">rladmin <span class="nb">bind</span> db db:1 endpoint 1:1 policy all-master-shards </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> You can find the endpoint id for the endpoint argument by running <em> status </em> command for rladmin. Look for the endpoint id information under the <em> ENDPOINT </em> section of the output. </div> </div> <h3 id="reapply-policies-after-topology-changes"> Reapply policies after topology changes </h3> <p> If you want to reapply the policy after topology changes, such as node restarts, failovers and migrations, run this command to reset the policy: </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">rladmin <span class="nb">bind</span> db db:&lt;ID&gt; endpoint &lt;endpoint id&gt; policy &lt;all-master-shards<span class="p">|</span>all-nodes&gt; </span></span></code></pre> </div> <p> This is not required with single policies. </p> <h4 id="other-implications"> Other implications </h4> <p> During the regular operation of the cluster different actions might take place, such as automatic migration or automatic failover, which change what proxy needs to be bound to what database. When such actions take place the cluster attempts, as much as possible, to automatically change proxy bindings to adhere to the defined policies. That said, the cluster attempts to prevent any existing client connections from being disconnected, and hence might not entirely enforce the policies. In such cases, you can enforce the policy using the appropriate rladmin commands. </p> <h2 id="about-multiple-active-proxy-support"> About multiple active proxy support </h2> <p> RS allows multiple databases to be created. Each database gets an endpoint (a unique URL and port on the FQDN). This endpoint receives all the traffic for all operations for that database. By default, RS binds this database endpoint to one of the proxies on a single node in the cluster. This proxy becomes an active proxy and receives all the operations for the given database. (note that if the node with the active proxy fails, a new proxy on another node takes over as part of the failover process automatically). </p> <p> In most cases, a single proxy can handle a large number of operations without consuming additional resources. However, under high load, network bandwidth or a high rate of packets per second (PPS) on the single active proxy can become a bottleneck to how fast database operation can be performed. In such cases, having multiple active proxies, across multiple nodes, mapped to the same external database endpoint, can significantly improve throughput. </p> <p> With the multiple active proxies capability, RS enables you to configure a database to have multiple internal proxies in order to improve performance, in some cases. It is important to note that, even though multiple active proxies can help improve the throughput of database operations, configuring multiple active proxies may cause additional latency in operations as the shards and proxies are spread across multiple nodes in the cluster. </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> When the network on a single active proxy becomes the bottleneck, you might also look into enabling the multiple NIC support in RS. With nodes that have multiple physical NICs (Network Interface Cards), you can configure RS to separate internal and external traffic onto independent physical NICs. For more details, refer to <a href="/docs/latest/operate/rs/networking/multi-ip-ipv6/"> Multi-IP &amp; IPv6 </a> . </div> </div> <p> Having multiple proxies for a database can improve RS's ability for fast failover in case of proxy and/or node failure. With multiple proxies for a database, there is no need for a client to wait for the cluster to spin up another proxy and a DNS change in most cases, the client just uses the next IP in the list to connect to another proxy. </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/configure/proxy-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/operate/rs/7.4/databases/import-export/import-data/.html
<section class="prose w-full py-12 max-w-none"> <h1> Import data into a database </h1> <p class="text-lg -mt-5 mb-10"> 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> <p> You can import, <a href="/docs/latest/operate/rs/7.4/databases/import-export/export-data/"> export </a> , or <a href="/docs/latest/operate/rs/7.4/databases/import-export/schedule-backups/"> backup </a> 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> <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> Importing data erases all existing content in the database. </div> </div> <h2 id="import-data-into-a-database"> Import data into a database </h2> <p> To import data into a database using the Cluster Manager UI: </p> <ol> <li> <p> On the <strong> Databases </strong> screen, select the database from the list, then select <strong> Configuration </strong> . </p> </li> <li> <p> Click <a href="/docs/latest/images/rs/buttons/button-toggle-actions-vertical.png#no-click" sdata-lightbox="/images/rs/buttons/button-toggle-actions-vertical.png#no-click"> <img alt="Toggle actions button" class="inline" src="/docs/latest/images/rs/buttons/button-toggle-actions-vertical.png#no-click" width="22px"/> </a> to open a list of additional actions. </p> </li> <li> <p> Select <strong> Import </strong> . </p> </li> <li> <p> Select the tab that corresponds to your storage location type and enter the location details. </p> <p> See <a href="#supported-storage-locations"> Supported storage locations </a> for more information about each storage location type. </p> </li> <li> <p> Select <strong> Import </strong> . </p> </li> </ol> <h2 id="supported-storage-services"> Supported storage locations </h2> <p> Data can be imported from 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 importing from a local mount point or a cloud provider, import locations need to be available to <a href="/docs/latest/operate/rs/7.4/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 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 importing data from an FTP server, make sure that: </p> <ul> <li> Your Redis Enterprise cluster can connect and authenticate to the FTP server. </li> <li> The user that you specify in the FTP server location has permission to read files from the server. </li> </ul> <p> To import data from an FTP server, set <strong> RDB file path/s </strong> using the following syntax: </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl"><span class="o">[</span>protocol<span class="o">]</span>://<span class="o">[</span>username<span class="o">]</span>:<span class="o">[</span>password<span class="o">]</span>@<span class="o">[</span>host<span class="o">]</span>:<span class="o">[</span>port<span class="o">]</span>/<span class="o">[</span>path<span class="o">]</span>/<span class="o">[</span>filename<span class="o">]</span>.rdb </span></span></code></pre> </div> <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 file's location path. </li> <li> <em> filename </em> : the name of the file. </li> </ul> <p> Example: <code> ftp://username:[email protected]/home/backups/&lt;filename&gt;.rdb </code> </p> <p> Select <strong> Add path </strong> to add another import file path. </p> <h3 id="local-mount-point"> Local mount point </h3> <p> Before importing data from a local mount point, make sure that: </p> <ul> <li> <p> The node can connect to the server hosting the mount point. </p> </li> <li> <p> The <code> redislabs:redislabs </code> user has permission to read files on the local mount point and on the destination server. </p> </li> <li> <p> You must mount the storage in the same path on all cluster nodes. You can also use local storage, but you must copy the imported files manually to all nodes because the import source folders on the nodes are not synchronized. </p> </li> </ul> <p> To import from a local mount point: </p> <ol> <li> <p> On each node in the cluster, create the mount point: </p> <ol> <li> <p> Connect to the node's terminal. </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 import location, enter the mount point. </p> <p> For example: <code> /mnt/Public/&lt;filename&gt;.rdb </code> </p> </li> </ol> <p> As of version 6.2.12, Redis Enterprise reads files directly from the mount point using a <a href="https://en.wikipedia.org/wiki/Symbolic_link"> symbolic link </a> (symlink) instead of copying them to a temporary directory on the node. </p> <p> Select <strong> Add path </strong> to add another import file path. </p> <h3 id="sftp-server"> SFTP server </h3> <p> Before importing data from 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 that you specify in the SFTP server location has permission to read files from the server. </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 &gt; Security &gt; 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 import data from 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"><span class="o">[</span>protocol<span class="o">]</span>://<span class="o">[</span>username<span class="o">]</span>:<span class="o">[</span>password<span class="o">]</span>@<span class="o">[</span>host<span class="o">]</span>:<span class="o">[</span>port<span class="o">]</span>/<span class="o">[</span>path<span class="o">]</span>/<span class="o">[</span>filename<span class="o">]</span>.rdb </span></span></code></pre> </div> <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 file's location path. </li> <li> <em> filename </em> : the name of the file. </li> </ul> <p> Example: <code> sftp://username:[email protected]/home/backups/[filename].rdb </code> </p> <p> Select <strong> Add path </strong> to add another import file path. </p> <h3 id="aws-s3"> AWS Simple Storage Service </h3> <p> Before you choose to import data from an <a href="https://aws.amazon.com/"> Amazon Web Services </a> (AWS) Simple Storage Service (S3) bucket, make sure you have: </p> <ul> <li> The path to the file in your bucket in the format: <code> s3://[bucketname]/[path]/[filename].rdb </code> </li> <li> <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html#Using_CreateAccessKey"> Access key ID and Secret access key </a> for an <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_users_create.html#id_users_create_console"> IAM user </a> with permission to read files from the bucket. </li> </ul> <p> In the Redis Enterprise Software Cluster Manager UI, when you enter the export location details: </p> <ul> <li> <p> Select <strong> AWS S3 </strong> . </p> </li> <li> <p> In the <strong> RDB file path/s </strong> field, enter the path of your bucket. Select <strong> Add path </strong> to add another import file path. </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> <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/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 s3_url &lt;URL&gt; </span></span></code></pre> </div> <p> Replace <code> &lt;URL&gt; </code> with the hostname or IP address of the S3-compatible storage location. </p> <h3 id="google-cloud-storage"> Google Cloud Storage </h3> <p> Before you import data from a <a href="https://developers.google.com/console/"> Google Cloud </a> storage bucket, make sure you have: </p> <ul> <li> Storage location path in the format: <code> /bucket_name/[path]/[filename].rdb </code> </li> <li> A <a href="https://cloud.google.com/iam/docs/creating-managing-service-account-keys#creating"> JSON service account key </a> for your account </li> <li> A <a href="https://cloud.google.com/storage/docs/access-control/using-iam-permissions#bucket-add"> principal </a> for your bucket with the <code> client_email </code> from the service account key and a <a href="https://cloud.google.com/storage/docs/access-control/iam-roles"> role </a> with permissions to get files from the bucket (such as the <strong> Storage Legacy Object Reader </strong> role, which grants <code> storage.objects.get </code> permissions) </li> </ul> <p> In the Redis Enterprise Software Cluster Manager UI, when you enter the import location details: </p> <ul> <li> <p> Select <strong> Google Cloud Storage </strong> . </p> </li> <li> <p> In the <strong> RDB file path/s </strong> field, enter the path of your file. Select <strong> Add path </strong> to add another import file path. </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> <h3 id="azure-blob-storage"> Azure Blob Storage </h3> <p> Before you choose to import from Azure Blob Storage, make sure that you have: </p> <ul> <li> <p> Storage location path in the format: <code> /container_name/[path/]/&lt;filename&gt;.rdb </code> </p> </li> <li> <p> Account name </p> </li> <li> <p> An authentication token, either an account key or an Azure <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/delegate-access-with-shared-access-signature"> shared access signature </a> (SAS). </p> <p> To find the account name and account key, see <a href="https://docs.microsoft.com/en-us/azure/storage/common/storage-account-keys-manage"> Manage storage account access keys </a> . </p> <p> Azure SAS support requires Redis Software version 6.0.20. To learn more about Azure SAS, see <a href="https://docs.microsoft.com/en-us/azure/storage/common/storage-sas-overview"> Grant limited access to Azure Storage resources using shared access signatures </a> . </p> </li> </ul> <p> In the Redis Enterprise Software Cluster Manager UI, when you enter the import location details: </p> <ul> <li> <p> Select <strong> Azure Blob Storage </strong> . </p> </li> <li> <p> In the <strong> RDB file path/s </strong> field, enter the path of your file. Select <strong> Add path </strong> to add another import file path. </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> <h2 id="importing-into-an-active-active-database"> Importing into an Active-Active database </h2> <p> When importing data into an Active-Active database, there are two options: </p> <ul> <li> <a href="/docs/latest/operate/rs/7.4/databases/import-export/flush/#flush-data-from-an-active-active-database"> Flush all data </a> from the Active-Active database, then import the data into the database. </li> <li> Import data but merge it into the existing database. </li> </ul> <p> Because Active-Active databases have a numeric counter data type, when you merge the imported data into the existing data RS increments counters by the value that is in the imported data. The import through the Redis Enterprise Cluster Manager UI handles these data types for you. </p> <p> You can import data into an Active-Active database <a href="#import-data-into-a-database"> from the Cluster Manager UI </a> . When you import data into an Active-Active database, there is a special prompt warning that the imported data will be merged into the existing database. </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/import-export/import-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/commands/cluster-replicate/.html
<section class="prose w-full py-12"> <h1 class="command-name"> CLUSTER REPLICATE </h1> <div class="font-semibold text-redis-ink-900"> Syntax </div> <pre class="command-syntax">CLUSTER REPLICATE node-id</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(1) </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> The command reconfigures a node as a replica of the specified master. If the node receiving the command is an <em> empty master </em> , as a side effect of the command, the node role is changed from master to replica. </p> <p> Once a node is turned into the replica of another master node, there is no need to inform the other cluster nodes about the change: heartbeat packets exchanged between nodes will propagate the new configuration automatically. </p> <p> A replica will always accept the command, assuming that: </p> <ol> <li> The specified node ID exists in its nodes table. </li> <li> The specified node ID does not identify the instance we are sending the command to. </li> <li> The specified node ID is a master. </li> </ol> <p> If the node receiving the command is not already a replica, but is a master, the command will only succeed, and the node will be converted into a replica, only if the following additional conditions are met: </p> <ol> <li> The node is not serving any hash slots. </li> <li> The node is empty, no keys are stored at all in the key space. </li> </ol> <p> If the command succeeds the new replica will immediately try to contact its master in order to replicate from it. </p> <h2 id="resp2resp3-reply"> RESP2/RESP3 Reply </h2> <a href="../../develop/reference/protocol-spec#simple-strings"> Simple string reply </a> : <code> OK </code> if the command was successful. Otherwise an error is returned. <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-replicate/"/> <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/clusters/logging/alerts-events/.html
<section class="prose w-full py-12 max-w-none"> <h1> Alerts and events </h1> <p class="text-lg -mt-5 mb-10"> Logged alerts and events </p> <p> The following alerts and events can appear in <code> syslog </code> and the Cluster Manager UI logs. </p> <table> <thead> <tr> <th> Alert/Event </th> <th> UI message </th> <th> Severity </th> <th> Notes </th> </tr> </thead> <tbody> <tr> <td> aof_slow_disk_io </td> <td> Redis performance is degraded as a result of disk I/O limits </td> <td> True: error, False: info </td> <td> node alert </td> </tr> <tr> <td> authentication_err </td> <td> </td> <td> error </td> <td> bdb event; Replica of - error authenticating with the source database </td> </tr> <tr> <td> backup_delayed </td> <td> Periodic backup has been delayed for longer than <code> &lt;threshold&gt; </code> minutes </td> <td> True: warning, False: info </td> <td> bdb alert; Has threshold parameter in the data: section of the log entry. </td> </tr> <tr> <td> backup_failed </td> <td> </td> <td> error </td> <td> bdb event </td> </tr> <tr> <td> backup_started </td> <td> </td> <td> info </td> <td> bdb event </td> </tr> <tr> <td> backup_succeeded </td> <td> </td> <td> info </td> <td> bdb event </td> </tr> <tr> <td> bdb_created </td> <td> </td> <td> info </td> <td> bdb event </td> </tr> <tr> <td> bdb_deleted </td> <td> </td> <td> info </td> <td> bdb event </td> </tr> <tr> <td> bdb_updated </td> <td> </td> <td> info </td> <td> bdb event; Indicates that a bdb configuration has been updated </td> </tr> <tr> <td> checks_error </td> <td> </td> <td> error </td> <td> node event; Indicates that one or more node checks have failed </td> </tr> <tr> <td> cluster_updated </td> <td> </td> <td> info </td> <td> cluster event; Indicates that cluster settings have been updated </td> </tr> <tr> <td> compression_unsup_err </td> <td> </td> <td> error </td> <td> bdb event; Replica of - Compression not supported by sync destination </td> </tr> <tr> <td> crossslot_err </td> <td> </td> <td> error </td> <td> bdb event; Replica of - sharded destination does not support operation executed on source </td> </tr> <tr> <td> cpu_utilization </td> <td> CPU utilization has reached <code> &lt;threshold&gt; </code> % </td> <td> True: warning, False: info </td> <td> node alert; Has global_threshold parameter in the key/value section of the log entry. </td> </tr> <tr> <td> even_node_count </td> <td> True high availability requires an odd number of nodes </td> <td> True: warning, False: info </td> <td> cluster alert </td> </tr> <tr> <td> ephemeral_storage </td> <td> Ephemeral storage has reached <code> &lt;threshold&gt; </code> % of its capacity </td> <td> True: warning, False: info </td> <td> node alert; Has global_threshold parameter in the key/value section of the log entry. </td> </tr> <tr> <td> export_failed </td> <td> </td> <td> error </td> <td> bdb event </td> </tr> <tr> <td> export_started </td> <td> </td> <td> info </td> <td> bdb event </td> </tr> <tr> <td> export_succeeded </td> <td> </td> <td> info </td> <td> bdb event </td> </tr> <tr> <td> failed </td> <td> Node failed </td> <td> critical </td> <td> node alert </td> </tr> <tr> <td> free_flash </td> <td> Flash storage has reached <code> &lt;threshold&gt; </code> % of its capacity </td> <td> True: warning, False: info </td> <td> node alert; Has global_threshold parameter in the key/value section of the log entry. </td> </tr> <tr> <td> high_latency </td> <td> Latency is higher than <code> &lt;threshold&gt; </code> milliseconds </td> <td> True: warning, False: info </td> <td> bdb alert; Has threshold parameter in the key/value section of the log entry. </td> </tr> <tr> <td> high_syncer_lag </td> <td> Replica of - sync lag is higher than <code> &lt;threshold&gt; </code> seconds </td> <td> True: warning, False: info </td> <td> bdb alert; Has threshold parameter in the key/value section of the log entry. </td> </tr> <tr> <td> high_throughput </td> <td> Throughput is higher than <code> &lt;threshold&gt; </code> RPS (requests per second) </td> <td> True: warning, False: info </td> <td> bdb alert; Has threshold parameter in the key/value section of the log entry. </td> </tr> <tr> <td> import_failed </td> <td> </td> <td> error </td> <td> bdb event </td> </tr> <tr> <td> import_started </td> <td> </td> <td> info </td> <td> bdb event </td> </tr> <tr> <td> import_succeeded </td> <td> </td> <td> info </td> <td> bdb event </td> </tr> <tr> <td> inconsistent_redis_sw </td> <td> Not all databases are running the same open source version </td> <td> True: warning, False: info </td> <td> cluster alert </td> </tr> <tr> <td> inconsistent_rl_sw </td> <td> Not all nodes in the cluster are running the same Redis Labs Enterprise Cluster version </td> <td> True: warning, False: info </td> <td> cluster alert </td> </tr> <tr> <td> insufficient_disk_aofrw </td> <td> Node has insufficient disk space for AOF rewrite </td> <td> True: error, False: info </td> <td> node alert </td> </tr> <tr> <td> internal_bdb </td> <td> Issues with internal cluster databases </td> <td> True: warning, False: info </td> <td> cluster alert </td> </tr> <tr> <td> license_added </td> <td> </td> <td> info </td> <td> cluster event </td> </tr> <tr> <td> license_deleted </td> <td> </td> <td> info </td> <td> cluster event </td> </tr> <tr> <td> license_updated </td> <td> </td> <td> info </td> <td> cluster event </td> </tr> <tr> <td> low_throughput </td> <td> Throughput is lower than <code> &lt;threshold&gt; </code> RPS (requests per second) </td> <td> True: warning, False: info </td> <td> bdb alert; Has threshold parameter in the key/value section of the log entry. </td> </tr> <tr> <td> memory </td> <td> Node memory has reached <code> &lt;threshold&gt; </code> % of its capacity </td> <td> True: warning, False: info </td> <td> node alert; Has global_threshold parameter in the key/value section of the log entry. </td> </tr> <tr> <td> multiple_nodes_down </td> <td> Multiple cluster nodes are down - this might cause data loss </td> <td> True: warning, False: info </td> <td> cluster alert </td> </tr> <tr> <td> net_throughput </td> <td> Network throughput has reached <code> &lt;threshold&gt; </code> MB/s </td> <td> True: warning, False: info </td> <td> node alert; Has global_threshold parameter in the key/value section of the log entry. </td> </tr> <tr> <td> node_abort_remove_request </td> <td> </td> <td> info </td> <td> node event </td> </tr> <tr> <td> node_joined </td> <td> Node joined </td> <td> info </td> <td> cluster event </td> </tr> <tr> <td> node_operation_failed </td> <td> Node operation failed </td> <td> error </td> <td> cluster event </td> </tr> <tr> <td> node_remove_abort_completed </td> <td> Node removed </td> <td> info </td> <td> cluster event; The remove node is a process that can fail and can also be aborted. If aborted, the abort can succeed or fail. </td> </tr> <tr> <td> node_remove_abort_failed </td> <td> Node removed </td> <td> error </td> <td> cluster event; The remove node is a process that can fail and can also be aborted. If aborted, the abort can succeed or fail. </td> </tr> <tr> <td> node_remove_completed </td> <td> Node removed </td> <td> info </td> <td> cluster event; The remove node is a process that can fail and can also be aborted. If aborted, the abort can succeed or fail. </td> </tr> <tr> <td> node_remove_failed </td> <td> Node removed </td> <td> error </td> <td> cluster event; The remove node is a process that can fail and can also be aborted. If aborted, the abort can succeed or fail. </td> </tr> <tr> <td> node_remove_request </td> <td> </td> <td> info </td> <td> node event </td> </tr> <tr> <td> ocsp_query_failed </td> <td> Failed querying OCSP server </td> <td> True: error, False: info </td> <td> cluster alert </td> </tr> <tr> <td> ocsp_status_revoked </td> <td> OCSP status revoked </td> <td> True: error, False: info </td> <td> cluster alert </td> </tr> <tr> <td> oom_err </td> <td> </td> <td> error </td> <td> bdb event; Replica of - Replication source/target out of memory </td> </tr> <tr> <td> persistent_storage </td> <td> Persistent storage has reached <code> &lt;threshold&gt; </code> % of its capacity </td> <td> True: warning, False: info </td> <td> node alert; Has global_threshold parameter in the key/value section of the log entry. </td> </tr> <tr> <td> ram_dataset_overhead </td> <td> RAM Dataset overhead in a shard has reached <code> &lt;threshold&gt; </code> % of its RAM limit </td> <td> True: warning, False: info </td> <td> bdb alert; Has threshold parameter in the key/value section of the log entry. </td> </tr> <tr> <td> ram_overcommit </td> <td> Cluster capacity is less than total memory allocated to its databases </td> <td> True: error, False: info </td> <td> cluster alert </td> </tr> <tr> <td> ram_values </td> <td> Percent of values in a shard's RAM is lower than <code> &lt;threshold&gt; </code> % of its key count </td> <td> True: warning, False: info </td> <td> bdb alert; Has threshold parameter in the key/value section of the log entry. </td> </tr> <tr> <td> shard_num_ram_values </td> <td> Number of values in a shard's RAM is lower than <code> &lt;threshold&gt; </code> values </td> <td> True: warning, False: info </td> <td> bdb alert; Has threshold parameter in the key/value section of the log entry. </td> </tr> <tr> <td> size </td> <td> Dataset size has reached <code> &lt;threshold&gt; </code> % of the memory limit </td> <td> True: warning, False: info </td> <td> bdb alert; Has threshold parameter in the key/value section of the log entry. </td> </tr> <tr> <td> syncer_connection_error </td> <td> </td> <td> error </td> <td> bdb alert </td> </tr> <tr> <td> syncer_general_error </td> <td> </td> <td> error </td> <td> bdb alert </td> </tr> <tr> <td> too_few_nodes_for_replication </td> <td> Database replication requires at least two nodes in cluster </td> <td> True: warning, False: info </td> <td> cluster alert </td> </tr> <tr> <td> user_created </td> <td> </td> <td> info </td> <td> user event </td> </tr> <tr> <td> user_deleted </td> <td> </td> <td> info </td> <td> user event </td> </tr> <tr> <td> user_updated </td> <td> </td> <td> info </td> <td> user event; Indicates that a user configuration has been 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/7.4/clusters/logging/alerts-events/"/> <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/sync/.html
<section class="prose w-full py-12"> <h1 class="command-name"> SYNC </h1> <div class="font-semibold text-redis-ink-900"> Syntax </div> <pre class="command-syntax">SYNC</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.0.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> SYNC </code> command is called by Redis replicas for initiating a replication stream from the master. It has been replaced in newer versions of Redis by <a href="/docs/latest/commands/psync/"> <code> PSYNC </code> </a> . </p> <p> For more information about replication in Redis please check the <a href="/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/sync/"/> <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/debuginfo/.html
<section class="prose w-full py-12 max-w-none"> <h1> Debug info requests </h1> <p class="text-lg -mt-5 mb-10"> Debug info requests </p> <div class="banner-article rounded-md" style="background-color: "> <p> These REST API paths are deprecated as of Redis Enterprise Software version 7.4.2. Use the new paths <a href="/docs/latest/operate/rs/references/rest-api/requests/cluster/debuginfo/"> <code> /v1/cluster/debuginfo </code> </a> , <a href="/docs/latest/operate/rs/references/rest-api/requests/nodes/debuginfo/"> <code> /v1/nodes/debuginfo </code> </a> , and <a href="/docs/latest/operate/rs/references/rest-api/requests/bdbs/debuginfo/"> <code> /v1/bdbs/debuginfo </code> </a> instead. </p> </div> <p> Downloads a support package, which includes logs and information about the cluster, nodes, databases, and shards, as a tar file called <code> filename.tar.gz </code> . Extract the files from the tar file to access the debug info. </p> <h2 id="get-debug-info-for-all-nodes-in-the-cluster"> Get debug info for all nodes in the cluster </h2> <table> <thead> <tr> <th> Method </th> <th> Path </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> <a href="/docs/latest/operate/rs/references/rest-api/requests/debuginfo/all/#get-all-debuginfo"> GET </a> </td> <td> <code> /v1/debuginfo/all </code> </td> <td> Gets debug info for all nodes </td> </tr> <tr> <td> <a href="/docs/latest/operate/rs/references/rest-api/requests/debuginfo/all/bdb/#get-all-debuginfo-bdb"> GET </a> </td> <td> <code> /v1/debuginfo/all/bdb/{bdb_uid} </code> </td> <td> Gets debug info for a database from all nodes </td> </tr> </tbody> </table> <h2 id="get-debug-info-for-the-current-node"> Get debug info for the current node </h2> <table> <thead> <tr> <th> Method </th> <th> Path </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> <a href="/docs/latest/operate/rs/references/rest-api/requests/debuginfo/node/#get-debuginfo-node"> GET </a> </td> <td> <code> /v1/debuginfo/node </code> </td> <td> Gets debug info for the current node </td> </tr> <tr> <td> <a href="/docs/latest/operate/rs/references/rest-api/requests/debuginfo/node/bdb/#get-debuginfo-node-bdb"> GET </a> </td> <td> <code> /v1/debuginfo/node/bdb/{bdb_uid} </code> </td> <td> Gets debug info for a database from the current 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/requests/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/integrate/redisvl/api/cache/searchindex.md.html
<section class="prose w-full py-12 max-w-none"> <h1> Redis Data Integration </h1> <p> This is the first General Availability version of Redis Data Integration (RDI). </p> <p> RDI's purpose is to help Redis customers sync Redis Enterprise with live data from their slow disk based databases in order to: </p> <ul> <li> Meet the required speed and scale of read queries and provide an excellent and predictable user experience. </li> <li> Save resources and time when building pipelines and coding data transformations. </li> <li> Reduce the total cost of ownership by saving money on expensive database read replicas. </li> </ul> <p> If you use a relational database as the system of record for your app, you may eventually find that its performance doesn't scale well as your userbase grows. It may be acceptable for a few thousand users but for a few million, it can become a major problem. If you don't have the option of abandoning the relational database, you should consider using a fast database, such as Redis, to cache data from read queries. Since read queries are typically many times more common than writes, the cache will greatly improve performance and let your app scale without a major redesign. </p> <p> RDI keeps a Redis cache up to date with changes in the primary database, using a <a href="https://en.wikipedia.org/wiki/Change_data_capture"> <em> Change Data Capture (CDC) </em> </a> mechanism. It also lets you <em> transform </em> the data from relational tables into convenient and fast data structures that match your app's requirements. You specify the transformations using a configuration system, so no coding is necessary. </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> RDI is supported with Redis database or <a href="https://redis.com/redis-enterprise/technology/active-active-geo-distribution/"> CRDB </a> (Active Active Replication) targets. </div> </div> <h2 id="features"> Features </h2> <p> RDI provides enterprise-grade streaming data pipelines with the following features: </p> <ul> <li> <strong> Near realtime pipeline </strong> - The CDC system captures changes in very short time intervals, then ships and processes them in <em> micro-batches </em> to provide near real time updates to Redis. </li> <li> <strong> At least once guarantee </strong> - RDI will deliver any change to the selected data set at least once to the target Redis database. </li> <li> <strong> Data integrity </strong> - RDI keeps the data change order per source table or unique key. </li> <li> <strong> High availability </strong> - All stateless components have hot failover or quick automatic recovery. RDI state is always highly available using Redis Enterprise replication. </li> <li> <strong> Easy to install and operate </strong> - Use a self-documenting command line interface (CLI) for all installation and day-two operations. </li> <li> <strong> No coding needed </strong> - Create and test your pipelines using Redis Insight. </li> <li> <strong> Data-in-transit encryption </strong> - RDI never persists data to disk. All data in-flight is protected using TLS or mTLS connections. </li> <li> <strong> Observability - Metrics </strong> - RDI collects data processing counters at source table granularity along with data processing performance metrics. These are available via GUI, CLI and <a href="https://prometheus.io/"> Prometheus </a> endpoints. </li> <li> <strong> Observability - logs </strong> - RDI saves rotating logs to a single folder. They are in a JSON format, so you can collect and process them with your favorite observability tool. </li> <li> <strong> Backpressure mechanism </strong> - RDI is designed to backoff writing data when the cache gets disconnected, which prevents cascading failure. Since the change data is persisted in the source database and Redis is very fast, RDI can easily catch up with missed changes after a short period of disconnection. See <a href="/docs/latest/integrate/redis-data-integration/architecture/#backpressure-mechanism"> Backpressure mechanism </a> for more information. </li> <li> <strong> Recovering from full failure </strong> - If the cache fails or gets disconnected for a long time, RDI can reconstruct the cache data in Redis using a full snapshot of the defined dataset. </li> <li> <strong> High throughput </strong> - Because RDI uses Redis for staging and writes to Redis as a target, it has very high throughput. With a single processor core and records of about 1KB in size, RDI processes around 10,000 records per second. While taking the initial full <em> snapshot </em> of the source database, RDI automatically scales to a configurable number of processing units, to fill the cache as fast as possible. </li> </ul> <h2 id="when-to-use-rdi"> When to use RDI </h2> <p> RDI is designed to support apps that must use a disk based database as the system of record but must also be fast and scalable. This is a common requirement for mobile and web apps with a rapidly-growing number of users; the performance of the main database is fine at first but it will soon struggle to handle the increasing demand without a cache. </p> <p> You should use RDI when: </p> <ul> <li> You must use a slow database as the system of record for the app . </li> <li> The app must always <em> write </em> its data to the slow database. </li> <li> You already intend to use Redis for the app cache. </li> <li> The data changes frequently in small increments. </li> <li> Your app can tolerate <em> eventual </em> consistency of data in the Redis cache. </li> </ul> <p> You should <em> not </em> use RDI when: </p> <ul> <li> You are migrating an existing data set into Redis only once. </li> <li> The data is updated infrequently and in big batches. </li> <li> Your app needs <em> immediate </em> cache consistency rather than <em> eventual </em> consistency. </li> <li> The data is ingested from two replicas of Active-Active at the same time. </li> <li> The app must <em> write </em> data to the Redis cache, which then updates the source database. </li> <li> Your data set will only ever be small. </li> </ul> <h2 id="supported-source-databases"> Supported source databases </h2> <p> RDI can capture data from any of the following sources: </p> <table> <thead> <tr> <th style="text-align:left"> Database </th> <th style="text-align:left"> Versions </th> </tr> </thead> <tbody> <tr> <td style="text-align:left"> Oracle </td> <td style="text-align:left"> 12c, 19c, 21c </td> </tr> <tr> <td style="text-align:left"> MariaDB </td> <td style="text-align:left"> &gt;= 10.5 </td> </tr> <tr> <td style="text-align:left"> MySQL </td> <td style="text-align:left"> 5.7, 8.0.x </td> </tr> <tr> <td style="text-align:left"> Postgres </td> <td style="text-align:left"> 10, 11, 12, 13, 14, 15 </td> </tr> <tr> <td style="text-align:left"> SQL Server </td> <td style="text-align:left"> 2017, 2019 </td> </tr> <tr> <td style="text-align:left"> Google Cloud SQL MySQL </td> <td style="text-align:left"> 8.0 </td> </tr> <tr> <td style="text-align:left"> Google Cloud SQL Postgres </td> <td style="text-align:left"> 15 </td> </tr> <tr> <td style="text-align:left"> Google Cloud SQL SQL Server </td> <td style="text-align:left"> 2019 </td> </tr> <tr> <td style="text-align:left"> Google Cloud AlloyDB for PostgreSQL </td> <td style="text-align:left"> </td> </tr> </tbody> </table> <h2 id="documentation"> Documentation </h2> <p> Learn more about RDI from the other pages in this section: </p> <nav> <a href="/docs/latest/integrate/redis-data-integration/quick-start-guide/"> Quickstart </a> <p> Get started with a simple pipeline example </p> <a href="/docs/latest/integrate/redis-data-integration/installation/"> Installation </a> <p> Learn how to install RDI </p> <a href="/docs/latest/integrate/redis-data-integration/architecture/"> Architecture </a> <p> Discover the main components of RDI </p> <a href="/docs/latest/integrate/redis-data-integration/data-pipelines/"> Data pipelines </a> <p> Learn how an RDI pipeline can transform source data before writing </p> <a href="/docs/latest/integrate/redis-data-integration/observability/"> Observability </a> <p> Learn how to monitor RDI </p> <a href="/docs/latest/integrate/redis-data-integration/faq/"> FAQ </a> <p> Find answers to common questions about RDI </p> <a href="/docs/latest/integrate/redis-data-integration/troubleshooting/"> Troubleshooting </a> <p> Solve and report simple problems with RDI </p> <a href="/docs/latest/integrate/redis-data-integration/reference/"> Reference </a> <p> View reference material for Redis Data Integration </p> <a href="/docs/latest/integrate/redis-data-integration/release-notes/"> Release notes </a> <br/> <br/> <a href="/docs/latest/integrate/redis-data-integration/rdi-archive/"> Preview version </a> <p> Describes where to view the preview version for RDI products </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/integrate/redis-data-integration/"/> <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/v1.4.0/.html
<section class="prose w-full py-12"> <h1> RedisInsight v1.4, April 2020 </h1> <p class="text-lg -mt-5 mb-10"> Redis 6 ACLs support, improved CLI and full screen support in Graph, TimeSeries and RedisSearch </p> <p> This is the General Availability Release of RedisInsight 1.4 (v1.4.0)! </p> <h3 id="headlines"> Headlines </h3> <ul> <li> Support for Redis 6, Redis Enterprise 6 and ACLs </li> <li> Improve CLI capabilities with removed command restrictions </li> <li> Full screen support in Graph, TimeSeries and RediSearch </li> </ul> <h3 id="full-details"> Full details: </h3> <ul> <li> <p> Features </p> <ul> <li> Core: <ul> <li> Added support for Redis 6 + RE6 and authentication using ACL </li> <li> Added Full screen support for Graph, TimeSeries and RediSearch. </li> <li> Improved UI consistency (colors and styles) in Graph and Timeseries </li> </ul> </li> <li> CLI: <ul> <li> Removed the command restrictions, unless a command is specifically blacklisted. </li> <li> Command responses are displayed in exactly the same way as in <code> redis-cli </code> </li> </ul> </li> <li> RedisGraph: <ul> <li> Optimized performances when getting nodes relationships (edges) from user's queries </li> </ul> </li> <li> Stream: <ul> <li> Improved UX when defining the timing range of events to be filtered </li> </ul> </li> </ul> </li> <li> <p> Bug Fixes: </p> <ul> <li> Core: <ul> <li> Fixed issue when connecting to Redis Enterprise with a password using a special character </li> </ul> </li> <li> Stream: <ul> <li> Fixed ability to properly visualize all events </li> </ul> </li> </ul> </li> </ul> <h3 id="known-issues"> Known issues </h3> <ul> <li> Core: <ul> <li> Authentication to Redis 6 OSS in cluster mode is not supported yet </li> </ul> </li> <li> CLI: <ul> <li> Blocking commands are not supported </li> <li> Commands which return non-standard streaming responses are not supported: <code> MONITOR, SUBSCRIBE, PSUBSCRIBE, SYNC, PSYNC, SCRIPT DEBUG </code> </li> </ul> </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/v1.4.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/integrate/redis-data-integration/installation/install-k8s/.html
<section class="prose w-full py-12 max-w-none"> <h1> Install on Kubernetes </h1> <p class="text-lg -mt-5 mb-10"> Learn how to install RDI on Kubernetes </p> <p> This guide explains how to use the RDI <a href="https://helm.sh/docs/topics/charts/"> Helm chart </a> to install on <a href="https://kubernetes.io/"> Kubernetes </a> (K8s). You can also <a href="/docs/latest/integrate/redis-data-integration/installation/install-vm/"> Install RDI on VMs </a> . </p> <p> The installation creates the following K8s objects: </p> <ul> <li> A K8s <a href="https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/"> namespace </a> named <code> rdi </code> . </li> <li> <a href="https://kubernetes.io/docs/concepts/workloads/controllers/deployment/"> Deployments </a> for the <a href="/docs/latest/integrate/redis-data-integration/architecture/#how-rdi-is-deployed"> RDI operator </a> , <a href="/docs/latest/integrate/redis-data-integration/observability/"> metrics exporter </a> , and API server. </li> <li> A <a href="https://kubernetes.io/docs/concepts/security/service-accounts/"> service account </a> along with a <a href="https://kubernetes.io/docs/reference/access-authn-authz/rbac/#restrictions-on-role-creation-or-update"> role </a> and <a href="https://kubernetes.io/docs/reference/access-authn-authz/rbac/#rolebinding-and-clusterrolebinding"> role binding </a> for the RDI operator. </li> <li> A <a href="https://kubernetes.io/docs/concepts/configuration/configmap/"> Configmap </a> for the different components with RDI Redis database details. </li> <li> <a href="https://kubernetes.io/docs/concepts/configuration/secret/"> Secrets </a> with the RDI Redis database credentials and TLS certificates. </li> </ul> <p> You can use this installation on <a href="https://docs.openshift.com/"> OpenShift </a> and other K8s distributions including cloud providers' K8s managed clusters. </p> <p> You can pull the RDI images from <a href="https://hub.docker.com/"> Docker Hub </a> or from your own <a href="#using-a-private-image-registry"> private image registry </a> . </p> <h2 id="before-you-install"> Before you install </h2> <p> Complete the following steps before running Helm: </p> <ul> <li> <a href="#create-the-rdi-database"> Create the RDI database </a> on your Redis Enterprise cluster. </li> <li> Create a <a href="/docs/latest/operate/rs/security/access-control/create-users/"> user </a> for the RDI database if you prefer not to use the default password (see <a href="/docs/latest/operate/rs/security/access-control/"> Access control </a> for more information). </li> <li> Download the RDI helm chart tar file from the <a href="https://cloud.redis.io/#rlec-downloads"> download center </a> . </li> <li> If you want to use a private image registry, <a href="#using-a-private-image-registry"> prepare it with the RDI images </a> . </li> </ul> <h3 id="create-the-rdi-database"> Create the RDI database </h3> <p> RDI uses a database on your Redis Enterprise cluster to store its state information. <em> This requires Redis Enterprise v6.4 or greater </em> . </p> <ul> <li> Use the Redis console to create a database with 250MB RAM with one primary and one replica. </li> <li> If you are deploying RDI for a production environment then secure this database with a password and <a href="https://en.wikipedia.org/wiki/Transport_Layer_Security"> TLS </a> . </li> </ul> <p> You should then provide the details of this database in the <a href="#the-valuesyaml-file"> <code> values.yaml </code> </a> file as described below. </p> <h3 id="using-a-private-image-registry"> Using a private image registry </h3> <p> Add the RDI images from <a href="https://hub.docker.com/"> Docker Hub </a> to your local registry. The example below shows how to specify the registry and image pull secret in the <a href="#the-valuesyaml-file"> <code> values.yaml </code> </a> file for the Helm chart: </p> <div class="highlight"> <pre class="chroma"><code class="language-yaml" data-lang="yaml"><span class="line"><span class="cl"><span class="nt">global</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">imagePullSecrets</span><span class="p">:</span><span class="w"> </span><span class="p">[]</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># - name: "image-pull-secret"</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">image</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">registry</span><span class="p">:</span><span class="w"> </span><span class="l">docker.io</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">repository</span><span class="p">:</span><span class="w"> </span><span class="l">redis</span><span class="w"> </span></span></span></code></pre> </div> <p> To pull images from a local registry, you must provide the image pull secret and in some cases also set the permissions. Follow the links below to learn how to use a private registry with: </p> <ul> <li> <a href="https://ranchermanager.docs.rancher.com/how-to-guides/new-user-guides/kubernetes-resources-setup/kubernetes-and-docker-registries#using-a-private-registry"> Rancher </a> </li> <li> <a href="https://docs.openshift.com/container-platform/4.17/openshift_images/managing_images/using-image-pull-secrets.html"> OpenShift </a> </li> <li> <a href="https://docs.aws.amazon.com/AmazonECR/latest/userguide/ECR_on_EKS.html"> Amazon Elastic Kubernetes Service (EKS) </a> </li> <li> <a href="https://cloud.google.com/artifact-registry/docs/pull-cached-dockerhub-images"> Google Kubernetes Engine (GKE) </a> </li> <li> <a href="https://learn.microsoft.com/en-us/azure/aks/cluster-container-registry-integration?tabs=azure-cli"> Azure Kubernetes Service (AKS) </a> </li> </ul> <h2 id="install-the-rdi-helm-chart"> Install the RDI Helm chart </h2> <ol> <li> <p> Decompress the tar file: </p> <div class="highlight"> <pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">tar -xvf rdi-k8s-&lt;rdi-tag&gt;.tar.gz </span></span></code></pre> </div> </li> <li> <p> Open the <code> values.yaml </code> file and set the appropriate values for your installation (see <a href="#the-valuesyaml-file"> The <code> values.yaml </code> file </a> below for the full set of available values). </p> </li> <li> <p> Start the installation: </p> <div class="highlight"> <pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">helm install &lt;The logical chart name&gt; rdi-k8s/&lt;rdi-tag&gt;/helm --create-namespace -n rdi </span></span></code></pre> </div> </li> </ol> <h3 id="the-valuesyaml-file"> The <code> values.yaml </code> file </h3> <p> The annotated <a href="https://helm.sh/docs/topics/charts/#templates-and-values"> <code> values.yaml </code> </a> file below describes the values you can set for the RDI Helm installation: </p> <div class="highlight"> <pre class="chroma"><code class="language-yaml" data-lang="yaml"><span class="line"><span class="cl"><span class="c"># Default RDI values in YAML format.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="c"># Variables to template configuration.</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">global</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># Set this property when using a private image repository.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># Provide an array of image pull secrets.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># Example:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># imagePullSecrets:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># - name: pullSecret1</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># - name: pullSecret2</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">imagePullSecrets</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">docker-config-jfrog</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="c"># DO NOT modify this value.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">vmMode</span><span class="p">:</span><span class="w"> </span><span class="kc">false</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="c"># Indicates whether the deployment is intended for an OpenShift environment.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">openShift</span><span class="p">:</span><span class="w"> </span><span class="kc">false</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">image</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># Overrides the image tag for all RDI components.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">tag</span><span class="p">:</span><span class="w"> </span><span class="m">0.0.0</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="c"># If using a private repository, update the default values accordingly.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># Docker registry.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">registry</span><span class="p">:</span><span class="w"> </span><span class="l">docker.io</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="c"># Docker image repository.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">repository</span><span class="p">:</span><span class="w"> </span><span class="l">redis</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="c"># Configuration for the RDI ConfigMap.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">rdiSysConfig</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># Log level for all RDI components. Valid options: DEBUG, INFO, ERROR.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># If specific component log levels are not set, this value will be used.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">RDI_LOG_LEVEL</span><span class="p">:</span><span class="w"> </span><span class="l">INFO</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="c"># Log level for the RDI API. Valid options: DEBUG, INFO, ERROR.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># If not set, RDI_LOG_LEVEL will be used.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># RDI_LOG_LEVEL_API: INFO</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="c"># Log level for the RDI Operator. Valid options: DEBUG, INFO, ERROR.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># If not set, RDI_LOG_LEVEL will be used.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># RDI_LOG_LEVEL_OPERATOR: INFO</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="c"># Log level for the RDI processor. Valid options: DEBUG, INFO, ERROR.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># If not set, RDI_LOG_LEVEL will be used.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># RDI_LOG_LEVEL_PROCESSOR: INFO</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="c"># Specifies whether the RDI is configured to use TLS.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">RDI_REDIS_SSL</span><span class="p">:</span><span class="w"> </span><span class="kc">false</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="c"># RDI_IMAGE_REPO: redis</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="c"># This value must be set to the same tag as global.image.tag.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># RDI_IMAGE_TAG: ""</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="c"># If using a private repository, set this value to the same secret name as in global.imagePullSecrets.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># RDI_IMAGE_PULL_SECRET: []</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="c"># The service IP of the RDI database.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># RDI_REDIS_HOST: ""</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="c"># The port for the RDI database.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># RDI_REDIS_PORT: ""</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="c"># Enable authentication for the RDI API.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># RDI_API_AUTH_ENABLED: "1"</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="c"># Specifies whether the API Collector should be deployed.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># RDI_API_COLLECTOR_ENABLED: "0"</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="c"># Configuration for the RDI Secret.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">rdiSysSecret</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># Username and password for RDI database.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># If using the default password, keep the username as an empty string.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># RDI_REDIS_USERNAME: ""</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># RDI_REDIS_PASSWORD: ""</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="c"># Uncomment this property when using a TLS connection from RDI to its Redis database.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># DO NOT modify this value.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># RDI_REDIS_CACERT: /etc/certificates/rdi_db/cacert</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="c"># Uncomment these properties when using a TLS connection from RDI to its Redis database.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># DO NOT modify these values.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># RDI_REDIS_CERT: /etc/certificates/rdi_db/cert</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># RDI_REDIS_KEY: /etc/certificates/rdi_db/key</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="c"># The passphrase used to get the private key stored in the secret store when using mTLS.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># RDI_REDIS_KEY_PASSPHRASE: ""</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="c"># The key used to encrypt the JWT token used by RDI API.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># JWT_SECRET_KEY: ""</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">rdiDbSSLSecret</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># Set to `true` when using a TLS connection from RDI to its Redis database.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">enabled</span><span class="p">:</span><span class="w"> </span><span class="kc">false</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="c"># The content of the CA certificate PEM file.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># Uncomment and set this property when using a TLS connection from RDI to its Redis database.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># cacert: ""</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="c"># The content of the certificate PEM file.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># Uncomment and set this property when using a TLS connection from RDI to its Redis database.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># cert: ""</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="c"># The content of the private key PEM file.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># Uncomment and set this property when using a TLS connection from RDI to its Redis database.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># key: ""</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="c"># Container default security context.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-container</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">securityContext</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">runAsNonRoot</span><span class="p">:</span><span class="w"> </span><span class="kc">true</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">runAsUser</span><span class="p">:</span><span class="w"> </span><span class="m">1000</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">runAsGroup</span><span class="p">:</span><span class="w"> </span><span class="m">1000</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">allowPrivilegeEscalation</span><span class="p">:</span><span class="w"> </span><span class="kc">false</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="c"># Set `isOpenshift` to `true` if deploying on OpenShift.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">reloader</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">reloader</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">isOpenshift</span><span class="p">:</span><span class="w"> </span><span class="kc">false</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">deployment</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">containerSecurityContext</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">allowPrivilegeEscalation</span><span class="p">:</span><span class="w"> </span><span class="kc">false</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">capabilities</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">drop</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="l">ALL</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">securityContext</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">runAsUser</span><span class="p">:</span><span class="w"> </span><span class="kc">null</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="c"># Configuration of the RDI Operator.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">operator</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></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">rdi-operator</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="c"># Specify an imagePullPolicy.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># ref: https://kubernetes.io/docs/concepts/containers/images/#pre-pulled-images</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">pullPolicy</span><span class="p">:</span><span class="w"> </span><span class="l">IfNotPresent</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="c"># Extra optional options for liveness probe.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">liveness</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">failureThreshold</span><span class="p">:</span><span class="w"> </span><span class="m">6</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">periodSeconds</span><span class="p">:</span><span class="w"> </span><span class="m">10</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="c"># Extra optional options for readiness probe.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">readiness</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">failureThreshold</span><span class="p">:</span><span class="w"> </span><span class="m">6</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">periodSeconds</span><span class="p">:</span><span class="w"> </span><span class="m">30</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="c"># Extra optional options for startup probe.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">startup</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">failureThreshold</span><span class="p">:</span><span class="w"> </span><span class="m">60</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">periodSeconds</span><span class="p">:</span><span class="w"> </span><span class="m">5</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">fluentd</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></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">rdi-fluentd</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="c"># Specify an imagePullPolicy.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># ref: https://kubernetes.io/docs/concepts/containers/images/#pre-pulled-images</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">pullPolicy</span><span class="p">:</span><span class="w"> </span><span class="l">IfNotPresent</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">rdiLogsHostPath</span><span class="p">:</span><span class="w"> </span><span class="s2">"/opt/rdi/logs"</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">podLogsHostPath</span><span class="p">:</span><span class="w"> </span><span class="s2">"/var/log/pods"</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">logrotateMinutes</span><span class="p">:</span><span class="w"> </span><span class="s2">"5"</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">rdiMetricsExporter</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></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">rdi-monitor</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="c"># Specify an imagePullPolicy.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># ref: https://kubernetes.io/docs/concepts/containers/images/#pre-pulled-images</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">pullPolicy</span><span class="p">:</span><span class="w"> </span><span class="l">IfNotPresent</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="c"># The RDI metrics service is set to ClusterIP, allowing access only from within the cluster.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># ref: http://kubernetes.io/docs/user-guide/services/</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">service</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">protocol</span><span class="p">:</span><span class="w"> </span><span class="l">TCP</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">port</span><span class="p">:</span><span class="w"> </span><span class="m">9121</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">targetPort</span><span class="p">:</span><span class="w"> </span><span class="m">9121</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">type</span><span class="p">:</span><span class="w"> </span><span class="l">ClusterIP</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="c"># Configure extra options for liveness probe.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">liveness</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">failureThreshold</span><span class="p">:</span><span class="w"> </span><span class="m">6</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">periodSeconds</span><span class="p">:</span><span class="w"> </span><span class="m">10</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="c"># Configure extra options for readiness probe.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">readiness</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">failureThreshold</span><span class="p">:</span><span class="w"> </span><span class="m">6</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">periodSeconds</span><span class="p">:</span><span class="w"> </span><span class="m">30</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="c"># Configure extra options for startupProbe.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">startup</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">failureThreshold</span><span class="p">:</span><span class="w"> </span><span class="m">60</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">periodSeconds</span><span class="p">:</span><span class="w"> </span><span class="m">5</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="c"># Configuration for the ServiceMonitor, which is used to scrape metrics from the RDI metrics service.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">serviceMonitor</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># Set to `true` to activate the ServiceMonitor.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">enabled</span><span class="p">:</span><span class="w"> </span><span class="kc">false</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="c"># The endpoint from which Prometheus will scrape metrics.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">path</span><span class="p">:</span><span class="w"> </span><span class="l">/metrics</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="c"># Configuration of the RDI API.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">apiServer</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></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">rdi-api</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="c"># Specify an imagePullPolicy.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># ref: https://kubernetes.io/docs/concepts/containers/images/#pre-pulled-images</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">pullPolicy</span><span class="p">:</span><span class="w"> </span><span class="l">IfNotPresent</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="c"># The RDI API service is set to ClusterIP, allowing access only from within the cluster.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># ref: http://kubernetes.io/docs/user-guide/services/</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">service</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">type</span><span class="p">:</span><span class="w"> </span><span class="l">ClusterIP</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">rdi-api</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">port</span><span class="p">:</span><span class="w"> </span><span class="m">8080</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">targetPort</span><span class="p">:</span><span class="w"> </span><span class="m">8081</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="c"># Configure extra options for liveness probe.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">liveness</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">failureThreshold</span><span class="p">:</span><span class="w"> </span><span class="m">6</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">periodSeconds</span><span class="p">:</span><span class="w"> </span><span class="m">10</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="c"># Configure extra options for readiness probe.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">readiness</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">failureThreshold</span><span class="p">:</span><span class="w"> </span><span class="m">6</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">periodSeconds</span><span class="p">:</span><span class="w"> </span><span class="m">30</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="c"># Configure extra options for startupProbe.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">startup</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">failureThreshold</span><span class="p">:</span><span class="w"> </span><span class="m">60</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">periodSeconds</span><span class="p">:</span><span class="w"> </span><span class="m">5</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="c"># Expose the RDI API service to be accessed from outside the cluster.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="c"># ref: http://kubernetes.io/docs/user-guide/services/</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">ingress</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># When `enabled` is set to `true`, RDI API Ingress will be created.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">enabled</span><span class="p">:</span><span class="w"> </span><span class="kc">false</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="c"># ref: https://kubernetes.io/blog/2020/04/02/improvements-to-the-ingress-api-in-kubernetes-1.18/#specifying-the-class-of-an-ingress</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># className: ""</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="c"># Ingress resources configure routes based on the requested host.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># The optional Host field defines the hosts for routing. If omitted, it matches all hosts.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># Example:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># hosts:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># - example.com</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># - another-example.com</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="c"># Annotations to be added to the IngressClass resource.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># Example:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># annotations:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># kubernetes.io/ingress.class: "nginx"</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># nginx.ingress.kubernetes.io/rewrite-target: /</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">tls</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># Specifies whether the Ingress should be configured to use TLS.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">enabled</span><span class="p">:</span><span class="w"> </span><span class="kc">false</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="c"># When `enabled` is set to `true`, set this property to the content of the crt file.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># crt: ""</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="c"># When `enabled` is set to `true`, set this property to the content of the key file.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># key: ""</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="c"># When `openShift` is set to `true`, Route will be created automatically.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="c"># Route exposes RDI API outside the cluster.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">route</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">tls</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># Specifies whether the Route should be configured to use TLS.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">enabled</span><span class="p">:</span><span class="w"> </span><span class="kc">false</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="c"># When `enabled` is set to `true`, set this property to the content of the crt file.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># crt: ""</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="c"># When `enabled` is set to `true`, set this property to the content of the key file.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># key: ""</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">collectorSourceMetricsExporter</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># The collector-source metrics service is set to ClusterIP, allowing access only from within the cluster.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># ref: http://kubernetes.io/docs/user-guide/services/</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">service</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">type</span><span class="p">:</span><span class="w"> </span><span class="l">ClusterIP</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">port</span><span class="p">:</span><span class="w"> </span><span class="m">9092</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">targetPort</span><span class="p">:</span><span class="w"> </span><span class="m">19000</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="c"># Configuration for the ServiceMonitor, which is used to scrape metrics from the collector-source metrics service.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">serviceMonitor</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># Set to `true` to activate the ServiceMonitor.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">enabled</span><span class="p">:</span><span class="w"> </span><span class="kc">false</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="c"># The endpoint from which Prometheus will scrape metrics.</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">path</span><span class="p">:</span><span class="w"> </span><span class="l">/metrics</span><span class="w"> </span></span></span></code></pre> </div> <h2 id="check-the-installation"> Check the installation </h2> <p> To verify the status of the K8s deployment, run the following command: </p> <div class="highlight"> <pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">helm list -n monitoring -n rdi </span></span></code></pre> </div> <p> The output looks like the following. Check that <code> &lt;logical_chart_name&gt; </code> is listed. </p> <pre tabindex="0"><code>NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION &lt;logical_chart_name&gt; rdi 1 2024-10-10 16:53... +0300 IDT deployed rdi-1.0.0 </code></pre> <p> Also, check that the following pods have <code> Running </code> status: </p> <div class="highlight"> <pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">sudo k3s kubectl get pod -n rdi </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl">NAME READY STATUS RESTARTS AGE </span></span><span class="line"><span class="cl">rdi-api-&lt;id&gt; 1/1 Running <span class="m">0</span> 29m </span></span><span class="line"><span class="cl">rdi-metric-&lt;id&gt;l 1/1 Running <span class="m">0</span> 29m </span></span><span class="line"><span class="cl">rdi-operator-&lt;id&gt; 1/1 Running <span class="m">0</span> 29m </span></span><span class="line"><span class="cl">&lt;logical_chart_name&gt;-reloader-&lt;id&gt; 1/1 Running <span class="m">0</span> 29m </span></span><span class="line"><span class="cl">collector-api-&lt;id&gt; 1/1 Running <span class="m">0</span> 29m </span></span></code></pre> </div> <p> You can verify that the RDI API works by adding the server in <a href="/docs/latest/develop/tools/insight/rdi-connector/"> Redis Insight </a> . </p> <h2 id="prepare-your-source-database"> Prepare your source database </h2> <p> You must also configure your source database to use the CDC connector. See the <a href="/docs/latest/integrate/redis-data-integration/data-pipelines/prepare-dbs/"> Prepare source databases </a> section to learn how to do this. </p> <h2 id="deploy-a-pipeline"> Deploy a pipeline </h2> <p> When the Helm installation is complete, and you have prepared the source database for CDC, you are ready to start using RDI. See the guides to <a href="/docs/latest/integrate/redis-data-integration/data-pipelines/data-pipelines/"> configuring </a> and <a href="/docs/latest/integrate/redis-data-integration/data-pipelines/deploy/"> deploying </a> RDI pipelines for more information. You can also configure and deploy a pipeline using <a href="/docs/latest/develop/tools/insight/rdi-connector/"> Redis Insight </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/integrate/redis-data-integration/installation/install-k8s/"/> <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/config/.html
<section class="prose w-full py-12 max-w-none"> <h1> rladmin cluster config </h1> <p class="text-lg -mt-5 mb-10"> Updates the cluster's configuration. </p> <p> Updates the cluster configuration. </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl"> rladmin cluster config </span></span><span class="line"><span class="cl"> <span class="o">[</span> auditing db_conns audit_protocol <span class="o">{</span> TCP <span class="p">|</span> <span class="nb">local</span> <span class="o">}</span> </span></span><span class="line"><span class="cl"> audit_address &lt;audit_address&gt; audit_port &lt;audit_port&gt; <span class="o">]</span> </span></span><span class="line"><span class="cl"> <span class="o">[</span>bigstore_driver <span class="o">{</span>speedb <span class="p">|</span> rocksdb<span class="o">}</span> <span class="o">]</span> </span></span><span class="line"><span class="cl"> <span class="o">[</span> control_cipher_suites &lt;BoringSSL cipher list&gt; <span class="o">]</span> </span></span><span class="line"><span class="cl"> <span class="o">[</span> cm_port &lt;number&gt; <span class="o">]</span> </span></span><span class="line"><span class="cl"> <span class="o">[</span> cm_session_timeout_minutes &lt;minutes&gt; <span class="o">]</span> </span></span><span class="line"><span class="cl"> <span class="o">[</span> cnm_http_port &lt;number&gt; <span class="o">]</span> </span></span><span class="line"><span class="cl"> <span class="o">[</span> cnm_https_port &lt;number&gt; <span class="o">]</span> </span></span><span class="line"><span class="cl"> <span class="o">[</span> crdb_coordinator_port &lt;number&gt; <span class="o">]</span> </span></span><span class="line"><span class="cl"> <span class="o">[</span> data_cipher_list &lt;openSSL cipher list&gt; <span class="o">]</span> </span></span><span class="line"><span class="cl"> <span class="o">[</span> data_cipher_suites_tls_1_3 &lt;openSSL cipher list&gt; <span class="o">]</span> </span></span><span class="line"><span class="cl"> <span class="o">[</span> debuginfo_path &lt;filepath&gt; <span class="o">]</span> </span></span><span class="line"><span class="cl"> <span class="o">[</span> encrypt_pkeys <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> envoy_admin_port &lt;new-port&gt; <span class="o">]</span> </span></span><span class="line"><span class="cl"> <span class="o">[</span> envoy_mgmt_server_port &lt;new-port&gt; <span class="o">]</span> </span></span><span class="line"><span class="cl"> <span class="o">[</span> gossip_envoy_admin_port &lt;new-port&gt; <span class="o">]</span> </span></span><span class="line"><span class="cl"> <span class="o">[</span> handle_redirects <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> handle_metrics_redirects <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> http_support <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> ipv6 <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> min_control_TLS_version <span class="o">{</span> 1.2 <span class="p">|</span> 1.3 <span class="o">}</span> <span class="o">]</span> </span></span><span class="line"><span class="cl"> <span class="o">[</span> min_data_TLS_version <span class="o">{</span> 1.2 <span class="p">|</span> 1.3 <span class="o">}</span> <span class="o">]</span> </span></span><span class="line"><span class="cl"> <span class="o">[</span> min_sentinel_TLS_version <span class="o">{</span> 1.2 <span class="p">|</span> 1.3 <span class="o">}</span> <span class="o">]</span> </span></span><span class="line"><span class="cl"> <span class="o">[</span> reserved_ports &lt;list of ports/port ranges&gt; <span class="o">]</span> </span></span><span class="line"><span class="cl"> <span class="o">[</span> s3_url &lt;URL&gt; <span class="o">]</span> </span></span><span class="line"><span class="cl"> <span class="o">[</span> s3_ca_cert &lt;filepath&gt; <span class="o">]</span> </span></span><span class="line"><span class="cl"> <span class="o">[</span> saslauthd_ldap_conf &lt;/tmp/ldap.conf&gt; <span class="o">]</span> </span></span><span class="line"><span class="cl"> <span class="o">[</span> sentinel_tls_mode <span class="o">{</span> allowed <span class="p">|</span> required <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> sentinel_cipher_suites &lt;golang cipher list&gt; <span class="o">]</span> </span></span><span class="line"><span class="cl"> <span class="o">[</span> services <span class="o">{</span> cm_server <span class="p">|</span> crdb_coordinator <span class="p">|</span> crdb_worker <span class="p">|</span> </span></span><span class="line"><span class="cl"> mdns_server <span class="p">|</span> pdns_server <span class="p">|</span> saslauthd <span class="p">|</span> </span></span><span class="line"><span class="cl"> stats_archiver <span class="o">}</span> <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> upgrade_mode <span class="o">{</span> enabled <span class="p">|</span> disabled <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> audit_address </td> <td> string </td> <td> TCP/IP address where a listener can capture <a href="/docs/latest/operate/rs/security/audit-events/"> audit event notifications </a> </td> </tr> <tr> <td> audit_port </td> <td> string </td> <td> Port where a listener can capture <a href="/docs/latest/operate/rs/security/audit-events/"> audit event notifications </a> </td> </tr> <tr> <td> audit_protocol </td> <td> <code> tcp </code> <br/> <code> local </code> </td> <td> Protocol used for <a href="/docs/latest/operate/rs/security/audit-events/"> audit event notifications </a> <br/> For production systems, only <code> tcp </code> is supported. </td> </tr> <tr> <td> control_cipher_suites </td> <td> list of ciphers </td> <td> Cipher suites used for TLS connections to the Cluster Manager UI (specified in the format understood by the BoringSSL library) <br/> (previously named <code> cipher_suites </code> ) </td> </tr> <tr> <td> cm_port </td> <td> integer </td> <td> UI server listening port </td> </tr> <tr> <td> cm_session_timeout_minutes </td> <td> integer </td> <td> Timeout in minutes for the CM session </td> </tr> <tr> <td> cnm_http_port </td> <td> integer </td> <td> HTTP REST API server listening port </td> </tr> <tr> <td> cnm_https_port </td> <td> integer </td> <td> HTTPS REST API server listening port </td> </tr> <tr> <td> crdb_coordinator_port </td> <td> integer, (range: 1024-65535) (default: 9081) </td> <td> CRDB coordinator port </td> </tr> <tr> <td> data_cipher_list </td> <td> list of ciphers </td> <td> Cipher suites used by the the data plane (specified in the format understood by the OpenSSL library) </td> </tr> <tr> <td> data_cipher_suites_tls_1_3 </td> <td> list of ciphers </td> <td> Specifies the enabled TLS 1.3 ciphers for the data plane </td> </tr> <tr> <td> debuginfo_path </td> <td> filepath </td> <td> Local directory to place generated support package files </td> </tr> <tr> <td> encrypt_pkeys </td> <td> <code> enabled </code> <br/> <code> disabled </code> </td> <td> Enable or turn off encryption of private keys </td> </tr> <tr> <td> envoy_admin_port </td> <td> integer, (range: 1024-65535) </td> <td> Envoy admin port. Changing this port during runtime might result in an empty response because envoy serves as the cluster gateway. </td> </tr> <tr> <td> envoy_mgmt_server_port </td> <td> integer, (range: 1024-65535) </td> <td> Envoy management server port </td> </tr> <tr> <td> gossip_envoy_admin_port </td> <td> integer, (range: 1024-65535) </td> <td> Gossip envoy admin port </td> </tr> <tr> <td> handle_redirects </td> <td> <code> enabled </code> <br/> <code> disabled </code> </td> <td> Enable or turn off handling DNS redirects when DNS is not configured and running behind a load balancer </td> </tr> <tr> <td> handle_metrics_redirects </td> <td> <code> enabled </code> <br/> <code> disabled </code> </td> <td> Enable or turn off handling cluster redirects internally for Metrics API </td> </tr> <tr> <td> http_support </td> <td> <code> enabled </code> <br/> <code> disabled </code> </td> <td> Enable or turn off using HTTP for REST API connections </td> </tr> <tr> <td> ipv6 </td> <td> <code> enabled </code> <br/> <code> disabled </code> </td> <td> Enable or turn off IPv6 connections to the Cluster Manager UI </td> </tr> <tr> <td> min_control_TLS_version </td> <td> <code> 1.2 </code> <br/> <code> 1.3 </code> </td> <td> The minimum TLS protocol version that is supported for the control path </td> </tr> <tr> <td> min_data_TLS_version </td> <td> <code> 1.2 </code> <br/> <code> 1.3 </code> </td> <td> The minimum TLS protocol version that is supported for the data path </td> </tr> <tr> <td> min_sentinel_TLS_version </td> <td> <code> 1.2 </code> <br/> <code> 1.3 </code> </td> <td> The minimum TLS protocol version that is supported for the discovery service </td> </tr> <tr> <td> reserved_ports </td> <td> list of ports/port ranges </td> <td> List of reserved ports and/or port ranges to avoid using for database endpoints (for example <code> reserved_ports 11000 13000-13010 </code> ) </td> </tr> <tr> <td> s3_url </td> <td> string </td> <td> The URL of S3 export and import </td> </tr> <tr> <td> s3_ca_cert </td> <td> string </td> <td> The CA certificate filepath for S3 export and import </td> </tr> <tr> <td> saslauthd_ldap_conf </td> <td> filepath </td> <td> Updates LDAP authentication configuration for the cluster </td> </tr> <tr> <td> sentinel_cipher_suites </td> <td> list of ciphers </td> <td> Cipher suites used by the discovery service (supported ciphers are implemented by the <a href="https://golang.org/src/crypto/tls/cipher_suites.go"> cipher_suites.go </a> package) </td> </tr> <tr> <td> sentinel_tls_mode </td> <td> <code> allowed </code> <br/> <code> required </code> <br/> <code> disabled </code> </td> <td> Define the SSL policy for the discovery service <br/> (previously named <code> sentinel_ssl_policy </code> ) </td> </tr> <tr> <td> services </td> <td> <code> cm_server </code> <br/> <code> crdb_coordinator </code> <br/> <code> crdb_worker </code> <br/> <code> mdns_server </code> <br/> <code> pdns_server </code> <br/> <code> saslauthd </code> <br/> <code> stats_archiver </code> <br/> <br/> <code> enabled </code> <br/> <code> disabled </code> </td> <td> Enable or turn off selected cluster services </td> </tr> <tr> <td> upgrade_mode </td> <td> <code> enabled </code> <br/> <code> disabled </code> </td> <td> Enable or turn off upgrade mode on the cluster </td> </tr> </tbody> </table> <h3 id="returns"> Returns </h3> <p> Reports whether the cluster was configured successfully. Displays an error message if the configuration attempt fails. </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 config cm_session_timeout_minutes <span class="m">20</span> </span></span><span class="line"><span class="cl">Cluster configured 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/cluster/config/"/> <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.info.html
<section class="prose w-full py-12"> <h1 class="command-name"> CMS.INFO </h1> <div class="font-semibold text-redis-ink-900"> Syntax </div> <pre class="command-syntax">CMS.INFO key</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(1) </dd> </dl> <p> Returns width, depth and total count of the sketch. </p> <h3 id="parameters"> Parameters: </h3> <ul> <li> <strong> key </strong> : The name of the sketch. </li> </ul> <h2 id="return"> Return </h2> <p> <a href="/docs/latest/develop/reference/protocol-spec/#arrays"> Array reply </a> with information of the filter. </p> <h2 id="examples"> Examples </h2> <pre tabindex="0"><code>redis&gt; CMS.INFO test 1) width 2) (integer) 2000 3) depth 4) (integer) 7 5) count 6) (integer) 0 </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.info/"/> <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/foreach/.html
<section class="prose w-full py-12 max-w-none"> <h1> Foreach </h1> <p class="text-lg -mt-5 mb-10"> For each record in the pipe, runs some operations. </p> <div class="highlight"> <pre class="chroma"><code class="language-java" data-lang="java"><span class="line"><span class="cl"><span class="kd">public</span> <span class="n">GearsBuilder</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span> <span class="n">foreach</span><span class="err">​</span><span class="o">(</span> </span></span><span class="line"><span class="cl"> <span class="n">gears</span><span class="o">.</span><span class="na">operations</span><span class="o">.</span><span class="na">ForeachOperation</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span> <span class="n">foreach</span><span class="o">)</span> </span></span></code></pre> </div> <p> Defines a set of operations to run for each record in the pipe. </p> <h2 id="parameters"> Parameters </h2> <table> <thead> <tr> <th> Name </th> <th> Type </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> foreach </td> <td> ForeachOperation <t> </t> </td> <td> The set of operations to run for each record </td> </tr> </tbody> </table> <h2 id="returns"> Returns </h2> <p> Returns a GearsBuilder object with a new template type. </p> <h2 id="example"> Example </h2> <p> For each person hash, add a new full_name field that combines their first and last names: </p> <div class="highlight"> <pre class="chroma"><code class="language-java" data-lang="java"><span class="line"><span class="cl"><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 class="na">foreach</span><span class="o">(</span><span class="n">r</span><span class="o">-&gt;{</span> </span></span><span class="line"><span class="cl"> <span class="n">String</span> <span class="n">firstName</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="na">getHashVal</span><span class="o">().</span><span class="na">get</span><span class="o">(</span><span class="s">"first_name"</span><span class="o">);</span> </span></span><span class="line"><span class="cl"> <span class="n">String</span> <span class="n">lastName</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="na">getHashVal</span><span class="o">().</span><span class="na">get</span><span class="o">(</span><span class="s">"last_name"</span><span class="o">);</span> </span></span><span class="line"><span class="cl"> <span class="n">r</span><span class="o">.</span><span class="na">getHashVal</span><span class="o">().</span><span class="na">put</span><span class="o">(</span><span class="s">"full_name"</span><span class="o">,</span> <span class="n">firstName</span> <span class="o">+</span> <span class="n">lastName</span><span class="o">);</span> </span></span><span class="line"><span class="cl"><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/oss_and_stack/stack-with-enterprise/gears-v1/jvm/classes/gearsbuilder/foreach/"/> <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/use/patterns/bulk-loading/.html
<section class="prose w-full py-12"> <h1> Bulk loading </h1> <p class="text-lg -mt-5 mb-10"> Writing data in bulk using the Redis protocol </p> <p> Bulk loading is the process of loading Redis with a large amount of pre-existing data. Ideally, you want to perform this operation quickly and efficiently. This document describes some strategies for bulk loading data in Redis. </p> <h2 id="bulk-loading-using-the-redis-protocol"> Bulk loading using the Redis protocol </h2> <p> Using a normal Redis client to perform bulk loading is not a good idea for a few reasons: the naive approach of sending one command after the other is slow because you have to pay for the round trip time for every command. It is possible to use pipelining, but for bulk loading of many records you need to write new commands while you read replies at the same time to make sure you are inserting as fast as possible. </p> <p> Only a small percentage of clients support non-blocking I/O, and not all the clients are able to parse the replies in an efficient way in order to maximize throughput. For all of these reasons the preferred way to mass import data into Redis is to generate a text file containing the Redis protocol, in raw format, in order to call the commands needed to insert the required data. </p> <p> For instance if I need to generate a large data set where there are billions of keys in the form: `keyN -&gt; ValueN' I will create a file containing the following commands in the Redis protocol format: </p> <pre><code>SET Key0 Value0 SET Key1 Value1 ... SET KeyN ValueN </code></pre> <p> Once this file is created, the remaining action is to feed it to Redis as fast as possible. In the past the way to do this was to use the <code> netcat </code> with the following command: </p> <pre><code>(cat data.txt; sleep 10) | nc localhost 6379 &gt; /dev/null </code></pre> <p> However this is not a very reliable way to perform mass import because netcat does not really know when all the data was transferred and can't check for errors. In 2.6 or later versions of Redis the <code> redis-cli </code> utility supports a new mode called <strong> pipe mode </strong> that was designed in order to perform bulk loading. </p> <p> Using the pipe mode the command to run looks like the following: </p> <pre><code>cat data.txt | redis-cli --pipe </code></pre> <p> That will produce an output similar to this: </p> <pre><code>All data transferred. Waiting for the last reply... Last reply received from server. errors: 0, replies: 1000000 </code></pre> <p> The redis-cli utility will also make sure to only redirect errors received from the Redis instance to the standard output. </p> <h3 id="generating-redis-protocol"> Generating Redis Protocol </h3> <p> The Redis protocol is extremely simple to generate and parse, and is <a href="/docs/latest/develop/reference/protocol-spec/"> Documented here </a> . However in order to generate protocol for the goal of bulk loading you don't need to understand every detail of the protocol, but just that every command is represented in the following way: </p> <pre><code>*&lt;args&gt;&lt;cr&gt;&lt;lf&gt; $&lt;len&gt;&lt;cr&gt;&lt;lf&gt; &lt;arg0&gt;&lt;cr&gt;&lt;lf&gt; &lt;arg1&gt;&lt;cr&gt;&lt;lf&gt; ... &lt;argN&gt;&lt;cr&gt;&lt;lf&gt; </code></pre> <p> Where <code> &lt;cr&gt; </code> means "\r" (or ASCII character 13) and <code> &lt;lf&gt; </code> means "\n" (or ASCII character 10). </p> <p> For instance the command <strong> SET key value </strong> is represented by the following protocol: </p> <pre><code>*3&lt;cr&gt;&lt;lf&gt; $3&lt;cr&gt;&lt;lf&gt; SET&lt;cr&gt;&lt;lf&gt; $3&lt;cr&gt;&lt;lf&gt; key&lt;cr&gt;&lt;lf&gt; $5&lt;cr&gt;&lt;lf&gt; value&lt;cr&gt;&lt;lf&gt; </code></pre> <p> Or represented as a quoted string: </p> <pre><code>"*3\r\n$3\r\nSET\r\n$3\r\nkey\r\n$5\r\nvalue\r\n" </code></pre> <p> The file you need to generate for bulk loading is just composed of commands represented in the above way, one after the other. </p> <p> The following Ruby function generates valid protocol: </p> <pre><code>def gen_redis_proto(*cmd) proto = "" proto &lt;&lt; "*"+cmd.length.to_s+"\r\n" cmd.each{|arg| proto &lt;&lt; "$"+arg.to_s.bytesize.to_s+"\r\n" proto &lt;&lt; arg.to_s+"\r\n" } proto end puts gen_redis_proto("SET","mykey","Hello World!").inspect </code></pre> <p> Using the above function it is possible to easily generate the key value pairs in the above example, with this program: </p> <pre><code>(0...1000).each{|n| STDOUT.write(gen_redis_proto("SET","Key#{n}","Value#{n}")) } </code></pre> <p> We can run the program directly in pipe to redis-cli in order to perform our first mass import session. </p> <pre><code>$ ruby proto.rb | redis-cli --pipe All data transferred. Waiting for the last reply... Last reply received from server. errors: 0, replies: 1000 </code></pre> <h3 id="how-the-pipe-mode-works-under-the-hood"> How the pipe mode works under the hood </h3> <p> The magic needed inside the pipe mode of redis-cli is to be as fast as netcat and still be able to understand when the last reply was sent by the server at the same time. </p> <p> This is obtained in the following way: </p> <ul> <li> redis-cli --pipe tries to send data as fast as possible to the server. </li> <li> At the same time it reads data when available, trying to parse it. </li> <li> Once there is no more data to read from stdin, it sends a special <strong> ECHO </strong> command with a random 20 byte string: we are sure this is the latest command sent, and we are sure we can match the reply checking if we receive the same 20 bytes as a bulk reply. </li> <li> Once this special final command is sent, the code receiving replies starts to match replies with these 20 bytes. When the matching reply is reached it can exit with success. </li> </ul> <p> Using this trick we don't need to parse the protocol we send to the server in order to understand how many commands we are sending, but just the replies. </p> <p> However while parsing the replies we take a counter of all the replies parsed so that at the end we are able to tell the user the amount of commands transferred to the server by the mass insert session. </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/develop/use/patterns/bulk-loading/"/> <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>