url
stringlengths
38
157
content
stringlengths
72
15.1M
https://redis.io/docs/latest/integrate/write-behind/reference/data-transformation-block-types/redis_write/.html
<section class="prose w-full py-12 max-w-none"> <h1> redis.write </h1> <p class="text-lg -mt-5 mb-10"> Write to a Redis Enterprise database </p> <p> Write to a Redis Enterprise database </p> <p> <strong> Properties </strong> </p> <table> <thead> <tr> <th> Name </th> <th> Type </th> <th> Description </th> <th> Required </th> </tr> </thead> <tbody> <tr> <td> <strong> connection </strong> </td> <td> <code> string </code> </td> <td> Name of Redis connection specified in <code> config.yaml </code> . <br/> Defaults to connection named <code> target </code> . </td> <td> no </td> </tr> <tr> <td> <strong> data_type </strong> <br/> </td> <td> <code> string </code> </td> <td> Type of Redis target data structure. <br/> Enum: <code> hash </code> (default), <code> json </code> , <code> set </code> , <code> sorted_set </code> , <code> stream </code> , <code> string </code> . <br/> Takes precedence over system property <code> target_data_type </code> . </td> <td> no </td> </tr> <tr> <td> <a href="#nest"> <strong> nest </strong> </a> </td> <td> <code> object </code> </td> <td> Nest (embed) object within a different key. <br/> If nesting is specified, the following parameters are ignored: <code> key </code> , <code> args </code> and <code> on_update </code> . </td> <td> no </td> </tr> <tr> <td> <strong> key </strong> </td> <td> <code> object </code> </td> <td> Definition of the target Redis key. <br/> </td> <td> yes </td> </tr> <tr> <td> ∟ <strong> expression </strong> </td> <td> <code> string </code> </td> <td> Expression used to calculate the target key. </td> <td> yes </td> </tr> <tr> <td> ∟ <strong> language </strong> </td> <td> <code> string </code> </td> <td> Language used to define the expression. <br/> Enum: <code> jmespath </code> , <code> sql </code> . </td> <td> yes </td> </tr> <tr> <td> <a href="#args"> <strong> args </strong> </a> </td> <td> <code> object </code> </td> <td> Arguments for modifying the target key. <br/> Specific to the data type. </td> <td> no </td> </tr> <tr> <td> <strong> mapping </strong> </td> <td> <code> array </code> </td> <td> Array of fields (or <code> field: alias </code> pairs) to be written to a Redis key. <br/> Supported for hashes, json documents and streams only. </td> <td> no </td> </tr> <tr> <td> <strong> on_update </strong> </td> <td> <code> string </code> </td> <td> Target key update strategy <br/> Enum: <code> merge </code> , <code> replace </code> (default). </td> <td> no </td> </tr> <tr> <td> <strong> expire </strong> </td> <td> <code> integer </code> </td> <td> TTL in seconds for the modified key to expire. <br/> If not specified (or <code> expire: 0 </code> ), the target key will never expire. </td> <td> no </td> </tr> </tbody> </table> <blockquote> <p> Notes: </p> </blockquote> <ul> <li> Job parameters always override system properties. In particular, <code> data_type </code> will override <code> target_data_type </code> and <code> on_update </code> will override <code> json_update_strategy </code> properties respectively. </li> <li> Mapping for <strong> JSON documents </strong> supports nested paths (e.g. <code> path.to.field </code> ) which results in creating a nested element in Redis key. When a dot is used in a field name, it must be escaped with a backslash (e.g. <code> path\.to\.field </code> ). Nested paths are not supported for hashes and streams. </li> <li> For <strong> strings </strong> Write-behind will automatically assume <code> on_update: replace </code> regardless of what was declared in the job file. Appends and increments are not currently supported. </li> <li> For <strong> streams </strong> Write-behind will ignore <code> on_update </code> property since they are append only. </li> </ul> <blockquote> <p> Notes: </p> </blockquote> <ul> <li> Job parameters always override system properties. In particular, <code> data_type </code> will override <code> target_data_type </code> and <code> on_update </code> will override <code> json_update_strategy </code> properties respectively. </li> <li> Mapping for JSON documents supports nested paths (e.g. <code> path.to.field </code> ) which results in creating a nested element in Redis key. When a dot is used in a field name, it must be escaped with a backslash (e.g. <code> path\.to\.field </code> ). Nested paths are not supported for hashes and streams. </li> </ul> <p> <strong> Example </strong> </p> <div class="highlight"> <pre class="chroma"><code class="language-yaml" data-lang="yaml"><span class="line"><span class="cl"><span class="nt">source</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">server_name</span><span class="p">:</span><span class="w"> </span><span class="l">chinook</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">schema</span><span class="p">:</span><span class="w"> </span><span class="l">public</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">table</span><span class="p">:</span><span class="w"> </span><span class="l">invoice</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">output</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># this block will use the default connection: target - since no explicit connection is specified,</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># the data will be written in a JSON format as the data_type: json is specified for the block</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="nt">uses</span><span class="p">:</span><span class="w"> </span><span class="l">redis.write</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">with</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">data_type</span><span class="p">:</span><span class="w"> </span><span class="l">json</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">key</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">expression</span><span class="p">:</span><span class="w"> </span><span class="l">concat(['invoice_id:', InvoiceId])</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">language</span><span class="p">:</span><span class="w"> </span><span class="l">jmespath</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">mapping</span><span class="p">:</span><span class="w"> </span><span class="c"># only the fields listed below will be written to a JSON document</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="nt">InvoiceId</span><span class="p">:</span><span class="w"> </span><span class="l">id</span><span class="w"> </span><span class="c"># this will create an element with a different name</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="nt">InvoiceDate</span><span class="p">:</span><span class="w"> </span><span class="l">date</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="nt">BillingAddress</span><span class="p">:</span><span class="w"> </span><span class="l">address.primary.street</span><span class="w"> </span><span class="c"># this will create a nested element in the JSON document</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="nt">BillingCity</span><span class="p">:</span><span class="w"> </span><span class="s2">"address.primary.city name"</span><span class="w"> </span><span class="c"># this will create a nested element with a space in the name</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="nt">BillingState</span><span class="p">:</span><span class="w"> </span><span class="l">address.primary.state</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="nt">BillingPostalCode</span><span class="p">:</span><span class="w"> </span><span class="s2">"address.primary.zip\\.code"</span><span class="w"> </span><span class="c"># this will create a nested element with a dot in the name</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="l">Total</span><span class="w"> </span><span class="c"># this will create an element with the same name as the original field</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">on_update</span><span class="p">:</span><span class="w"> </span><span class="l">merge</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># this block will use the explicitly specified connection: target1 - it must be defined in config.yaml</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># the data will be written to the corresponding Redis set, based on a value of the key expression</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="nt">uses</span><span class="p">:</span><span class="w"> </span><span class="l">redis.write</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">with</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">connection</span><span class="p">:</span><span class="w"> </span><span class="l">target</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">data_type</span><span class="p">:</span><span class="w"> </span><span class="l">set</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">key</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">expression</span><span class="p">:</span><span class="w"> </span><span class="l">concat(['invoices:', BillingCountry])</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">language</span><span class="p">:</span><span class="w"> </span><span class="l">jmespath</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">args</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">member</span><span class="p">:</span><span class="w"> </span><span class="l">InvoiceId</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># this block will use the explicitly specified connection: target1 - it must be defined in config.yaml</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># the data will be written to the Redis sorted set named invoices:sorted as specified in the key expression</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="nt">uses</span><span class="p">:</span><span class="w"> </span><span class="l">redis.write</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">with</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">connection</span><span class="p">:</span><span class="w"> </span><span class="l">target1</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">data_type</span><span class="p">:</span><span class="w"> </span><span class="l">sorted_set</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">key</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">expression</span><span class="p">:</span><span class="w"> </span><span class="s2">"`invoices:sorted`"</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">language</span><span class="p">:</span><span class="w"> </span><span class="l">jmespath</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">args</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">score</span><span class="p">:</span><span class="w"> </span><span class="l">Total</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">member</span><span class="p">:</span><span class="w"> </span><span class="l">InvoiceId</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># this block will use the specified connection: target2 - this, again, has to be defined in config.yaml</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># the data will be written to a Redis stream named invoice:events as specified in the key expression</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="nt">uses</span><span class="p">:</span><span class="w"> </span><span class="l">redis.write</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">with</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">connection</span><span class="p">:</span><span class="w"> </span><span class="l">target2</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">data_type</span><span class="p">:</span><span class="w"> </span><span class="l">stream</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">key</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">expression</span><span class="p">:</span><span class="w"> </span><span class="s2">"`invoice:events`"</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">language</span><span class="p">:</span><span class="w"> </span><span class="l">jmespath</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">mapping</span><span class="p">:</span><span class="w"> </span><span class="c"># only the fields listed below will be written to a stream message, with two of them renamed as message_id and country</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="nt">InvoiceId</span><span class="p">:</span><span class="w"> </span><span class="l">message_id</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="nt">BillingCountry</span><span class="p">:</span><span class="w"> </span><span class="l">country</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="l">Total</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># this block will use the default connection: target - since no explicit connection is specified,</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># the data will be written to a Redis string as the data_type: string is specified for the block</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="nt">uses</span><span class="p">:</span><span class="w"> </span><span class="l">redis.write</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">with</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">data_type</span><span class="p">:</span><span class="w"> </span><span class="l">string</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">key</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">expression</span><span class="p">:</span><span class="w"> </span><span class="l">concat(['Invoice:', InvoiceId])</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">language</span><span class="p">:</span><span class="w"> </span><span class="l">jmespath</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">args</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">value</span><span class="p">:</span><span class="w"> </span><span class="l">Total</span><span class="w"> </span><span class="c"># only the Total field will be written to a string</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">expire</span><span class="p">:</span><span class="w"> </span><span class="m">100</span><span class="w"> </span><span class="c"># the key will expire in 100 seconds</span><span class="w"> </span></span></span></code></pre> </div> <p> <a name="args"> </a> </p> <h2 id="args-object"> args: object </h2> <p> Arguments for modifying the target key </p> <p> <strong> Properties </strong> </p> <table> <thead> <tr> <th> Name </th> <th> Type </th> <th> Description </th> <th> Required </th> </tr> </thead> <tbody> <tr> <td> <strong> score </strong> </td> <td> <code> string </code> </td> <td> Field name used as a score for sorted sets. <br/> Valid for sorted sets only. </td> <td> yes </td> </tr> <tr> <td> <strong> member </strong> </td> <td> <code> string </code> </td> <td> Field name used as a member for sets and sorted sets. <br/> Valid for sets and sorted sets only. </td> <td> yes </td> </tr> <tr> <td> <strong> value </strong> </td> <td> <code> string </code> </td> <td> Field name used as a value for strings. <br/> Valid for strings only. </td> <td> yes </td> </tr> </tbody> </table> <p> <a name="nest"> </a> </p> <h2 id="nest-object"> nest: object </h2> <p> Nest (embed) object within a different key </p> <p> <strong> Properties </strong> </p> <table> <thead> <tr> <th> Name </th> <th> Type </th> <th> Description </th> <th> Required </th> </tr> </thead> <tbody> <tr> <td> <strong> parent </strong> </td> <td> <code> object </code> </td> <td> Parent object definition. </td> <td> yes </td> </tr> <tr> <td> ∟ <strong> server_name </strong> </td> <td> <code> string </code> </td> <td> Server name. </td> <td> no </td> </tr> <tr> <td> ∟ <strong> schema </strong> </td> <td> <code> string </code> </td> <td> Schema name. </td> <td> no </td> </tr> <tr> <td> ∟ <strong> table </strong> </td> <td> <code> string </code> </td> <td> Parent table. </td> <td> yes </td> </tr> <tr> <td> <strong> parent_key </strong> </td> <td> <code> string </code> </td> <td> Field name used to identify the parent key (usually FK). </td> <td> yes </td> </tr> <tr> <td> <strong> child_key </strong> </td> <td> <code> string </code> </td> <td> Optional field name used to identify the parent key value (if different from <strong> parent_key </strong> ) in the child record. If not specified, then the field name defined in <strong> parent_key </strong> is used to lookup the value. </td> <td> no </td> </tr> <tr> <td> <strong> nesting_key </strong> </td> <td> <code> string </code> </td> <td> Field name used to create the nesting key (usually PK). </td> <td> yes </td> </tr> <tr> <td> <strong> path </strong> </td> <td> <code> string </code> </td> <td> Path, where the nested object should reside in a parent document. <br/> Must start with the root (e.g. <code> $.&lt;children-elements-here&gt; </code> ) </td> <td> yes </td> </tr> <tr> <td> <strong> structure </strong> </td> <td> <code> string </code> </td> <td> Data structure used to represent the object in a parent document ( <code> map </code> is the only supported value). </td> <td> no </td> </tr> </tbody> </table> <blockquote> <p> Notes: </p> </blockquote> <ul> <li> When <code> nest </code> object is defined, Write-behind will automatically assume <code> data_type: json </code> and <code> on_update: merge </code> regardless of what was declared in the job file. </li> <li> Nesting job cannot be used together with any of the these properties: <code> key </code> , <code> args </code> . The key is automatically calculated based on the following template: <code> &lt;parent_table&gt;:&lt;parent_key&gt;:&lt;parent_key.value | child_key.value&gt; </code> . </li> <li> When <code> expire </code> is specified, it will be applied to the <strong> parent </strong> key. Therefore all nested objects will expire together with the parent key. </li> </ul> <p> <strong> Example </strong> </p> <div class="highlight"> <pre class="chroma"><code class="language-yaml" data-lang="yaml"><span class="line"><span class="cl"><span class="nt">source</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">server_name</span><span class="p">:</span><span class="w"> </span><span class="l">chinook</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">schema</span><span class="p">:</span><span class="w"> </span><span class="l">public</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">table</span><span class="p">:</span><span class="w"> </span><span class="l">InvoiceLine</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">output</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="nt">uses</span><span class="p">:</span><span class="w"> </span><span class="l">redis.write</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">with</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">nest</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">parent</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># server_name: chinook</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># schema: public</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">table</span><span class="p">:</span><span class="w"> </span><span class="l">Invoice</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">nesting_key</span><span class="p">:</span><span class="w"> </span><span class="l">InvoiceLineId</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">parent_key</span><span class="p">:</span><span class="w"> </span><span class="l">InvoiceId</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># child_key: ParentInvoiceId</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">$.InvoiceLineItems</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># structure: map</span><span class="w"> </span></span></span></code></pre> </div> <blockquote> <p> Note: In the example above <code> child_key </code> is not needed, because the FK in the child table <code> InvoiceLine </code> is defined using the same field name <code> InvoiceId </code> as in the parent table <code> Invoice </code> . If instead a FK was defined differently (e.g. InvoiceLine.ParentInvoivceId = Invoice.InvoiceId), then <code> child_key </code> parameter would be required to describe this relationship in the child job. </p> </blockquote> <form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback"> <input class="hidden" name="origin" value="https://redis.io/docs/latest/integrate/write-behind/reference/data-transformation-block-types/redis_write/"/> <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/php/.html
<section class="prose w-full py-12 max-w-none"> <h1> Predis guide (PHP) </h1> <p class="text-lg -mt-5 mb-10"> Connect your PHP application to a Redis database </p> <p> <a href="https://github.com/predis/predis"> <code> Predis </code> </a> is the recommended <a href="https://php.net/"> PHP </a> client for Redis. The sections below explain how to install <code> Predis </code> and connect your application to a Redis 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> Although we provide basic documentation for <code> Predis </code> , it is a third-party client library and is not developed or supported directly by Redis. </div> </div> <p> <code> Predis </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> Use <a href="https://getcomposer.org/"> Composer </a> to install the <code> Predis </code> library with the following command line: </p> <div class="highlight"> <pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">composer require predis/predis </span></span></code></pre> </div> <h2 id="connect-and-test"> Connect and test </h2> <p> Connect to a locally-running server on the standard port (6379) with the following code: </p> <div class="highlight"> <pre class="chroma"><code class="language-php" data-lang="php"><span class="line"><span class="cl"><span class="o">&lt;?</span><span class="nx">php</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="k">require</span> <span class="s1">'vendor/autoload.php'</span><span class="p">;</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="k">use</span> <span class="nx">Predis\Client</span> <span class="k">as</span> <span class="nx">PredisClient</span><span class="p">;</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="nv">$r</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">PredisClient</span><span class="p">();</span> </span></span></code></pre> </div> <p> Store and retrieve a simple string to test the connection: </p> <div class="highlight"> <pre class="chroma"><code class="language-php" data-lang="php"><span class="line"><span class="cl"><span class="k">echo</span> <span class="nv">$r</span><span class="o">-&gt;</span><span class="na">set</span><span class="p">(</span><span class="s1">'foo'</span><span class="p">,</span> <span class="s1">'bar'</span><span class="p">),</span> <span class="nx">PHP_EOL</span><span class="p">;</span> </span></span><span class="line"><span class="cl"><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="k">echo</span> <span class="nv">$r</span><span class="o">-&gt;</span><span class="na">get</span><span class="p">(</span><span class="s1">'foo'</span><span class="p">),</span> <span class="nx">PHP_EOL</span><span class="p">;</span> </span></span><span class="line"><span class="cl"><span class="c1">// &gt;&gt;&gt; bar </span></span></span></code></pre> </div> <p> Store and retrieve a <a href="/docs/latest/develop/data-types/hashes/"> hash </a> object: </p> <div class="highlight"> <pre class="chroma"><code class="language-php" data-lang="php"><span class="line"><span class="cl"><span class="nv">$r</span><span class="o">-&gt;</span><span class="na">hset</span><span class="p">(</span><span class="s1">'user-session:123'</span><span class="p">,</span> <span class="s1">'name'</span><span class="p">,</span> <span class="s1">'John'</span><span class="p">);</span> </span></span><span class="line"><span class="cl"><span class="nv">$r</span><span class="o">-&gt;</span><span class="na">hset</span><span class="p">(</span><span class="s1">'user-session:123'</span><span class="p">,</span> <span class="s1">'surname'</span><span class="p">,</span> <span class="s1">'Smith'</span><span class="p">);</span> </span></span><span class="line"><span class="cl"><span class="nv">$r</span><span class="o">-&gt;</span><span class="na">hset</span><span class="p">(</span><span class="s1">'user-session:123'</span><span class="p">,</span> <span class="s1">'company'</span><span class="p">,</span> <span class="s1">'Redis'</span><span class="p">);</span> </span></span><span class="line"><span class="cl"><span class="nv">$r</span><span class="o">-&gt;</span><span class="na">hset</span><span class="p">(</span><span class="s1">'user-session:123'</span><span class="p">,</span> <span class="s1">'age'</span><span class="p">,</span> <span class="mi">29</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="k">echo</span> <span class="nx">var_export</span><span class="p">(</span><span class="nv">$r</span><span class="o">-&gt;</span><span class="na">hgetall</span><span class="p">(</span><span class="s1">'user-session:123'</span><span class="p">)),</span> <span class="nx">PHP_EOL</span><span class="p">;</span> </span></span><span class="line"><span class="cl"><span class="cm">/* &gt;&gt;&gt; </span></span></span><span class="line"><span class="cl"><span class="cm">array ( </span></span></span><span class="line"><span class="cl"><span class="cm"> 'name' =&gt; 'John', </span></span></span><span class="line"><span class="cl"><span class="cm"> 'surname' =&gt; 'Smith', </span></span></span><span class="line"><span class="cl"><span class="cm"> 'company' =&gt; 'Redis', </span></span></span><span class="line"><span class="cl"><span class="cm"> 'age' =&gt; '29', </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></code></pre> </div> <h2 id="more-information"> More information </h2> <p> The <a href="https://github.com/predis/predis/wiki"> Predis wiki on Github </a> has information about the different connection options you can use. </p> <p> See also the pages in this section for more information and examples: </p> <nav> <a href="/docs/latest/develop/clients/php/connect/"> Connect to the server </a> <p> Connect your PHP application to a Redis database </p> <a href="/docs/latest/develop/clients/php/queryjson/"> Example - Index and query JSON documents </a> <p> Learn how to use the Redis query engine with JSON </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/php/"/> <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/info/.html
<section class="prose w-full py-12 max-w-none"> <h1> rladmin info </h1> <p class="text-lg -mt-5 mb-10"> Shows the current configuration of a cluster, database, node, or proxy. </p> <p> Shows the current configuration of specified databases, proxies, clusters, or nodes. </p> <h2 id="info-cluster"> <code> info cluster </code> </h2> <p> Lists the current configuration for the cluster. </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></code></pre> </div> <h3 id="parameters"> Parameters </h3> <p> None </p> <h3 id="returns"> Returns </h3> <p> Returns the current configuration for the cluster. </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 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"> shards_overbooking: disabled </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_fork_evict_ram: enabled </span></span><span class="line"><span class="cl"> default_provisioned_redis_version: 6.0 </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">4</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"> slave_ha: enabled </span></span><span class="line"><span class="cl"> slave_ha_grace_period: <span class="m">600</span> </span></span><span class="line"><span class="cl"> slave_ha_cooldown_period: <span class="m">3600</span> </span></span><span class="line"><span class="cl"> slave_ha_bdb_cooldown_period: <span class="m">7200</span> </span></span><span class="line"><span class="cl"> parallel_shards_upgrade: <span class="m">0</span> </span></span><span class="line"><span class="cl"> show_internals: disabled </span></span><span class="line"><span class="cl"> expose_hostnames_for_all_suffixes: disabled </span></span><span class="line"><span class="cl"> login_lockout_threshold: <span class="m">5</span> </span></span><span class="line"><span class="cl"> login_lockout_duration: <span class="m">1800</span> </span></span><span class="line"><span class="cl"> login_lockout_counter_reset_after: <span class="m">900</span> </span></span><span class="line"><span class="cl"> default_concurrent_restore_actions: <span class="m">10</span> </span></span><span class="line"><span class="cl"> endpoint_rebind_propagation_grace_time: <span class="m">15</span> </span></span><span class="line"><span class="cl"> data_internode_encryption: disabled </span></span><span class="line"><span class="cl"> redis_upgrade_policy: major </span></span><span class="line"><span class="cl"> db_conns_auditing: disabled </span></span><span class="line"><span class="cl"> watchdog profile: local-network </span></span><span class="line"><span class="cl"> http support: enabled </span></span><span class="line"><span class="cl"> upgrade mode: disabled </span></span><span class="line"><span class="cl"> cm_session_timeout_minutes: <span class="m">15</span> </span></span><span class="line"><span class="cl"> cm_port: <span class="m">8443</span> </span></span><span class="line"><span class="cl"> cnm_http_port: <span class="m">8080</span> </span></span><span class="line"><span class="cl"> cnm_https_port: <span class="m">9443</span> </span></span><span class="line"><span class="cl"> bigstore_driver: speedb </span></span></code></pre> </div> <h2 id="info-db"> <code> info db </code> </h2> <p> Shows the current configuration for databases. </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">rladmin info db <span class="o">[</span> <span class="o">{</span>db:&lt;id&gt; <span class="p">|</span> &lt;name&gt;<span class="o">}</span> <span class="o">]</span> </span></span></code></pre> </div> <h3 id="parameters-1"> Parameters </h3> <table> <thead> <tr> <th> Parameter </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> db:id </td> <td> ID of the specified database (optional) </td> </tr> <tr> <td> name </td> <td> Name of the specified database (optional) </td> </tr> </tbody> </table> <h3 id="returns-1"> Returns </h3> <p> Returns the current configuration for all databases. </p> <p> If <code> db:&lt;id&gt; </code> or <code> &lt;name&gt; </code> is specified, returns the current configuration for the specified database. </p> <h3 id="example-1"> Example </h3> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">$ rladmin info db db:1 </span></span><span class="line"><span class="cl">db:1 <span class="o">[</span>database1<span class="o">]</span>: </span></span><span class="line"><span class="cl"> client_buffer_limits: 1GB <span class="o">(</span>hard limit<span class="o">)</span>/512MB <span class="o">(</span>soft limit<span class="o">)</span> in <span class="m">30</span> seconds </span></span><span class="line"><span class="cl"> slave_buffer: auto </span></span><span class="line"><span class="cl"> pubsub_buffer_limits: 32MB <span class="o">(</span>hard limit<span class="o">)</span>/8MB <span class="o">(</span>soft limit<span class="o">)</span> in <span class="m">60</span> seconds </span></span><span class="line"><span class="cl"> proxy_client_buffer_limits: 0KB <span class="o">(</span>hard limit<span class="o">)</span>/0KB <span class="o">(</span>soft limit<span class="o">)</span> in <span class="m">0</span> seconds </span></span><span class="line"><span class="cl"> proxy_slave_buffer_limits: 1GB <span class="o">(</span>hard limit<span class="o">)</span>/512MB <span class="o">(</span>soft limit<span class="o">)</span> in <span class="m">60</span> seconds </span></span><span class="line"><span class="cl"> proxy_pubsub_buffer_limits: 32MB <span class="o">(</span>hard limit<span class="o">)</span>/8MB <span class="o">(</span>soft limit<span class="o">)</span> in <span class="m">60</span> seconds </span></span><span class="line"><span class="cl"> repl_backlog: 1.02MB <span class="o">(</span><span class="m">1073741</span> bytes<span class="o">)</span> </span></span><span class="line"><span class="cl"> repl_timeout: <span class="m">360</span> seconds </span></span><span class="line"><span class="cl"> repl_diskless: default </span></span><span class="line"><span class="cl"> master_persistence: disabled </span></span><span class="line"><span class="cl"> maxclients: <span class="m">10000</span> </span></span><span class="line"><span class="cl"> conns: <span class="m">5</span> </span></span><span class="line"><span class="cl"> conns_type: per-thread </span></span><span class="line"><span class="cl"> sched_policy: cmp </span></span><span class="line"><span class="cl"> max_aof_file_size: 300GB </span></span><span class="line"><span class="cl"> max_aof_load_time: <span class="m">3600</span> seconds </span></span><span class="line"><span class="cl"> dedicated_replicaof_threads: <span class="m">5</span> </span></span><span class="line"><span class="cl"> max_client_pipeline: <span class="m">200</span> </span></span><span class="line"><span class="cl"> max_shard_pipeline: <span class="m">2000</span> </span></span><span class="line"><span class="cl"> max_connections: <span class="m">0</span> </span></span><span class="line"><span class="cl"> oss_cluster: disabled </span></span><span class="line"><span class="cl"> oss_cluster_api_preferred_ip_type: internal </span></span><span class="line"><span class="cl"> gradual_src_mode: disabled </span></span><span class="line"><span class="cl"> gradual_src_max_sources: <span class="m">1</span> </span></span><span class="line"><span class="cl"> gradual_sync_mode: auto </span></span><span class="line"><span class="cl"> gradual_sync_max_shards_per_source: <span class="m">1</span> </span></span><span class="line"><span class="cl"> slave_ha: disabled <span class="o">(</span>database<span class="o">)</span> </span></span><span class="line"><span class="cl"> mkms: enabled </span></span><span class="line"><span class="cl"> oss_sharding: disabled </span></span><span class="line"><span class="cl"> mtls_allow_weak_hashing: disabled </span></span><span class="line"><span class="cl"> mtls_allow_outdated_certs: disabled </span></span><span class="line"><span class="cl"> data_internode_encryption: disabled </span></span><span class="line"><span class="cl"> proxy_policy: single </span></span><span class="line"><span class="cl"> db_conns_auditing: disabled </span></span><span class="line"><span class="cl"> syncer_mode: centralized </span></span></code></pre> </div> <h2 id="info-node"> <code> info node </code> </h2> <p> Lists the current configuration for all nodes. </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">rladmin info node <span class="o">[</span> &lt;id&gt; <span class="o">]</span> </span></span></code></pre> </div> <h3 id="parameters-2"> Parameters </h3> <table> <thead> <tr> <th> Parameter </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> id </td> <td> ID of the specified node </td> </tr> </tbody> </table> <h3 id="returns-2"> Returns </h3> <p> Returns the current configuration for all nodes. </p> <p> If <code> &lt;id&gt; </code> is specified, returns the current configuration for the specified node. </p> <h3 id="example-2"> Example </h3> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">$ rladmin info node <span class="m">3</span> </span></span><span class="line"><span class="cl">Command Output: node:3 </span></span><span class="line"><span class="cl"> address: 198.51.100.17 </span></span><span class="line"><span class="cl"> external addresses: N/A </span></span><span class="line"><span class="cl"> recovery path: N/A </span></span><span class="line"><span class="cl"> quorum only: disabled </span></span><span class="line"><span class="cl"> max redis servers: <span class="m">100</span> </span></span><span class="line"><span class="cl"> max listeners: <span class="m">100</span> </span></span></code></pre> </div> <h2 id="info-proxy"> <code> info proxy </code> </h2> <p> Lists the current configuration for a proxy. </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">rladmin info proxy <span class="o">{</span> &lt;id&gt; <span class="p">|</span> all <span class="o">}</span> </span></span></code></pre> </div> <h3 id="parameters-3"> Parameters </h3> <table> <thead> <tr> <th> Parameter </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> id </td> <td> ID of the specified proxy </td> </tr> <tr> <td> all </td> <td> Show the current configuration for all proxies (optional) </td> </tr> </tbody> </table> <h3 id="returns-3"> Returns </h3> <p> If no parameter is specified or the <code> all </code> option is specified, returns the current configuration for all proxies. </p> <p> If <code> &lt;id&gt; </code> is specified, returns the current configuration for the specified proxy. </p> <h3 id="example-3"> Example </h3> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">$ rladmin info proxy </span></span><span class="line"><span class="cl">proxy:1 </span></span><span class="line"><span class="cl"> mode: dynamic </span></span><span class="line"><span class="cl"> scale_threshold: <span class="m">80</span> <span class="o">(</span>%<span class="o">)</span> </span></span><span class="line"><span class="cl"> scale_duration: <span class="m">30</span> <span class="o">(</span>seconds<span class="o">)</span> </span></span><span class="line"><span class="cl"> max_threads: <span class="m">8</span> </span></span><span class="line"><span class="cl"> threads: <span class="m">3</span> </span></span></code></pre> </div> <form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback"> <input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/7.4/references/cli-utilities/rladmin/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/release-notes/redisearch/redisearch-2.8-release-notes/.html
<section class="prose w-full py-12 max-w-none"> <h1> RediSearch 2.8 release notes </h1> <p class="text-lg -mt-5 mb-10"> RESP3 support. Geo Polygon Search. Performance improvements. </p> <h2 id="requirements"> Requirements </h2> <p> RediSearch v2.8.17 requires: </p> <ul> <li> Minimum Redis compatibility version (database): 7.2 </li> <li> Minimum Redis Enterprise Software version (cluster): 7.2.4 </li> </ul> <h2 id="v2817-august-2024"> v2.8.17 (August 2024) </h2> <p> This is a maintenance release for RediSearch 2.8 </p> <p> Update urgency: <code> HIGH </code> : There is a critical bug that may affect a subset of users. Upgrade! </p> <ul> <li> <p> Bug fixes: </p> <ul> <li> <a href="https://github.com/redisearch/redisearch/pull/4941"> #4941 </a> Adjusting the module configuration to avoid routing overload on the first shard in a clustered database (MOD-7505) </li> <li> <a href="https://github.com/redisearch/redisearch/pull/4950"> #4950 </a> <code> FT.PROFILE </code> on <code> AGGREGATE </code> numeric queries could cause a crash due to reusing internal <code> CURSOR </code> in large range of numeric values (MOD-7454) </li> </ul> </li> </ul> <h2 id="v2816-august-2024"> v2.8.16 (August 2024) </h2> <p> This is a maintenance release for RediSearch 2.8 </p> <p> Update urgency: <code> HIGH </code> : There is a critical bug that may affect a subset of users. Upgrade! </p> <ul> <li> <p> Bug fixes: </p> <ul> <li> <a href="https://github.com/redisearch/redisearch/pull/4896"> #4896 </a> - <code> FT.AGGREGATE </code> with <code> VERBATIM </code> option is not handled by the shards in cluster mode (MOD-7463) </li> <li> <a href="https://github.com/redisearch/redisearch/pull/4917"> #4917 </a> - Union query, similar to <code> "is|the" </code> , starting with 2 <a href="https://redis.io/docs/latest/develop/interact/search-and-query/advanced-concepts/stopwords/"> stopwords </a> could cause a crash (MOD-7495) </li> <li> <a href="https://github.com/redisearch/redisearch/pull/4921"> #4921 </a> - Counting twice the field statistics at the <code> #search </code> section of an <code> INFO </code> response (MOD-7339) </li> <li> <a href="https://github.com/redisearch/redisearch/pull/4939"> #4939 </a> - Query warning when using RESP3 response for reaching <code> MAXPREFIXEXPANSION </code> (MOD-7588) </li> <li> <a href="https://github.com/redisearch/redisearch/pull/4930"> #4930 </a> - Loop when using the wildcard <code> w'term' </code> and prefix/infix/suffix pattern <code> 'ter*' </code> leading shard to restart (MOD-7453) </li> <li> <a href="https://github.com/redisearch/redisearch/pull/4912"> #4912 </a> - Avoid stemming expansion when querying for numeric values (MOD-7025) </li> </ul> </li> </ul> <h2 id="v2815-july-2024"> v2.8.15 (July 2024) </h2> <p> Update urgency: <code> HIGH </code> : There is a critical bug that may affect a subset of users. Upgrade! </p> <ul> <li> <p> Bug fixes: </p> <ul> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4754"> #4754 </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/4737"> #4737 </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 <code> SORTBY 2 @field1 @field2 </code> was ignoring the subsequent field(MOD-7206) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4803"> #4803 </a> - Keys expiring during query returning empty array (MOD-7010) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4794"> #4794 </a> - Index sanitiser (GC) trying to clean deleted numeric index could cause a crash (MOD-7303) </li> </ul> </li> <li> <p> Improvements: </p> <ul> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4792"> #4792 </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/4768"> #4768 </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/4745"> #4745 </a> - <code> GROUPBY </code> recursion cleanup (MOD-7245) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4823"> #4823 </a> - Mechanism of keys expiration during the query execution clearing intermediate results </li> </ul> </li> </ul> <h2 id="v2814-june-2024"> v2.8.14 (June 2024) </h2> <p> This is a maintenance release for RediSearch 2.8 </p> <p> Update urgency: <code> MODERATE </code> : Program an upgrade of the server, but it's not urgent. </p> <ul> <li> <p> Bug fixes: </p> <ul> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4614"> #4614 </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/4556"> #4556 </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/4646"> #4646 </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> <li> <p> Improvements: </p> <ul> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4595"> #4595 </a> Report memory of the <code> TAG </code> and <code> TEXT </code> tries (MOD-5902) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4669"> #4669 </a> Inverted index memory counting (MOD-5977,MOD-5866) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4687"> #4687 </a> Add missing <code> FT.INFO </code> fields when used within a cluster (MOD-6920) </li> </ul> </li> </ul> <h2 id="v2813-march-2024"> v2.8.13 (March 2024) </h2> <p> This is a maintenance release for RediSearch 2.8. </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/RediSearch/RediSearch/pull/4481"> #4481 </a> Query syntax on <code> GEOSHAPE </code> accepting just prefix instead of complete predicate (MOD-6663) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4513"> #4513 </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/4534"> #4534 </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/4530"> #4530 </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/4539"> #4539 </a> Unfree memory while re-indexing a new RDB as it's loading could cause a crash (MOD-6831, 6810) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4498"> #4498 </a> Vector pre-filtered query (hybrid query) that times out causing a crash due to deadlock when trying to write a new document (MOD-6510, MOD-6244) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4495"> #4495 </a> <code> FT.SEARCH </code> accessing an inexistent memory address causes a crash if using the deprecated <code> FT.ADD </code> command (MOD-6599) </li> </ul> </li> <li> <p> Improvements: </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 ... EXEC </code> or LUA script (MOD-6541) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4526"> #4526 </a> Adding detailed geometry info on error messages (MOD-6701) </li> </ul> </li> </ul> <h2 id="v2812-march-2024"> v2.8.12 (March 2024) </h2> <p> This is a maintenance release for RediSearch 2.8. </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/RediSearch/RediSearch/pull/4476"> #4476 </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/4467"> #4467 </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/4403"> #4403 </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/4355"> #4355 </a> Searching for a synonym will iterate in the same group multiple times, causing a performance hit (MOD-6490) </li> </ul> </li> <li> <p> Improvements: </p> <ul> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4313"> #4313 </a> Memory allocation patterns on the memory used to query <code> GEOSHAPE </code> types (MOD-6431) </li> </ul> </li> </ul> <h2 id="v2811-january-2024"> v2.8.11 (January 2024) </h2> <p> This is a maintenance release for RediSearch 2.8. </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/RediSearch/RediSearch/pull/4324"> #4324 </a> Internal cluster mechanism not waiting until all replies from shards causing a crash (MOD-6287) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4297"> #4297 </a> Execution loader when using <code> FT.AGGREGATE </code> with <code> LOAD </code> stage failing to buffer the right results potentially causing a crash (MOD-6385) </li> </ul> </li> <li> <p> Improvements: </p> <ul> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4264"> #4264 </a> Granularity of the time reporting counters on <code> FT.PROFILE </code> (MOD-6002) </li> </ul> </li> </ul> <h2 id="v2810-january-2024"> v2.8.10 (January 2024) </h2> <p> This is a maintenance release for RediSearch 2.8. </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/RediSearch/RediSearch/pull/4287"> #4287 </a> Re-index process while syncing from the replica causes a crash due to internal index variable initialization (MOD-6337, MOD-6336) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4249"> #4249 </a> Memory tracking on cluster setups causing high memory usage and potentially Out-of-Memory (MOD-6123, MOD-5639) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4244"> #4244 </a> Profiling <code> FT.AGGREGATE </code> using the <code> WITHCURSOR </code> flag with a <code> - </code> clause causes a crash due to timeout (MOD-5512) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/3916"> #3916 </a> Expiring <code> JSON </code> documents while querying it causing a crash due to deadlock (MOD-5769, MOD-5895, MOD-6189, MOD-5895) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4235"> #4235 </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/4190"> #4190 </a> Profiling <code> FT.AGGREGATE </code> causes a crash on RESP3 replies (MOD-6250, MOD-6295) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4148"> #4148 </a> , <a href="https://github.com/RediSearch/RediSearch/pull/4038"> #4038 </a> <code> ON_TIMEOUT FAIL\RETURN </code> policies in the cluster setup not being respected (MOD-6035, MOD-5948, MOD-6090) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4110"> #4110 </a> Format of error response contains inconsistencies when timing out (MOD-6011, MOD-5965) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4104"> #4104 </a> <code> FT.SEARCH </code> not responding when using TLS encryption on Amazon Linux 2 (MOD-6012) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4009"> #4009 </a> In cluster setup does not return a timeout error for <code> FT.SEARCH </code> (MOD-5911) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/3920"> #3920 </a> In cluster setup does not return a timeout error for <code> FT.AGGREGATE </code> (MOD-5209) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/3914"> #3914 </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/4220"> #4220 </a> Server crash when attempting to run the ForkGC (Garbage Collection routine) after dropping the index (MOD-6276) </li> </ul> </li> <li> <p> Improvements: </p> <ul> <li> <a href="https://github.com/RediSearch/RediSearch/pull/3682"> #3682 </a> Report last key error and field type indexing failures on <code> FT.INFO </code> (MOD-5364) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4236"> #4236 </a> Adding Vector index parameters at the <code> FT.INFO </code> report (MOD-6198) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4196"> #4196 </a> Check for timeout after results processing in <code> FT.SEARCH </code> on cluster setup (MOD-6278) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4164"> #4164 </a> Report <code> TIMEOUT </code> , <code> MAXPREFIXEXPANSION </code> warnings in RESP3 replies (MOD-6234) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4165"> #4165 </a> Indicate timeout on <code> FT.PROFILE </code> report (MOD-6184) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4149"> #4149 </a> Indicate timeout from Cursor on <code> FAIL </code> timeout policy (MOD-5990) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4147"> #4147 </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/3940"> #3940 </a> Query optimization when predicate contains multiple <code> INTERSECTION </code> (AND) of <code> UNION </code> (OR) (MOD-5910) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4059"> #4059 </a> Return cursor id when experiencing a timeout, when the policy is <code> ON_TIMEOUT RETURN </code> (MOD-5966) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4006"> #4006 </a> Possibly problematic index name alias validation (MOD-5945) </li> </ul> </li> </ul> <h2 id="v289-october-2023"> v2.8.9 (October 2023) </h2> <p> This is a maintenance release for RediSearch 2.8. </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/RediSearch/RediSearch/pull/3874"> #3874 </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/3967"> #3967 </a> Resharding optimizations causing the process to get stuck (MOD-5874, MOD-5864) </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> <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> </ul> </li> <li> <p> Improvements: </p> <ul> <li> <a href="https://github.com/RediSearch/RediSearch/pull/3938"> #3938 </a> Propagating error messages in multiple shards database, instead of failing silently (MOD-5211) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/3903"> #3903 </a> Added support for Rocky Linux 9 and RHEL9 (MOD-5759) </li> </ul> </li> </ul> <h2 id="v288-september-2023"> v2.8.8 (September 2023) </h2> <p> This is a maintenance release for RediSearch 2.8. </p> <p> Update urgency: <code> SECURITY </code> : There are security fixes in the release. </p> <p> Details: </p> <ul> <li> <p> Security and privacy: </p> <ul> <li> <a href="https://github.com/RediSearch/RediSearch/pull/3788"> #3788 </a> Don’t expose internal cluster commands (MOD-5706) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/3844"> #3844 </a> Limits maximum phonetic length avoiding to be exploit (MOD 5767) </li> </ul> </li> <li> <p> Bug fixes: </p> <ul> <li> <a href="https://github.com/RediSearch/RediSearch/pull/3771"> #3771 </a> Broken <code> lower() </code> and <code> upper() </code> functions on <code> APPLY </code> stage in <code> FT.AGGREGATE </code> in <code> DIALECT 3 </code> (MOD-5041) </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> cause a crash (MOD-5608) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/3780"> #3780 </a> Wrong document length calculation causing incorrect score values (MOD-5622) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/3808"> #3808 </a> <code> LOAD </code> step after a <code> FILTER </code> step could cause a crash on <code> FT.AGGREGATE </code> (MOD-5267) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/3823"> #3823 </a> <code> APPLY </code> or <code> FILTER </code> parser leak (MOD-5751) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/3837"> #3837 </a> Connection using TLS fail on Redis 7.2 (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 to a memory corruption (MOD-5791) </li> </ul> </li> <li> <p> Improvements: </p> <ul> <li> <a href="https://github.com/RediSearch/RediSearch/pull/3534"> #3534 </a> Vector Similarity 0.7.1 (MOD-5624) </li> </ul> </li> </ul> <h2 id="v28-ga-v284-july-2023"> v2.8 GA (v2.8.4) (July 2023) </h2> <p> This is the General Availability release of RediSearch 2.8. </p> <h3 id="headlines"> Headlines </h3> <p> RediSearch 2.8 introduces support for RESP3, new features, performance improvements, and bug fixes. </p> <h3 id="whats-new-in-284"> What's new in 2.8.4 </h3> <p> This new major version introduces new and frequently asked for Geo Polygon Search, adding the <code> GEOSHAPE </code> field type that supports polygon shapes using <a href="https://en.wikipedia.org/wiki/Well-known_text_representation_of_geometry"> WKT notation </a> . Besides the current <code> GEO </code> (alias for <code> GEOPOINT </code> ) used in geo range queries, we add support for <code> POLYGON </code> and <code> POINT </code> as new geo shape formats (new <code> GEOSHAPE </code> ). In addition, 2.8 brings performance improvements for <code> SORT BY </code> operations using <code> FT.SEARCH </code> and <code> FT.AGGREGATE </code> , and new <code> FORMAT </code> for enhanced responses on <code> FT.SEARCH </code> and <code> FT.AGGREGATE </code> in RESP3 only. </p> <p> Features: </p> <ul> <li> <p> Introduce support for geo polygon shapes and queries: </p> <ul> <li> <p> Adding <code> GEOSHAPE </code> <a href="/docs/latest/commands/ft.create"> field type </a> to map polygons in the <code> SCHEMA </code> on <code> FT.CREATE </code> (MOD-4798) </p> </li> <li> <p> Support for polygons <code> POLYGON </code> and <code> POINT </code> using <a href="https://en.wikipedia.org/wiki/Well-known_text_representation_of_geometry"> WKT notation </a> , for example <code> POLYGON((lon1 lat1, lon2 lat2, ...)) </code> </p> </li> <li> <p> Adjust the <a href="/docs/latest/commands/ft.search#examples"> query syntax </a> on <code> FT.SEARCH </code> for polygons using the predicate <code> @geom:[OPERATOR $poly] </code> and defining polygon in WKT format as <code> PARAMS 2 poly "POLYGON((10 20, ...))" </code> using <code> DIALECT 3 </code> </p> </li> <li> <p> Initially <code> WITHIN </code> and <code> CONTAINS </code> operators with <code> GEOSHAPES </code> for now </p> </li> <li> <p> Support multiple coordinate systems: cartesian (X,Y) with the flag <code> FLAT </code> for flat earth and geographic (lon, lat) using the flag <code> SPHERICAL </code> (MOD-5303). Geographic coordinate system using spherical indexing as default ( <code> SPHERICAL </code> ) </p> </li> <li> <p> Add memory usage per Geometry Index in the <code> FT.INFO </code> response report (MOD-5278) </p> </li> </ul> </li> <li> <p> Introduce performance optimization for sorting operations on <code> FT.SEARCH </code> and <code> FT.AGGREGATE </code> as default on <code> DIALECT 4 </code> . It will improve performance in 4 different scenarios, listed below: </p> <ul> <li> <p> Skip Sorter - applied when there is no sort of any kind. The query can return once it reaches the <code> LIMIT </code> requested results. </p> </li> <li> <p> Partial Range - applied when there is a <code> SORTBY </code> a numeric field, with no filter or filter by the same numeric field, the query iterates on a range large enough to satisfy the <code> LIMIT </code> requested results. </p> </li> <li> <p> Hybrid - applied when there is a <code> SORTBY </code> a numeric field in addition to another non-numeric filter. Some results will get filtered, and the initial range may not be large enough. The iterator then is rewinded with the following ranges, and an additional iteration takes place to collect <code> LIMIT </code> requested results. </p> </li> <li> <p> No optimization - If there is a sort by score or by non-numeric field, there is no other option but to retrieve all results and compare their values. </p> </li> </ul> </li> <li> <p> Add <code> WITHCOUNT </code> argument that allow return accurate counts for the query results with sorting. This operation processes all results in order to get accurate count, being less performant than the optimized option (default behavior on <code> DIALECT 4 </code> ) (MOD-5311) </p> </li> <li> <p> New <code> FORMAT </code> argument in <code> FT.SEARCH </code> and <code> FT.AGGREGATE </code> to retrieve the results as JSON strings or RESP3 hierarchical structures (RESP3 only) (MOD-5390) </p> </li> </ul> <p> Improvements (since 2.8.3): </p> <ul> <li> <p> <a href="https://github.com/RediSearch/RediSearch/pull/3717"> #3717 </a> - Polygon shapes validation and orientation correction when clockwise (MOD-5575) </p> </li> <li> <p> <a href="https://github.com/RediSearch/RediSearch/pull/3534"> #3534 </a> - Vector Similarity [ <a href="https://github.com/RedisAI/VectorSimilarity/releases/tag/v0.7.0"> 0.7.0 </a> ] </p> </li> <li> <p> <a href="https://github.com/RediSearch/RediSearch/pull/3657"> #3657 </a> - Allow GC calls for all tiered indexes in the schema </p> </li> <li> <p> <a href="https://github.com/RediSearch/RediSearch/pull/3701"> #3701 </a> - HNSW is now using data blocks to store vectors and metadata instead of array </p> </li> </ul> <p> Changed behavior: </p> <ul> <li> <a href="https://github.com/RediSearch/RediSearch/pull/3355"> #3355 </a> , <a href="https://github.com/RediSearch/RediSearch/pull/3635"> #3635 </a> Expired keys deleted from replica's index, returning an empty array instead of <code> nil </code> (MOD-4739) </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> <p> The version inside Redis will be 2.8.4 in semantic versioning. Since the version of a module in Redis is numeric, we could not add a GA flag. </p> </li> <li> <p> Minimal Redis version: 7.2 </p> </li> <li> <p> If indexing and querying RedisJSON data structures, this version is best combined with RedisJSON 2.6 (v2.6.0 onwards). </p> </li> </ul> </div> </div> <form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback"> <input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redisearch/redisearch-2.8-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/rc/security/shared-responsibility-model/.html
<section class="prose w-full py-12 max-w-none"> <h1> Redis Cloud shared responsibility model </h1> <p> The security of all Redis Cloud deployments is a shared responsibility. Redis, the public cloud providers (Amazon Web Services [AWS], Google Cloud, and Microsoft Azure), and our customers all help ensure the security of these deployments. </p> <h2 id="redis-responsibility"> Redis responsibility </h2> <p> Redis Cloud's offerings are managed by Redis and deployed on AWS, Azure, and Google Cloud infrastructure. </p> <p> Redis is responsible for the software that runs Redis Cloud. This includes the patching and maintenance of the operating systems that Redis is deployed on as well as the patching and maintenance of Redis Cloud. </p> <h2 id="cloud-provider-responsibility"> Cloud provider responsibility </h2> <p> The public cloud provider hosting your Redis Cloud databases is responsible for the physical security of their data centers and the security of the network, storage, servers, and virtualization that form the core infrastructure of your deployment. </p> <p> Amazon, Microsoft, and Google public clouds embrace a wide range of security best practices and compliance standards. Compliance informationβ€”including audits, attestations, and certifications about resources hostedβ€”can be found on these compliance pages: </p> <ul> <li> <a href="https://aws.amazon.com/compliance/"> AWS Compliance </a> </li> <li> <a href="https://cloud.google.com/security/compliance"> Google Cloud Compliance </a> </li> <li> <a href="https://azure.microsoft.com/en-us/overview/trusted-cloud/compliance/"> Azure Compliance </a> </li> </ul> <h2 id="customer-responsibility"> Customer responsibility </h2> <p> Customers are responsible for the security configurations in their Redis databases and the Redis Cloud console. Customers must understand and implement the Redis Cloud security features and best practices. </p> <p> Customers are also responsible for the applications built on Redis and the data they store in Redis. Customers determine the cloud provider, region, and availability zone of their deployments. </p> <p> Customers understand that Redis Cloud Essentials plans are deployed to a multi-tenant infrastructure. Redis Cloud Pro plans are deployed to a single-tenant infrastructure dedicated to one specific customer. </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/security/shared-responsibility-model/"/> <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.debug-help.html
<section class="prose w-full py-12"> <h1 class="command-name"> JSON.DEBUG HELP </h1> <div class="font-semibold text-redis-ink-900"> Syntax </div> <pre class="command-syntax">JSON.DEBUG HELP</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"> N/A </dd> </dl> <p> Return helpful information about the <a href="/docs/latest/commands/json.debug/"> <code> JSON.DEBUG </code> </a> command </p> <h2 id="return"> Return </h2> <p> JSON.DEBUG HELP returns an array with helpful messages. </p> <h2 id="see-also"> See also </h2> <p> <a href="/docs/latest/commands/json.debug/"> <code> JSON.DEBUG </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.debug-help/"/> <div class="flex flex-row justify-between"> <div class="grid justify-center"> <span class="font-mono"> RATE THIS PAGE </span> <div class="star-rating"> <input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/> <label class="star" for="5-stars"> β˜… </label> <input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/> <label class="star" for="4-stars"> β˜… </label> <input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/> <label class="star" for="3-stars"> β˜… </label> <input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/> <label class="star" for="2-stars"> β˜… </label> <input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/> <label class="star" for="1-stars"> β˜… </label> </div> </div> <a class="font-mono no-underline" href="#"> Back to top ↑ </a> </div> <div class="hidden" id="feedback-form"> <div class="grid gap-2"> <textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea> <button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit"> Submit </button> </div> </div> </form> <script> document.addEventListener("DOMContentLoaded", function() { const form = document.querySelector("#page-feedback"); form.addEventListener("submit", function(event) { event.preventDefault(); var xhr = new XMLHttpRequest(); var url = "\/docusight\/api\/rate"; var params = new URLSearchParams(new FormData(form)); xhr.open("POST", url, true); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.onreadystatechange = function() { if (xhr.readyState === 4 && xhr.status === 200) { const responseData = JSON.parse(xhr.responseText); const responseMessage = responseData.response; const newText = document.createTextNode(responseMessage); form.parentNode.replaceChild(newText, form); } }; xhr.send(params); }); }); </script> </section>
https://redis.io/docs/latest/operate/redisinsight/install/install-on-aws/.html
<section class="prose w-full py-12 max-w-none"> <h1> Install on AWS EC2 </h1> <p class="text-lg -mt-5 mb-10"> How to install Redis Insight on AWS EC2 </p> <p> This tutorial shows you how to install Redis Insight on an AWS EC2 instance and manage ElastiCache Redis instances using Redis Insight. To complete this tutorial you must have access to the AWS Console and permissions to launch EC2 instances. </p> <h2 id="step-1-launch-ec2-instance"> Step 1: Launch EC2 Instance </h2> <p> Next, launch an EC2 instance. </p> <ol> <li> Navigate to EC2 under AWS Console. </li> <li> Click Launch Instance. </li> <li> Choose 64-bit Amazon Linux AMI. </li> <li> Choose at least a t2.medium instance. The size of the instance depends on the memory used by your ElastiCache instance that you want to analyze. </li> <li> Under Configure Instance: <ul> <li> Choose the VPC that has your ElastiCache instances. </li> <li> Choose a subnet that has network access to your ElastiCache instances. </li> <li> Ensure that your EC2 instance has a public IP Address. </li> <li> Assign the IAM role that you created in Step 1. </li> </ul> </li> <li> Under the storage section, allocate at least 100 GiB storage. </li> <li> Under security group, ensure that: <ul> <li> Incoming traffic is allowed on port 5540 </li> <li> Incoming traffic is allowed on port 22 only during installation </li> </ul> </li> <li> Review and launch the ec2 instance. </li> </ol> <h2 id="step-2-verify-permissions-and-connectivity"> Step 2: Verify permissions and connectivity </h2> <p> Next, verify that the EC2 instance has the required IAM permissions and can connect to ElastiCache Redis instances. </p> <ol> <li> SSH into the newly launched EC2 instance. </li> <li> Open a command prompt. </li> <li> Run the command <code> aws s3 ls </code> . This should list all S3 buckets. <ol> <li> If the <code> aws </code> command cannot be found, make sure your EC2 instance is based of Amazon Linux. </li> </ol> </li> <li> Next, find the hostname of the ElastiCache instance you want to analyze and run the command <code> echo info | nc &lt;redis host&gt; 6379 </code> . </li> <li> If you see some details about the ElastiCache Redis instance, you can proceed to the next step. </li> <li> If you cannot connect to redis, you should review your VPC, subnet, and security group settings. </li> </ol> <h2 id="step-3-install-docker-on-ec2"> Step 3: Install Docker on EC2 </h2> <p> Next, install Docker on the EC2 instance. Run the following commands: </p> <ol> <li> <code> sudo yum update -y </code> </li> <li> <code> sudo yum install -y docker </code> </li> <li> <code> sudo service docker start </code> </li> <li> <code> sudo usermod -a -G docker ec2-user </code> </li> <li> Log out and log back in again to pick up the new docker group permissions. </li> <li> To verify, run <code> docker ps </code> . You should see some output without having to run <code> sudo </code> . </li> </ol> <h2 id="step-4-run-redis-insight-in-the-docker-container"> Step 4: Run Redis Insight in the Docker container </h2> <p> Finally, install Redis Insight using one of the options described below. </p> <ol> <li> If you do not want to persist your Redis Insight data: </li> </ol> <div class="highlight"> <pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">docker run -d --name redisinsight -p 5540:5540 redis/redisinsight:latest </span></span></code></pre> </div> <ol start="2"> <li> If you want to persist your Redis Insight data, first attach the Docker volume to the <code> /data </code> path and then run the following command: </li> </ol> <div class="highlight"> <pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">docker run -d --name redisinsight -p 5540:5540 redis/redisinsight:latest -v redisinsight:/data </span></span></code></pre> </div> <p> If the previous command returns a permission error, ensure that the user with <code> ID = 1000 </code> has the necessary permission to access the volume provided ( <code> redisinsight </code> in the command above). </p> <p> Find the IP Address of your EC2 instances and launch your browser at <code> http://&lt;EC2 IP Address&gt;:5540 </code> . Accept the EULA and start using Redis Insight. </p> <p> Redis Insight also provides a health check endpoint at <code> http://&lt;EC2 IP Address&gt;:5540/api/health/ </code> to monitor the health of the running container. </p> <h2 id="summary"> Summary </h2> <p> In this guide, we installed Redis Insight on an AWS EC2 instance running Docker. As a next step, you should add an ElastiCache Redis Instance and then run the memory analysis. </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/redisinsight/install/install-on-aws/"/> <div class="flex flex-row justify-between"> <div class="grid justify-center"> <span class="font-mono"> RATE THIS PAGE </span> <div class="star-rating"> <input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/> <label class="star" for="5-stars"> β˜… </label> <input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/> <label class="star" for="4-stars"> β˜… </label> <input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/> <label class="star" for="3-stars"> β˜… </label> <input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/> <label class="star" for="2-stars"> β˜… </label> <input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/> <label class="star" for="1-stars"> β˜… </label> </div> </div> <a class="font-mono no-underline" href="#"> Back to top ↑ </a> </div> <div class="hidden" id="feedback-form"> <div class="grid gap-2"> <textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea> <button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit"> Submit </button> </div> </div> </form> <script> document.addEventListener("DOMContentLoaded", function() { const form = document.querySelector("#page-feedback"); form.addEventListener("submit", function(event) { event.preventDefault(); var xhr = new XMLHttpRequest(); var url = "\/docusight\/api\/rate"; var params = new URLSearchParams(new FormData(form)); xhr.open("POST", url, true); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.onreadystatechange = function() { if (xhr.readyState === 4 && xhr.status === 200) { const responseData = JSON.parse(xhr.responseText); const responseMessage = responseData.response; const newText = document.createTextNode(responseMessage); form.parentNode.replaceChild(newText, form); } }; xhr.send(params); }); }); </script> </section>
https://redis.io/docs/latest/operate/rs/installing-upgrading/install/plan-deployment/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/installing-upgrading/install/plan-deployment/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/develop/connect/clients/nodejs/.html
<section class="prose w-full py-12 max-w-none"> <h1> node-redis guide (JavaScript) </h1> <p class="text-lg -mt-5 mb-10"> Connect your Node.js/JavaScript application to a Redis database </p> <p> <a href="https://github.com/redis/node-redis"> node-redis </a> is the Redis client for Node.js/JavaScript. The sections below explain how to install <code> node-redis </code> and connect your application to a Redis database. </p> <p> <code> node-redis </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> <p> You can also access Redis with an object-mapping client interface. See <a href="/docs/latest/integrate/redisom-for-node-js/"> RedisOM for Node.js </a> for more information. </p> <h2 id="install"> Install </h2> <p> To install node-redis, run: </p> <div class="highlight"> <pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">npm install redis </span></span></code></pre> </div> <h2 id="connect-and-test"> Connect and test </h2> <p> Connect to localhost on port 6379. </p> <div class="highlight"> <pre class="chroma"><code class="language-js" data-lang="js"><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></span><span class="line"><span class="cl"><span class="nx">client</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="s1">'error'</span><span class="p">,</span> <span class="nx">err</span> <span class="p">=&gt;</span> <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s1">'Redis Client Error'</span><span class="p">,</span> <span class="nx">err</span><span class="p">));</span> </span></span><span class="line"><span class="cl"> </span></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></code></pre> </div> <p> Store and retrieve a simple string. </p> <div class="highlight"> <pre class="chroma"><code class="language-js" data-lang="js"><span class="line"><span class="cl"><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">'key'</span><span class="p">,</span> <span class="s1">'value'</span><span class="p">);</span> </span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">value</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s1">'key'</span><span class="p">);</span> </span></span></code></pre> </div> <p> Store and retrieve a map. </p> <div class="highlight"> <pre class="chroma"><code class="language-js" data-lang="js"><span class="line"><span class="cl"><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">'user-session:123'</span><span class="p">,</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="nx">name</span><span class="o">:</span> <span class="s1">'John'</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nx">surname</span><span class="o">:</span> <span class="s1">'Smith'</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nx">company</span><span class="o">:</span> <span class="s1">'Redis'</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nx">age</span><span class="o">:</span> <span class="mi">29</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">let</span> <span class="nx">userSession</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">'user-session:123'</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">JSON</span><span class="p">.</span><span class="nx">stringify</span><span class="p">(</span><span class="nx">userSession</span><span class="p">,</span> <span class="kc">null</span><span class="p">,</span> <span class="mi">2</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"> "surname": "Smith", </span></span></span><span class="line"><span class="cl"><span class="cm"> "name": "John", </span></span></span><span class="line"><span class="cl"><span class="cm"> "company": "Redis", </span></span></span><span class="line"><span class="cl"><span class="cm"> "age": "29" </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></code></pre> </div> <p> To connect to a different host or port, use a connection string in the format <code> redis[s]://[[username][:password]@][host][:port][/db-number] </code> : </p> <div class="highlight"> <pre class="chroma"><code class="language-js" data-lang="js"><span class="line"><span class="cl"><span class="nx">createClient</span><span class="p">({</span> </span></span><span class="line"><span class="cl"> <span class="nx">url</span><span class="o">:</span> <span class="s1">'redis://alice:[email protected]:6380'</span> </span></span><span class="line"><span class="cl"><span class="p">});</span> </span></span></code></pre> </div> <p> To check if the client is connected and ready to send commands, use <code> client.isReady </code> , which returns a Boolean. <code> client.isOpen </code> is also available. This returns <code> true </code> when the client's underlying socket is open, and <code> false </code> when it isn't (for example, when the client is still connecting or reconnecting after a network error). </p> <h2 id="more-information"> More information </h2> <p> The <a href="https://redis.js.org/"> <code> node-redis </code> website </a> has more examples. The <a href="https://github.com/redis/node-redis"> Github repository </a> also has useful information, including a guide to the <a href="https://github.com/redis/node-redis/blob/master/docs/client-configuration.md"> connection configuration options </a> you can use. </p> <p> See also the other pages in this section for more information and examples: </p> <nav> <a href="/docs/latest/develop/clients/nodejs/connect/"> Connect to the server </a> <p> Connect your Node.js application to a Redis database </p> <a href="/docs/latest/develop/clients/nodejs/produsage/"> Production usage </a> <p> Get your Node.js 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/nodejs/"/> <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/.html
<section class="prose w-full py-12 max-w-none"> <h1> Manage clusters </h1> <p class="text-lg -mt-5 mb-10"> Administrative tasks and information related to the Redis Enterprise cluster. </p> <p> You can manage your Redis Enterprise Software clusters with several different tools: </p> <ul> <li> Cluster Manager UI (the web-based user interface) </li> <li> Command-line tools ( <a href="/docs/latest/operate/rs/references/cli-utilities/rladmin/"> rladmin </a> , <a href="/docs/latest/develop/tools/cli/"> redis-cli </a> , <a href="/docs/latest/operate/rs/references/cli-utilities/crdb-cli/"> crdb-cli </a> ) </li> <li> <a href="/docs/latest/operate/rs/references/rest-api/"> REST API </a> </li> </ul> <nav> <a href="/docs/latest/operate/rs/clusters/new-cluster-setup/"> Set up a new cluster </a> <p> How to set up a new cluster using the management UI. </p> <a href="/docs/latest/operate/rs/clusters/add-node/"> Add a node </a> <p> Add a node to your existing Redis Enterprise cluster. </p> <a href="/docs/latest/operate/rs/clusters/configure/"> Configure clusters </a> <p> Configuration options for your Redis Enterprise cluster. </p> <a href="/docs/latest/operate/rs/clusters/optimize/"> Optimize clusters </a> <p> Configuration changes and information you can use to optimize your performance and memory usage. </p> <a href="/docs/latest/operate/rs/clusters/maintenance-mode/"> Maintenance mode for cluster nodes </a> <p> Prepare a cluster node for maintenance. </p> <a href="/docs/latest/operate/rs/clusters/change-node-role/"> Change node roles </a> <p> Change node roles to demote the primary node to a secondary node or promote a secondary node to become the primary node. </p> <a href="/docs/latest/operate/rs/clusters/cluster-recovery/"> Recover a failed cluster </a> <p> How to use the cluster configuration file and database data to recover a failed cluster. </p> <a href="/docs/latest/operate/rs/clusters/remove-node/"> Remove a node </a> <p> Remove a node from your Redis Enterprise cluster. </p> <a href="/docs/latest/operate/rs/clusters/replace-node/"> Replace a cluster node </a> <p> Replace a node in your cluster that is down. </p> <a href="/docs/latest/operate/rs/clusters/logging/"> Logging events </a> <p> Management actions performed with Redis Enterprise are logged to make sure system management tasks are appropriately performed or monitored by administrators and for compliance with regulatory standards. </p> <a href="/docs/latest/operate/rs/clusters/monitoring/"> Monitoring with metrics and alerts </a> <p> Use the metrics that measure the performance of your Redis Enterprise Software clusters, nodes, databases, and shards to track the performance of your databases. </p> </nav> <form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback"> <input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/clusters/"/> <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.14.0/.html
<section class="prose w-full py-12"> <h1> RedisInsight v2.14.0, November 2022 </h1> <p class="text-lg -mt-5 mb-10"> RedisInsight v2.14.0 </p> <h2 id="2140-november-2022"> 2.14.0 (November 2022) </h2> <p> This is the General Availability (GA) release of RedisInsight 2.14. </p> <h3 id="highlights"> Highlights </h3> <ul> <li> Support for <a href="https://redis.io/docs/stack/search/"> search capabilities </a> in Browser: Create secondary index via dedicated form, run queries and full-text search in Browser or Tree views </li> <li> Ability to resize the column width of key values when displaying hashes, lists, and sorted sets </li> <li> Command processing time displayed as part of the result 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/1345"> #1345 </a> , <a href="https://github.com/RedisInsight/RedisInsight/pull/1346"> #1346 </a> , <a href="https://github.com/RedisInsight/RedisInsight/pull/1376"> #1376 </a> Added support for <a href="https://redis.io/docs/stack/search/"> search capabilities </a> in Browser tool. Create secondary index of your data using a dedicated form. Conveniently run your queries and full-text search against the preselected index and display results in Browser or Tree views. </li> <li> <a href="https://github.com/RedisInsight/RedisInsight/pull/1385"> #1385 </a> Resize the column width of key values when displaying hashes, lists, and sorted sets </li> <li> <a href="https://github.com/RedisInsight/RedisInsight/pull/1407"> #1354 </a> Do not scroll to the end of results when double-clicking a command output in CLI </li> <li> <a href="https://github.com/RedisInsight/RedisInsight/pull/1347"> #1347 </a> Display command processing time as part of the result in Workbench (time taken to process the command by both RedisInsight backend and Redis) </li> <li> <a href="https://github.com/RedisInsight/RedisInsight/pull/1351"> #1351 </a> Display the namespaces section in the Database analysis report when no namespaces were found </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.14.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/rs/release-notes/legacy-release-notes/rlec-4-2-october-2015/.html
<section class="prose w-full py-12 max-w-none"> <h1> RLEC 4.2.1-30 Release Notes (October 18, 2015) </h1> <p> If you are upgrading from a previous version, make sure to review the <a href="/docs/latest/operate/rs/installing-upgrading/upgrading/"> upgrade instructions </a> before running through the upgrade process. </p> <h2 id="new-features"> New features </h2> <ul> <li> rsyslog logging support - RLEC now writes by default to syslog, which enables monitoring through rsyslog. </li> <li> Profile support for tuning cloud and non-cloud environments -- enables the administrator to configure RLEC to run with different performance profiles that are optimized for either cloud or non-cloud environments. For additional details, refer to the <a href="/docs/latest/operate/rs/clusters/optimize/optimization/"> Performance optimization </a> section. </li> <li> SLA for AOF rewrite - enables the administrator to configure database parameters, by running the rladmin tune command, related to when AOF rewrite is triggered based on the time it would take to load the database from the AOF file, and on the maximum AOF rewrite file size. In addition, updates to the AOF rewrite mechanism minimize chances of the disk getting full. </li> <li> New warning and alerts related to AOF rewrite mechanism - a warning is shown during the setup process in case the disk size is lower than twice the size of the RAM. New cluster level alerts added to alert when node available disk space is lower than the needed disk space for AOF rewrite purposes, and when node performance is degraded due to reaching disk I/O limits. </li> <li> Replica Of support for multiple sources - the Replica Of feature is enhanced to support creating a database that is a replica of multiple source databases. For additional details, refer to the Replica Of section. </li> <li> Cross cluster Replica Of - the Replica Of feature now supports defining a database that is a replica of databases that belong to a different RLEC cluster. For additional details, refer to the Replica Of section. </li> <li> Multi-IP support - on a node that has multiple IPs, enables the administrator to specify which IP address is used for internal traffic and which IP addresses are used for external traffic. For additional details, refer to <a href="/docs/latest/operate/rs/networking/multi-ip-ipv6/"> Multi-IP &amp; IPv6 </a> support. </li> <li> IPv6 support for external traffic - on a node that has multiple IPs, external IP addresses can be of IPv6 type. For additional details, refer to <a href="/docs/latest/operate/rs/networking/multi-ip-ipv6/"> Multi-IP &amp; IPv6 </a> support section. </li> <li> Support for OpenStack Object Store ("Swift") location for import / export / backup. For additional details, refer to <a href="/docs/latest/operate/rs/databases/import-export/schedule-backups/"> Database backup </a> and <a href="/docs/latest/operate/rs/databases/import-export/import-data/"> Importing data to a database </a> sections. </li> <li> Import of a sharded database - support for importing data of a sharded database by indicating multiple files paths. For additional details, refer to the <a href="/docs/latest/operate/rs/databases/import-export/import-data/"> Importing data to a database </a> section. </li> <li> Enable running the install script in silent mode using "-y" parameter for default answers ("Y") or "-c" for file path parameters for custom answers. For additional details, refer to <a href="/docs/latest/operate/rs/installing-upgrading/"> Accessing and installing the setup package </a> section. </li> <li> New rladmin command-line-interface "info" command allows for fetching current value of tunable parameters. </li> </ul> <h2 id="changes"> Changes </h2> <ul> <li> rladmin command-line-interface can only be run under user root or redislabs. For additional details, refer to the <a href="https://docs.redis.com/latest/rs/references/rladmin/"> rladmin command-line interface (CLI) </a> section. </li> <li> Import / export / backup to/from Amazon S3 requires supplying the credentials per usage instance; it does not use central cloud credentials that used to be supplied in the Settings -&gt; General page. </li> <li> Fields related to storing Amazon S3 Cloud credentials have been removed from Settings -&gt; General page. </li> <li> Performance optimization in the database resharding mechanism. </li> <li> Persistent and ephemeral storage cluster level alerts are enabled by default and set to 70%. </li> <li> Various enhancements to rladmin command-line-interface (CLI) to support new commands. </li> <li> Redis version updated to 2.8.21 that addresses <a href="https://groups.google.com/forum/#!msg/redis-db/4Y6OqK8gEyk/Dg-5cejl-eUJ"> CVE-2015-4335/DSA-3279 - Redis Lua Sandbox Escape </a> . </li> <li> Port 3336 added to the list of ports being used by RLEC. </li> <li> Node "Network utilization" alert measured in percentages (%) has been updated to "Network throughput" alert measured in MBps. If the alert was defined then it will be disabled when upgrading to this version and the user needs to reconfigure it with a new value. </li> <li> Performance improvements to the database Import to make the process much faster. </li> <li> Enhancements to the support package to include additional details. </li> <li> Removed support for SSL 2.0/3.0 protocols due to security vulnerabilities. </li> <li> Disabled "dofile" functionality in Redis to solve a possible security vulnerability. </li> <li> rladmin CLI "tune watchdog profile" command syntax updated to "tune cluster watchdog_profile". </li> </ul> <h2 id="fixed-issues"> Fixed issues </h2> <ul> <li> Support for relative path for backup and import functionalities. </li> <li> Fix issue with TLS configuration of email server settings. </li> <li> Email alerts not sent for database export and import processes. </li> <li> Fix erroneous entries in the Log page. </li> <li> Sometimes a wrong value is reported in the UI for node used ephemeral storage space. </li> <li> Sometime the wrong Replica Of Lag value is reported in the UI. </li> <li> RLEC-6875 - email server settings not working when using port 587. </li> <li> RLEC-5498 - Improve rladmin response time when a node is down. </li> <li> Validation of Replica Of source definition did not fail in the UI and would only fail in runtime if it was using the Cluster Name (FQDN) and the FQDN was not properly configured in the DNS. </li> <li> Various improvements to error messages reported by rladmin. </li> </ul> <h2 id="known-issues"> Known issues </h2> <ul> <li> <p> <strong> Issue </strong> : Connecting from a client to a database endpoint with mixed upper case and lower case letters can result in a slow response from the database. </p> <p> <strong> Workaround </strong> : The cluster name (FQDN) should consist of only lower-case letters. When connecting from a client to a database endpoint, only lower case letters should be used in the endpoint. </p> </li> <li> <p> <strong> Issue </strong> : When upgrading a node to a new RLEC version (refer to <a href="/docs/latest/operate/rs/installing-upgrading/upgrading/"> Upgrading nodes </a> while the node is in the offline state (refer to <a href="/docs/latest/operate/rs/clusters/remove-node/"> Taking a node offline </a> , the upgrade process succeeds but might result in an unstable cluster. </p> <p> <strong> Workaround </strong> : Do not try to upgrade a node while it is in the offline state. </p> </li> <li> <p> <strong> Issue </strong> : In Red Hat Enterprise Linux, and CentOS operating systems, the process used for cleaning up internal log files does not work, thereby allowing the log files to grow and possibly result in disk space issues. </p> <p> <strong> Workaround </strong> : On each machine that functions as a node in the cluster, create a file named "redislabs", and save it in the following location: "/etc/logrotate.d/" (e.g. "/etc/logrotate.d/redislabs"). The file should contain the following text: </p> <pre tabindex="0"><code>/var/opt/redislabs/log/\*.log { daily missingok copytruncate rotate 7 compress notifempty } </code></pre> <p> The file's permissions should be root:root, 644. Afterwards, from the operating system command line interface (CLI) run the following commands: </p> <pre tabindex="0"><code>yum install policycoreutils-python semanage fcontext -a -t var_log_t '/var/opt/redislabs/log(/.\*)?' restsorecon -R /var/opt/redislabs/log </code></pre> </li> <li> <p> <strong> Issue </strong> : In the Replica Of process, if the target database does not have replication enabled and it is restarted or fails for any reason, the data on target database might not be in sync with the source database, although the status of the Replica Of process indicates it is. </p> <p> <strong> Workaround </strong> : You need to manually stop and restart the synchronization process in order to ensure the databases are in sync. </p> </li> <li> <p> <strong> Issue </strong> : In the Replica Of process, if the source database is resharded while the replica of process is active, the synchronization process will fail. </p> <p> <strong> Workaround </strong> : You need to manually stop and restart the synchronization process after resharding of the source database is done. </p> </li> <li> <p> <strong> Issue </strong> : In the replica of process, high database traffic might restart the Replica of process as result of the "replica buffer" being exceeded. In this case you see the status of the replica of process as "Syncing" frequently. </p> <p> <strong> Workaround </strong> : You need to manually reconfigure the "replica buffer" through rladmin and set the buffer size to a new size. In order to find the appropriate buffer size please contact support at: <a href="mailto:[email protected]"> [email protected] </a> . </p> </li> <li> <p> <strong> Issue </strong> : In a cluster that is configured to support rack-zone awareness, if the user forces migration of a master or replica shard, through rladmin, to a node on the same rack-zone as its corresponding master or replica shard, and later runs the rebalance process, the rebalance process will not migrate the shards to ensure rack-zone awareness compliance. </p> <p> <strong> Workaround </strong> : In the scenario described above, you need to manually migrate the shard, through rladmin, to a node on a valid rack-zone in order to ensure rack-zone awareness compliance. </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/legacy-release-notes/rlec-4-2-october-2015/"/> <div class="flex flex-row justify-between"> <div class="grid justify-center"> <span class="font-mono"> RATE THIS PAGE </span> <div class="star-rating"> <input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/> <label class="star" for="5-stars"> β˜… </label> <input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/> <label class="star" for="4-stars"> β˜… </label> <input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/> <label class="star" for="3-stars"> β˜… </label> <input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/> <label class="star" for="2-stars"> β˜… </label> <input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/> <label class="star" for="1-stars"> β˜… </label> </div> </div> <a class="font-mono no-underline" href="#"> Back to top ↑ </a> </div> <div class="hidden" id="feedback-form"> <div class="grid gap-2"> <textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea> <button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit"> Submit </button> </div> </div> </form> <script> document.addEventListener("DOMContentLoaded", function() { const form = document.querySelector("#page-feedback"); form.addEventListener("submit", function(event) { event.preventDefault(); var xhr = new XMLHttpRequest(); var url = "\/docusight\/api\/rate"; var params = new URLSearchParams(new FormData(form)); xhr.open("POST", url, true); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.onreadystatechange = function() { if (xhr.readyState === 4 && xhr.status === 200) { const responseData = JSON.parse(xhr.responseText); const responseMessage = responseData.response; const newText = document.createTextNode(responseMessage); form.parentNode.replaceChild(newText, form); } }; xhr.send(params); }); }); </script> </section>
https://redis.io/docs/latest/operate/rs/7.4/references/rest-api/requests/nodes/actions/.html
<section class="prose w-full py-12 max-w-none"> <h1> Node actions requests </h1> <p class="text-lg -mt-5 mb-10"> Node action requests </p> <table> <thead> <tr> <th> Method </th> <th> Path </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> <a href="#get-all-nodes-actions"> GET </a> </td> <td> <code> /v1/nodes/actions </code> </td> <td> Get status of all actions on all nodes </td> </tr> <tr> <td> <a href="#get-node-actions"> GET </a> </td> <td> <code> /v1/nodes/{node_uid}/actions </code> </td> <td> Get status of all actions on a specific node </td> </tr> <tr> <td> <a href="#get-node-action"> GET </a> </td> <td> <code> /v1/nodes/{node_uid}/actions/{action} </code> </td> <td> Get status of an action on a specific node </td> </tr> <tr> <td> <a href="#post-node-action"> POST </a> </td> <td> <code> /v1/nodes/{node_uid}/actions/{action} </code> </td> <td> Initiate node action </td> </tr> <tr> <td> <a href="#delete-node-action"> DELETE </a> </td> <td> <code> /v1/nodes/{node_uid}/actions/{action} </code> </td> <td> Cancel action or remove action status </td> </tr> </tbody> </table> <h2 id="get-all-nodes-actions"> Get all actions </h2> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">GET /v1/nodes/actions </span></span></code></pre> </div> <p> Get the status of all currently executing, pending, or completed actions on all nodes. </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_status_of_all_node_actions"> view_status_of_all_node_actions </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 /nodes/actions </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> <h3 id="get-all-response"> Response </h3> <p> Returns a list of <a href="/docs/latest/operate/rs/7.4/references/rest-api/objects/action/"> action objects </a> . </p> <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, response provides details about an ongoing action. </td> </tr> </tbody> </table> <h2 id="get-node-actions"> Get node actions statuses </h2> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">GET /v1/nodes/<span class="o">{</span>node_uid<span class="o">}</span>/actions </span></span></code></pre> </div> <p> Get the status of all actions on a specific node. </p> <h4 id="required-permissions"> Required permissions </h4> <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_status_of_node_action"> view_status_of_node_action </a> </td> <td> admin <br/> cluster_member <br/> cluster_viewer <br/> db_member <br/> db_viewer </td> </tr> </tbody> </table> <h3 id="get-request-all-actions"> 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 /nodes/1/actions </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="url-parameters"> URL parameters </h4> <table> <thead> <tr> <th> Field </th> <th> Type </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> action </td> <td> string </td> <td> The action to check. </td> </tr> </tbody> </table> <h3 id="get-response-all-actions"> Response </h3> <p> Returns a JSON object that includes a list of <a href="/docs/latest/operate/rs/7.4/references/rest-api/objects/action/"> action objects </a> for the specified node. </p> <p> If no actions are available, the response will include an empty array. </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">"actions"</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">"name"</span><span class="p">:</span> <span class="s2">"remove_node"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"node_uid"</span><span class="p">:</span> <span class="s2">"1"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"status"</span><span class="p">:</span> <span class="s2">"running"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"progress"</span><span class="p">:</span> <span class="mi">10</span> </span></span><span class="line"><span class="cl"> <span class="p">}</span> </span></span><span class="line"><span class="cl"> <span class="p">]</span> </span></span><span class="line"><span class="cl"><span class="p">}</span> </span></span></code></pre> </div> <h3 id="get-error-codes-all-actions"> Error codes </h3> <table> <thead> <tr> <th> Code </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> internal_error </td> <td> An internal error that cannot be mapped to a more precise error code has been encountered. </td> </tr> <tr> <td> insufficient_resources </td> <td> The cluster does not have sufficient resources to complete the required operation. </td> </tr> </tbody> </table> <h3 id="get-status-codes-all-actions"> 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, response provides details about an ongoing action. </td> </tr> <tr> <td> <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5"> 404Β NotΒ Found </a> </td> <td> Action does not exist (i.e. not currently running and no available status of last run). </td> </tr> </tbody> </table> <h2 id="get-node-action"> Get node action status </h2> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">GET /v1/nodes/<span class="o">{</span>node_uid<span class="o">}</span>/actions/<span class="o">{</span>action<span class="o">}</span> </span></span></code></pre> </div> <p> Get the status of a currently executing, queued, or completed action on a specific node. </p> <h3 id="get-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">GET /nodes/1/actions/remove </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-response"> Response </h3> <p> Returns an <a href="/docs/latest/operate/rs/7.4/references/rest-api/objects/action/"> action object </a> for the specified node. </p> <h3 id="get-error-codes"> Error codes </h3> <table> <thead> <tr> <th> Code </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> internal_error </td> <td> An internal error that cannot be mapped to a more precise error code has been encountered. </td> </tr> <tr> <td> insufficient_resources </td> <td> The cluster does not have sufficient resources to complete the required operation. </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> No error, response provides details about an ongoing action. </td> </tr> <tr> <td> <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5"> 404 Not Found </a> </td> <td> Action does not exist (i.e. not currently running and no available status of last run). </td> </tr> </tbody> </table> <h2 id="post-node-action"> Initiate node action </h2> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">POST /v1/nodes/<span class="o">{</span>node_uid<span class="o">}</span>/actions/<span class="o">{</span>action<span class="o">}</span> </span></span></code></pre> </div> <p> Initiate a node action. </p> <p> The API allows only a single instance of any action type to be invoked at the same time, and violations of this requirement will result in a <code> 409 CONFLICT </code> response. </p> <p> The caller is expected to query and process the results of the previously executed instance of the same action, which will be removed as soon as the new one is submitted. </p> <h4 id="permissions-1"> Permissions </h4> <table> <thead> <tr> <th> Permission name </th> <th> Roles </th> </tr> </thead> <tbody> <tr> <td> <a href="/docs/latest/operate/rs/7.4/references/rest-api/permissions/#start_node_action"> start_node_action </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 /nodes/1/actions/remove </span></span></code></pre> </div> <h4 id="headers-1"> Headers </h4> <table> <thead> <tr> <th> Key </th> <th> Value </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> Host </td> <td> cnm.cluster.fqdn </td> <td> Domain name </td> </tr> <tr> <td> Accept </td> <td> application/json </td> <td> Accepted media type </td> </tr> </tbody> </table> <h4 id="url-parameters-1"> URL parameters </h4> <table> <thead> <tr> <th> Field </th> <th> Type </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> action </td> <td> string </td> <td> The name of the action required. </td> </tr> </tbody> </table> <p> Currently supported actions are: </p> <ul> <li> <p> <code> remove </code> : Removes the node from the cluster after migrating all bound resources to other nodes. As soon as a successful remove request is received, the cluster will no longer automatically migrate resources, such as shards and endpoints, to the node even if the remove task fails at some point. </p> <ul> <li> <p> By default, the remove node action completes after all resources migrate off the removed node. Node removal does not wait for migrated shards' persistence files to be created on the new nodes. </p> <p> To change node removal to wait for the creation of new persistence files for all migrated shards, set <code> wait_for_persistence </code> to <code> true </code> in the request body or <a href="/docs/latest/operate/rs/7.4/references/rest-api/requests/cluster/policy/#put-cluster-policy"> update the cluster policy </a> <code> persistent_node_removal </code> to <code> true </code> to change the cluster's default behavior. </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">POST /v1/nodes/&lt;node_id&gt;/actions/remove </span></span><span class="line"><span class="cl"><span class="o">{</span> </span></span><span class="line"><span class="cl"> <span class="s2">"wait_for_persistence"</span>: <span class="nb">true</span> </span></span><span class="line"><span class="cl"><span class="o">}</span> </span></span></code></pre> </div> </li> </ul> </li> <li> <p> <code> maintenance_on </code> : Creates a snapshot of the node, migrates shards to other nodes, and prepares the node for maintenance. See <a href="/docs/latest/operate/rs/7.4/clusters/maintenance-mode/"> maintenance mode </a> for more information. </p> <ul> <li> <p> As of Redis Enterprise Software version 7.4.2, a new node snapshot is created only if no maintenance mode snapshots already exist or if you set <code> "overwrite_snapshot": true </code> in the request body. </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">POST /v1/nodes/1/actions/maintenance_on </span></span><span class="line"><span class="cl"><span class="o">{</span> </span></span><span class="line"><span class="cl"> <span class="s2">"overwrite_snapshot"</span>: <span class="nb">true</span> </span></span><span class="line"><span class="cl"><span class="o">}</span> </span></span></code></pre> </div> </li> <li> <p> If there aren't enough resources to migrate shards out of the maintained node, set <code> "evict_ha_replica": false </code> and <code> "evict_active_active_replica": false </code> in the request body to keep the replica shards in place but demote any master shards. Use these two parameters instead of <code> keep_slave_shards </code> , which is deprecated as of Redis Enterprise Software version 7.4.2. </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">POST /v1/nodes/1/actions/maintenance_on </span></span><span class="line"><span class="cl"><span class="o">{</span> </span></span><span class="line"><span class="cl"> <span class="s2">"overwrite_snapshot"</span>: true, </span></span><span class="line"><span class="cl"> <span class="s2">"evict_ha_replica"</span>: false, </span></span><span class="line"><span class="cl"> <span class="s2">"evict_active_active_replica"</span>: <span class="nb">false</span> </span></span><span class="line"><span class="cl"><span class="o">}</span> </span></span></code></pre> </div> </li> <li> <p> To specify databases whose shards should be evicted from the node when entering maintenance mode, set <code> "evict_dbs": ["List of database ID strings"] </code> in the request body. </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">POST /v1/nodes/1/actions/maintenance_on </span></span><span class="line"><span class="cl"><span class="o">{</span> </span></span><span class="line"><span class="cl"> <span class="s2">"overwrite_snapshot"</span>: true, </span></span><span class="line"><span class="cl"> <span class="s2">"evict_dbs"</span>: <span class="o">[</span><span class="s2">"1"</span>, <span class="s2">"3"</span><span class="o">]</span> </span></span><span class="line"><span class="cl"><span class="o">}</span> </span></span></code></pre> </div> </li> </ul> </li> <li> <p> <code> maintenance_off </code> : Restores node to its previous state before maintenance started. See <a href="/docs/latest/operate/rs/7.4/clusters/maintenance-mode/"> maintenance mode </a> for more information. </p> <ul> <li> <p> By default, it uses the latest node snapshot. </p> </li> <li> <p> Use <code> "snapshot_name": </code> <code> "..." </code> in the request body to restore the state from a specific snapshot. </p> </li> <li> <p> To avoid restoring shards at the node, use <code> "skip_shards_restore": </code> <code> true </code> . </p> </li> </ul> </li> <li> <p> <code> enslave_node </code> : Turn node into a replica. </p> </li> </ul> <h3 id="post-response"> Response </h3> <p> The body content may provide additional action details. </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> Action initiated successfully. </td> </tr> <tr> <td> <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.10"> 409 Conflict </a> </td> <td> Only a single instance of any action type can be invoked at the same time. </td> </tr> </tbody> </table> <h3 id="example-requests"> Example requests </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 -X POST -u <span class="s2">"[username]:[password]"</span> -d <span class="s2">"{}"</span> </span></span><span class="line"><span class="cl"> https://<span class="o">[</span>host<span class="o">][</span>:port<span class="o">]</span>/v1/nodes/1/actions/remove </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/nodes/1/actions/remove"</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="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 class="p">,</span> </span></span><span class="line"><span class="cl"><span class="p">}</span> </span></span><span class="line"><span class="cl"><span class="n">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 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">data</span><span class="o">=</span><span class="n">payload</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-node-action"> Cancel action </h2> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">DELETE /v1/nodes/<span class="o">{</span>node_uid<span class="o">}</span>/actions/<span class="o">{</span>action<span class="o">}</span> </span></span></code></pre> </div> <p> Cancel a queued or executing node action, or remove the status of a previously executed and completed action. </p> <h3 id="permissions-2"> Permissions </h3> <table> <thead> <tr> <th> Permission name </th> </tr> </thead> <tbody> <tr> <td> <a href="/docs/latest/operate/rs/7.4/references/rest-api/permissions/#cancel_node_action"> cancel_node_action </a> </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 /nodes/1/actions/remove </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="url-parameters-2"> URL parameters </h4> <table> <thead> <tr> <th> Field </th> <th> Type </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> action </td> <td> string </td> <td> The name of the action to cancel. </td> </tr> </tbody> </table> <h3 id="delete-response"> Response </h3> <p> Returns a status code. </p> <h4 id="delete-status-codes"> Status codes </h4> <table> <thead> <tr> <th> Code </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1"> 200 OK </a> </td> <td> Action will be cancelled when possible. </td> </tr> <tr> <td> <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5"> 404 Not Found </a> </td> <td> Action unknown or not currently running. </td> </tr> </tbody> </table> <form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback"> <input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/7.4/references/rest-api/requests/nodes/actions/"/> <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/debuginfo/all/.html
<section class="prose w-full py-12 max-w-none"> <h1> All nodes debug info requests </h1> <p class="text-lg -mt-5 mb-10"> Documents the Redis Enterprise Software REST API debuginfo/all requests. </p> <div class="banner-article rounded-md" style="background-color: "> <p> This REST API path is deprecated as of Redis Enterprise Software version 7.4.2. Use the new path <a href="/docs/latest/operate/rs/7.4/references/rest-api/requests/cluster/debuginfo/"> <code> /v1/cluster/debuginfo </code> </a> instead. </p> </div> <table> <thead> <tr> <th> Method </th> <th> Path </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> <a href="#get-all-debuginfo"> GET </a> </td> <td> <code> /v1/debuginfo/all </code> </td> <td> Get debug info for all nodes </td> </tr> </tbody> </table> <h2 id="get-all-debuginfo"> Get debug info for all nodes </h2> <pre><code>GET /v1/debuginfo/all </code></pre> <p> Downloads a tar file that contains debug info from all nodes. </p> <h4 id="required-permissions"> Required permissions </h4> <table> <thead> <tr> <th> Permission name </th> </tr> </thead> <tbody> <tr> <td> <a href="/docs/latest/operate/rs/7.4/references/rest-api/permissions/#view_debugging_info"> view_debugging_info </a> </td> </tr> </tbody> </table> <h3 id="get-all-request"> Request </h3> <h4 id="example-http-request"> Example HTTP request </h4> <pre><code>GET /debuginfo/all </code></pre> <h3 id="get-all-response"> Response </h3> <p> Downloads the debug info in a tar file called <code> filename.tar.gz </code> . Extract the files from the tar file to access the debug info for all nodes. </p> <h4 id="response-headers"> Response headers </h4> <table> <thead> <tr> <th> Key </th> <th> Value </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> Content-Type </td> <td> application/x-gzip </td> <td> Media type of request/response body </td> </tr> <tr> <td> Content-Length </td> <td> 653350 </td> <td> Length of the response body in octets </td> </tr> <tr> <td> Content-Disposition </td> <td> attachment; filename=debuginfo.tar.gz </td> <td> Display response in browser or download as attachment </td> </tr> </tbody> </table> <h3 id="get-all-status-codes"> Status codes </h3> <table> <thead> <tr> <th> Code </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1"> 200 OK </a> </td> <td> Success. </td> </tr> <tr> <td> <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.1"> 500 Internal Server Error </a> </td> <td> Failed to get debug info. </td> </tr> </tbody> </table> <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/debuginfo/all/"/> <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/upgrade/.html
<section class="prose w-full py-12 max-w-none"> <h1> Upgrade Redis Enterprise for Kubernetes </h1> <p class="text-lg -mt-5 mb-10"> Information about upgrading your Redis Enterprise cluster on Kubernetes. </p> <p> Redis implements rolling updates for software upgrades in Kubernetes deployments. The upgrade process includes updating three components: </p> <ol> <li> Upgrade the Redis Enterprise operator </li> <li> Upgrade the Redis Enterprise cluster (REC) </li> <li> Upgrade Redis Enterprise databases (REDB) </li> </ol> <p> To use OpenShift container platform CLI to upgrade your Redis Enterprise, see <a href="/docs/latest/operate/kubernetes/upgrade/openshift-cli/"> Upgrade Redis Enterprise with OpenShift CLI </a> . </p> <p> For all other Kubernetes distributions, see <a href="/docs/latest/operate/kubernetes/upgrade/upgrade-redis-cluster/"> Upgrade Redis Enterprise for Kubernetes </a> . </p> <h2 id="upgrade-compatibility"> Upgrade compatibility </h2> <p> When upgrading, both your Kubernetes version and Redis operator version need to be supported at all times. When upgrading your Kubernetes version, you need to make sure both the current and target K8s version are supported by your Redis operator version. When upgrading your Redis operator version, you need make sure both the current and target operator versions are supported by your K8s version. This means if you are planning a large jump in versions, the upgrade might need to be done in multiple steps. </p> <p> The flow chart below can help you decide if your upgrade requires multiple steps. </p> <a href="/docs/latest/images/k8s/upgrade-flowchart.jpg" sdata-lightbox="/images/k8s/upgrade-flowchart.jpg"> <img alt="Upgrade flowchart" src="/docs/latest/images/k8s/upgrade-flowchart.jpg"/> </a> <h2 id="how-does-the-rec-upgrade-work"> How does the REC upgrade work? </h2> <p> The Redis Enterprise cluster (REC) uses a rolling upgrade, meaning it upgrades pods one by one. Each pod is updated after the last one completes successfully. This helps keep your cluster available for use. </p> <p> To upgrade, the cluster terminates each pod and deploys a new pod based on the new image. Before each pod goes down, the operator checks if the pod is a primary (master) for the cluster, and if it hosts any primary (master) shards. If so, a replica on a different pod is promoted to primary. Then when the pod is terminated, the API remains available through the newly promoted primary pod. </p> <p> After a pod is updated, the next pod is terminated and updated. After all of the pods are updated, the upgrade process is complete. </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/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/oss_and_stack/stack-with-enterprise/deprecated-features/triggers-and-functions/concepts/function_flags/.html
<section class="prose w-full py-12 max-w-none"> <h1> Function flags </h1> <p class="text-lg -mt-5 mb-10"> Function flags for JavaScript functions </p> <div class="banner-article rounded-md"> <p> The Redis Stack triggers and functions feature preview has ended and it will not be promoted to GA. </p> </div> <p> When registering a function, it is possible to include additional information about its behavior. This information is known as function flags. Function flags are an optional argument that can be specified after the function implementation. The following flags are supported: </p> <ol> <li> <code> redis.functionFlags.NO_WRITES </code> : This flag indicates that the function does not perform any write commands. Enabling this flag allows a function to be executed on read-only replicas or in out-of-memory (OOM) situations. Redis enforces this flag's behavior, meaning that any attempt to call a write command within a function that has this flag set will result in an exception. </li> <li> <code> redis.functionFlags.ALLOW_OOM </code> : By default, Redis prevents any function from running in an OOM scenario. However, this flag allows overriding this behavior and running a function even when there is a memory shortage. Enabling this flag is considered unsafe and may cause Redis to exceed the <code> maxmemory </code> limit. <strong> Users should only enable this flag if they are certain that their function does not consume additional memory. </strong> For example, it is safe to run a function that only deletes data during an OOM situation. </li> <li> <code> redis.functionFlags.RAW_ARGUMENTS </code> : By default, Redis attempts to decode all function arguments as <code> JS </code> <code> String </code> s. If the decoding fails, an error is returned to the client. However, when this flag is set, Redis avoids string decoding and passes the argument as a <code> JS </code> <code> ArrayBuffer </code> instead. </li> </ol> <p> The following example shows how to set the <code> redis.functionFlags.NO_WRITES </code> flag: </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_ping'</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="kd">function</span><span class="p">(</span><span class="nx">client</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">'ping'</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> <span class="p">},</span> </span></span><span class="line"><span class="cl"> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="nx">flags</span><span class="o">:</span> <span class="p">[</span><span class="nx">redis</span><span class="p">.</span><span class="nx">functionFlags</span><span class="p">.</span><span class="nx">NO_WRITES</span><span class="p">]</span> </span></span><span class="line"><span class="cl"> <span class="p">}</span> </span></span><span class="line"><span class="cl"><span class="p">);</span> </span></span></code></pre> </div> <p> 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 lib.my_ping <span class="m">0</span> </span></span><span class="line"><span class="cl"><span class="s2">"PONG"</span> </span></span><span class="line"><span class="cl">127.0.0.1:6379&gt; config <span class="nb">set</span> maxmemory <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_ping <span class="m">0</span> </span></span><span class="line"><span class="cl"><span class="s2">"PONG"</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/function_flags/"/> <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/script/.html
<section class="prose w-full py-12"> <h1 class="command-name"> SCRIPT </h1> <div class="font-semibold text-redis-ink-900"> Syntax </div> <pre class="command-syntax">SCRIPT</pre> <dl class="grid grid-cols-[auto,1fr] gap-2 mb-12"> <dt class="font-semibold text-redis-ink-900 m-0"> Available since: </dt> <dd class="m-0"> 2.6.0 </dd> <dt class="font-semibold text-redis-ink-900 m-0"> Time complexity: </dt> <dd class="m-0"> Depends on subcommand. </dd> <dt class="font-semibold text-redis-ink-900 m-0"> ACL categories: </dt> <dd class="m-0"> <code> @slow </code> <span class="mr-1 last:hidden"> , </span> </dd> </dl> <p> This is a container command for script management commands. </p> <p> To see the list of available commands you can call <a href="/docs/latest/commands/script-help/"> <code> SCRIPT HELP </code> </a> . </p> <br/> <form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback"> <input class="hidden" name="origin" value="https://redis.io/docs/latest/commands/script/"/> <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/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/7.4/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/operate/oss_and_stack/reference/internals/internals-vm/.html
<section class="prose w-full py-12 max-w-none"> <h1> Virtual memory (deprecated) </h1> <p class="text-lg -mt-5 mb-10"> A description of the Redis virtual memory system that was deprecated in 2.6. This document exists for historical interest. </p> <p> <strong> Note: this document was written by the creator of Redis, Salvatore Sanfilippo, early in the development of Redis (c. 2010). Virtual Memory has been deprecated since Redis 2.6, so this documentation is here only for historical interest. </strong> </p> <p> This document details the internals of the Redis Virtual Memory subsystem prior to Redis 2.6. The intended audience is not the final user but programmers willing to understand or modify the Virtual Memory implementation. </p> <h2 id="keys-vs-values-what-is-swapped-out"> Keys vs Values: what is swapped out? </h2> <p> The goal of the VM subsystem is to free memory transferring Redis Objects from memory to disk. This is a very generic command, but specifically, Redis transfers only objects associated with <em> values </em> . In order to understand better this concept we'll show, using the DEBUG command, how a key holding a value looks from the point of view of the Redis internals: </p> <pre><code>redis&gt; set foo bar OK redis&gt; debug object foo Key at:0x100101d00 refcount:1, value at:0x100101ce0 refcount:1 encoding:raw serializedlength:4 </code></pre> <p> As you can see from the above output, the Redis top level hash table maps Redis Objects (keys) to other Redis Objects (values). The Virtual Memory is only able to swap <em> values </em> on disk, the objects associated to <em> keys </em> are always taken in memory: this trade off guarantees very good lookup performances, as one of the main design goals of the Redis VM is to have performances similar to Redis with VM disabled when the part of the dataset frequently used fits in RAM. </p> <h2 id="how-does-a-swapped-value-looks-like-internally"> How does a swapped value looks like internally </h2> <p> When an object is swapped out, this is what happens in the hash table entry: </p> <ul> <li> The key continues to hold a Redis Object representing the key. </li> <li> The value is set to NULL </li> </ul> <p> So you may wonder where we store the information that a given value (associated to a given key) was swapped out. Just in the key object! </p> <p> This is how the Redis Object structure <em> robj </em> looks like: </p> <pre><code>/* The actual Redis Object */ typedef struct redisObject { void *ptr; unsigned char type; unsigned char encoding; unsigned char storage; /* If this object is a key, where is the value? * REDIS_VM_MEMORY, REDIS_VM_SWAPPED, ... */ unsigned char vtype; /* If this object is a key, and value is swapped out, * this is the type of the swapped out object. */ int refcount; /* VM fields, this are only allocated if VM is active, otherwise the * object allocation function will just allocate * sizeof(redisObject) minus sizeof(redisObjectVM), so using * Redis without VM active will not have any overhead. */ struct redisObjectVM vm; } robj; </code></pre> <p> As you can see there are a few fields about VM. The most important one is <em> storage </em> , that can be one of this values: </p> <ul> <li> <code> REDIS_VM_MEMORY </code> : the associated value is in memory. </li> <li> <code> REDIS_VM_SWAPPED </code> : the associated values is swapped, and the value entry of the hash table is just set to NULL. </li> <li> <code> REDIS_VM_LOADING </code> : the value is swapped on disk, the entry is NULL, but there is a job to load the object from the swap to the memory (this field is only used when threaded VM is active). </li> <li> <code> REDIS_VM_SWAPPING </code> : the value is in memory, the entry is a pointer to the actual Redis Object, but there is an I/O job in order to transfer this value to the swap file. </li> </ul> <p> If an object is swapped on disk ( <code> REDIS_VM_SWAPPED </code> or <code> REDIS_VM_LOADING </code> ), how do we know where it is stored, what type it is, and so forth? That's simple: the <em> vtype </em> field is set to the original type of the Redis object swapped, while the <em> vm </em> field (that is a <em> redisObjectVM </em> structure) holds information about the location of the object. This is the definition of this additional structure: </p> <pre><code>/* The VM object structure */ struct redisObjectVM { off_t page; /* the page at which the object is stored on disk */ off_t usedpages; /* number of pages used on disk */ time_t atime; /* Last access time */ } vm; </code></pre> <p> As you can see the structure contains the page at which the object is located in the swap file, the number of pages used, and the last access time of the object (this is very useful for the algorithm that select what object is a good candidate for swapping, as we want to transfer on disk objects that are rarely accessed). </p> <p> As you can see, while all the other fields are using unused bytes in the old Redis Object structure (we had some free bit due to natural memory alignment concerns), the <em> vm </em> field is new, and indeed uses additional memory. Should we pay such a memory cost even when VM is disabled? No! This is the code to create a new Redis Object: </p> <pre><code>... some code ... if (server.vm_enabled) { pthread_mutex_unlock(&amp;server.obj_freelist_mutex); o = zmalloc(sizeof(*o)); } else { o = zmalloc(sizeof(*o)-sizeof(struct redisObjectVM)); } ... some code ... </code></pre> <p> As you can see if the VM system is not enabled we allocate just <code> sizeof(*o)-sizeof(struct redisObjectVM) </code> of memory. Given that the <em> vm </em> field is the last in the object structure, and that this fields are never accessed if VM is disabled, we are safe and Redis without VM does not pay the memory overhead. </p> <h2 id="the-swap-file"> The Swap File </h2> <p> The next step in order to understand how the VM subsystem works is understanding how objects are stored inside the swap file. The good news is that's not some kind of special format, we just use the same format used to store the objects in .rdb files, that are the usual dump files produced by Redis using the <a href="/commands/save"> <code> SAVE </code> </a> command. </p> <p> The swap file is composed of a given number of pages, where every page size is a given number of bytes. This parameters can be changed in redis.conf, since different Redis instances may work better with different values: it depends on the actual data you store inside it. The following are the default values: </p> <pre><code>vm-page-size 32 vm-pages 134217728 </code></pre> <p> Redis takes a "bitmap" (a contiguous array of bits set to zero or one) in memory, every bit represent a page of the swap file on disk: if a given bit is set to 1, it represents a page that is already used (there is some Redis Object stored there), while if the corresponding bit is zero, the page is free. </p> <p> Taking this bitmap (that will call the page table) in memory is a huge win in terms of performances, and the memory used is small: we just need 1 bit for every page on disk. For instance in the example below 134217728 pages of 32 bytes each (4GB swap file) is using just 16 MB of RAM for the page table. </p> <h2 id="transferring-objects-from-memory-to-swap"> Transferring objects from memory to swap </h2> <p> In order to transfer an object from memory to disk we need to perform the following steps (assuming non threaded VM, just a simple blocking approach): </p> <ul> <li> Find how many pages are needed in order to store this object on the swap file. This is trivially accomplished just calling the function <code> rdbSavedObjectPages </code> that returns the number of pages used by an object on disk. Note that this function does not duplicate the .rdb saving code just to understand what will be the length <em> after </em> an object will be saved on disk, we use the trick of opening /dev/null and writing the object there, finally calling <code> ftello </code> in order check the amount of bytes required. What we do basically is to save the object on a virtual very fast file, that is, /dev/null. </li> <li> Now that we know how many pages are required in the swap file, we need to find this number of contiguous free pages inside the swap file. This task is accomplished by the <code> vmFindContiguousPages </code> function. As you can guess this function may fail if the swap is full, or so fragmented that we can't easily find the required number of contiguous free pages. When this happens we just abort the swapping of the object, that will continue to live in memory. </li> <li> Finally we can write the object on disk, at the specified position, just calling the function <code> vmWriteObjectOnSwap </code> . </li> </ul> <p> As you can guess once the object was correctly written in the swap file, it is freed from memory, the storage field in the associated key is set to <code> REDIS_VM_SWAPPED </code> , and the used pages are marked as used in the page table. </p> <h2 id="loading-objects-back-in-memory"> Loading objects back in memory </h2> <p> Loading an object from swap to memory is simpler, as we already know where the object is located and how many pages it is using. We also know the type of the object (the loading functions are required to know this information, as there is no header or any other information about the object type on disk), but this is stored in the <em> vtype </em> field of the associated key as already seen above. </p> <p> Calling the function <code> vmLoadObject </code> passing the key object associated to the value object we want to load back is enough. The function will also take care of fixing the storage type of the key (that will be <code> REDIS_VM_MEMORY </code> ), marking the pages as freed in the page table, and so forth. </p> <p> The return value of the function is the loaded Redis Object itself, that we'll have to set again as value in the main hash table (instead of the NULL value we put in place of the object pointer when the value was originally swapped out). </p> <h2 id="how-blocking-vm-works"> How blocking VM works </h2> <p> Now we have all the building blocks in order to describe how the blocking VM works. First of all, an important detail about configuration. In order to enable blocking VM in Redis <code> server.vm_max_threads </code> must be set to zero. We'll see later how this max number of threads info is used in the threaded VM, for now all it's needed to now is that Redis reverts to fully blocking VM when this is set to zero. </p> <p> We also need to introduce another important VM parameter, that is, <code> server.vm_max_memory </code> . This parameter is very important as it is used in order to trigger swapping: Redis will try to swap objects only if it is using more memory than the max memory setting, otherwise there is no need to swap as we are matching the user requested memory usage. </p> <h2 id="blocking-vm-swapping"> Blocking VM swapping </h2> <p> Swapping of object from memory to disk happens in the cron function. This function used to be called every second, while in the recent Redis versions on git it is called every 100 milliseconds (that is, 10 times per second). If this function detects we are out of memory, that is, the memory used is greater than the vm-max-memory setting, it starts transferring objects from memory to disk in a loop calling the function <code> vmSwapOneObect </code> . This function takes just one argument, if 0 it will swap objects in a blocking way, otherwise if it is 1, I/O threads are used. In the blocking scenario we just call it with zero as argument. </p> <p> vmSwapOneObject acts performing the following steps: </p> <ul> <li> The key space in inspected in order to find a good candidate for swapping (we'll see later what a good candidate for swapping is). </li> <li> The associated value is transferred to disk, in a blocking way. </li> <li> The key storage field is set to <code> REDIS_VM_SWAPPED </code> , while the <em> vm </em> fields of the object are set to the right values (the page index where the object was swapped, and the number of pages used to swap it). </li> <li> Finally the value object is freed and the value entry of the hash table is set to NULL. </li> </ul> <p> The function is called again and again until one of the following happens: there is no way to swap more objects because either the swap file is full or nearly all the objects are already transferred on disk, or simply the memory usage is already under the vm-max-memory parameter. </p> <h2 id="what-values-to-swap-when-we-are-out-of-memory"> What values to swap when we are out of memory? </h2> <p> Understanding what's a good candidate for swapping is not too hard. A few objects at random are sampled, and for each their <em> swappability </em> is commuted as: </p> <pre><code>swappability = age*log(size_in_memory) </code></pre> <p> The age is the number of seconds the key was not requested, while size_in_memory is a fast estimation of the amount of memory (in bytes) used by the object in memory. So we try to swap out objects that are rarely accessed, and we try to swap bigger objects over smaller one, but the latter is a less important factor (because of the logarithmic function used). This is because we don't want bigger objects to be swapped out and in too often as the bigger the object the more I/O and CPU is required in order to transfer it. </p> <h2 id="blocking-vm-loading"> Blocking VM loading </h2> <p> What happens if an operation against a key associated with a swapped out object is requested? For instance Redis may just happen to process the following command: </p> <pre><code>GET foo </code></pre> <p> If the value object of the <code> foo </code> key is swapped we need to load it back in memory before processing the operation. In Redis the key lookup process is centralized in the <code> lookupKeyRead </code> and <code> lookupKeyWrite </code> functions, this two functions are used in the implementation of all the Redis commands accessing the keyspace, so we have a single point in the code where to handle the loading of the key from the swap file to memory. </p> <p> So this is what happens: </p> <ul> <li> The user calls some command having as argument a swapped key </li> <li> The command implementation calls the lookup function </li> <li> The lookup function search for the key in the top level hash table. If the value associated with the requested key is swapped (we can see that checking the <em> storage </em> field of the key object), we load it back in memory in a blocking way before to return to the user. </li> </ul> <p> This is pretty straightforward, but things will get more <em> interesting </em> with the threads. From the point of view of the blocking VM the only real problem is the saving of the dataset using another process, that is, handling <a href="/commands/bgsave"> <code> BGSAVE </code> </a> and <a href="/commands/bgrewriteaof"> <code> BGREWRITEAOF </code> </a> commands. </p> <h2 id="background-saving-when-vm-is-active"> Background saving when VM is active </h2> <p> The default Redis way to persist on disk is to create .rdb files using a child process. Redis calls the fork() system call in order to create a child, that has the exact copy of the in memory dataset, since fork duplicates the whole program memory space (actually thanks to a technique called Copy on Write memory pages are shared between the parent and child process, so the fork() call will not require too much memory). </p> <p> In the child process we have a copy of the dataset in a given point in the time. Other commands issued by clients will just be served by the parent process and will not modify the child data. </p> <p> The child process will just store the whole dataset into the dump.rdb file and finally will exit. But what happens when the VM is active? Values can be swapped out so we don't have all the data in memory, and we need to access the swap file in order to retrieve the swapped values. While child process is saving the swap file is shared between the parent and child process, since: </p> <ul> <li> The parent process needs to access the swap file in order to load values back into memory if an operation against swapped out values are performed. </li> <li> The child process needs to access the swap file in order to retrieve the full dataset while saving the data set on disk. </li> </ul> <p> In order to avoid problems while both the processes are accessing the same swap file we do a simple thing, that is, not allowing values to be swapped out in the parent process while a background saving is in progress. This way both the processes will access the swap file in read only. This approach has the problem that while the child process is saving no new values can be transferred on the swap file even if Redis is using more memory than the max memory parameters dictates. This is usually not a problem as the background saving will terminate in a short amount of time and if still needed a percentage of values will be swapped on disk ASAP. </p> <p> An alternative to this scenario is to enable the Append Only File that will have this problem only when a log rewrite is performed using the <a href="/commands/bgrewriteaof"> <code> BGREWRITEAOF </code> </a> command. </p> <h2 id="the-problem-with-the-blocking-vm"> The problem with the blocking VM </h2> <p> The problem of blocking VM is that... it's blocking :) This is not a problem when Redis is used in batch processing activities, but for real-time usage one of the good points of Redis is the low latency. The blocking VM will have bad latency behaviors as when a client is accessing a swapped out value, or when Redis needs to swap out values, no other clients will be served in the meantime. </p> <p> Swapping out keys should happen in background. Similarly when a client is accessing a swapped out value other clients accessing in memory values should be served mostly as fast as when VM is disabled. Only the clients dealing with swapped out keys should be delayed. </p> <p> All this limitations called for a non-blocking VM implementation. </p> <h2 id="threaded-vm"> Threaded VM </h2> <p> There are basically three main ways to turn the blocking VM into a non blocking one. </p> <ul> <li> 1: One way is obvious, and in my opinion, not a good idea at all, that is, turning Redis itself into a threaded server: if every request is served by a different thread automatically other clients don't need to wait for blocked ones. Redis is fast, exports atomic operations, has no locks, and is just 10k lines of code, <em> because </em> it is single threaded, so this was not an option for me. </li> <li> 2: Using non-blocking I/O against the swap file. After all you can think Redis already event-loop based, why don't just handle disk I/O in a non-blocking fashion? I also discarded this possibility because of two main reasons. One is that non blocking file operations, unlike sockets, are an incompatibility nightmare. It's not just like calling select, you need to use OS-specific things. The other problem is that the I/O is just one part of the time consumed to handle VM, another big part is the CPU used in order to encode/decode data to/from the swap file. This is I picked option three, that is... </li> <li> 3: Using I/O threads, that is, a pool of threads handling the swap I/O operations. This is what the Redis VM is using, so let's detail how this works. </li> </ul> <h2 id="io-threads"> I/O Threads </h2> <p> The threaded VM design goals where the following, in order of importance: </p> <ul> <li> Simple implementation, little room for race conditions, simple locking, VM system more or less completely decoupled from the rest of Redis code. </li> <li> Good performances, no locks for clients accessing values in memory. </li> <li> Ability to decode/encode objects in the I/O threads. </li> </ul> <p> The above goals resulted in an implementation where the Redis main thread (the one serving actual clients) and the I/O threads communicate using a queue of jobs, with a single mutex. Basically when main thread requires some work done in the background by some I/O thread, it pushes an I/O job structure in the <code> server.io_newjobs </code> queue (that is, just a linked list). If there are no active I/O threads, one is started. At this point some I/O thread will process the I/O job, and the result of the processing is pushed in the <code> server.io_processed </code> queue. The I/O thread will send a byte using an UNIX pipe to the main thread in order to signal that a new job was processed and the result is ready to be processed. </p> <p> This is how the <code> iojob </code> structure looks like: </p> <pre><code>typedef struct iojob { int type; /* Request type, REDIS_IOJOB_* */ redisDb *db;/* Redis database */ robj *key; /* This I/O request is about swapping this key */ robj *val; /* the value to swap for REDIS_IOREQ_*_SWAP, otherwise this * field is populated by the I/O thread for REDIS_IOREQ_LOAD. */ off_t page; /* Swap page where to read/write the object */ off_t pages; /* Swap pages needed to save object. PREPARE_SWAP return val */ int canceled; /* True if this command was canceled by blocking side of VM */ pthread_t thread; /* ID of the thread processing this entry */ } iojob; </code></pre> <p> There are just three type of jobs that an I/O thread can perform (the type is specified by the <code> type </code> field of the structure): </p> <ul> <li> <code> REDIS_IOJOB_LOAD </code> : load the value associated to a given key from swap to memory. The object offset inside the swap file is <code> page </code> , the object type is <code> key-&gt;vtype </code> . The result of this operation will populate the <code> val </code> field of the structure. </li> <li> <code> REDIS_IOJOB_PREPARE_SWAP </code> : compute the number of pages needed in order to save the object pointed by <code> val </code> into the swap. The result of this operation will populate the <code> pages </code> field. </li> <li> <code> REDIS_IOJOB_DO_SWAP </code> : Transfer the object pointed by <code> val </code> to the swap file, at page offset <code> page </code> . </li> </ul> <p> The main thread delegates just the above three tasks. All the rest is handled by the I/O thread itself, for instance finding a suitable range of free pages in the swap file page table (that is a fast operation), deciding what object to swap, altering the storage field of a Redis object to reflect the current state of a value. </p> <h2 id="non-blocking-vm-as-probabilistic-enhancement-of-blocking-vm"> Non blocking VM as probabilistic enhancement of blocking VM </h2> <p> So now we have a way to request background jobs dealing with slow VM operations. How to add this to the mix of the rest of the work done by the main thread? While blocking VM was aware that an object was swapped out just when the object was looked up, this is too late for us: in C it is not trivial to start a background job in the middle of the command, leave the function, and re-enter in the same point the computation when the I/O thread finished what we requested (that is, no co-routines or continuations or alike). </p> <p> Fortunately there was a much, much simpler way to do this. And we love simple things: basically consider the VM implementation a blocking one, but add an optimization (using non the no blocking VM operations we are able to perform) to make the blocking <em> very </em> unlikely. </p> <p> This is what we do: </p> <ul> <li> Every time a client sends us a command, <em> before </em> the command is executed, we examine the argument vector of the command in search for swapped keys. After all we know for every command what arguments are keys, as the Redis command format is pretty simple. </li> <li> If we detect that at least a key in the requested command is swapped on disk, we block the client instead of really issuing the command. For every swapped value associated to a requested key, an I/O job is created, in order to bring the values back in memory. The main thread continues the execution of the event loop, without caring about the blocked client. </li> <li> In the meanwhile, I/O threads are loading values in memory. Every time an I/O thread finished loading a value, it sends a byte to the main thread using an UNIX pipe. The pipe file descriptor has a readable event associated in the main thread event loop, that is the function <code> vmThreadedIOCompletedJob </code> . If this function detects that all the values needed for a blocked client were loaded, the client is restarted and the original command called. </li> </ul> <p> So you can think of this as a blocked VM that almost always happen to have the right keys in memory, since we pause clients that are going to issue commands about swapped out values until this values are loaded. </p> <p> If the function checking what argument is a key fails in some way, there is no problem: the lookup function will see that a given key is associated to a swapped out value and will block loading it. So our non blocking VM reverts to a blocking one when it is not possible to anticipate what keys are touched. </p> <p> For instance in the case of the <a href="/commands/sort"> <code> SORT </code> </a> command used together with the <a href="/commands/get"> <code> GET </code> </a> or <code> BY </code> options, it is not trivial to know beforehand what keys will be requested, so at least in the first implementation, <code> SORT BY/GET </code> resorts to the blocking VM implementation. </p> <h2 id="blocking-clients-on-swapped-keys"> Blocking clients on swapped keys </h2> <p> How to block clients? To suspend a client in an event-loop based server is pretty trivial. All we do is canceling its read handler. Sometimes we do something different (for instance for BLPOP) that is just marking the client as blocked, but not processing new data (just accumulating the new data into input buffers). </p> <h2 id="aborting-io-jobs"> Aborting I/O jobs </h2> <p> There is something hard to solve about the interactions between our blocking and non blocking VM, that is, what happens if a blocking operation starts about a key that is also "interested" by a non blocking operation at the same time? </p> <p> For instance while SORT BY is executed, a few keys are being loaded in a blocking manner by the sort command. At the same time, another client may request the same keys with a simple <em> GET key </em> command, that will trigger the creation of an I/O job to load the key in background. </p> <p> The only simple way to deal with this problem is to be able to kill I/O jobs in the main thread, so that if a key that we want to load or swap in a blocking way is in the <code> REDIS_VM_LOADING </code> or <code> REDIS_VM_SWAPPING </code> state (that is, there is an I/O job about this key), we can just kill the I/O job about this key, and go ahead with the blocking operation we want to perform. </p> <p> This is not as trivial as it is. In a given moment an I/O job can be in one of the following three queues: </p> <ul> <li> server.io_newjobs: the job was already queued but no thread is handling it. </li> <li> server.io_processing: the job is being processed by an I/O thread. </li> <li> server.io_processed: the job was already processed. The function able to kill an I/O job is <code> vmCancelThreadedIOJob </code> , and this is what it does: </li> <li> If the job is in the newjobs queue, that's simple, removing the iojob structure from the queue is enough as no thread is still executing any operation. </li> <li> If the job is in the processing queue, a thread is messing with our job (and possibly with the associated object!). The only thing we can do is waiting for the item to move to the next queue in a <em> blocking way </em> . Fortunately this condition happens very rarely so it's not a performance problem. </li> <li> If the job is in the processed queue, we just mark it as <em> canceled </em> marking setting the <code> canceled </code> field to 1 in the iojob structure. The function processing completed jobs will just ignored and free the job instead of really processing it. </li> </ul> <h2 id="questions"> Questions? </h2> <p> This document is in no way complete, the only way to get the whole picture is reading the source code, but it should be a good introduction in order to make the code review / understanding a lot simpler. </p> <p> Something is not clear about this page? Please leave a comment and I'll try to address the issue possibly integrating the answer in this document. </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/reference/internals/internals-vm/"/> <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/rs-6-4-2-61/.html
<section class="prose w-full py-12 max-w-none"> <h1> Redis Enterprise Software release notes 6.4.2-61 (April 2023) </h1> <p class="text-lg -mt-5 mb-10"> 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. </p> <p> This is a maintenance release for ​ <a href="https://redis.com/redis-enterprise-software/download-center/software/"> ​Redis Enterprise Software version 6.4.2 </a> . </p> <p> The following table shows the MD5 checksums for the available packages: </p> <table> <thead> <tr> <th> Package </th> <th> MD5 checksum (6.4.2-61 April release) </th> </tr> </thead> <tbody> <tr> <td> Ubuntu 16 </td> <td> f8f616147c9daaaeb9cd8cb1ae44157f </td> </tr> <tr> <td> Ubuntu 18 </td> <td> 1de5b0bafd4edec8d7817bddcecf3824 </td> </tr> <tr> <td> Ubuntu 20 </td> <td> 829e91c7fac1a0ab7e36cb4a65d19906 </td> </tr> <tr> <td> RedHat Enterprise Linux (RHEL) 7 <br/> Oracle Enterprise Linux (OL) 7 </td> <td> 477f1d3161ea16e8d52c41eb61d92637 </td> </tr> <tr> <td> RedHat Enterprise Linux (RHEL) 8 <br/> Oracle Enterprise Linux (OL) 8 <br/> Rocky Enterprise Linux </td> <td> 1170af43f88bf5f9095890916c0fe74d </td> </tr> <tr> <td> Amazon Linux 2 (Release Candidate) </td> <td> e246ae158db32e0a483a23392b2a7f47 </td> </tr> </tbody> </table> <h2 id="new-features-and-enhancements"> New features and enhancements </h2> <ul> <li> <p> Amazon Linux 2 supported as a release candidate (RC) </p> <div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md"> <div class="p-2 pr-5"> <svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg"> <circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5"> </circle> <path d="M10.5 14V16" stroke="currentColor" stroke-width="2"> </path> <path d="M10.5 5V12" stroke="currentColor" stroke-width="2"> </path> </svg> </div> <div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50"> <div class="font-medium"> Note: </div> A database with modules cannot reside on an Amazon Linux 2 (release candidate) node. Support will be added in a future maintenance release. </div> </div> </li> <li> <p> Add node ID indication to <a href="/docs/latest/operate/rs/references/cli-utilities/rladmin/cluster/debug_info/"> <code> debug_info </code> package </a> (RS95360) </p> </li> <li> <p> Add support for underscore <code> _ </code> as a valid character for <a href="/docs/latest/operate/rs/clusters/configure/rack-zone-awareness/"> rack awareness </a> (RS87458) </p> </li> <li> <p> When updating a <a href="/docs/latest/operate/rs/references/rest-api/objects/bdb/"> BDB object </a> , the version property is immutable. Any validation will be performed according to the BDB object version that was set during upgrade or install (RS93294) </p> </li> </ul> <h4 id="redis-stack-v626"> Redis Stack v6.2.6 </h4> <p> Redis Enterprise Software v6.4.2 includes the new features delivered in the latest <a href="https://redis.com/blog/introducing-redis-stack-6-2-6-and-7-0-6/"> Redis Stack release (6.2.6 v6) </a> : </p> <ul> <li> <p> <a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/search/"> RediSearch v2.6.6 </a> </p> </li> <li> <p> <a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/json/"> RedisJSON v2.4.6 </a> </p> </li> <li> <p> <a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/bloom/"> RedisBloom v2.4.5 </a> </p> </li> <li> <p> <a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/deprecated-features/graph/"> RedisGraph v2.10.9 </a> </p> </li> <li> <p> <a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/timeseries/"> RedisTimeSeries v1.8.9 </a> </p> </li> </ul> <p> See <a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/install/upgrade-module/"> Upgrade modules </a> to learn how to upgrade a module for a database. </p> <h2 id="version-changes"> Version changes </h2> <h3 id="deprecations"> Deprecations </h3> <h4 id="ubuntu-1604"> Ubuntu 16.04 </h4> <p> Ubuntu 16 support is deprecated and will be removed in a future release. </p> <h4 id="active-active-database-persistence"> Active-Active database persistence </h4> <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> <h2 id="resolved-issues"> Resolved issues </h2> <ul> <li> <p> RS95344 - Fixed known limitation for RHEL 7 and RHEL 8 where CRDB databases fail to start when installed using custom installation paths </p> </li> <li> <p> RS88010 - Roll back node configuration when the <a href="/docs/latest/operate/rs/clusters/remove-node/"> remove node </a> operation fails </p> </li> <li> <p> RS95824 - Fixed an issue with running <code> rl_rdbconvert </code> on Ubuntu </p> </li> <li> <p> RS97971 - Fixed known limitation for the edge case where resharding fails for rack-aware databases with no replication </p> </li> </ul> <h2 id="known-limitations"> Known limitations </h2> <h3 id="operating-system-limitations"> Operating system limitations </h3> <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 will be added in a future maintenance release. </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/rs-6-4-2-61/"/> <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/pexpiretime/.html
<section class="prose w-full py-12"> <h1 class="command-name"> PEXPIRETIME </h1> <div class="font-semibold text-redis-ink-900"> Syntax </div> <pre class="command-syntax">PEXPIRETIME key</pre> <dl class="grid grid-cols-[auto,1fr] gap-2 mb-12"> <dt class="font-semibold text-redis-ink-900 m-0"> Available since: </dt> <dd class="m-0"> 7.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> @read </code> <span class="mr-1 last:hidden"> , </span> <code> @fast </code> <span class="mr-1 last:hidden"> , </span> </dd> </dl> <p> <code> PEXPIRETIME </code> has the same semantic as <a href="/docs/latest/commands/expiretime/"> <code> EXPIRETIME </code> </a> , but returns the absolute Unix expiration timestamp in milliseconds instead of seconds. </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 "Hello" "OK" redis&gt; PEXPIREAT mykey 33177117420000 (integer) 1 redis&gt; PEXPIRETIME mykey (integer) 33177117420000 </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> <p> One of the following: </p> <ul> <li> <a href="../../develop/reference/protocol-spec#integers"> Integer reply </a> : Expiration Unix timestamp in milliseconds. </li> <li> <a href="../../develop/reference/protocol-spec#integers"> Integer reply </a> : <code> -1 </code> if the key exists but has no associated expiration time. </li> <li> <a href="../../develop/reference/protocol-spec#integers"> Integer reply </a> : <code> -2 </code> if the key does not exist. </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/pexpiretime/"/> <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/optimization/memory-optimization/.html
<section class="prose w-full py-12 max-w-none"> <h1> Memory optimization </h1> <p class="text-lg -mt-5 mb-10"> Strategies for optimizing memory usage in Redis </p> <h2 id="special-encoding-of-small-aggregate-data-types"> Special encoding of small aggregate data types </h2> <p> Since Redis 2.2 many data types are optimized to use less space up to a certain size. Hashes, Lists, Sets composed of just integers, and Sorted Sets, when smaller than a given number of elements, and up to a maximum element size, are encoded in a very memory-efficient way that uses <em> up to 10 times less memory </em> (with 5 times less memory used being the average saving). </p> <p> This is completely transparent from the point of view of the user and API. Since this is a CPU / memory tradeoff it is possible to tune the maximum number of elements and maximum element size for special encoded types using the following redis.conf directives (defaults are shown): </p> <h3 id="redis--62"> Redis &lt;= 6.2 </h3> <pre tabindex="0"><code>hash-max-ziplist-entries 512 hash-max-ziplist-value 64 zset-max-ziplist-entries 128 zset-max-ziplist-value 64 set-max-intset-entries 512 </code></pre> <h3 id="redis--70"> Redis &gt;= 7.0 </h3> <pre tabindex="0"><code>hash-max-listpack-entries 512 hash-max-listpack-value 64 zset-max-listpack-entries 128 zset-max-listpack-value 64 set-max-intset-entries 512 </code></pre> <h3 id="redis--72"> Redis &gt;= 7.2 </h3> <p> The following directives are also available: </p> <pre tabindex="0"><code>set-max-listpack-entries 128 set-max-listpack-value 64 </code></pre> <p> If a specially encoded value overflows the configured max size, Redis will automatically convert it into normal encoding. This operation is very fast for small values, but if you change the setting in order to use specially encoded values for much larger aggregate types the suggestion is to run some benchmarks and tests to check the conversion time. </p> <h2 id="using-32-bit-instances"> Using 32-bit instances </h2> <p> When Redis is compiled as a 32-bit target, it uses a lot less memory per key, since pointers are small, but such an instance will be limited to 4 GB of maximum memory usage. To compile Redis as 32-bit binary use <em> make 32bit </em> . RDB and AOF files are compatible between 32-bit and 64-bit instances (and between little and big endian of course) so you can switch from 32 to 64-bit, or the contrary, without problems. </p> <h2 id="bit-and-byte-level-operations"> Bit and byte level operations </h2> <p> Redis 2.2 introduced new bit and byte level operations: <a href="/commands/getrange"> <code> GETRANGE </code> </a> , <a href="/commands/setrange"> <code> SETRANGE </code> </a> , <a href="/commands/getbit"> <code> GETBIT </code> </a> and <a href="/commands/setbit"> <code> SETBIT </code> </a> . Using these commands you can treat the Redis string type as a random access array. For instance, if you have an application where users are identified by a unique progressive integer number, you can use a bitmap to save information about the subscription of users in a mailing list, setting the bit for subscribed and clearing it for unsubscribed, or the other way around. With 100 million users this data will take just 12 megabytes of RAM in a Redis instance. You can do the same using <a href="/commands/getrange"> <code> GETRANGE </code> </a> and <a href="/commands/setrange"> <code> SETRANGE </code> </a> to store one byte of information for each user. This is just an example but it is possible to model several problems in very little space with these new primitives. </p> <h2 id="use-hashes-when-possible"> Use hashes when possible </h2> <p> Small hashes are encoded in a very small space, so you should try representing your data using hashes whenever possible. For instance, if you have objects representing users in a web application, instead of using different keys for name, surname, email, password, use a single hash with all the required fields. </p> <p> If you want to know more about this, read the next section. </p> <h2 id="using-hashes-to-abstract-a-very-memory-efficient-plain-key-value-store-on-top-of-redis"> Using hashes to abstract a very memory-efficient plain key-value store on top of Redis </h2> <p> I understand the title of this section is a bit scary, but I'm going to explain in detail what this is about. </p> <p> Basically it is possible to model a plain key-value store using Redis where values can just be just strings, which is not just more memory efficient than Redis plain keys but also much more memory efficient than memcached. </p> <p> Let's start with some facts: a few keys use a lot more memory than a single key containing a hash with a few fields. How is this possible? We use a trick. In theory to guarantee that we perform lookups in constant time (also known as O(1) in big O notation) there is the need to use a data structure with a constant time complexity in the average case, like a hash table. </p> <p> But many times hashes contain just a few fields. When hashes are small we can instead just encode them in an O(N) data structure, like a linear array with length-prefixed key-value pairs. Since we do this only when N is small, the amortized time for <a href="/commands/hget"> <code> HGET </code> </a> and <a href="/commands/hset"> <code> HSET </code> </a> commands is still O(1): the hash will be converted into a real hash table as soon as the number of elements it contains grows too large (you can configure the limit in redis.conf). </p> <p> This does not only work well from the point of view of time complexity, but also from the point of view of constant times since a linear array of key-value pairs happens to play very well with the CPU cache (it has a better cache locality than a hash table). </p> <p> However since hash fields and values are not (always) represented as full-featured Redis objects, hash fields can't have an associated time to live (expire) like a real key, and can only contain a string. But we are okay with this, this was the intention anyway when the hash data type API was designed (we trust simplicity more than features, so nested data structures are not allowed, as expires of single fields are not allowed). </p> <p> So hashes are memory efficient. This is useful when using hashes to represent objects or to model other problems when there are group of related fields. But what about if we have a plain key value business? </p> <p> Imagine we want to use Redis as a cache for many small objects, which can be JSON encoded objects, small HTML fragments, simple key -&gt; boolean values and so forth. Basically, anything is a string -&gt; string map with small keys and values. </p> <p> Now let's assume the objects we want to cache are numbered, like: </p> <ul> <li> object:102393 </li> <li> object:1234 </li> <li> object:5 </li> </ul> <p> This is what we can do. Every time we perform a SET operation to set a new value, we actually split the key into two parts, one part used as a key, and the other part used as the field name for the hash. For instance, the object named "object:1234" is actually split into: </p> <ul> <li> a Key named object:12 </li> <li> a Field named 34 </li> </ul> <p> So we use all the characters but the last two for the key, and the final two characters for the hash field name. To set our key we use the following command: </p> <pre tabindex="0"><code>HSET object:12 34 somevalue </code></pre> <p> As you can see every hash will end up containing 100 fields, which is an optimal compromise between CPU and memory saved. </p> <p> There is another important thing to note, with this schema every hash will have more or less 100 fields regardless of the number of objects we cached. This is because our objects will always end with a number and not a random string. In some way, the final number can be considered as a form of implicit pre-sharding. </p> <p> What about small numbers? Like object:2? We handle this case using just "object:" as a key name, and the whole number as the hash field name. So object:2 and object:10 will both end inside the key "object:", but one as field name "2" and one as "10". </p> <p> How much memory do we save this way? </p> <p> I used the following Ruby program to test how this works: </p> <div class="highlight"> <pre class="chroma"><code class="language-ruby" data-lang="ruby"><span class="line"><span class="cl"><span class="nb">require</span> <span class="s1">'rubygems'</span> </span></span><span class="line"><span class="cl"><span class="nb">require</span> <span class="s1">'redis'</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="no">USE_OPTIMIZATION</span> <span class="o">=</span> <span class="kp">true</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">hash_get_key_field</span><span class="p">(</span><span class="n">key</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> <span class="n">s</span> <span class="o">=</span> <span class="n">key</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">':'</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">s</span><span class="o">[</span><span class="mi">1</span><span class="o">].</span><span class="n">length</span> <span class="o">&gt;</span> <span class="mi">2</span> </span></span><span class="line"><span class="cl"> <span class="p">{</span> <span class="ss">key</span><span class="p">:</span> <span class="n">s</span><span class="o">[</span><span class="mi">0</span><span class="o">]</span> <span class="o">+</span> <span class="s1">':'</span> <span class="o">+</span> <span class="n">s</span><span class="o">[</span><span class="mi">1</span><span class="o">][</span><span class="mi">0</span><span class="o">..-</span><span class="mi">3</span><span class="o">]</span><span class="p">,</span> <span class="ss">field</span><span class="p">:</span> <span class="n">s</span><span class="o">[</span><span class="mi">1</span><span class="o">][-</span><span class="mi">2</span><span class="o">..-</span><span class="mi">1</span><span class="o">]</span> <span class="p">}</span> </span></span><span class="line"><span class="cl"> <span class="k">else</span> </span></span><span class="line"><span class="cl"> <span class="p">{</span> <span class="ss">key</span><span class="p">:</span> <span class="n">s</span><span class="o">[</span><span class="mi">0</span><span class="o">]</span> <span class="o">+</span> <span class="s1">':'</span><span class="p">,</span> <span class="ss">field</span><span class="p">:</span> <span class="n">s</span><span class="o">[</span><span class="mi">1</span><span class="o">]</span> <span class="p">}</span> </span></span><span class="line"><span class="cl"> <span class="k">end</span> </span></span><span class="line"><span class="cl"><span class="k">end</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">hash_set</span><span class="p">(</span><span class="n">r</span><span class="p">,</span> <span class="n">key</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> <span class="n">kf</span> <span class="o">=</span> <span class="n">hash_get_key_field</span><span class="p">(</span><span class="n">key</span><span class="p">)</span> </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="n">kf</span><span class="o">[</span><span class="ss">:key</span><span class="o">]</span><span class="p">,</span> <span class="n">kf</span><span class="o">[</span><span class="ss">:field</span><span class="o">]</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="k">end</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">hash_get</span><span class="p">(</span><span class="n">r</span><span class="p">,</span> <span class="n">key</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> <span class="n">kf</span> <span class="o">=</span> <span class="n">hash_get_key_field</span><span class="p">(</span><span class="n">key</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> <span class="n">r</span><span class="o">.</span><span class="n">hget</span><span class="p">(</span><span class="n">kf</span><span class="o">[</span><span class="ss">:key</span><span class="o">]</span><span class="p">,</span> <span class="n">kf</span><span class="o">[</span><span class="ss">:field</span><span class="o">]</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="k">end</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="no">Redis</span><span class="o">.</span><span class="n">new</span> </span></span><span class="line"><span class="cl"><span class="p">(</span><span class="mi">0</span><span class="o">..</span><span class="mi">100_000</span><span class="p">)</span><span class="o">.</span><span class="n">each</span> <span class="k">do</span> <span class="o">|</span><span class="nb">id</span><span class="o">|</span> </span></span><span class="line"><span class="cl"> <span class="n">key</span> <span class="o">=</span> <span class="s2">"object:</span><span class="si">#{</span><span class="nb">id</span><span class="si">}</span><span class="s2">"</span> </span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="no">USE_OPTIMIZATION</span> </span></span><span class="line"><span class="cl"> <span class="n">hash_set</span><span class="p">(</span><span class="n">r</span><span class="p">,</span> <span class="n">key</span><span class="p">,</span> <span class="s1">'val'</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> <span class="k">else</span> </span></span><span class="line"><span class="cl"> <span class="n">r</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="n">key</span><span class="p">,</span> <span class="s1">'val'</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> <span class="k">end</span> </span></span><span class="line"><span class="cl"><span class="k">end</span> </span></span></code></pre> </div> <p> This is the result against a 64 bit instance of Redis 2.2: </p> <ul> <li> USE_OPTIMIZATION set to true: 1.7 MB of used memory </li> <li> USE_OPTIMIZATION set to false; 11 MB of used memory </li> </ul> <p> This is an order of magnitude, I think this makes Redis more or less the most memory efficient plain key value store out there. </p> <p> <em> WARNING </em> : for this to work, make sure that in your redis.conf you have something like this: </p> <pre tabindex="0"><code>hash-max-zipmap-entries 256 </code></pre> <p> Also remember to set the following field accordingly to the maximum size of your keys and values: </p> <pre tabindex="0"><code>hash-max-zipmap-value 1024 </code></pre> <p> Every time a hash exceeds the number of elements or element size specified it will be converted into a real hash table, and the memory saving will be lost. </p> <p> You may ask, why don't you do this implicitly in the normal key space so that I don't have to care? There are two reasons: one is that we tend to make tradeoffs explicit, and this is a clear tradeoff between many things: CPU, memory, and max element size. The second is that the top-level key space must support a lot of interesting things like expires, LRU data, and so forth so it is not practical to do this in a general way. </p> <p> But the Redis Way is that the user must understand how things work so that he can pick the best compromise and to understand how the system will behave exactly. </p> <h2 id="memory-allocation"> Memory allocation </h2> <p> To store user keys, Redis allocates at most as much memory as the <code> maxmemory </code> setting enables (however there are small extra allocations possible). </p> <p> The exact value can be set in the configuration file or set later via <a href="/commands/config-set"> <code> CONFIG SET </code> </a> (for more info, see <a href="/docs/latest/develop/reference/eviction/"> Using memory as an LRU cache </a> ). There are a few things that should be noted about how Redis manages memory: </p> <ul> <li> Redis will not always free up (return) memory to the OS when keys are removed. This is not something special about Redis, but it is how most malloc() implementations work. For example, if you fill an instance with 5GB worth of data, and then remove the equivalent of 2GB of data, the Resident Set Size (also known as the RSS, which is the number of memory pages consumed by the process) will probably still be around 5GB, even if Redis will claim that the user memory is around 3GB. This happens because the underlying allocator can't easily release the memory. For example, often most of the removed keys were allocated on the same pages as the other keys that still exist. </li> <li> The previous point means that you need to provision memory based on your <strong> peak memory usage </strong> . If your workload from time to time requires 10GB, even if most of the time 5GB could do, you need to provision for 10GB. </li> <li> However allocators are smart and are able to reuse free chunks of memory, so after you free 2GB of your 5GB data set, when you start adding more keys again, you'll see the RSS (Resident Set Size) stay steady and not grow more, as you add up to 2GB of additional keys. The allocator is basically trying to reuse the 2GB of memory previously (logically) freed. </li> <li> Because of all this, the fragmentation ratio is not reliable when you had a memory usage that at the peak is much larger than the currently used memory. The fragmentation is calculated as the physical memory actually used (the RSS value) divided by the amount of memory currently in use (as the sum of all the allocations performed by Redis). Because the RSS reflects the peak memory, when the (virtually) used memory is low since a lot of keys/values were freed, but the RSS is high, the ratio <code> RSS / mem_used </code> will be very high. </li> </ul> <p> If <code> maxmemory </code> is not set Redis will keep allocating memory as it sees fit and thus it can (gradually) eat up all your free memory. Therefore it is generally advisable to configure some limits. You may also want to set <code> maxmemory-policy </code> to <code> noeviction </code> (which is <em> not </em> the default value in some older versions of Redis). </p> <p> It makes Redis return an out-of-memory error for write commands if and when it reaches the limit - which in turn may result in errors in the application but will not render the whole machine dead because of memory starvation. </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/optimization/memory-optimization/"/> <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/redisearch/redisearch-2.10-release-notes/.html
<section class="prose w-full py-12 max-w-none"> <h1> RediSearch 2.10 release notes </h1> <p class="text-lg -mt-5 mb-10"> New vector data types. Enhanced indexing capabilities. Simplified query syntax. Expanded geospatial search. </p> <h2 id="requirements"> Requirements </h2> <p> RediSearch v2.10.7 requires: </p> <ul> <li> Minimum Redis compatibility version (database): 7.4 </li> <li> Minimum Redis Enterprise Software version (cluster): 7.6 (TBD) </li> </ul> <h2 id="v2107-septermber-2024"> v2.10.7 (Septermber 2024) </h2> <p> This is a maintenance release for RediSearch 2.10 </p> <p> Update urgency: <code> HIGH </code> : There is a critical bug that may affect a subset of users. Upgrade! </p> <p> Bug Fixes </p> <ul> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4941"> https://github.com/RediSearch/RediSearch/pull/4941 </a> Adjusting the module configuration to avoid routing overload on the first shard in a clustered database (MOD-7505) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4950"> https://github.com/RediSearch/RediSearch/pull/4950 </a> <code> FT.PROFILE </code> on <code> AGGREGATE </code> numeric queries could cause a crash due to reuse of an internal CURSOR in a large range of numeric values (MOD-7454) </li> </ul> <h2 id="v2106-august-2024"> v2.10.6 (August 2024): </h2> <p> This is a maintenance release for RediSearch 2.10. </p> <p> Update urgency: <code> HIGH </code> - There is a critical bug that may affect a subset of users. Upgrade! </p> <p> Bug fixes: </p> <ul> <li> <a href="https://github.com/redisearch/redisearch/pull/4916"> #4916 </a> - Union query, similar to <code> "is|the" </code> , starting with 2 <a href="https://redis.io/docs/latest/develop/interact/search-and-query/advanced-concepts/stopwords/"> storwords </a> could cause a crash (MOD-7495) </li> <li> <a href="https://github.com/redisearch/redisearch/pull/4895"> #4895 </a> - <code> FT.AGGREGATE </code> with <code> VERBATIM </code> option is not handled by the shards in cluster mode (MOD-7463) </li> <li> <a href="https://github.com/redisearch/redisearch/pull/4922"> #4922 </a> - Counting twice the field statistics at <code> #search </code> section of <code> INFO </code> response (MOD-7339) </li> </ul> <h2 id="v210-ga-v2105-july-2024"> v2.10 GA (v2.10.5) (July 2024) </h2> <p> This is the General Availability release of RediSearch 2.10 </p> <h3 id="headlines"> Headlines: </h3> <p> This latest RediSearch introduces memory-efficient vector data types, enhanced indexing capabilities with support for empty and missing fields, simplified query syntax, and expanded geospatial search features. </p> <h3 id="whats-new-in-2105"> What's new in 2.10.5 </h3> <p> This new major version introduces new <code> BFLOAT16 </code> and <code> FLOAT16 </code> vector data types, reducing memory consumed by vectors while preserving accuracy. This update also includes highly-requested support for indexing empty and missing values and enhances the developer experience for queries with exact matching capabilities. Developers can now match <code> TAG </code> fields without needing to escape special characters, making the onboarding process and use of the query syntax easier. Lastly, Geospatial search capabilities have been expanded with new <code> INTERSECT </code> and <code> DISJOINT </code> operators, and ergonomics have been improved by providing better reporting of the memory consumed by the index and exposing the full-text scoring in an aggregation pipeline. </p> <p> Features: </p> <ul> <li> <p> Enhancing exact matching queries with <code> TAG </code> avoiding escaping special meaning characters using the <a href="https://redis.io/docs/latest/develop/interact/search-and-query/query/exact-match/#tag-field"> simpler syntax </a> <code> '@tag:{"my-query%term"}' </code> and <code> NUMERIC </code> queries: </p> <ul> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4802"> #4802 </a> - Using double quotes to wrap exact matching query terms such as <code> @email:{"[email protected]"} </code> in <code> DIALECT 2 </code> ( MOD-7299) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4676"> #4676 </a> , <a href="https://github.com/RediSearch/RediSearch/pull/4433"> #4433 </a> - Enhancing query parser to avoid unnecessary escaping (MOD-5756) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4527"> #4527 </a> - Enhancing exact matching queries for <code> NUMERIC </code> using single value <code> FT.SEARCH idx @numeric:[3456] </code> (MOD-6623) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4802"> #4802 </a> - Enabling support for single operators in <code> NUMERIC </code> queries such as equivalence <code> == </code> , difference <code> != </code> , greater than <code> &gt; </code> and <code> &gt;= </code> and less than <code> &lt; </code> and <code> &lt;= </code> as in <code> FT.SEARCH idx '@numeric==3456' </code> (MOD-6749) </li> </ul> </li> <li> <p> Adding new keywords to support indexing empty values using <code> INDEXEMPTY </code> and missing values using <code> INDEXMISSING </code> per field in the <code> SCHEMA </code> while defining the <a href="https://redis.io/docs/latest/commands/ft.create/"> index </a> with <code> FT.CREATE </code> </p> <ul> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4663"> #4663 </a> , <a href="https://github.com/RediSearch/RediSearch/pull/4721"> #4721 </a> - Indexing empty strings values <code> "" </code> for <code> TAG </code> and <code> TEXT </code> fields (MOD-6540, MOD-7200) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4721"> #4721 </a> - Updating the query parser to support empty value queries for <code> TEXT </code> as <code> FT.SEARCH idx '@text_field:""' </code> or <code> FT.SEARCH idx '""' </code> and for <code> TAG </code> as in <code> FT.SEARCH idx '@tag_field:{""}' </code> (MOD-7200) </li> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4720"> #4720 </a> , <a href="https://github.com/RediSearch/RediSearch/pull/4635"> #4635 </a> - Indexing missing values for all field types introducing the query syntax function <code> ismissing(@field) </code> enabling query for missing fields as in <code> FT.SEARCH idx 'ismissing(@text)' </code> (MOD-6532) </li> </ul> </li> <li> <p> Enabling new vector data types reducing memory consumed by vectors with the new <code> BFLOAT16 </code> and <code> FLOAT16 </code> </p> <ul> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4674"> #4674 </a> - Adding support <code> BFLOAT16 </code> and <code> FLOAT16 </code> in the <a href="https://redis.io/docs/latest/develop/interact/search-and-query/advanced-concepts/vectors/#creation-attributes-per-algorithm"> vector index definition </a> (MOD-6765, MOD-6776) </li> </ul> </li> <li> <p> Exposing the full-text score values during the aggregation pipeline using <code> ADDSCORE </code> . When calling the scores you can use <code> @__score </code> in the pipeline as in <code> FT.AGGREGATE idx 'hello' ADDSCORES SORTBY 2 @__score DESC </code> </p> <ul> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4859"> #4859 </a> - Expose scores to <code> FT.AGGREGATE </code> pipeline (MOD-7190) </li> </ul> </li> <li> <p> <a href="https://github.com/RediSearch/RediSearch/pull/4227"> #4227 </a> - Adding support for new operators <code> INTERSECT </code> and <code> DISJOINT </code> when querying for <code> GEOSHAPE </code> <a href="https://redis.io/docs/latest/develop/interact/search-and-query/query/geo-spatial/"> polygons </a> (MOD-6178) </p> </li> </ul> <p> Bug fixes (since 2.10.4): </p> <ul> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4854"> #4854 </a> - Avoid expansion on stemming from numeric values (MOD-7025) </li> </ul> <p> Improvements (since 2.10.4): </p> <ul> <li> <a href="https://github.com/RediSearch/RediSearch/pull/4865"> #4865 </a> - Add coverage for cleaning garbage entries when indexing missing fields (MOD-7415) </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> The version inside Redis will be 2.10.5 in semantic versioning. Since the version of a module in Redis is numeric, we could not add a Release Candidate flag. </li> <li> Minimal Redis version: 7.4 </li> <li> If indexing and querying RedisJSON data structures, this version is best combined with RedisJSON 2.8 (v2.8.2 onwards) </li> </ul> </div> </div> <form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback"> <input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redisearch/redisearch-2.10-release-notes/"/> <div class="flex flex-row justify-between"> <div class="grid justify-center"> <span class="font-mono"> RATE THIS PAGE </span> <div class="star-rating"> <input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/> <label class="star" for="5-stars"> β˜… </label> <input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/> <label class="star" for="4-stars"> β˜… </label> <input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/> <label class="star" for="3-stars"> β˜… </label> <input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/> <label class="star" for="2-stars"> β˜… </label> <input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/> <label class="star" for="1-stars"> β˜… </label> </div> </div> <a class="font-mono no-underline" href="#"> Back to top ↑ </a> </div> <div class="hidden" id="feedback-form"> <div class="grid gap-2"> <textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea> <button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit"> Submit </button> </div> </div> </form> <script> document.addEventListener("DOMContentLoaded", function() { const form = document.querySelector("#page-feedback"); form.addEventListener("submit", function(event) { event.preventDefault(); var xhr = new XMLHttpRequest(); var url = "\/docusight\/api\/rate"; var params = new URLSearchParams(new FormData(form)); xhr.open("POST", url, true); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.onreadystatechange = function() { if (xhr.readyState === 4 && xhr.status === 200) { const responseData = JSON.parse(xhr.responseText); const responseMessage = responseData.response; const newText = document.createTextNode(responseMessage); form.parentNode.replaceChild(newText, form); } }; xhr.send(params); }); }); </script> </section>
https://redis.io/docs/latest/integrate/redis-data-integration/data-pipelines/data-pipelines/.html
<section class="prose w-full py-12"> <h1> Configure data pipelines </h1> <p class="text-lg -mt-5 mb-10"> Learn how to configure ingest pipelines for data transformation </p> <p> RDI implements <a href="https://en.wikipedia.org/wiki/Change_data_capture"> change data capture </a> (CDC) with <em> pipelines </em> . (See the <a href="/docs/latest/integrate/redis-data-integration/architecture/#overview"> architecture overview </a> for an introduction to pipelines.) </p> <h2 id="overview"> Overview </h2> <p> An RDI pipeline captures change data records from the source database, and transforms them into Redis data structures. It writes each of these new structures to a Redis target database under its own key. </p> <p> By default, RDI transforms the source data into <a href="/docs/latest/develop/data-types/hashes/"> hashes </a> or <a href="/docs/latest/develop/data-types/json/"> JSON objects </a> for the target with a standard data mapping and a standard format for the key. However, you can also provide your own custom transformation <a href="#job-files"> jobs </a> for each source table, using your own data mapping and key pattern. You specify these jobs declaratively with YAML configuration files that require no coding. </p> <p> The data tranformation involves two separate stages. First, the data ingested during CDC is automatically transformed to a JSON format. Then, this JSON data gets passed on to your custom transformation for further processing. </p> <p> You can provide a job file for each source table you want to transform, but you can also add a <em> default job </em> for any tables that don't have their own. You must specify the full name of the source table in the job file (or the special name "*" in the default job) and you can also include filtering logic to skip data that matches a particular condition. As part of the transformation, you can specify whether you want to store the data in Redis as <a href="/docs/latest/develop/data-types/json/"> JSON objects </a> , <a href="/docs/latest/develop/data-types/hashes/"> hashes </a> , <a href="/docs/latest/develop/data-types/sets/"> sets </a> , <a href="/docs/latest/develop/data-types/streams/"> streams </a> , <a href="/docs/latest/develop/data-types/sorted-sets/"> sorted sets </a> , or <a href="/docs/latest/develop/data-types/strings/"> strings </a> . </p> <p> The diagram below shows the flow of data through the pipeline: </p> <a href="/docs/latest/images/rdi/RDIPipeDataflow.drawio.svg" sdata-lightbox="/images/rdi/RDIPipeDataflow.drawio.svg"> <img src="/docs/latest/images/rdi/RDIPipeDataflow.drawio.svg"/> </a> <h2 id="pipeline-configuration"> Pipeline configuration </h2> <p> RDI uses a set of <a href="https://en.wikipedia.org/wiki/YAML"> YAML </a> files to configure each pipeline. The following diagram shows the folder structure of the configuration: </p> <a href="/docs/latest/images/rdi/ingest/ingest-config-folders.svg" sdata-lightbox="/images/rdi/ingest/ingest-config-folders.svg"> <img src="/docs/latest/images/rdi/ingest/ingest-config-folders.svg"/> </a> <p> The main configuration for the pipeline is in the <code> config.yaml </code> file. This specifies the connection details for the source database (such as host, username, and password) and also the queries that RDI will use to extract the required data. You should place job configurations in the <code> Jobs </code> folder if you want to specify your own data transformations. </p> <p> The sections below describe the two types of configuration file in more detail. </p> <h2 id="the-configyaml-file"> The <code> config.yaml </code> file </h2> <p> Here is an example of a <code> config.yaml </code> file. Note that the values of the form " <code> ${name} </code> " refer to environment variables that you should set with the <a href="/docs/latest/integrate/redis-data-integration/reference/cli/redis-di-set-secret/"> <code> redis-di set-secret </code> </a> command. In particular, you should normally use environment variables as shown to set the source and target username and password rather than storing them in plain text in this file (see <a href="#set-secrets"> Set secrets </a> below for more information). </p> <div class="highlight"> <pre class="chroma"><code class="language-yaml" data-lang="yaml"><span class="line"><span class="cl"><span class="nt">sources</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">mysql</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">cdc</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">logging</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">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 class="nt">connection</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">mysql</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">host</span><span class="p">:</span><span class="w"> </span><span class="l">${RDI_REDIS_HOST}</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">13000</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">database</span><span class="p">:</span><span class="w"> </span><span class="l">redislabscdc</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">user</span><span class="p">:</span><span class="w"> </span><span class="l">${SOURCE_DB_USERNAME}</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">password</span><span class="p">:</span><span class="w"> </span><span class="l">${SOURCE_DB_PASSWORD}</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="c"># The names of the following properties should match the ones you used</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="c"># when setting the TLS/mTLS secrets. Set only `cacert` if you are using</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="c"># TLS, but set all of them if you are using mTLS:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="c"># key: ${SOURCE_DB_KEY}</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="c"># cert: ${SOURCE_DB_CERT}</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="c"># cacert: ${SOURCE_DB_CACERT}</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="c"># key_password: ${SOURCE_DB_KEY_PASSWORD}</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">tables</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">emp</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">snapshot_sql</span><span class="p">:</span><span class="w"> </span><span class="s2">"SELECT * from redislabscdc.emp WHERE empno &lt; 1000"</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">columns</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="l">empno</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="l">fname</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="l">lname</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">keys</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="l">empno</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># Advanced collector properties (optional):</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># advanced:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># Sink collector properties - see the full list at https://debezium.io/documentation/reference/stable/operations/debezium-server.html#_redis_stream</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># sink:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># redis.memory.limit.mb: 100</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># redis.memory.threshold.percentage: 85</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># Source specific properties - see the full list at https://debezium.io/documentation/reference/stable/connectors/</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># source:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># snapshot.mode: initial</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># Quarkus framework properties - see the full list at https://quarkus.io/guides/all-config</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># quarkus:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c"># banner.enabled: "false"</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">targets</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">my-redis</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">connection</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">redis</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">host</span><span class="p">:</span><span class="w"> </span><span class="l">localhost</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">12000</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">user</span><span class="p">:</span><span class="w"> </span><span class="l">${TARGET_DB_USERNAME}</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">password</span><span class="p">:</span><span class="w"> </span><span class="l">${TARGET_DB_PASSWORD}</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="c"># The names of the following properties should match the ones you used</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="c"># when setting the TLS/mTLS secrets. Set only `cacert` if you are using</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="c"># TLS, but set all of them if you are using mTLS:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="c"># key: ${TARGET_DB_KEY}</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="c"># cert: ${TARGET_DB_CERT}</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="c"># cacert: ${TARGET_DB_CACERT}</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="c"># key_password: ${TARGET_DB_KEY_PASSWORD}</span><span class="w"> </span></span></span></code></pre> </div> <p> The main sections of the file configure <a href="#sources"> <code> sources </code> </a> and <a href="#targets"> <code> targets </code> </a> . </p> <h3 id="sources"> Sources </h3> <p> The <code> sources </code> section has a subsection for the source that you need to configure. The source section starts with a unique name to identify the source (in the example we have a source called <code> mysql </code> but you can choose any name you like). The example configuration contains the following data: </p> <ul> <li> <code> type </code> : The type of collector to use for the pipeline. Currently, the only type we support is <code> cdc </code> . </li> <li> <code> connection </code> : The connection details for the source database: hostname, port, schema/ db name, database credentials and <a href="https://en.wikipedia.org/wiki/Transport_Layer_Security"> TLS </a> / <a href="https://en.wikipedia.org/wiki/Mutual_authentication#mTLS"> mTLS </a> secrets. </li> <li> <code> tables </code> : The dataset you want to collect from the source. This subsection specifies: <ul> <li> <code> snapshot_sql </code> : A query that selects the tables to include in the dataset (the default is to include all tables if you don't specify a query here). </li> <li> <code> columns </code> : A list of the columns you are interested in (the default is to include all columns if you don't supply a list) </li> <li> <code> keys </code> : A list of primary keys, one for each table. If the table doesn't have a column with a <a href="https://www.w3schools.com/sql/sql_primarykey.asp"> <code> PRIMARY KEY </code> </a> or <a href="https://www.w3schools.com/sql/sql_unique.asp"> <code> UNIQUE </code> </a> constraint then you can supply a unique composite key. </li> </ul> </li> <li> <code> advanced </code> : These optional properties configure other Debezium-specific features. The available sub-sections are: <ul> <li> <code> sink </code> : All advanced properties for writing to RDI (TLS, memory threshold, etc). See the Debezium <a href="https://debezium.io/documentation/reference/stable/operations/debezium-server.html#_redis_stream"> Redis stream properties </a> page for the full set of available properties. </li> <li> <code> source </code> : All advanced connector properties (for example, RAC nodes). See <a href="#db-connect-props"> Database-specific connection properties </a> below and also see the Debezium <a href="https://debezium.io/documentation/reference/stable/connectors/"> Connectors </a> pages for more information about the properties available for each database type. </li> <li> <code> quarkus </code> : All advanced properties for Debezium server, such as the log level. See the Quarkus <a href="https://quarkus.io/guides/all-config"> Configuration options </a> docs for the full set of available properties. </li> </ul> </li> </ul> <h3 id="targets"> Targets </h3> <p> Use this section to provide the connection details for the target Redis database(s). As with the sources, you should start each target section with a unique name that you are free to choose (here, we have used <code> my-redis </code> as an example). In the <code> connection </code> section, you can supply the <code> type </code> of target database, which will generally be <code> redis </code> along with the <code> host </code> and <code> port </code> of the server. You can also supply connection credentials and TLS/mTLS secrets here if you use them. </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> If you specify <code> localhost </code> as the address of either the source or target server during installation then the connection will fail if the actual IP address changes for the local VM. For this reason, we recommend that you don't use <code> localhost </code> for the address. However, if you do encounter this problem, you can fix it using the following commands on the VM that is running RDI itself: </p> <div class="highlight"> <pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">sudo k3s kubectl delete nodes --all </span></span><span class="line"><span class="cl">sudo service k3s restart </span></span></code></pre> </div> </div> </div> <h2 id="job-files"> Job files </h2> <p> You can optionally supply one or more job files that specify how you want to transform the captured data before writing it to the target. Each job file contains a YAML configuration that controls the transformation for a particular table from the source database. You can also add a <code> default-job.yaml </code> file to provide a default transformation for tables that don't have a specific job file of their own. </p> <p> The job files have a structure like the following example. This configures a default job that: </p> <ul> <li> Writes the data to a Redis hash </li> <li> Adds a field <code> app_code </code> to the hash with a value of <code> foo </code> </li> <li> Adds a prefix of <code> aws </code> and a suffix of <code> gcp </code> to the key </li> </ul> <div class="highlight"> <pre class="chroma"><code class="language-yaml" data-lang="yaml"><span class="line"><span class="cl"><span class="nt">source</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">table</span><span class="p">:</span><span class="w"> </span><span class="s2">"*"</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">row_format</span><span class="p">:</span><span class="w"> </span><span class="l">full</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">transform</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="nt">uses</span><span class="p">:</span><span class="w"> </span><span class="l">add_field</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">with</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">fields</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="nt">field</span><span class="p">:</span><span class="w"> </span><span class="l">after.app_code</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">expression</span><span class="p">:</span><span class="w"> </span><span class="s2">"`foo`"</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">language</span><span class="p">:</span><span class="w"> </span><span class="l">jmespath</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">output</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="nt">uses</span><span class="p">:</span><span class="w"> </span><span class="l">redis.write</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">with</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">data_type</span><span class="p">:</span><span class="w"> </span><span class="l">hash</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">key</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">expression</span><span class="p">:</span><span class="w"> </span><span class="l">concat(['aws', '#', table, '#', keys(key)[0], '#', values(key)[0], '#gcp'])</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">language</span><span class="p">:</span><span class="w"> </span><span class="l">jmespath</span><span class="w"> </span></span></span></code></pre> </div> <p> The main sections of these files are: </p> <ul> <li> <p> <code> source </code> : This is a mandatory section that specifies the data items that you want to use. You can add the following properties here: </p> <ul> <li> <code> server_name </code> : Logical server name (optional). This corresponds to the <code> debezium.source.topic.prefix </code> property specified in the Debezium Server's <code> application.properties </code> config file. </li> <li> <code> db </code> : Database name (optional) </li> <li> <code> schema </code> : Database schema (optional) </li> <li> <code> table </code> : Database table name. This refers to a table name you supplied in <code> config.yaml </code> . The default job doesn't apply to a specific table, so use "*" in place of the table name for this job only. </li> <li> <code> row_format </code> : Format of the data to be transformed. This can take the values <code> data_only </code> (default) to use only the payload data, or <code> full </code> to use the complete change record. See the <code> transform </code> section below for details of the extra data you can access when you use the <code> full </code> option. </li> <li> <code> case_insensitive </code> : This applies to the <code> server_name </code> , <code> db </code> , <code> schema </code> , and <code> table </code> properties and is set to <code> true </code> by default. Set it to <code> false </code> if you need to use case-sensitive values for these properties. </li> </ul> </li> <li> <p> <code> transform </code> : This is an optional section describing the transformation that the pipeline applies to the data before writing it to the target. The <code> uses </code> property specifies a <em> transformation block </em> that will use the parameters supplied in the <code> with </code> section. See the <a href="/docs/latest/integrate/redis-data-integration/reference/data-transformation/"> data transformation reference </a> for more details about the supported transformation blocks, and also the <a href="/docs/latest/integrate/redis-data-integration/reference/jmespath-custom-functions/"> JMESPath custom functions </a> reference. </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> If you set <code> row_format </code> to <code> full </code> under the <code> source </code> settings, you can access extra data from the change record in the transformation: </p> <ul> <li> Use the expression <code> key.key </code> to get the generated Redis key as a string. </li> <li> Use <code> before.&lt;FIELD_NAME&gt; </code> to get the value of a field <em> before </em> it was updated in the source database (the field name by itself gives you the value <em> after </em> the update). </li> </ul> </div> </div> </li> <li> <p> <code> output </code> : This is a mandatory section to specify the data structure(s) that RDI will write to the target along with the text pattern for the key(s) that will access it. Note that you can map one record to more than one key in Redis or nest a record as a field of a JSON structure (see <a href="/docs/latest/integrate/redis-data-integration/data-pipelines/data-denormalization/"> Data denormalization </a> for more information about nesting). You can add the following properties in the <code> output </code> section: </p> <ul> <li> <code> uses </code> : This must have the value <code> redis.write </code> to specify writing to a Redis data structure. You can add more than one block of this type in the same job. </li> <li> <code> with </code> : <ul> <li> <code> connection </code> : Connection name as defined in <code> config.yaml </code> (by default, the connection named <code> target </code> is used). </li> <li> <code> data_type </code> : Target data structure when writing data to Redis. The supported types are <code> hash </code> , <code> json </code> , <code> set </code> , <code> sorted_set </code> , <code> stream </code> and <code> string </code> . </li> <li> <code> key </code> : This lets you override the default key for the data structure with custom logic: <ul> <li> <code> expression </code> : Expression to generate the key. </li> <li> <code> language </code> : Expression language, which must be <code> jmespath </code> or <code> sql </code> . </li> </ul> </li> <li> <code> expire </code> : Positive integer value indicating a number of seconds for the key to expire. If you don't specify this property, the key will never expire. </li> </ul> </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> In a job file, the <code> transform </code> section is optional, but if you don't specify a <code> transform </code> , you must specify custom key logic in <code> output.with.key </code> . You can include both of these sections if you want both a custom transform and a custom key. </div> </div> <p> Another example below shows how you can rename the <code> fname </code> field to <code> first_name </code> in the table <code> emp </code> using the <a href="/docs/latest/integrate/redis-data-integration/reference/data-transformation/rename_field/"> <code> rename_field </code> </a> block. It also demonstrates how you can set the key of this record instead of relying on the default logic. (See the <a href="/docs/latest/integrate/redis-data-integration/data-pipelines/transform-examples/"> Transformation examples </a> section for more examples of job files.) </p> <div class="highlight"> <pre class="chroma"><code class="language-yaml" data-lang="yaml"><span class="line"><span class="cl"><span class="nt">source</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">server_name</span><span class="p">:</span><span class="w"> </span><span class="l">redislabs</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">schema</span><span class="p">:</span><span class="w"> </span><span class="l">dbo</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">table</span><span class="p">:</span><span class="w"> </span><span class="l">emp</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">transform</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="nt">uses</span><span class="p">:</span><span class="w"> </span><span class="l">rename_field</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">with</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">from_field</span><span class="p">:</span><span class="w"> </span><span class="l">fname</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">to_field</span><span class="p">:</span><span class="w"> </span><span class="l">first_name</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">output</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="nt">uses</span><span class="p">:</span><span class="w"> </span><span class="l">redis.write</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">with</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">connection</span><span class="p">:</span><span class="w"> </span><span class="l">target</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">key</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">expression</span><span class="p">:</span><span class="w"> </span><span class="l">concat(['emp:fname:',fname,':lname:',lname])</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">language</span><span class="p">:</span><span class="w"> </span><span class="l">jmespath</span><span class="w"> </span></span></span></code></pre> </div> <p> See the <a href="/docs/latest/integrate/redis-data-integration/reference/config-yaml-reference/"> RDI configuration file </a> reference for full details about the available source, transform, and target configuration options and see also the <a href="/docs/latest/integrate/redis-data-integration/reference/data-transformation/"> data transformation reference </a> for details of all the available transformation blocks. </p> <h2 id="source-preparation"> Source preparation </h2> <p> Before using the pipeline you must first prepare your source database to use the Debezium connector for <em> change data capture (CDC) </em> . See the <a href="/docs/latest/integrate/redis-data-integration/architecture/#overview"> architecture overview </a> for more information about CDC. Each database type has a different set of preparation steps. You can find the preparation guides for the databases that RDI supports in the <a href="/docs/latest/integrate/redis-data-integration/data-pipelines/prepare-dbs/"> Prepare source databases </a> section. </p> <h2 id="deploy-a-pipeline"> Deploy a pipeline </h2> <p> When your configuration is ready, you must deploy it to start using the pipeline. See <a href="/docs/latest/integrate/redis-data-integration/data-pipelines/deploy/"> Deploy a pipeline </a> to learn how to do this. </p> <h2 id="ingest-pipeline-lifecycle"> Ingest pipeline lifecycle </h2> <p> Once you have created the configuration for a pipeline, it goes through the following phases: </p> <ol> <li> <em> Deploy </em> - when you deploy the pipeline, RDI first validates it before use. Then, the <a href="/docs/latest/integrate/redis-data-integration/architecture/#how-rdi-is-deployed"> operator </a> creates and configures the collector and stream processor that will run the pipeline. </li> <li> <em> Snapshot </em> - The collector starts the pipeline by creating a snapshot of the full dataset. This involves reading all the relevant source data, transforming it and then writing it into the Redis target. You should expect this phase to take minutes or hours to complete if you have a lot of data. </li> <li> <em> CDC </em> - Once the snapshot is complete, the collector starts listening for updates to the source data. Whenever a change is committed to the source, the collector captures it and adds it to the target through the pipeline. This phase continues indefinitely unless you change the pipeline configuration. </li> <li> <em> Update </em> - If you update the pipeline configuration, the operator starts applying it to the processor and the collector. Note that the changes only affect newly-captured data unless you reset the pipeline completely. Once RDI has accepted the updates, the pipeline returns to the CDC phase with the new configuration. </li> <li> <em> Reset </em> - There are circumstances where you might want to rebuild the dataset completely. For example, you might want to apply a new transformation to all the source data or refresh the dataset if RDI is disconnected from the source for a long time. In situations like these, you can <em> reset </em> the pipeline back to the snapshot phase. When this is complete, the pipeline continues with CDC as usual. </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/integrate/redis-data-integration/data-pipelines/data-pipelines/"/> <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/commands/memory-malloc-stats/.html
<section class="prose w-full py-12"> <h1 class="command-name"> MEMORY MALLOC-STATS </h1> <div class="font-semibold text-redis-ink-900"> Syntax </div> <pre class="command-syntax">MEMORY MALLOC-STATS</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"> 4.0.0 </dd> <dt class="font-semibold text-redis-ink-900 m-0"> Time complexity: </dt> <dd class="m-0"> Depends on how much memory is allocated, could be slow </dd> <dt class="font-semibold text-redis-ink-900 m-0"> ACL categories: </dt> <dd class="m-0"> <code> @slow </code> <span class="mr-1 last:hidden"> , </span> </dd> </dl> <p> The <code> MEMORY MALLOC-STATS </code> command provides an internal statistics report from the memory allocator. </p> <p> This command is currently implemented only when using <strong> jemalloc </strong> as an allocator, and evaluates to a benign NOOP for all others. </p> <h2 id="resp2-reply"> RESP2 Reply </h2> <a href="../../develop/reference/protocol-spec#bulk-strings"> Bulk string reply </a> : the memory allocator's internal statistics report <h2 id="resp3-reply"> RESP3 Reply </h2> <a href="../../develop/reference/protocol-spec#bulk-strings"> Bulk string reply </a> : The memory allocator's internal statistics report. <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/memory-malloc-stats/"/> <div class="flex flex-row justify-between"> <div class="grid justify-center"> <span class="font-mono"> RATE THIS PAGE </span> <div class="star-rating"> <input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/> <label class="star" for="5-stars"> β˜… </label> <input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/> <label class="star" for="4-stars"> β˜… </label> <input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/> <label class="star" for="3-stars"> β˜… </label> <input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/> <label class="star" for="2-stars"> β˜… </label> <input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/> <label class="star" for="1-stars"> β˜… </label> </div> </div> <a class="font-mono no-underline" href="#"> Back to top ↑ </a> </div> <div class="hidden" id="feedback-form"> <div class="grid gap-2"> <textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea> <button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit"> Submit </button> </div> </div> </form> <script> document.addEventListener("DOMContentLoaded", function() { const form = document.querySelector("#page-feedback"); form.addEventListener("submit", function(event) { event.preventDefault(); var xhr = new XMLHttpRequest(); var url = "\/docusight\/api\/rate"; var params = new URLSearchParams(new FormData(form)); xhr.open("POST", url, true); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.onreadystatechange = function() { if (xhr.readyState === 4 && xhr.status === 200) { const responseData = JSON.parse(xhr.responseText); const responseMessage = responseData.response; const newText = document.createTextNode(responseMessage); form.parentNode.replaceChild(newText, form); } }; xhr.send(params); }); }); </script> </section>
https://redis.io/docs/latest/commands/geoadd/.html
<section class="prose w-full py-12"> <h1 class="command-name"> GEOADD </h1> <div class="font-semibold text-redis-ink-900"> Syntax </div> <pre class="command-syntax">GEOADD key [NX | XX] [CH] longitude latitude member [longitude latitude member ...]</pre> <dl class="grid grid-cols-[auto,1fr] gap-2 mb-12"> <dt class="font-semibold text-redis-ink-900 m-0"> Available since: </dt> <dd class="m-0"> 3.2.0 </dd> <dt class="font-semibold text-redis-ink-900 m-0"> Time complexity: </dt> <dd class="m-0"> O(log(N)) for each item added, where N is the number of elements in the sorted set. </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> @geo </code> <span class="mr-1 last:hidden"> , </span> <code> @slow </code> <span class="mr-1 last:hidden"> , </span> </dd> </dl> <p> Adds the specified geospatial items (longitude, latitude, name) to the specified key. Data is stored into the key as a sorted set, in a way that makes it possible to query the items with the <a href="/docs/latest/commands/geosearch/"> <code> GEOSEARCH </code> </a> command. </p> <p> The command takes arguments in the standard format x,y so the longitude must be specified before the latitude. There are limits to the coordinates that can be indexed: areas very near to the poles are not indexable. </p> <p> The exact limits, as specified by EPSG:900913 / EPSG:3785 / OSGEO:41001 are the following: </p> <ul> <li> Valid longitudes are from -180 to 180 degrees. </li> <li> Valid latitudes are from -85.05112878 to 85.05112878 degrees. </li> </ul> <p> The command will report an error when the user attempts to index coordinates outside the specified ranges. </p> <p> <strong> Note: </strong> there is no <strong> GEODEL </strong> command because you can use <a href="/docs/latest/commands/zrem/"> <code> ZREM </code> </a> to remove elements. The Geo index structure is just a sorted set. </p> <h2 id="geoadd-options"> GEOADD options </h2> <p> <code> GEOADD </code> also provides the following options: </p> <ul> <li> <strong> XX </strong> : Only update elements that already exist. Never add elements. </li> <li> <strong> NX </strong> : Don't update already existing elements. Always add new elements. </li> <li> <strong> CH </strong> : Modify the return value from the number of new elements added, to the total number of elements changed (CH is an abbreviation of <em> changed </em> ). Changed elements are <strong> new elements added </strong> and elements already existing for which <strong> the coordinates was updated </strong> . So elements specified in the command line having the same score as they had in the past are not counted. Note: normally, the return value of <code> GEOADD </code> only counts the number of new elements added. </li> </ul> <p> Note: The <strong> XX </strong> and <strong> NX </strong> options are mutually exclusive. </p> <h2 id="how-does-it-work"> How does it work? </h2> <p> The way the sorted set is populated is using a technique called <a href="https://en.wikipedia.org/wiki/Geohash"> Geohash </a> . Latitude and Longitude bits are interleaved to form a unique 52-bit integer. We know that a sorted set double score can represent a 52-bit integer without losing precision. </p> <p> This format allows for bounding box and radius querying by checking the 1+8 areas needed to cover the whole shape and discarding elements outside it. The areas are checked by calculating the range of the box covered, removing enough bits from the less significant part of the sorted set score, and computing the score range to query in the sorted set for each area. </p> <h2 id="what-earth-model-does-it-use"> What Earth model does it use? </h2> <p> The model assumes that the Earth is a sphere since it uses the Haversine formula to calculate distance. This formula is only an approximation when applied to the Earth, which is not a perfect sphere. The introduced errors are not an issue when used, for example, by social networks and similar applications requiring this type of querying. However, in the worst case, the error may be up to 0.5%, so you may want to consider other systems for error-critical applications. </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; GEOADD Sicily 13.361389 38.115556 "Palermo" 15.087269 37.502669 "Catania" (integer) 2 redis&gt; GEODIST Sicily Palermo Catania "166274.1516" redis&gt; GEORADIUS Sicily 15 37 100 km 1) "Catania" redis&gt; GEORADIUS Sicily 15 37 200 km 1) "Palermo" 2) "Catania" </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> : When used without optional arguments, the number of elements added to the sorted set (excluding score updates). If the CH option is specified, the number of elements that were changed (added or updated). <br/> <h2> History </h2> <ul> <li> Starting with Redis version 6.2.0: Added the <code> CH </code> , <code> NX </code> and <code> XX </code> options. </li> </ul> <form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback"> <input class="hidden" name="origin" value="https://redis.io/docs/latest/commands/geoadd/"/> <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-graph/.html
<section class="prose w-full py-12"> <h1 class="command-name"> LATENCY GRAPH </h1> <div class="font-semibold text-redis-ink-900"> Syntax </div> <pre class="command-syntax">LATENCY GRAPH event</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> Produces an ASCII-art style graph for the specified event. </p> <p> <code> LATENCY GRAPH </code> lets you intuitively understand the latency trend of an <code> event </code> via state-of-the-art visualization. It can be used for quickly grasping the situation before resorting to means such parsing the raw data from <a href="/docs/latest/commands/latency-history/"> <code> LATENCY HISTORY </code> </a> or external tooling. </p> <p> Valid values for <code> event </code> are: </p> <ul> <li> <code> active-defrag-cycle </code> </li> <li> <code> aof-fsync-always </code> </li> <li> <code> aof-stat </code> </li> <li> <code> aof-rewrite-diff-write </code> </li> <li> <code> aof-rename </code> </li> <li> <code> aof-write </code> </li> <li> <code> aof-write-active-child </code> </li> <li> <code> aof-write-alone </code> </li> <li> <code> aof-write-pending-fsync </code> </li> <li> <code> command </code> </li> <li> <code> expire-cycle </code> </li> <li> <code> eviction-cycle </code> </li> <li> <code> eviction-del </code> </li> <li> <code> fast-command </code> </li> <li> <code> fork </code> </li> <li> <code> rdb-unlink-temp-file </code> </li> </ul> <h2 id="examples"> Examples </h2> <pre tabindex="0"><code>127.0.0.1:6379&gt; latency reset command (integer) 0 127.0.0.1:6379&gt; debug sleep .1 OK 127.0.0.1:6379&gt; debug sleep .2 OK 127.0.0.1:6379&gt; debug sleep .3 OK 127.0.0.1:6379&gt; debug sleep .5 OK 127.0.0.1:6379&gt; debug sleep .4 OK 127.0.0.1:6379&gt; latency graph command command - high 500 ms, low 101 ms (all time high 500 ms) -------------------------------------------------------------------------------- #_ _|| _||| _|||| 11186 542ss sss </code></pre> <p> The vertical labels under each graph column represent the amount of seconds, minutes, hours or days ago the event happened. For example "15s" means that the first graphed event happened 15 seconds ago. </p> <p> The graph is normalized in the min-max scale so that the zero (the underscore in the lower row) is the minimum, and a # in the higher row is the maximum. </p> <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#bulk-strings"> Bulk string reply </a> : Latency graph <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-graph/"/> <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/encryption/.html
<section class="prose w-full py-12 max-w-none"> <h1> Encrypt REST API requests </h1> <h2 id="require-https-for-api-endpoints"> Require HTTPS for API endpoints </h2> <p> By default, the Redis Enterprise Software API supports communication over HTTP and HTTPS. However, you can turn off support for HTTP to ensure that API requests are encrypted. </p> <p> Before you turn off HTTP support, be sure to migrate any scripts or proxy configurations that use HTTP to the encrypted API endpoint to prevent broken connections. </p> <p> To turn off HTTP support for API endpoints, run: </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">rladmin cluster config http_support disabled </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/rest-api/encryption/"/> <div class="flex flex-row justify-between"> <div class="grid justify-center"> <span class="font-mono"> RATE THIS PAGE </span> <div class="star-rating"> <input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/> <label class="star" for="5-stars"> β˜… </label> <input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/> <label class="star" for="4-stars"> β˜… </label> <input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/> <label class="star" for="3-stars"> β˜… </label> <input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/> <label class="star" for="2-stars"> β˜… </label> <input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/> <label class="star" for="1-stars"> β˜… </label> </div> </div> <a class="font-mono no-underline" href="#"> Back to top ↑ </a> </div> <div class="hidden" id="feedback-form"> <div class="grid gap-2"> <textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea> <button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit"> Submit </button> </div> </div> </form> <script> document.addEventListener("DOMContentLoaded", function() { const form = document.querySelector("#page-feedback"); form.addEventListener("submit", function(event) { event.preventDefault(); var xhr = new XMLHttpRequest(); var url = "\/docusight\/api\/rate"; var params = new URLSearchParams(new FormData(form)); xhr.open("POST", url, true); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.onreadystatechange = function() { if (xhr.readyState === 4 && xhr.status === 200) { const responseData = JSON.parse(xhr.responseText); const responseMessage = responseData.response; const newText = document.createTextNode(responseMessage); form.parentNode.replaceChild(newText, form); } }; xhr.send(params); }); }); </script> </section>
https://redis.io/docs/latest/operate/rs/7.4/references/rest-api/requests/bdbs/modules/upgrade/.html
<section class="prose w-full py-12 max-w-none"> <h1> Database upgrade modules requests </h1> <p class="text-lg -mt-5 mb-10"> Upgrade Redis module requests </p> <table> <thead> <tr> <th> Method </th> <th> Path </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> <a href="#post-bdb-modules-upgrade"> POST </a> </td> <td> <code> /v1/bdbs/{uid}/modules/upgrade </code> </td> <td> Upgrade module </td> </tr> </tbody> </table> <h2 id="post-bdb-modules-upgrade"> Upgrade module </h2> <pre><code>POST /v1/bdbs/{string: uid}/modules/upgrade </code></pre> <p> Upgrades module version on a specific BDB. </p> <h4 id="required-permissions"> Required permissions </h4> <table> <thead> <tr> <th> Permission name </th> </tr> </thead> <tbody> <tr> <td> <a href="/docs/latest/operate/rs/7.4/references/rest-api/permissions/#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 /bdbs/1/modules/upgrade </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 class="nt">"module_name"</span><span class="p">:</span> <span class="s2">"ReJson"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"current_semantic_version"</span><span class="p">:</span> <span class="s2">"2.2.1"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"new_module"</span><span class="p">:</span> <span class="s2">"aa3648d79bd4082d414587c42ea0b234"</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">"// Optional fields to fine-tune restart and failover behavior:"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"preserve_roles"</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">"may_discard_data"</span><span class="p">:</span> <span class="kc">false</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 </td> <td> List of dicts representing the modules that will be upgraded. Each dict must include: <br/> <br/> β€’ <strong> current_module </strong> : uid of a module to upgrade <br/> <br/> β€’ <strong> new_module </strong> : UID of the module we want to upgrade to <br/> <br/> β€’ <strong> new_module_args </strong> : args list for the new module </td> </tr> <tr> <td> preserve_roles </td> <td> boolean </td> <td> Preserve shards’ master/replica roles (optional) </td> </tr> <tr> <td> may_discard_data </td> <td> boolean </td> <td> Discard data in a non-replicated non-persistent bdb (optional) </td> </tr> </tbody> </table> <h3 id="post-response"> Response </h3> <p> Returns the upgraded <a href="/docs/latest/operate/rs/7.4/references/rest-api/objects/module/"> module 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">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">"name of database #1"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"module_id"</span><span class="p">:</span> <span class="s2">"aa3648d79bd4082d414587c42ea0b234"</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">"ReJson"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"semantic_version"</span><span class="p">:</span> <span class="s2">"2.2.2"</span> </span></span><span class="line"><span class="cl"> <span class="s2">"// additional fields..."</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> 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> missing_module </td> <td> Module is not present in cluster. </td> </tr> <tr> <td> module_downgrade_unsupported </td> <td> Module downgrade is not allowed. </td> </tr> <tr> <td> redis_incompatible_version </td> <td> Module min_redis_version is bigger than the current Redis version. </td> </tr> <tr> <td> redis_pack_incompatible_version </td> <td> Module min_redis_pack_version is bigger than the current Redis Enterprise version. </td> </tr> <tr> <td> unsupported_module_capabilities </td> <td> New version of module does support all the capabilities needed for the database configuration </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 or node 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> The requested configuration is invalid. </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/bdbs/modules/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/7.4/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/7.4/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/7.4/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/7.4/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/7.4/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/7.4/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/7.4/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/7.4/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/7.4/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/7.4/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/develop/data-types/timeseries/.html
<section class="prose w-full py-12 max-w-none"> <h1> Time series </h1> <p class="text-lg -mt-5 mb-10"> Ingest and query time series data with Redis </p> <p> <a href="https://discord.gg/KExRgMb"> <img alt="Discord" src="https://img.shields.io/discord/697882427875393627?style=flat-square"/> </a> <a href="https://github.com/RedisTimeSeries/RedisTimeSeries/"> <img alt="Github" src="https://img.shields.io/static/v1?label=&amp;message=repository&amp;color=5961FF&amp;logo=github"/> </a> </p> <p> The Redis time series structure lets you store and query timestamped data points. </p> <p> Redis time series is not available by default in the basic Redis server, so you should install Redis Stack or Redis Enterprise, both of which include time series 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="features"> Features </h2> <ul> <li> High volume inserts, low latency reads </li> <li> Query by start time and end-time </li> <li> Aggregated queries (min, max, avg, sum, range, count, first, last, STD.P, STD.S, Var.P, Var.S, twa) for any time bucket </li> <li> Configurable maximum retention period </li> <li> Compaction for automatically updated aggregated timeseries </li> <li> Secondary indexing for time series entries. Each time series has labels (field value pairs) which will allows to query by labels </li> </ul> <h2 id="client-libraries"> Client libraries </h2> <p> Official and community client libraries in Python, Java, JavaScript, Ruby, Go, C#, Rust, and PHP. </p> <p> See the <a href="clients"> clients page </a> for the full list. </p> <h2 id="using-with-other-metrics-tools"> Using with other metrics tools </h2> <p> In the <a href="https://github.com/RedisTimeSeries"> RedisTimeSeries </a> GitHub organization you can find projects that help you integrate RedisTimeSeries with other tools, including: </p> <ol> <li> <a href="https://github.com/RedisTimeSeries/prometheus-redistimeseries-adapter"> Prometheus </a> , read/write adapter to use RedisTimeSeries as backend db. </li> <li> <a href="https://github.com/RedisTimeSeries/grafana-redis-datasource"> Grafana 7.1+ </a> , using the <a href="https://redislabs.com/blog/introducing-the-redis-data-source-plug-in-for-grafana/"> Redis Data Source </a> . </li> <li> <a href="https://github.com/influxdata/telegraf"> Telegraf </a> . Download the plugin from <a href="https://portal.influxdata.com/downloads/"> InfluxData </a> . </li> <li> StatsD, Graphite exports using graphite protocol. </li> </ol> <h2 id="memory-model"> Memory model </h2> <p> A time series is a linked list of memory chunks. Each chunk has a predefined size of samples. Each sample is a 128-bit tuple: 64 bits for the timestamp and 64 bits for the value. </p> <h2 id="forum"> Forum </h2> <p> Got questions? Feel free to ask at the <a href="https://forum.redislabs.com/c/modules/redistimeseries"> RedisTimeSeries mailing list </a> . </p> <h2 id="license"> License </h2> <p> RedisTimeSeries is licensed under the <a href="https://redis.com/legal/rsalv2-agreement"> Redis Source Available License 2.0 (RSALv2) </a> or the <a href="https://www.mongodb.com/licensing/server-side-public-license"> Server Side Public License v1 (SSPLv1) </a> . </p> <nav> <a href="/docs/latest/develop/data-types/timeseries/quickstart/"> Quickstart </a> <p> Quick Start Guide to Time Series </p> <a href="/docs/latest/develop/data-types/timeseries/configuration/"> Configuration Parameters </a> <p> RedisTimeSeries supports multiple module configuration parameters. All of these parameters can only be set at load-time. </p> <a href="/docs/latest/develop/data-types/timeseries/development/"> Development </a> <p> Developing RedisTimeSeries </p> <a href="/docs/latest/develop/data-types/timeseries/clients/"> Clients </a> <p> Time Series Client Libraries </p> <a href="/docs/latest/develop/data-types/timeseries/reference/"> Reference </a> <p> Reference </p> <a href="/docs/latest/develop/data-types/timeseries/use_cases/"> Use cases </a> <p> Time series use cases </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/data-types/timeseries/"/> <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/7-2-4-releases/7-2-4-7/.html
<section class="prose w-full py-12 max-w-none"> <h1> Redis Enterprise for Kubernetes release notes 7.2.4-7 (Oct 2023) </h1> <p class="text-lg -mt-5 mb-10"> This is a minor maintenance release with a few enhancements/fixes on the Kubernetes product, and a newer Redis Enterprise container version. </p> <h2 id="highlights"> Highlights </h2> <p> This is a minor maintenance release with a few enhancement/fixes on the Kubernetes product, and a newer Redis Enterprise container version. </p> <p> The following are the notable changes: </p> <ul> <li> Customers who are on RHEL 7 based images and who are already using this version of 7.2 can migrate to RHEL 8 based images when they upgrade. <ul> <li> Previously, you could not migrate a cluster to newer OS version. </li> <li> All customers should plan to move to RHEL 8 based images. The next major version of Redis Enterprise will not support RHEL 7. </li> <li> This process requires specific pre-requisites and actions. Updated guides are being developed and will be available soon. </li> </ul> </li> <li> Added VMware TKG 2.1 and 2.2 to the <a href="#supported-distributions"> Supported distributions </a> table. </li> </ul> <h2 id="new-in-this-release"> New in this release </h2> <h3 id="enhancements"> Enhancements </h3> <ul> <li> Support for migration from RHEL7 images to RHEL8 during upgrade (RED-106785) </li> <li> Support for Redis Enterprise Software version 7.2.4-64 (RED-108832) </li> </ul> <h3 id="resolved-issues"> Resolved issues </h3> <ul> <li> Fixed cluster recovery flow when non default modules are used (RED-107711 RED-106872) </li> </ul> <h2 id="version-changes"> Version changes </h2> <p> For a list of fixes related to CVEs, see the <a href="/docs/latest/operate/rs/release-notes/rs-7-2-4-releases/rs-7-2-4-64/#security"> Redis Enterprise 7.2.4-64 release notes </a> . </p> <h3 id="breaking-changes"> Breaking changes </h3> <p> The following changes included in this release affect the upgrade process. Please read carefully before upgrading to 7.2.4-7. </p> <h4 id="validatingwebhookconfiguration"> ValidatingWebhookConfiguration </h4> <p> Versions 6.4.2-4 and later include a new <code> ValidatingWebhookConfiguration </code> resource to replace the <code> redb-admission </code> webhook resource. To use releases 6.4.2-4 or later, delete the old webhook resource and apply the new file. See <a href="/docs/latest/operate/kubernetes/upgrade/upgrade-redis-cluster/#reapply-webhook"> upgrade Redis cluster </a> for instructions. </p> <h4 id="openshift-scc"> OpenShift SCC </h4> <p> Versions 6.4.2-6 and later include a new SCC ( <code> redis-enterprise-scc-v2 </code> ) that you need to bind to your service account before upgrading. OpenShift clusters running version 6.2.12 or earlier upgrading to version 6.2.18 or later might get stuck if you skip this step. See <a href="/docs/latest/operate/kubernetes/upgrade/upgrade-redis-cluster/#before-upgrading"> upgrade a Redis Enterprise cluster (REC) </a> for instructions. </p> <h3 id="upcoming-changes"> Upcoming changes </h3> <ul> <li> A future release of Redis Enterprise will remove support for RHEL7. We recommend migrating to RHEL8. </li> </ul> <h3 id="supported-distributions"> Supported distributions </h3> <p> The following table shows supported distributions at the time of this release. You can also find this list in <a href="/docs/latest/operate/kubernetes/reference/supported_k8s_distributions/"> Supported Kubernetes distributions </a> . </p> <p> <span title="Check mark icon"> βœ… </span> Supported – This distribution is supported for this version of Redis Enterprise Software for Kubernetes. </p> <p> <span title="Warning icon"> ⚠️ </span> Deprecated – This distribution is still supported for this version of Redis Enterprise Software for Kubernetes, but support will be removed in a future release. </p> <p> <span title="X icon"> ❌ </span> End of life – Support for this distribution ended. </p> <p> Any distribution not listed below is not supported for production workloads. </p> <table> <thead> <tr> <th> <strong> Kubernetes version </strong> </th> <th> <strong> 1.22 </strong> </th> <th> <strong> 1.23 </strong> </th> <th> <strong> 1.24 </strong> </th> <th> <strong> 1.25 </strong> </th> <th> <strong> 1.26 </strong> </th> <th> <strong> 1.27 </strong> </th> </tr> </thead> <tbody> <tr> <td> Community Kubernetes </td> <td> <span title="X icon"> ❌ </span> </td> <td> <span title="X icon"> ❌ </span> </td> <td> <span title="Check mark icon"> βœ… </span> </td> <td> <span title="Check mark icon"> βœ… </span> </td> <td> <span title="Check mark icon"> βœ… </span> </td> <td> <span title="Check mark icon"> βœ… </span> </td> </tr> <tr> <td> Amazon EKS </td> <td> <span title="End of life"> ❌ </span> </td> <td> <span title="Deprecation warning"> ⚠️ </span> </td> <td> <span title="Supported"> βœ… </span> </td> <td> <span title="Supported"> βœ… </span> </td> <td> <span title="Supported"> βœ… </span> </td> <td> <span title="Supported"> βœ… </span> </td> </tr> <tr> <td> Azure AKS </td> <td> </td> <td> <span title="X icon"> ❌ </span> </td> <td> <span title="X icon"> ❌ </span> </td> <td> <span title="Check mark icon"> βœ… </span> </td> <td> <span title="Check mark icon"> βœ… </span> </td> <td> <span title="Check mark icon"> βœ… </span> </td> </tr> <tr> <td> Google GKE </td> <td> <span title="X icon"> ❌ </span> </td> <td> <span title="Warning icon"> ⚠️ </span> </td> <td> <span title="Check mark icon"> βœ… </span> </td> <td> <span title="Check mark icon"> βœ… </span> </td> <td> <span title="Check mark icon"> βœ… </span> </td> <td> <span title="Check mark icon"> βœ… </span> </td> </tr> <tr> <td> Rancher 2.6 </td> <td> <span title="X icon"> ❌ </span> </td> <td> <span title="X icon"> ❌ </span> </td> <td> <span title="Warning icon"> ⚠️ </span> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> Rancher 2.7 </td> <td> </td> <td> <span title="Warning icon"> ⚠️ </span> </td> <td> <span title="Check mark icon"> βœ… </span> </td> <td> <span title="Check mark icon"> βœ… </span> </td> <td> </td> <td> </td> </tr> <tr> <td> VMware TKG 1.6 </td> <td> <span title="Warning icon"> ⚠️ </span> </td> <td> <span title="Warning icon"> ⚠️ </span> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> VMware TKG 2.1 </td> <td> <span title="Warning icon"> ⚠️ </span> </td> <td> <span title="Warning icon"> ⚠️ </span> </td> <td> <span title="Check mark icon"> βœ… </span> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> VMware TKG 2.2 </td> <td> </td> <td> <span title="Check mark icon"> βœ… </span> </td> <td> <span title="Check mark icon"> βœ… </span> </td> <td> <span title="Check mark icon"> βœ… </span> </td> <td> </td> <td> </td> </tr> <tr> <td> <strong> OpenShift version </strong> </td> <td> <strong> 4.9 </strong> </td> <td> <strong> 4.10 </strong> </td> <td> <strong> 4.11 </strong> </td> <td> <strong> 4.12 </strong> </td> <td> <strong> 4.13 </strong> </td> <td> </td> </tr> <tr> <td> </td> <td> <span title="X icon"> ❌ </span> </td> <td> <span title="Warning icon"> ⚠️ </span> </td> <td> <span title="Check mark icon"> βœ… </span> </td> <td> <span title="Check mark icon"> βœ… </span> </td> <td> <span title="Check mark icon"> βœ… </span> </td> <td> </td> </tr> <tr> <td> <strong> VMware TKGI version </strong> </td> <td> <strong> 1.13 </strong> </td> <td> <strong> 1.14 </strong> </td> <td> <strong> 1.15 </strong> </td> <td> <strong> 1.16 </strong> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> <span title="X icon"> ❌ </span> </td> <td> <span title="Warning icon"> ⚠️ </span> </td> <td> <span title="Check mark icon"> βœ… </span> </td> <td> <span title="Check mark icon"> βœ… </span> </td> <td> </td> <td> </td> </tr> </tbody> </table> <h2 id="downloads"> Downloads </h2> <ul> <li> <strong> Redis Enterprise </strong> : <code> redislabs/redis:7.2.4-64 </code> </li> <li> <strong> Operator </strong> : <code> redislabs/operator:7.2.4-7 </code> </li> <li> <strong> Services Rigger </strong> : <code> redislabs/k8s-controller:7.2.4-7. </code> </li> </ul> <h4 id="openshift-images"> OpenShift images </h4> <ul> <li> <strong> Redis Enterprise </strong> : <code> registry.connect.redhat.com/redislabs/redis-enterprise:7.2.4-64.rhel8-openshift </code> (or <code> redislabs/redis-enterprise:7.2.4-64.rhel7-openshift </code> if upgrading from RHEL 7) </li> <li> <strong> Operator </strong> : <code> registry.connect.redhat.com/redislabs/redis-enterprise-operator:7.2.4-7 </code> </li> <li> <strong> Services Rigger </strong> : <code> registry.connect.redhat.com/redislabs/services-manager:7.2.4-7 </code> </li> </ul> <h4 id="olm-bundle"> OLM bundle </h4> <p> <strong> Redis Enterprise operator bundle </strong> : <code> v7.2.4-7 </code> </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> It is not possible to upgrade your OLM deployment to version 7.2.4 from version 6.2.4-8 (November release). Uninstall 6.2.4-8 and perform a fresh install of 7.2.4. </div> </div> <h2 id="known-limitations"> Known limitations </h2> <p> The limitations below are specific to the Redis Enterprise for Kubernetes product. To view limitations for the supported Redis Enterprise Software version, see the <a href="/docs/latest/operate/rs/release-notes/rs-7-2-4-releases/#known-limitations"> 7.2.4 release notes </a> . </p> <h3 id="existing-limitations"> Existing limitations </h3> <ul> <li> <p> <strong> REDBs created with versions before 6.2.10-4 will automatically upgrade modules when the cluster is upgraded (RED-106834) </strong> </p> </li> <li> <p> <strong> When modifying the database suffix for an Active-Active database, while the service-rigger is in a terminating state, the services-rigger will detele and create the ingress or route resources in a loop (RED-107687) </strong> Wait until the services- rigger pod has finished to terminate it. </p> </li> <li> <p> <strong> REAADB changes might fail with "gateway timeout" errors, mostly on OpenShift (RED-103048) </strong> Retry the operation. </p> </li> <li> <p> <strong> Misleading error appears when a service creation has failed due to service already existing " <code> provided IP is already allocated </code> " (RED-100669) </strong> Delete the service manually. </p> </li> <li> <p> <strong> Existing OpenShift route during REC creation might prevent REC from starting (RED-100668) </strong> Delete the route manually. </p> </li> <li> <p> <strong> Creating two databases with the same name directly on Redis Enterprise software will cause the service to be deleted and the database will not be available (RED-99997) </strong> Avoid duplicating database names. Database creation via K8s has validation in place to prevent this. </p> </li> <li> <p> <strong> Installing the operator bundle produces warning: <code> Warning: would violate PodSecurity "restricted: v1.24" </code> (RED-97381) </strong> Ignore the warning. This issue is documented as benign on official Red Hat documentation. </p> </li> <li> <p> <strong> RERC resources must have a unique name (RED-96302) </strong> The string "rec-name"/"rec-namespace" must be different from all other participating clusters in the Active-Active database. </p> </li> <li> <p> <strong> Admission is not blocking REAADB with <code> shardCount </code> which exceeds license quota (RED-96301) </strong> Fix the problems with the REAADB and reapply. </p> </li> <li> <p> <strong> Active-Active controller only supports global database options. Configuration specific to location is not supported (RED-86490) </strong> </p> </li> <li> <p> <strong> Active-Active setup removal might keep services or routes undeleted (RED-77752) </strong> Delete services or routes manually if you encounter this problem. </p> </li> <li> <p> <strong> <code> autoUpgrade </code> set to <code> true </code> can cause unexpected bdb upgrades when <code> redisUpgradePolicy </code> is set to <code> true </code> (RED-72351) </strong> Contact support if your deployment is impacted. </p> </li> <li> <p> <strong> Following the previous quick start guide version causes issues with creating an REDB due to unrecognized memory field name (RED-69515) </strong> The workaround is to use the newer (current) revision of Deploy Redis Enterprise Software for Kubernetes. </p> </li> <li> <p> <strong> PVC size issues when using decimal value in spec (RED-62132) </strong> Make sure you use integer values for the PVC size. </p> </li> <li> <p> <strong> REC might report error states on initial startup (RED-61707) </strong> There is no workaround at this time except to ignore the errors. </p> </li> <li> <p> <strong> Hashicorp Vault integration - no support for Gesher (RED-55080) </strong> There is no workaround for this issue. Gesher support has been deprecated. </p> </li> <li> <p> <strong> REC clusters fail to start on Kubernetes clusters with unsynchronized clocks (RED-47254) </strong> When REC clusters are deployed on Kubernetes clusters without synchronized clocks, the REC cluster does not start correctly. The fix is to use NTP to synchronize the underlying K8s nodes. </p> </li> <li> <p> <strong> Deleting an OpenShift project with an REC deployed may hang (RED-47192) </strong> When an REC cluster is deployed in a project (namespace) and has REDB resources, the REDB resources must be deleted first before the REC can be deleted. Therefore, until the REDB resources are deleted, the project deletion will hang. The fix is to delete the REDB resources first and the REC second. Then, you can delete the project. </p> </li> <li> <p> <strong> Clusters must be named 'rec' in OLM-based deployments (RED-39825) </strong> In OLM-deployed operators, the deployment of the cluster will fail if the name is not "rec". When the operator is deployed via the OLM, the security context constraints (scc) are bound to a specific service account name (namely, "rec"). The workaround is to name the cluster "rec". </p> </li> <li> <p> <strong> Readiness probe incorrect on failures (RED-39300) </strong> STS Readiness probe does not mark a node as "not ready" when running <code> rladmin status </code> on node failure. </p> </li> <li> <p> <strong> Internal DNS and Kubernetes DNS may have conflicts (RED-37462) </strong> DNS conflicts are possible between the cluster <code> mdns_server </code> and the K8s DNS. This only impacts DNS resolution from within cluster nodes for Kubernetes DNS names. </p> </li> <li> <p> <strong> K8s-based 5.4.10 clusters seem to negatively affect existing 5.4.6 clusters (RED-37233) </strong> Upgrade clusters to latest version. </p> </li> <li> <p> <strong> Node CPU usage is reported instead of pod CPU usage (RED-36884) </strong> In Kubernetes, the reported node CPU usage is the usage of the Kubernetes worker node hosting the REC pod. </p> </li> <li> <p> <strong> An unreachable cluster has status running (RED-32805) </strong> When a cluster is in an unreachable state, the state remains <code> running </code> instead of triggering an error. </p> </li> <li> <p> <strong> Long cluster names cause routes to be rejected (RED-25871) </strong> A cluster name longer than 20 characters will result in a rejected route configuration because the host part of the domain name exceeds 63 characters. The workaround is to limit the cluster name to 20 characters or fewer. </p> </li> <li> <p> <strong> Cluster CR (REC) errors are not reported after invalid updates (RED-25542) </strong> A cluster CR specification error is not reported if two or more invalid CR resources are updated in sequence. </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/kubernetes/release-notes/7-2-4-releases/7-2-4-7/"/> <div class="flex flex-row justify-between"> <div class="grid justify-center"> <span class="font-mono"> RATE THIS PAGE </span> <div class="star-rating"> <input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/> <label class="star" for="5-stars"> β˜… </label> <input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/> <label class="star" for="4-stars"> β˜… </label> <input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/> <label class="star" for="3-stars"> β˜… </label> <input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/> <label class="star" for="2-stars"> β˜… </label> <input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/> <label class="star" for="1-stars"> β˜… </label> </div> </div> <a class="font-mono no-underline" href="#"> Back to top ↑ </a> </div> <div class="hidden" id="feedback-form"> <div class="grid gap-2"> <textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea> <button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit"> Submit </button> </div> </div> </form> <script> document.addEventListener("DOMContentLoaded", function() { const form = document.querySelector("#page-feedback"); form.addEventListener("submit", function(event) { event.preventDefault(); var xhr = new XMLHttpRequest(); var url = "\/docusight\/api\/rate"; var params = new URLSearchParams(new FormData(form)); xhr.open("POST", url, true); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.onreadystatechange = function() { if (xhr.readyState === 4 && xhr.status === 200) { const responseData = JSON.parse(xhr.responseText); const responseMessage = responseData.response; const newText = document.createTextNode(responseMessage); form.parentNode.replaceChild(newText, form); } }; xhr.send(params); }); }); </script> </section>
https://redis.io/docs/latest/operate/rs/installing-upgrading/creating-support-package/.html
<section class="prose w-full py-12 max-w-none"> <h1> Create a support package </h1> <p class="text-lg -mt-5 mb-10"> Create a support package that gathers essential information to help debug issues. </p> <p> If you encounter any issues that you are not able to resolve yourself and need to <a href="https://redis.io/support/"> contact Redis support </a> for assistance, you can <a href="#create-support-package"> create a support package </a> that gathers all essential information to help debug your issues. </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 process of creating the support package can take several minutes and generates load on the system. </div> </div> <h2 id="support-package-files"> Support package files </h2> <p> The support package is a zip file that contains all cluster configuration and logs. </p> <p> When downloaded from the Cluster Manager UI, the support package's name is <code> debuginfo.tar.gz </code> . </p> <h3 id="database-support-package-files"> Database support package files </h3> <p> Cluster and database support packages collect database details in <code> database_&lt;bdb_uid&gt; </code> directories, where <code> &lt;bdb_uid&gt; </code> is the database ID, and Redis shard details in <code> &lt;node_uid&gt; </code> directories. </p> <p> The following table describes the included files: </p> <table> <thead> <tr> <th> File </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> ccs-redis.json </td> <td> Primary node's local cluster configuration store (CCS). </td> </tr> <tr> <td> /database_&lt;bdb_uid&gt;/ </td> <td> Directory that includes files for a specific database.&lt;bdb_uid&gt; is the database ID. </td> </tr> <tr> <td> database_&lt;bdb_uid&gt;_ccs_info.txt </td> <td> Database information from the cluster configuration store (CCS). Includes settings for databases, endpoints, shards, replicas, and CRDB. </td> </tr> <tr> <td> database_&lt;bdb_uid&gt;.clientlist </td> <td> List of clients connected to the database when the support package was created. </td> </tr> <tr> <td> database_&lt;bdb_uid&gt;.info </td> <td> Redis information and statistics for the database. See <a href="/docs/latest/commands/info/"> <code> INFO </code> </a> for details about the collected fields. </td> </tr> <tr> <td> database_&lt;bdb_uid&gt;.rladmin </td> <td> Database information. See <a href="/docs/latest/operate/rs/references/cli-utilities/rladmin/info/#info-db"> <code> rladmin info db </code> </a> for an example of collected fields. Also includes creation time, last changed time, Redis version, memory limit, persistence type, eviction policy, hashing policy, and whether SSL, backups, and email alerts are enabled. </td> </tr> <tr> <td> database_&lt;bdb_uid&gt;.slowlog </td> <td> Contains slowlog output, which includes commands that took longer than 10 milliseconds. Only included if <code> slowlog_in_sanitized_support </code> is <code> true </code> in cluster settings. </td> </tr> <tr> <td> /node_&lt;node_uid&gt;/redis_&lt;shard_uid&gt;.txt </td> <td> For each shard of the specified database only. Includes shard configuration and <a href="/docs/latest/commands/info/"> information </a> , slowlog information, and latency information. </td> </tr> </tbody> </table> <h3 id="node-support-package-files"> Node support package files </h3> <p> Cluster and node support packages collect node details in <code> node_&lt;node_uid&gt; </code> directories, where <code> &lt;node_uid&gt; </code> is the node ID. </p> <p> The following table describes the included files: </p> <table> <thead> <tr> <th> File </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> ccs-redis.json </td> <td> The node's local cluster configuration store (CCS). </td> </tr> <tr> <td> /conf/ </td> <td> Directory that contains configuration files. </td> </tr> <tr> <td> /logs/ </td> <td> Directory that includes logs. </td> </tr> <tr> <td> node_&lt;node_uid&gt;.ccs </td> <td> Includes cluster configuration, node configuration, and DMC proxy configuration. </td> </tr> <tr> <td> node_&lt;node_uid&gt;_envoy_config.json </td> <td> Envoy configuration. </td> </tr> <tr> <td> node_&lt;node_uid&gt;.rladmin </td> <td> Information about the cluster's nodes, databases, endpoints, and shards. See <a href="/docs/latest/operate/rs/references/cli-utilities/rladmin/status/"> <code> rladmin status </code> </a> for example output. </td> </tr> <tr> <td> node_&lt;node_uid&gt;_sys_info.txt </td> <td> Node's system information including: <br/> β€’ Socket files list <br/> β€’ Log files list <br/> β€’ Processes running on the node <br/> β€’ Disk usage <br/> β€’ Persistent files list <br/> β€’ Memory usage <br/> β€’ Network interfaces <br/> β€’ Installed packages <br/> β€’ Active iptables <br/> β€’ OS and platform <br/> β€’ Network connection <br/> β€’ Status of Redis processes </td> </tr> <tr> <td> redis_&lt;shard_uid&gt;.txt </td> <td> For each shard of the specified database only. Includes shard configuration and <a href="/docs/latest/commands/info/"> information </a> , slowlog information, and latency information. </td> </tr> </tbody> </table> <p> Each node's <code> /conf/ </code> directory contains the following files: </p> <ul> <li> bootstrap_status.json </li> <li> ccs-paths.conf </li> <li> config.json </li> <li> envoy.yaml </li> <li> gossip_envoy.yaml </li> <li> heartbeatd-config.json </li> <li> last_bootstrap.json </li> <li> local_addr.conf </li> <li> node.id </li> <li> node_local_config.json </li> <li> redislabs_env_config.sh </li> <li> socket.conf </li> <li> supervisord_alert_mgr.conf </li> <li> supervisord_cm_server.conf </li> <li> supervisord_crdb_coordinator.conf </li> <li> supervisord_crdb_worker.conf </li> <li> supervisord_mdns_server.conf </li> <li> supervisord_pdns_server.conf </li> </ul> <p> Each node's <code> /conf/ </code> directory also contains the following key and cert modulus files: </p> <ul> <li> api_cert.modulus </li> <li> api_key.modulus </li> <li> ccs_internode_encryption_cert.modulus </li> <li> ccs_internode_encryption_key.modulus </li> <li> cm_cert.modulus </li> <li> cm_key.modulus </li> <li> data_internode_encryption_cert.modulus </li> <li> data_internode_encryption_key.modulus </li> <li> gossip_ca_signed_cert.modulus </li> <li> gossip_ca_signed_key.modulus </li> <li> mesh_ca_signed_cert.modulus </li> <li> mesh_ca_signed_key.modulus </li> <li> metrics_exporter_cert.modulus </li> <li> metrics_exporter_key.modulus </li> <li> proxy_cert.modulus </li> <li> proxy_key.modulus </li> <li> syncer_cert.modulus </li> <li> syncer_key.modulus </li> </ul> <h2 id="create-support-package"> Create support package </h2> <h3 id="cluster-manager-ui-method"> Cluster Manager UI method </h3> <p> To create a support package from the Cluster Manager UI: </p> <ol> <li> <p> In the navigation menu, select <strong> Support </strong> . </p> <a href="/docs/latest/images/rs/screenshots/create-support-package.png" sdata-lightbox="/images/rs/screenshots/create-support-package.png"> <img alt="Select Support and create a support package." src="/docs/latest/images/rs/screenshots/create-support-package.png" width="60%"/> </a> </li> <li> <p> Select <strong> Proceed </strong> . </p> </li> <li> <p> In the <strong> Create support package </strong> dialog, select <strong> Run process </strong> . </p> </li> <li> <p> The package is created and downloaded by your browser. </p> </li> </ol> <h3 id="command-line-method"> Command-line method </h3> <p> If package creation fails with <code> internal error </code> or if you cannot access the UI, create a support package for the cluster from the command line on any node in the cluster using the <a href="/docs/latest/operate/rs/references/cli-utilities/rladmin/cluster/debug_info/"> <code> rladmin cluster debug_info </code> </a> command: </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">/opt/redislabs/bin/rladmin cluster debug_info </span></span></code></pre> </div> <ul> <li> <p> If <code> rladmin cluster debug_info </code> fails for lack of space in the <code> /tmp </code> directory, you can: </p> <ol> <li> <p> Change the storage location where the support package is saved: </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">rladmin cluster config debuginfo_path &lt;path&gt; </span></span></code></pre> </div> <p> The <code> redislabs </code> user must have write access to the storage location on all cluster nodes. </p> </li> <li> <p> On any node in the cluster, run: </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">rladmin cluster debug_info </span></span></code></pre> </div> </li> </ol> </li> <li> <p> If <code> rladmin cluster debug_info </code> fails for another reason, you can create a support package for the cluster from the command line on each node in the cluster with the command: </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">/opt/redislabs/bin/debuginfo </span></span></code></pre> </div> </li> </ul> <p> Upload the tar file to <a href="https://redis.com/company/support/"> Redis support </a> . The path to the archive is shown in the command output. </p> <h3 id="rest-api-method"> REST API method </h3> <p> You can also use <code> debuginfo </code> <a href="/docs/latest/operate/rs/references/rest-api/"> REST API </a> requests to create and download support packages. </p> <p> To download debug info from all nodes and databases: </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">GET /v1/cluster/debuginfo </span></span></code></pre> </div> <p> To download debug info from all nodes: </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">GET /v1/nodes/debuginfo </span></span></code></pre> </div> <p> To download debug info from a specific node, replace <code> &lt;uid&gt; </code> in the following request with the node ID: </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">GET /v1/nodes/&lt;uid&gt;/debuginfo </span></span></code></pre> </div> <p> To download debug info from all databases: </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">GET /v1/bdbs/debuginfo </span></span></code></pre> </div> <p> To download debug info from a specific database, replace <code> &lt;uid&gt; </code> in the following request with the database ID: </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">GET /v1/bdbs/&lt;uid&gt;/debuginfo </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/installing-upgrading/creating-support-package/"/> <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/.html
<section class="prose w-full py-12 max-w-none"> <h1> Search and query </h1> <p> The <a href="https://redis.com/blog/introducing-redisearch-2-0/"> RediSearch 2.x module </a> is a source-available project that lets you build powerful search queries for open source Redis databases. When combined with Redis Enterprise Software, you can use the same protocols and <a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/search/commands/"> commands </a> to run geo-replicated queries and full-text searches over efficient in-memory indexes. </p> <h2 id="index-documents"> Index documents </h2> <p> The search and query engine indexes documents, which are objects that represent data as field-value pairs. You can index more than one field per document, and these fields can represent text, numeric, or geospatial data types. </p> <p> As the documents in your database change, the index automatically processes these changes to keep the search results up to date. </p> <p> With indexes, you can do: </p> <ul> <li> Language-aware <a href="/docs/latest/develop/interact/search-and-query/advanced-concepts/query_syntax#fuzzy-matching"> fuzzy matching </a> </li> <li> Fast <a href="/docs/latest/develop/interact/search-and-query/administration/overview#auto-complete"> auto-complete </a> </li> <li> <a href="/docs/latest/develop/interact/search-and-query/advanced-concepts/query_syntax"> Exact phrase matching </a> </li> <li> <a href="/docs/latest/develop/interact/search-and-query/advanced-concepts/query_syntax#numeric-filters-in-query"> Numeric filtering </a> </li> <li> <a href="/docs/latest/develop/interact/search-and-query/advanced-concepts/query_syntax#geo-filters"> Geo-radius queries </a> </li> </ul> <h2 id="supported-document-types"> Supported document types </h2> <p> You can store documents as Redis <a href="/docs/latest/develop/data-types/hashes/"> hashes </a> or <a href="/docs/latest/develop/data-types/json/"> JSON </a> . To search and query JSON documents, you also need to enable <a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/json/"> JSON </a> in your database. </p> <h3 id="hash-documents"> Hash documents </h3> <p> With Redis <a href="/docs/latest/develop/data-types/hashes/"> hashes </a> , each document is assigned to a single key and uses field-value pairs to represent the document's contents. </p> <p> You can run <a href="/docs/latest/commands/hgetall/"> <code> HGETALL </code> </a> to retrieve the entire hash document. </p> <h3 id="json-documents"> JSON documents </h3> <p> You can index, search, and query JSON documents stored in your database. </p> <p> For more information about how to search and query JSON documents, see the <a href="/docs/latest/develop/get-started/document-database/"> quick start </a> . </p> <h2 id="search-features"> Search features </h2> <p> For full-text searches, you can customize the field queries and ranking of the search results. When querying, you can use multiple predicates that query text, numeric, and geospatial fields in one query. You can also sort by a specific field and limit the results with an offset to produce customized results pages. </p> <p> Redis Stack supports <a href="/docs/latest/develop/interact/search-and-query/advanced-concepts/stemming/"> over 15 natural languages </a> for stemming and includes auto-complete engines with specific commands that can provide real-time <a href="/docs/latest/commands/ft.sugadd"> interactive search suggestions </a> . </p> <h2 id="search-and-query-active-active-databases"> Search and query Active-Active databases </h2> <p> As a result of the new RediSearch architecture and methodology, <a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/search/search-active-active/"> RediSearch 2.x supports Active-Active databases </a> . You can now serve your index information from geo-distributed database instances. </p> <h2 id="resharding-indexed-data"> Resharding indexed data </h2> <p> By moving the index out of the keyspace and structuring the data as hashes, RediSearch 2.x makes it possible to reshard the database. When half of the data moves to the new shard, the index related to that data is created synchronously and Redis removes the keys from the index when it detects that the keys were deleted. Because the index on the new shard is created synchronously though, it's expected that the resharding process will take longer than resharding of a database without search and query enabled. </p> <h2 id="limitations"> Limitations </h2> <ul> <li> You cannot use search and query capabilities with the <a href="/docs/latest/operate/rs/databases/configure/oss-cluster-api/"> OSS Cluster API </a> . </li> </ul> <h2 id="more-info"> More info </h2> <ul> <li> <a href="https://redis.com/blog/getting-started-with-redisearch-2-0/"> Getting Started with RediSearch 2.0 </a> </li> <li> <a href="/docs/latest/develop/get-started/document-database/"> Search and query quick start </a> </li> <li> <a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/search/config/"> Search and query configuration </a> </li> <li> <a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/search/commands/"> Search and query commands </a> </li> <li> <a href="/docs/latest/develop/interact/search-and-query/advanced-concepts/"> Search and query references </a> </li> <li> <a href="https://github.com/RediSearch/RediSearch"> RediSearch source </a> </li> </ul> <form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback"> <input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/oss_and_stack/stack-with-enterprise/search/"/> <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/blpop/.html
<section class="prose w-full py-12"> <h1 class="command-name"> BLPOP </h1> <div class="font-semibold text-redis-ink-900"> Syntax </div> <pre class="command-syntax">BLPOP key [key ...] timeout</pre> <dl class="grid grid-cols-[auto,1fr] gap-2 mb-12"> <dt class="font-semibold text-redis-ink-900 m-0"> Available since: </dt> <dd class="m-0"> 2.0.0 </dd> <dt class="font-semibold text-redis-ink-900 m-0"> Time complexity: </dt> <dd class="m-0"> O(N) where N is the number of provided keys. </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> @list </code> <span class="mr-1 last:hidden"> , </span> <code> @slow </code> <span class="mr-1 last:hidden"> , </span> <code> @blocking </code> <span class="mr-1 last:hidden"> , </span> </dd> </dl> <p> <code> BLPOP </code> is a blocking list pop primitive. It is the blocking version of <a href="/docs/latest/commands/lpop/"> <code> LPOP </code> </a> because it blocks the connection when there are no elements to pop from any of the given lists. An element is popped from the head of the first list that is non-empty, with the given keys being checked in the order that they are given. </p> <h2 id="non-blocking-behavior"> Non-blocking behavior </h2> <p> When <code> BLPOP </code> is called, if at least one of the specified keys contains a non-empty list, an element is popped from the head of the list and returned to the caller together with the <code> key </code> it was popped from. </p> <p> Keys are checked in the order that they are given. Let's say that the key <code> list1 </code> doesn't exist and <code> list2 </code> and <code> list3 </code> hold non-empty lists. Consider the following command: </p> <pre tabindex="0"><code>BLPOP list1 list2 list3 0 </code></pre> <p> <code> BLPOP </code> guarantees to return an element from the list stored at <code> list2 </code> (since it is the first non empty list when checking <code> list1 </code> , <code> list2 </code> and <code> list3 </code> in that order). </p> <h2 id="blocking-behavior"> Blocking behavior </h2> <p> If none of the specified keys exist, <code> BLPOP </code> blocks the connection until another client performs an <a href="/docs/latest/commands/lpush/"> <code> LPUSH </code> </a> or <a href="/docs/latest/commands/rpush/"> <code> RPUSH </code> </a> operation against one of the keys. </p> <p> Once new data is present on one of the lists, the client returns with the name of the key unblocking it and the popped value. </p> <p> When <code> BLPOP </code> causes a client to block and a non-zero timeout is specified, the client will unblock returning a <code> nil </code> multi-bulk value when the specified timeout has expired without a push operation against at least one of the specified keys. </p> <p> <strong> The timeout argument is interpreted as a double value specifying the maximum number of seconds to block </strong> . A timeout of zero can be used to block indefinitely. </p> <h2 id="what-key-is-served-first-what-client-what-element-priority-ordering-details"> What key is served first? What client? What element? Priority ordering details. </h2> <ul> <li> If the client tries to blocks for multiple keys, but at least one key contains elements, the returned key / element pair is the first key from left to right that has one or more elements. In this case the client is not blocked. So for instance <code> BLPOP key1 key2 key3 key4 0 </code> , assuming that both <code> key2 </code> and <code> key4 </code> are non-empty, will always return an element from <code> key2 </code> . </li> <li> If multiple clients are blocked for the same key, the first client to be served is the one that was waiting for more time (the first that blocked for the key). Once a client is unblocked it does not retain any priority, when it blocks again with the next call to <code> BLPOP </code> it will be served accordingly to the number of clients already blocked for the same key, that will all be served before it (from the first to the last that blocked). </li> <li> When a client is blocking for multiple keys at the same time, and elements are available at the same time in multiple keys (because of a transaction or a Lua script added elements to multiple lists), the client will be unblocked using the first key that received a push operation (assuming it has enough elements to serve our client, as there may be other clients as well waiting for this key). Basically after the execution of every command Redis will run a list of all the keys that received data AND that have at least a client blocked. The list is ordered by new element arrival time, from the first key that received data to the last. For every key processed, Redis will serve all the clients waiting for that key in a FIFO fashion, as long as there are elements in this key. When the key is empty or there are no longer clients waiting for this key, the next key that received new data in the previous command / transaction / script is processed, and so forth. </li> </ul> <h2 id="behavior-of-blpop-when-multiple-elements-are-pushed-inside-a-list"> Behavior of <code> BLPOP </code> when multiple elements are pushed inside a list. </h2> <p> There are times when a list can receive multiple elements in the context of the same conceptual command: </p> <ul> <li> Variadic push operations such as <code> LPUSH mylist a b c </code> . </li> <li> After an <a href="/docs/latest/commands/exec/"> <code> EXEC </code> </a> of a <a href="/docs/latest/commands/multi/"> <code> MULTI </code> </a> block with multiple push operations against the same list. </li> <li> Executing a Lua Script with Redis 2.6 or newer. </li> </ul> <p> When multiple elements are pushed inside a list where there are clients blocking, the behavior is different for Redis 2.4 and Redis 2.6 or newer. </p> <p> For Redis 2.6 what happens is that the command performing multiple pushes is executed, and <em> only after </em> the execution of the command the blocked clients are served. Consider this sequence of commands. </p> <pre><code>Client A: BLPOP foo 0 Client B: LPUSH foo a b c </code></pre> <p> If the above condition happens using a Redis 2.6 server or greater, Client <strong> A </strong> will be served with the <code> c </code> element, because after the <a href="/docs/latest/commands/lpush/"> <code> LPUSH </code> </a> command the list contains <code> c,b,a </code> , so taking an element from the left means to return <code> c </code> . </p> <p> Instead Redis 2.4 works in a different way: clients are served <em> in the context </em> of the push operation, so as long as <code> LPUSH foo a b c </code> starts pushing the first element to the list, it will be delivered to the Client <strong> A </strong> , that will receive <code> a </code> (the first element pushed). </p> <p> The behavior of Redis 2.4 creates a lot of problems when replicating or persisting data into the AOF file, so the much more generic and semantically simpler behavior was introduced into Redis 2.6 to prevent problems. </p> <p> Note that for the same reason a Lua script or a <code> MULTI/EXEC </code> block may push elements into a list and afterward <strong> delete the list </strong> . In this case the blocked clients will not be served at all and will continue to be blocked as long as no data is present on the list after the execution of a single command, transaction, or script. </p> <h2 id="blpop-inside-a-multi--exec-transaction"> <code> BLPOP </code> inside a <code> MULTI </code> / <code> EXEC </code> transaction </h2> <p> <code> BLPOP </code> can be used with pipelining (sending multiple commands and reading the replies in batch), however this setup makes sense almost solely when it is the last command of the pipeline. </p> <p> Using <code> BLPOP </code> inside a <a href="/docs/latest/commands/multi/"> <code> MULTI </code> </a> / <a href="/docs/latest/commands/exec/"> <code> EXEC </code> </a> block does not make a lot of sense as it would require blocking the entire server in order to execute the block atomically, which in turn does not allow other clients to perform a push operation. For this reason the behavior of <code> BLPOP </code> inside <a href="/docs/latest/commands/multi/"> <code> MULTI </code> </a> / <a href="/docs/latest/commands/exec/"> <code> EXEC </code> </a> when the list is empty is to return a <code> nil </code> multi-bulk reply, which is the same thing that happens when the timeout is reached. </p> <p> If you like science fiction, think of time flowing at infinite speed inside a <a href="/docs/latest/commands/multi/"> <code> MULTI </code> </a> / <a href="/docs/latest/commands/exec/"> <code> EXEC </code> </a> block... </p> <h2 id="examples"> Examples </h2> <pre tabindex="0"><code>redis&gt; DEL list1 list2 (integer) 0 redis&gt; RPUSH list1 a b c (integer) 3 redis&gt; BLPOP list1 list2 0 1) "list1" 2) "a" </code></pre> <h2 id="reliable-queues"> Reliable queues </h2> <p> When <code> BLPOP </code> returns an element to the client, it also removes the element from the list. This means that the element only exists in the context of the client: if the client crashes while processing the returned element, it is lost forever. </p> <p> This can be a problem with some application where we want a more reliable messaging system. When this is the case, please check the <a href="/docs/latest/commands/brpoplpush/"> <code> BRPOPLPUSH </code> </a> command, that is a variant of <code> BLPOP </code> that adds the returned element to a target list before returning it to the client. </p> <h2 id="pattern-event-notification"> Pattern: Event notification </h2> <p> Using blocking list operations it is possible to mount different blocking primitives. For instance for some application you may need to block waiting for elements into a Redis Set, so that as far as a new element is added to the Set, it is possible to retrieve it without resort to polling. This would require a blocking version of <a href="/docs/latest/commands/spop/"> <code> SPOP </code> </a> that is not available, but using blocking list operations we can easily accomplish this task. </p> <p> The consumer will do: </p> <pre tabindex="0"><code>LOOP forever WHILE SPOP(key) returns elements ... process elements ... END BRPOP helper_key END </code></pre> <p> While in the producer side we'll use simply: </p> <pre tabindex="0"><code>MULTI SADD key element LPUSH helper_key x EXEC </code></pre> <h2 id="resp2-reply"> RESP2 Reply </h2> <p> One of the following: </p> <ul> <li> <a href="../../develop/reference/protocol-spec#bulk-strings"> Nil reply </a> : no element could be popped and the timeout expired </li> <li> <a href="../../develop/reference/protocol-spec#arrays"> Array reply </a> : the key from which the element was popped and the value of the popped element. </li> </ul> <h2 id="resp3-reply"> RESP3 Reply </h2> <p> One of the following: </p> <ul> <li> <a href="../../develop/reference/protocol-spec#nulls"> Null reply </a> : no element could be popped and the timeout expired </li> <li> <a href="../../develop/reference/protocol-spec#arrays"> Array reply </a> : the key from which the element was popped and the value of the popped element. </li> </ul> <br/> <h2> History </h2> <ul> <li> Starting with Redis version 6.0.0: <code> timeout </code> is interpreted as a double instead of an integer. </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/blpop/"/> <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/indexing/.html
<section class="prose w-full py-12"> <h1> Document Indexing </h1> <p class="text-lg -mt-5 mb-10"> This document describes how documents are added to the index. </p> <h2 id="components"> Components </h2> <ul> <li> <code> Document </code> - contains the actual document and its fields. </li> <li> <code> RSAddDocumentCtx </code> - the per-document state that is used while it is being indexed. The state is discarded after the indexing is complete. </li> <li> <code> ForwardIndex </code> - contains terms found in the document. The forward index is used to write the <code> InvertedIndex </code> . </li> <li> <code> InvertedIndex </code> - an index that maps terms to occurrences within applicable documents. </li> </ul> <h2 id="architecture"> Architecture </h2> <p> The indexing process begins by creating a new <code> RSAddDocumentCtx </code> and adding a document to it. Internally, this is divided into several steps. </p> <ol> <li> <p> Submission </p> <p> A <code> DocumentContext </code> is created, and is associated with a document (as received) from input. The submission process will also perform some preliminary caching. </p> </li> <li> <p> Preprocessing </p> <p> After a document has been submitted, it is preprocessed. Preprocessing performs stateless processing on all document input fields. For text fields, this means tokenizing the document and creating a forward index. The preprocesors will store this information in per-field variables within the <code> AddDocumentCtx </code> . This computed result is then written to the persistent index later on during the indexing phase. </p> <p> If the document is sufficiently large, the preprocessing is done in a separate thread, which allows concurrent preprocessing and also avoids blocking other threads. If the document is smaller, the preprocessing is done within the main thread, avoiding the overhead of additional context switching. The <code> SELF_EXC_THRESHOLD </code> macro contains the threshold for 'sufficiently large'. </p> <p> After the document is preprocessed, it is submitted to be indexed. </p> </li> <li> <p> Indexing </p> <p> Indexing proper consists of committing the precomputed results of the preprocessing phase. It is done in a single thread, and is in the form of a queue. </p> <p> Because documents must be written to the index in the exact order of their document ID assignment, and because the indexing process must also yield to other potential indexing processes, you may end up in a situation where document IDs are written to the index out-of-order. To solve that, the order in which documents are actually written must be well-defined. If there is only one thread writing documents, then this thread will not need to worry about out-of-order IDs while writing. </p> <p> Having a single background thread also helps optimize in several areas, as will be seen later on. The basic idea is that when there are a lot of documents queued for the indexing thread, the indexing thread may treat them as batch commands, greatly reducing the number of locks/unlocks of the GIL and the number of times term keys need to be opened and closed. </p> </li> <li> <p> Skipping already indexed documents </p> <p> The phases below may operate on more than one document at a time. When a document is fully indexed, it is marked as done. When the thread iterates over the queue it will only perform processing/indexing on items not yet marked as done. </p> </li> <li> <p> Term merging </p> <p> Term merging, or forward index merging, is done when there is more than a single document in the queue. The forward index of each document in the queue is scanned, and a larger, master forward index is constructed in its place. Each entry in the forward index contains a reference to the origin document as well as the normal offset/score/frequency information. </p> <p> Creating a master forward index avoids opening common term keys more than once per document. </p> <p> If there is only one document within the queue, a master forward index is not created. </p> <p> Note that the internal type of the master forward index is not actually <code> ForwardIndex </code> . </p> </li> <li> <p> Document ID assignment </p> <p> At this point, the GIL is locked and every document in the queue is assigned a document ID. The assignment is done immediately before writing to the index so as to reduce the number of times the GIL is locked; thus, the GIL is locked only once, right before the index is written. </p> </li> <li> <p> Writing to Indexes </p> <p> With the GIL being locked, any pending index data is written to the indexes. This usually involves opening one or more Redis keys, and writing/copying computed data into those keys. </p> <p> After this is done, the reply for the given document is sent, and the <code> AddDocumentCtx </code> freed. </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/develop/interact/search-and-query/administration/indexing/"/> <div class="flex flex-row justify-between"> <div class="grid justify-center"> <span class="font-mono"> RATE THIS PAGE </span> <div class="star-rating"> <input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/> <label class="star" for="5-stars"> β˜… </label> <input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/> <label class="star" for="4-stars"> β˜… </label> <input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/> <label class="star" for="3-stars"> β˜… </label> <input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/> <label class="star" for="2-stars"> β˜… </label> <input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/> <label class="star" for="1-stars"> β˜… </label> </div> </div> <a class="font-mono no-underline" href="#"> Back to top ↑ </a> </div> <div class="hidden" id="feedback-form"> <div class="grid gap-2"> <textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea> <button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit"> Submit </button> </div> </div> </form> <script> document.addEventListener("DOMContentLoaded", function() { const form = document.querySelector("#page-feedback"); form.addEventListener("submit", function(event) { event.preventDefault(); var xhr = new XMLHttpRequest(); var url = "\/docusight\/api\/rate"; var params = new URLSearchParams(new FormData(form)); xhr.open("POST", url, true); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.onreadystatechange = function() { if (xhr.readyState === 4 && xhr.status === 200) { const responseData = JSON.parse(xhr.responseText); const responseMessage = responseData.response; const newText = document.createTextNode(responseMessage); form.parentNode.replaceChild(newText, form); } }; xhr.send(params); }); }); </script> </section>
https://redis.io/docs/latest/operate/rc/changelog/2023/march-2023/.html
<section class="prose w-full py-12 max-w-none"> <h1> Redis Cloud changelog (March 2023) </h1> <p class="text-lg -mt-5 mb-10"> New features, enhancements, and other changes added to Redis Cloud during March 2023. </p> <p> This changelog lists new features, enhancements, and other changes added to Redis Cloud during March 2023. </p> <h2 id="new-features-and-enhancements"> New features and enhancements </h2> <h3 id="redis-70-preview"> Redis 7.0 preview </h3> <p> A preview of Redis 7.0 is available for <a href="/docs/latest/operate/rc/databases/create-database/create-essentials-database/"> Fixed subscriptions </a> in selected regions in AWS and GCP. However, some Redis 7.0 functionality might not be fully available during preview. Redis 7.0 also introduces several changes to existing Redis commands; see the <a href="#redis-70-breaking-changes"> list of breaking changes </a> for more details. </p> <p> The following tables show which new open source Redis 7.0 commands are supported in Redis 7.0 subscriptions. </p> <h4 id="cluster-management-commandshahahugoshortcode-s1-hbhbgroupcluster"> <a href="/docs/latest/commands/?group=cluster"> Cluster management commands </a> </h4> <table> <thead> <tr> <th style="text-align:left"> <span style="min-width: 10em; display: table-cell"> Command </span> </th> <th style="text-align:left"> Supported </th> </tr> </thead> <tbody> <tr> <td style="text-align:left"> <a href="/docs/latest/commands/cluster-addslotsrange/"> CLUSTER ADDSLOTSRANGE </a> </td> <td style="text-align:left"> <span title="Not supported"> ❌ Not supported </span> </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/commands/cluster-delslotsrange/"> CLUSTER DELSLOTSRANGE </a> </td> <td style="text-align:left"> <span title="Not supported"> ❌ Not supported </span> </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/commands/cluster-links/"> CLUSTER LINKS </a> </td> <td style="text-align:left"> <span title="Not supported"> ❌ Not supported </span> </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/commands/cluster-shards/"> CLUSTER SHARDS </a> </td> <td style="text-align:left"> <span title="Not supported"> ❌ Not supported </span> </td> </tr> </tbody> </table> <h4 id="connection-management-commandshahahugoshortcode-s6-hbhbgroupconnection"> <a href="/docs/latest/commands/?group=connection"> Connection management commands </a> </h4> <table> <thead> <tr> <th style="text-align:left"> <span style="min-width: 10em; display: table-cell"> Command </span> </th> <th style="text-align:left"> Supported </th> </tr> </thead> <tbody> <tr> <td style="text-align:left"> <a href="/docs/latest/commands/client-no-evict/"> CLIENT NO-EVICT </a> </td> <td style="text-align:left"> <span title="Not supported"> ❌ Not supported </span> </td> </tr> </tbody> </table> <h4 id="data-type-commands"> Data type commands </h4> <table> <thead> <tr> <th style="text-align:left"> Data type </th> <th style="text-align:left"> Command </th> <th style="text-align:left"> Supported </th> </tr> </thead> <tbody> <tr> <td style="text-align:left"> <a href="/docs/latest/commands/?group=list"> List </a> </td> <td style="text-align:left"> <a href="/docs/latest/commands/blmpop/"> BLMPOP </a> </td> <td style="text-align:left"> <span title="Supported"> βœ… Supported </span> </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/commands/?group=list"> List </a> </td> <td style="text-align:left"> <a href="/docs/latest/commands/lmpop/"> LMPOP </a> </td> <td style="text-align:left"> <span title="Supported"> βœ… Supported </span> </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/commands/?group=set"> Set </a> </td> <td style="text-align:left"> <a href="/docs/latest/commands/sintercard/"> SINTERCARD </a> </td> <td style="text-align:left"> <span title="Supported"> βœ… Supported </span> </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/commands/?group=sorted-set"> Sorted set </a> </td> <td style="text-align:left"> <a href="/docs/latest/commands/bzmpop/"> BZMPOP </a> </td> <td style="text-align:left"> <span title="Supported"> βœ… Supported </span> </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/commands/?group=sorted-set"> Sorted set </a> </td> <td style="text-align:left"> <a href="/docs/latest/commands/zintercard/"> ZINTERCARD </a> </td> <td style="text-align:left"> <span title="Supported"> βœ… Supported </span> </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/commands/?group=sorted-set"> Sorted set </a> </td> <td style="text-align:left"> <a href="/docs/latest/commands/bzmpop/"> BZMPOP </a> </td> <td style="text-align:left"> <span title="Supported"> βœ… Supported </span> </td> </tr> </tbody> </table> <h4 id="keys-generic-commandshahahugoshortcode-s20-hbhbgroupgeneric"> <a href="/docs/latest/commands/?group=generic"> Keys (generic) commands </a> </h4> <table> <thead> <tr> <th style="text-align:left"> <span style="min-width: 10em; display: table-cell"> Command </span> </th> <th style="text-align:left"> Supported </th> </tr> </thead> <tbody> <tr> <td style="text-align:left"> <a href="/docs/latest/commands/expiretime/"> EXPIRETIME </a> </td> <td style="text-align:left"> <span title="Supported"> βœ… Supported </span> </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/commands/pexpiretime/"> PEXPIRETIME </a> </td> <td style="text-align:left"> <span title="Supported"> βœ… Supported </span> </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/commands/sort_ro/"> SORT_RO </a> </td> <td style="text-align:left"> <span title="Supported"> βœ… Supported </span> </td> </tr> </tbody> </table> <h4 id="pubsub-commandshahahugoshortcode-s24-hbhbgrouppubsub"> <a href="/docs/latest/commands/?group=pubsub"> Pub/sub commands </a> </h4> <table> <thead> <tr> <th style="text-align:left"> <span style="min-width: 10em; display: table-cell"> Command </span> </th> <th style="text-align:left"> Supported </th> </tr> </thead> <tbody> <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"> βœ… Supported </span> </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"> βœ… Supported </span> </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/commands/spublish/"> SPUBLISH </a> </td> <td style="text-align:left"> <span title="Not supported"> ❌ Not supported </span> </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/commands/ssubscribe/"> SSUBSCRIBE </a> </td> <td style="text-align:left"> <span title="Not supported"> ❌ Not supported </span> </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/commands/sunsubscribe/"> SUNSUBSCRIBE </a> </td> <td style="text-align:left"> <span title="Not supported"> ❌ Not supported </span> </td> </tr> </tbody> </table> <h4 id="scripting-and-function-commandshahahugoshortcode-s30-hbhbgroupscripting"> <a href="/docs/latest/commands/?group=scripting"> Scripting and function commands </a> </h4> <table> <thead> <tr> <th style="text-align:left"> <span style="min-width: 10em; display: table-cell"> Command </span> </th> <th style="text-align:left"> Supported </th> </tr> </thead> <tbody> <tr> <td style="text-align:left"> <a href="/docs/latest/commands/eval_ro/"> EVAL_RO </a> </td> <td style="text-align:left"> <span title="Not supported"> ❌ Not supported </span> </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/commands/evalsha_ro/"> EVALSHA_RO </a> </td> <td style="text-align:left"> <span title="Not supported"> ❌ Not supported </span> </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/commands/function-delete/"> FUNCTION DELETE </a> </td> <td style="text-align:left"> <span title="Supported"> βœ… Supported </span> </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/commands/function-dump/"> FUNCTION DUMP </a> </td> <td style="text-align:left"> <span title="Supported"> βœ… Supported </span> </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/commands/function-flush/"> FUNCTION FLUSH </a> </td> <td style="text-align:left"> <span title="Supported"> βœ… Supported </span> </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/commands/function-help/"> FUNCTION HELP </a> </td> <td style="text-align:left"> <span title="Supported"> βœ… Supported </span> </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/commands/function-kill/"> FUNCTION KILL </a> </td> <td style="text-align:left"> <span title="Supported"> βœ… Supported </span> </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/commands/function-list/"> FUNCTION LIST </a> </td> <td style="text-align:left"> <span title="Supported"> βœ… Supported </span> </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/commands/function-load/"> FUNCTION LOAD </a> </td> <td style="text-align:left"> <span title="Supported"> βœ… Supported </span> </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/commands/function-restore/"> FUNCTION RESTORE </a> </td> <td style="text-align:left"> <span title="Supported"> βœ… Supported </span> </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/commands/function-stats/"> FUNCTION STATS </a> </td> <td style="text-align:left"> <span title="Not supported"> ❌ Not supported </span> </td> </tr> </tbody> </table> <h4 id="server-management-commandshahahugoshortcode-s42-hbhbgroupserver"> <a href="/docs/latest/commands/?group=server"> Server management commands </a> </h4> <table> <thead> <tr> <th style="text-align:left"> <span style="min-width: 10em; display: table-cell"> Command </span> </th> <th style="text-align:left"> Supported </th> </tr> </thead> <tbody> <tr> <td style="text-align:left"> <a href="/docs/latest/commands/acl-dryrun/"> ACL DRYRUN </a> </td> <td style="text-align:left"> <span title="Not supported"> ❌ Not supported </span> </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/commands/command-docs/"> COMMAND DOCS </a> </td> <td style="text-align:left"> <span title="Supported"> βœ… Supported </span> </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/commands/command-getkeysandflags/"> COMMAND GETKEYSANDFLAGS </a> </td> <td style="text-align:left"> <span title="Supported"> βœ… Supported </span> </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/commands/command-list/"> COMMAND LIST </a> </td> <td style="text-align:left"> <span title="Supported"> βœ… Supported </span> </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/commands/module-loadex/"> MODULE LOADEX </a> </td> <td style="text-align:left"> <span title="Not supported"> ❌ Not supported </span> </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/commands/latency-histogram/"> LATENCY HISTOGRAM </a> </td> <td style="text-align:left"> <span title="Not supported"> ❌ Not supported </span> </td> </tr> </tbody> </table> <h2 id="breaking-changes"> Breaking changes </h2> <h3 id="redis-70-breaking-changes"> Redis 7.0 breaking changes </h3> <p> When new major versions of open source Redis change existing commands, upgrading your database to a new version can potentially break some functionality. Before you upgrade, make sure to read the provided list of breaking changes that affect Redis Enterprise and update any applications that connect to your database to handle these changes. </p> <p> To check your Redis database version ( <code> redis_version </code> ), you can use the admin console or run the <a href="/docs/latest/commands/info/"> <code> INFO </code> </a> command with <a href="/docs/latest/operate/rs/references/cli-utilities/redis-cli/"> <code> redis-cli </code> </a> : </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">$ redis-cli -p &lt;port&gt; INFO </span></span><span class="line"><span class="cl"><span class="s2">"# Server </span></span></span><span class="line"><span class="cl"><span class="s2">redis_version:7.0.8 </span></span></span><span class="line"><span class="cl"><span class="s2">..."</span> </span></span></code></pre> </div> <p> Open source Redis version 7.0 introduces the following potentially breaking changes to Redis Enterprise: </p> <h4 id="programmability"> Programmability </h4> <ul> <li> <p> Lua scripts no longer have access to the <code> print() </code> function ( <a href="https://github.com/redis/redis/pull/10651"> #10651 </a> ) - The <code> print </code> function was removed from Lua because it can potentially cause the Redis processes to get stuck (if no one reads from stdout). Users should use redis.log. An alternative is to override the <code> print </code> implementation and print the message to the log file. </p> </li> <li> <p> Block <a href="/docs/latest/commands/pfcount/"> <code> PFCOUNT </code> </a> and <a href="/docs/latest/commands/publish/"> <code> PUBLISH </code> </a> in read-only scripts (*_RO commands, <code> no-writes </code> ) ( <a href="https://github.com/redis/redis/pull/10744"> #10744 </a> ) - Consider <code> PFCOUNT </code> and <code> PUBLISH </code> as write commands in scripts, in addition to <code> EVAL </code> ; meaning: </p> <ul> <li> They can never be used in scripts with shebang ( <code> #! </code> ) and no <code> no-writes </code> flag </li> <li> They are blocked in <code> EVAL_RO </code> and <code> _RO </code> variants, (even in scripts without shebang ( <code> #! </code> ) flags) </li> <li> Allow <code> no-write </code> scripts in EVAL (not just in EVAL_RO), even during <code> CLIENT PAUSE WRITE </code> </li> </ul> </li> <li> <p> Hide the <code> may_replicate </code> flag from the <a href="/docs/latest/commands/command/"> <code> COMMAND </code> </a> command response ( <a href="https://github.com/redis/redis/pull/10744"> #10744 </a> ) - As part of the change to treat <code> may_replicate </code> commands <code> PFCOUNT </code> and <code> PUBLISH </code> as write commands in scripts, in addition to <code> EVAL </code> , the <code> may_replicate </code> flag has been removed from the <code> COMMAND </code> response. </p> </li> </ul> <h4 id="error-handling"> Error handling </h4> <ul> <li> <p> Rephrased some error responses about invalid commands or arguments ( <a href="https://github.com/redis/redis/pull/10612"> #10612 </a> ) - </p> <ul> <li> Error response for unknown command introduced a case change ( <code> Unknown </code> to <code> unknown </code> ) </li> <li> Errors for module commands extended to cover subcommands, updated syntax to match Redis Server syntax </li> <li> Arity errors for module commands introduce a case change ( <code> Wrong </code> to <code> wrong </code> ); will consider full command name </li> </ul> </li> <li> <p> Corrected error codes returned from <a href="/docs/latest/commands/eval/"> <code> EVAL </code> </a> scripts ( <a href="https://github.com/redis/redis/pull/10218"> #10218 </a> , <a href="https://github.com/redis/redis/pull/10329"> #10329 </a> ). </p> <p> These examples show changes in behavior: </p> <div class="highlight"> <pre class="chroma"><code class="language-diff" data-lang="diff"><span class="line"><span class="cl"> 1: config set maxmemory 1 </span></span><span class="line"><span class="cl"> 2: +OK </span></span><span class="line"><span class="cl"> 3: eval "return redis.call('set','x','y')" 0 </span></span><span class="line"><span class="cl"><span class="gd">- 4: -ERR Error running script (call to 71e6319f97b0fe8bdfa1c5df3ce4489946dda479): @user_script:1: @user_script: 1: -OOM command not allowed when used memory &gt; 'maxmemory'. </span></span></span><span class="line"><span class="cl"><span class="gd"></span><span class="gi">+ 4: -ERR Error running script (call to 71e6319f97b0fe8bdfa1c5df3ce4489946dda479): @user_script:1: OOM command not allowed when used memory &gt; 'maxmemory'. </span></span></span><span class="line"><span class="cl"><span class="gi"></span> 5: eval "return redis.pcall('set','x','y')" 0 </span></span><span class="line"><span class="cl"><span class="gd">- 6: -@user_script: 1: -OOM command not allowed when used memory &gt; 'maxmemory'. </span></span></span><span class="line"><span class="cl"><span class="gd"></span><span class="gi">+ 6: -OOM command not allowed when used memory &gt; 'maxmemory'. </span></span></span><span class="line"><span class="cl"><span class="gi"></span> 7: eval "return redis.call('select',99)" 0 </span></span><span class="line"><span class="cl"> 8: -ERR Error running script (call to 4ad5abfc50bbccb484223905f9a16f09cd043ba8): @user_script:1: ERR DB index is out of range </span></span><span class="line"><span class="cl"> 9: eval "return redis.pcall('select',99)" 0 </span></span><span class="line"><span class="cl"> 10: -ERR DB index is out of range </span></span><span class="line"><span class="cl"> 11: eval_ro "return redis.call('set','x','y')" 0 </span></span><span class="line"><span class="cl"><span class="gd">-12: -ERR Error running script (call to 71e6319f97b0fe8bdfa1c5df3ce4489946dda479): @user_script:1: @user_script: 1: Write commands are not allowed from read-only scripts. </span></span></span><span class="line"><span class="cl"><span class="gd"></span><span class="gi">+12: -ERR Error running script (call to 71e6319f97b0fe8bdfa1c5df3ce4489946dda479): @user_script:1: ERR Write commands are not allowed from read-only scripts. </span></span></span><span class="line"><span class="cl"><span class="gi"></span> 13: eval_ro "return redis.pcall('set','x','y')" 0 </span></span><span class="line"><span class="cl"><span class="gd">-14: -@user_script: 1: Write commands are not allowed from read-only scripts. </span></span></span><span class="line"><span class="cl"><span class="gd"></span><span class="gi">+14: -ERR Write commands are not allowed from read-only scripts. </span></span></span></code></pre> </div> </li> <li> <p> <a href="/docs/latest/commands/zpopmin/"> <code> ZPOPMIN </code> </a> / <a href="/docs/latest/commands/zpopmax/"> <code> ZPOPMAX </code> </a> used to produce wrong replies when count is 0 with non-zset <a href="https://github.com/redis/redis/pull/9711"> #9711 </a> ): </p> <ul> <li> <code> ZPOPMIN </code> / <code> ZPOPMAX </code> used to produce an <code> (empty array) </code> when <code> key </code> was not a sorted set and the optional <code> count </code> argument was set to <code> 0 </code> and now produces a <code> WRONGTYPE </code> error response instead. </li> <li> The optional <code> count </code> argument must be positive. A negative value produces a <code> value is out of range </code> error. </li> </ul> <p> These examples show changes in behavior: </p> <div class="highlight"> <pre class="chroma"><code class="language-diff" data-lang="diff"><span class="line"><span class="cl"> 1: zadd myzset 1 "one" </span></span><span class="line"><span class="cl"> 2: (integer) 1 </span></span><span class="line"><span class="cl"> 3: zadd myzset 2 "two" </span></span><span class="line"><span class="cl"> 4: (integer) 1 </span></span><span class="line"><span class="cl"> 5: zadd myzset 3 "three" </span></span><span class="line"><span class="cl"> 6: (integer) 1 </span></span><span class="line"><span class="cl"> 7: zpopmin myzset -1 </span></span><span class="line"><span class="cl"><span class="gd">- 8: (empty array) </span></span></span><span class="line"><span class="cl"><span class="gd"></span><span class="gi">+ 8: (error) ERR value is out of range, must be positive </span></span></span><span class="line"><span class="cl"><span class="gi"></span> 9: 127.0.0.1:6379&gt; set foo bar </span></span><span class="line"><span class="cl"> 10: OK </span></span><span class="line"><span class="cl"> 11: zpopmin foo 0 </span></span><span class="line"><span class="cl"><span class="gd">-12: (empty array) </span></span></span><span class="line"><span class="cl"><span class="gd"></span><span class="gi">+12: (error) WRONGTYPE Operation against a key holding the wrong kind of value </span></span></span></code></pre> </div> </li> <li> <p> <a href="/docs/latest/commands/lpop/"> <code> LPOP </code> </a> / <a href="/docs/latest/commands/rpop/"> <code> RPOP </code> </a> with count against a nonexistent list returns a null array instead of <code> (nil) </code> ( <a href="https://github.com/redis/redis/pull/10095"> #10095 </a> ). This change was backported to 6.2. </p> </li> <li> <p> <a href="/docs/latest/commands/lpop/"> <code> LPOP </code> </a> / <a href="/docs/latest/commands/rpop/"> <code> RPOP </code> </a> used to produce <code> (nil) </code> when count is 0, now produces a null array ( <a href="https://github.com/redis/redis/pull/9692"> #9692 </a> ). This change was backported to 6.2. </p> </li> <li> <p> <a href="/docs/latest/commands/xclaim/"> <code> XCLAIM </code> </a> / <a href="/docs/latest/commands/xautoclaim/"> <code> XAUTOCLAIM </code> </a> skips deleted entries instead of replying with <code> nil </code> and deletes them from the pending entry list ( <a href="https://github.com/redis/redis/pull/10227"> #10227 </a> ) - <code> XCLAIM </code> / <code> XAUTOCLAIM </code> now behaves in the following way: </p> <ul> <li> If you try to claim a deleted entry, it is deleted from the pending entry list (PEL) where it is found (as well as the group PEL). Therefore, such an entry is not claimed, just cleared from PEL (because it doesn't exist in the stream anyway). </li> <li> Because deleted entries are not claimed, <code> X[AUTO]CLAIM </code> does not return "nil" instead of an entry. </li> <li> Added an array of all the deleted stream IDs to <code> XAUTOCLAIM </code> response. </li> </ul> </li> </ul> <h4 id="acls"> ACLs </h4> <ul> <li> <p> <a href="/docs/latest/commands/acl-getuser/"> <code> ACL GETUSER </code> </a> reply now uses ACL syntax for <code> keys </code> and <code> channels </code> ( <a href="https://github.com/redis/redis/pull/9974"> #9974 </a> ). <code> ACL GETUSER </code> now uses the ACL DSL (Domain Specific Language) for keys and channels. </p> <p> These examples show changes in behavior: </p> <div class="highlight"> <pre class="chroma"><code class="language-diff" data-lang="diff"><span class="line"><span class="cl"> 1: acl setuser foo off resetchannels &amp;channel1 -@all +get </span></span><span class="line"><span class="cl"> 2: OK </span></span><span class="line"><span class="cl"> 3: acl getuser foo </span></span><span class="line"><span class="cl"> 4: 1) "flags" </span></span><span class="line"><span class="cl"> 5: 2) 1) "off" </span></span><span class="line"><span class="cl"> 6: 3) "passwords" </span></span><span class="line"><span class="cl"> 7: 4) (empty array) </span></span><span class="line"><span class="cl"> 8: 5) "commands" </span></span><span class="line"><span class="cl"> 9: 6) "-@all +get" </span></span><span class="line"><span class="cl"> 10: 7) "keys" </span></span><span class="line"><span class="cl"><span class="gd">-11: 8) (empty array) </span></span></span><span class="line"><span class="cl"><span class="gd"></span><span class="gi">+11: 8) "" </span></span></span><span class="line"><span class="cl"><span class="gi"></span> 12: 9)"channels" </span></span><span class="line"><span class="cl"><span class="gd">-13 10) 1) "channel1" </span></span></span><span class="line"><span class="cl"><span class="gd"></span><span class="gi">+13 10) "&amp;channel1" </span></span></span></code></pre> </div> </li> <li> <p> <a href="/docs/latest/commands/sort/"> <code> SORT </code> </a> / <a href="/docs/latest/commands/sort_ro/"> <code> SORT_RO </code> </a> commands reject key access patterns in <code> GET </code> and <code> BY </code> if the ACL doesn't grant the command full keyspace access ( <a href="https://github.com/redis/redis/pull/10340"> #10340 </a> ) - The <code> sort </code> and <code> sort_ro </code> commands can access external keys via <code> GET </code> and <code> BY </code> . In order to make sure the user cannot violate the authorization ACL rules, Redis 7 will reject external keys access patterns unless ACL allows <code> SORT </code> full access to all keys. For backwards compatibility, <code> SORT </code> with <code> GET </code> / <code> BY </code> keeps working, but if ACL has restrictions to certain keys, the use of these features will result in a permission denied error. </p> <p> These examples show changes in behavior: </p> <pre tabindex="0"><code>USER FOO (+sort ~* ~mylist) #FOO&gt; sort mylist by w* get v* - is O.K since ~* provides full key access </code></pre> <pre tabindex="0"><code>USER FOO (+sort %R~* ~mylist) #FOO&gt; sort mylist by w* get v* - is O.K since %R~* provides full key READ access** </code></pre> <pre tabindex="0"><code>USER FOO (+sort %W~* ~mylist) #FOO&gt; sort mylist by w* get v* - will now fail since $W~* only provides full key WRITE access </code></pre> <pre tabindex="0"><code>USER FOO (+sort ~v* ~mylist) #FOO&gt; sort mylist by w* get v* - will now fail since ~v* only provides partial key access </code></pre> </li> <li> <p> Fix ACL category for <a href="/docs/latest/commands/select/"> <code> SELECT </code> </a> , [ <code> WAIT </code> ](/docs/latest/commands/wait/, <a href="/docs/latest/commands/role/"> <code> ROLE </code> </a> [ <code> LASTSAVE </code> ](/docs/latest/commands/lastsave/, [ <code> READONLY </code> ](/docs/latest/commands/readonly/, [ <code> READWRITE </code> ](/docs/latest/commands/readwrite/, <a href="/docs/latest/commands/asking/"> <code> ASKING </code> </a> ( <a href="https://github.com/redis/redis/pull/9208"> #9208 </a> ): </p> <ul> <li> <code> SELECT </code> and <code> WAIT </code> have been recategorized from <code> @keyspace </code> to <code> @connection </code> </li> <li> <code> ROLE </code> , <code> LASTSAVE </code> have been categorized as <code> @admin </code> and <code> @dangerous </code> </li> <li> <code> ASKING </code> , <code> READONLY </code> , <code> READWRITE </code> have also been assigned the <code> @connection </code> category and removed from <code> @keyspace </code> </li> <li> Command categories are explained in <a href="/docs/latest/operate/oss_and_stack/management/security/acl/#command-categories"> ACL documentation </a> </li> </ul> </li> </ul> <h4 id="command-introspection-stats-and-configuration"> Command introspection, stats, and configuration </h4> <ul> <li> <p> <a href="/docs/latest/commands/command/"> <code> COMMAND </code> </a> reply drops <code> random </code> and <code> sort-for-scripts </code> flags, which are now part of <a href="/docs/latest/develop/reference/command-tips/"> command tips </a> ( <a href="https://github.com/redis/redis/pull/10104"> #10104 </a> ) - The <code> random </code> flag was replaced with the <code> nondeterministic_output </code> tip; the <code> sort-for-scripts </code> flag was replaced by the <code> nondeterministic_output_order </code> tip </p> </li> <li> <p> <a href="/docs/latest/commands/info/"> <code> INFO </code> </a> <code> commandstats </code> now shows the stats per sub-command ( <a href="https://github.com/redis/redis/pull/9504"> #9504 </a> ) For example, while previous versions would provide a single entry for all command usage, in Redis 7, each sub command is reported separately: </p> <ul> <li> <p> Redis 6.2: </p> <pre tabindex="0"><code>cmdstat_acl:calls=4,usec=279,usec_per_call=69.75,rejected_calls=0,failed_calls=2 </code></pre> </li> <li> <p> Redis 7: </p> <pre tabindex="0"><code>cmdstat_acl|list:calls=1,usec=4994,usec_per_call=4994.00,rejected_calls=0,failed_calls=0 cmdstat_acl|setuser:calls=2,usec=16409,usec_per_call=8204.50,rejected_calls=0,failed_calls=0 cmdstat_acl|deluser:calls=1,usec=774,usec_per_call=774.00,rejected_calls=0,failed_calls=0 cmdstat_acl|getuser:calls=1,usec=6044,usec_per_call=6044.00,rejected_calls=0,failed_calls=0 </code></pre> </li> </ul> </li> <li> <p> <a href="/docs/latest/commands/config-rewrite/"> <code> CONFIG REWRITE </code> </a> , [ <code> CONFIG RESETSTAT </code> ](/docs/latest/commands/config-resetstat/, and most [ <code> CONFIG SET </code> ](/docs/latest/commands/config-set/commands are now allowed during loading ( <a href="https://github.com/redis/redis/pull/9878"> #9878 </a> ) </p> </li> </ul> <h2 id="deprecations"> Deprecations </h2> <ul> <li> <a href="/docs/latest/commands/cluster-slots/"> <code> CLUSTER SLOTS </code> </a> is deprecated as of Redis 7.0 </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/changelog/2023/march-2023/"/> <div class="flex flex-row justify-between"> <div class="grid justify-center"> <span class="font-mono"> RATE THIS PAGE </span> <div class="star-rating"> <input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/> <label class="star" for="5-stars"> β˜… </label> <input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/> <label class="star" for="4-stars"> β˜… </label> <input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/> <label class="star" for="3-stars"> β˜… </label> <input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/> <label class="star" for="2-stars"> β˜… </label> <input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/> <label class="star" for="1-stars"> β˜… </label> </div> </div> <a class="font-mono no-underline" href="#"> Back to top ↑ </a> </div> <div class="hidden" id="feedback-form"> <div class="grid gap-2"> <textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea> <button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit"> Submit </button> </div> </div> </form> <script> document.addEventListener("DOMContentLoaded", function() { const form = document.querySelector("#page-feedback"); form.addEventListener("submit", function(event) { event.preventDefault(); var xhr = new XMLHttpRequest(); var url = "\/docusight\/api\/rate"; var params = new URLSearchParams(new FormData(form)); xhr.open("POST", url, true); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.onreadystatechange = function() { if (xhr.readyState === 4 && xhr.status === 200) { const responseData = JSON.parse(xhr.responseText); const responseMessage = responseData.response; const newText = document.createTextNode(responseMessage); form.parentNode.replaceChild(newText, form); } }; xhr.send(params); }); }); </script> </section>
https://redis.io/docs/latest/operate/rs/7.4/references/rest-api/objects/bootstrap/.html
<section class="prose w-full py-12 max-w-none"> <h1> Bootstrap object </h1> <p class="text-lg -mt-5 mb-10"> An object for bootstrap configuration </p> <p> A bootstrap configuration object. </p> <table> <thead> <tr> <th> Name </th> <th> Type/Value </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> action </td> <td> 'create_cluster' <br/> 'join_cluster' <br/> 'recover_cluster' </td> <td> Action to perform </td> </tr> <tr> <td> cluster </td> <td> <a href="/docs/latest/operate/rs/7.4/references/rest-api/objects/bootstrap/cluster_identity/"> cluster_identity </a> object </td> <td> Cluster to join or create </td> </tr> <tr> <td> cnm_https_port </td> <td> integer </td> <td> Port to join a cluster with non-default cnm_https 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> credentials </td> <td> <a href="/docs/latest/operate/rs/7.4/references/rest-api/objects/bootstrap/credentials/"> credentials </a> object </td> <td> Cluster admin credentials </td> </tr> <tr> <td> dns_suffixes </td> <td> <pre><code> [{ "name": string, "cluster_default": boolean, "use_aaaa_ns": boolean, "use_internal_addr": boolean, "slaves": array }, ...] </code></pre> </td> <td> Explicit configuration of DNS suffixes <br/> <strong> name </strong> : DNS suffix name <br/> <strong> cluster_default </strong> : Should this suffix be the default cluster suffix <br/> <strong> use_aaaa_ns </strong> : Should AAAA records be published for NS records <br/> <strong> use_internal_addr </strong> : Should internal cluster IPs be published for databases <br/> <strong> slaves </strong> : List of replica servers that should be published as NS and notified </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> license </td> <td> string </td> <td> License string. If not provided, a trial license is set by default. </td> </tr> <tr> <td> max_retries </td> <td> integer </td> <td> Max number of retries in case of recoverable errors </td> </tr> <tr> <td> node </td> <td> <a href="/docs/latest/operate/rs/7.4/references/rest-api/objects/bootstrap/node_identity/"> node_identity </a> object </td> <td> Node description </td> </tr> <tr> <td> policy </td> <td> <a href="/docs/latest/operate/rs/7.4/references/rest-api/objects/bootstrap/policy/"> policy </a> object </td> <td> Policy object </td> </tr> <tr> <td> recovery_filename </td> <td> string </td> <td> Name of backup file to recover from </td> </tr> <tr> <td> required_version </td> <td> string </td> <td> This node can only join the cluster if all nodes in the cluster have a version greater than the required_version </td> </tr> <tr> <td> retry_time </td> <td> integer </td> <td> Max waiting time between retries (in seconds) </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/bootstrap/"/> <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/.html
<section class="prose w-full py-12 max-w-none"> <h1> Memory and performance </h1> <p class="text-lg -mt-5 mb-10"> Learn more about managing your memory and optimizing performance for your database. </p> <p> Redis Enterprise Software has multiple mechanisms in its architecture to help optimize storage and performance. </p> <h2 id="memory-limits"> Memory limits </h2> <p> Database memory limits define the maximum size your database can reach across all database replicas and <a href="/docs/latest/glossary/#letter-s"> shards </a> on the cluster. Your memory limit will also determine the number of shards you'll need. </p> <p> Besides your dataset, the memory limit must also account for replication, Active-Active overhead, and module overhead, and a number of other factors. These can significantly increase your database size, sometimes increasing it by four times or more. </p> <p> For more information on memory limits, see <a href="/docs/latest/operate/rs/databases/memory-performance/memory-limit/"> Database memory limits </a> . </p> <h2 id="eviction-policies"> Eviction policies </h2> <p> When a database exceeds its memory limit, eviction policies determine which data is removed. The eviction policy removes keys based on frequency of use, how recently used, randomly, expiration date, or a combination of these factors. The policy can also be set to <code> noeviction </code> to return a memory limit error when trying to insert more data. </p> <p> The default eviction policy for databases is <code> volatile-lru </code> which evicts the least recently used keys out of all keys with the <code> expire </code> field set. The default for Active-Active databases is <code> noeviction </code> . </p> <p> For more information, see <a href="/docs/latest/operate/rs/databases/memory-performance/eviction-policy/"> eviction policies </a> . </p> <h2 id="database-persistence"> Database persistence </h2> <p> Both RAM memory and flash memory are at risk of data loss if a server or process fails. Persisting your data to disk helps protect it against loss in those situations. You can configure persistence at the time of database creation, or by editing the database’s configuration. </p> <p> There are two main types of persistence strategies in Redis Enterprise Software: append-only files (AoF) and snapshots. </p> <p> Append-only files (AoF) keep a record of data changes and writes each change to the end of a file, allowing you to recover the dataset by replaying the writes in the append-only log. </p> <p> Snapshots capture all the data as it exists in one moment in time and writes it to disk, allowing you to recover the entire dataset as it existed at that moment in time. </p> <p> For more info on data persistence see <a href="/docs/latest/operate/rs/databases/configure/database-persistence/"> Database persistence with Redis Enterprise Software </a> or <a href="https://redis.com/redis-enterprise/technology/durable-redis/"> Durable Redis </a> . </p> <h2 id="auto-tiering"> Auto Tiering </h2> <p> By default, Redis Enterprise Software stores your data entirely in <a href="https://en.wikipedia.org/wiki/Random-access_memory"> RAM </a> for improved performance. The <a href="/docs/latest/operate/rs/databases/auto-tiering/"> Auto Tiering </a> feature enables your data to span both RAM and <a href="https://en.wikipedia.org/wiki/Solid-state_drive"> SSD </a> storage ( <a href="https://en.wikipedia.org/wiki/Flash_memory"> flash memory </a> ). Keys are always stored in RAM, but Auto Tiering manages the location of their values. Frequently used (hot) values are stored on RAM, but infrequently used (warm) values are moved to flash memory. This saves on expensive RAM space, which give you comparable performance at a lower cost for large datasets. </p> <p> For more info, see <a href="/docs/latest/operate/rs/databases/auto-tiering/"> Auto Tiering </a> . </p> <h2 id="shard-placement"> Shard placement </h2> <p> The location of the primary and replica shards on the cluster nodes can impact your database performance. Primary shards and their corresponding replica shards are always placed on separate nodes for data resiliency and high availability. The shard placement policy helps to maintain optimal performance and resiliency. </p> <p> Redis Enterprise Software has two shard placement policies available: </p> <ul> <li> <strong> dense </strong> : puts as many shards as possible on the smallest number of nodes </li> <li> <strong> sparse </strong> : spread the shards across as many nodes as possible </li> </ul> <p> For more info about the shard placement policy, see <a href="/docs/latest/operate/rs/databases/memory-performance/shard-placement-policy/"> Shard placement policy </a> </p> <h2 id="metrics"> Metrics </h2> <p> From the Redis Enterprise Software Cluster Manager UI, you can monitor the performance of your clusters, nodes, databases, and shards with real-time metrics. You can also enable alerts for node, cluster, or database events such as high memory usage or throughput. </p> <p> With the Redis Enterprise Software API, you can also integrate Redis Enterprise metrics into other monitoring environments, such as Prometheus. </p> <p> For more info about monitoring with Redis Enterprise Software, see <a href="/docs/latest/operate/rs/clusters/monitoring/"> Monitoring with metrics and alerts </a> , and <a href="/docs/latest/operate/rs/databases/memory-performance/memory-limit/#memory-metrics"> Memory statistics </a> . </p> <h2 id="scaling-databases"> Scaling databases </h2> <p> Each Redis Enterprise cluster can contain multiple databases. In Redis, databases represent data that belong to a single application, tenant, or microservice. Redis Enterprise is built to scale to 100s of databases per cluster to provide flexible and efficient multi-tenancy models. </p> <p> Each database can contain few or many Redis shards. Sharding is transparent to Redis applications. Master shards in the database process data operations for a given subset of keys. The number of shards per database is configurable and depend on the throughput needs of the applications. Databases in Redis Enterprise can be resharded into more Redis shards to scale throughput while maintaining sub-millisecond latencies. Resharding is performed without downtime. </p> <a href="/docs/latest/images/rs/sharding.png" sdata-lightbox="/images/rs/sharding.png"> <img src="/docs/latest/images/rs/sharding.png"/> </a> <p> Redis Enterprise places master shards and replicas in separate nodes, racks, and zones, and uses in-memory replication to protect data against failures. </p> <p> In Redis Enterprise, each database has a quota of RAM. The quota cannot exceed the limits of the RAM available on the node. However, with Redis Enterprise Flash, RAM is extended to the local flash drive (SATA, NVMe SSDs etc). The total quota of the database can take advantage of both RAM and Flash drive. The administrator can choose the RAM vs Flash ratio and adjust that anytime in the lifetime of the database without downtime. </p> <p> With Auto Tiering, instead of storing all keys and data for a given shard in RAM, less frequently accessed values are pushed to flash. If applications need to access a value that is in flash, Redis Enterprise automatically brings the value into RAM. Depending on the flash hardware in use, applications experience slightly higher latency when bringing values back into RAM from flash. However subsequent accesses to the same value is fast, once the value is in RAM. </p> <h2 id="client-side-caching"> Client-side caching </h2> <p> Client-side caching allows Redis clients to store a subset of data in a local cache and avoid sending repeated requests to the Redis database. When used to cache frequently accessed data, this technique can improve performance by decreasing network traffic, latency, and load on the database. For more information about client-side caching, see the <a href="/docs/latest/develop/clients/client-side-caching/"> client-side caching introduction </a> . </p> <p> Redis Software supports client-side caching for databases with Redis versions 7.4 and later. See <a href="/docs/latest/operate/rs/references/compatibility/client-side-caching/"> Client-side caching compatibility with Redis Software </a> for more information about compatibility and configuration options. </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/memory-performance/"/> <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/advanced-capabilities/.html
<section class="prose w-full py-12 max-w-none"> <h1> Advanced capabilities </h1> <p class="text-lg -mt-5 mb-10"> Describes Redis Cloud Advanced capability options. </p> <p> Advanced capabilities extend Redis database functionality by adding new data types and options. </p> <p> Available options depend on your database plan and <strong> Type </strong> . </p> <h2 id="essentials"> Redis Cloud Essentials </h2> <p> All Redis Cloud Essentials databases support <a href="/docs/latest/operate/oss_and_stack/"> Redis Stack </a> , which enables the most frequently used capabilities. </p> <a href="/docs/latest/images/rc/new-database-general-type-free-stack.png" sdata-lightbox="/images/rc/new-database-general-type-free-stack.png"> <img alt="For Essentials, the Type setting in the General section includes an option for Redis Stack." src="/docs/latest/images/rc/new-database-general-type-free-stack.png" width="300px"/> </a> <p> When the database <strong> Type </strong> is set to <em> Redis Stack </em> , the Advanced capabilities section of the database details page displays the advanced capabilities included with the database and their versions. </p> <a href="/docs/latest/images/rc/database-details-modules-stack-free.png" sdata-lightbox="/images/rc/database-details-modules-stack-free.png"> <img alt="For Essentials, the Database details page lists the capabilities and versions added by Redis Stack." src="/docs/latest/images/rc/database-details-modules-stack-free.png" width="75%"/> </a> <p> Redis Cloud is updated on a regular basis, which includes the advanced capabilities supported by the service. Versions displayed by the Redis Cloud console may vary from those shown above. For the latest details of any capability, see <a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/"> Redis Stack and Redis Enterprise </a> . </p> <h2 id="pro"> Redis Cloud Pro </h2> <p> Redis Cloud Pro lets you choose advanced capabilities for each database. </p> <a href="/docs/latest/images/rc/database-details-redis-module-select-flexible.png" sdata-lightbox="/images/rc/database-details-redis-module-select-flexible.png"> <img alt="For Pro databases, you can select the capabilites included in your database." src="/docs/latest/images/rc/database-details-redis-module-select-flexible.png" width="75%"/> </a> <p> You can select more than one advanced capability for a database, though there are limits: </p> <ul> <li> <p> The following advanced capabilities can be combined in Pro databases: </p> <ul> <li> Search and query </li> <li> JSON </li> <li> Time series </li> <li> Probabilistic </li> </ul> </li> <li> <p> <a href="/docs/latest/operate/rc/databases/create-database/create-active-active-database/"> Active-Active databases </a> only support JSON and Search and query. </p> </li> </ul> <p> You don't have to combine capabilities. To remove a selected capability, clear its checkbox. </p> <p> To learn more, see <a href="/docs/latest/develop/get-started/"> Redis Stack </a> and <a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/"> Redis Stack and Redis Enterprise </a> . </p> <h3 id="search-and-query-sizing"> Search and query sizing </h3> <p> When you create a Pro database with <a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/search/"> Search and Query </a> , you must consider the sizing and throughput requirements for search and query when you define the dataset size and throughput for your database. </p> <p> Use the <a href="https://redis.io/redisearch-sizing-calculator/"> Search and query sizing calculator </a> to estimate your index size and throughput requirements. </p> <ul> <li> <strong> Dataset Size </strong> : Add the estimated index size from the Sizing calculator to your expected dataset size. </li> <li> <strong> Throughput </strong> : Enter the total estimated throughput from the Sizing calculator when you enter your throughput. </li> <li> <strong> Query performance factor </strong> : The query performance factor adds extra power specifically for search and query. Select a factor to increase your queries per second by that amount. </li> </ul> <h4 id="query-performance-factor"> Query performance factor </h4> <p> The query performance factor adds extra compute power specifically for search and query. When you create a database with search and query, you can increase your search queries per second by the selected factor. Below is a screenshot of the Cloud configuration for query performance factor. </p> <a href="/docs/latest/images/rc/database-details-query-performance-factor-pro.png" sdata-lightbox="/images/rc/database-details-query-performance-factor-pro.png"> <img alt="For Pro databases, you can select the query performance factor for your database." src="/docs/latest/images/rc/database-details-query-performance-factor-pro.png" width="75%"/> </a> <p> We recommend testing your application with a test database to see your baseline queries per second and determine how much you want to boost your query performance. After you have determined your queries per second and your desired performance factor, <a href="/docs/latest/operate/rc/databases/create-database/"> create a new database </a> with the desired performance factor and <a href="/docs/latest/operate/rc/databases/migrate-databases/"> migrate data </a> from the test database to your new database. </p> <p> For more info on how to use scalable search, see <a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/search/scalable-query-best-practices/"> Best practices for scalable Redis Query Engine </a> . </p> <form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback"> <input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rc/databases/configuration/advanced-capabilities/"/> <div class="flex flex-row justify-between"> <div class="grid justify-center"> <span class="font-mono"> RATE THIS PAGE </span> <div class="star-rating"> <input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/> <label class="star" for="5-stars"> β˜… </label> <input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/> <label class="star" for="4-stars"> β˜… </label> <input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/> <label class="star" for="3-stars"> β˜… </label> <input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/> <label class="star" for="2-stars"> β˜… </label> <input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/> <label class="star" for="1-stars"> β˜… </label> </div> </div> <a class="font-mono no-underline" href="#"> Back to top ↑ </a> </div> <div class="hidden" id="feedback-form"> <div class="grid gap-2"> <textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea> <button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit"> Submit </button> </div> </div> </form> <script> document.addEventListener("DOMContentLoaded", function() { const form = document.querySelector("#page-feedback"); form.addEventListener("submit", function(event) { event.preventDefault(); var xhr = new XMLHttpRequest(); var url = "\/docusight\/api\/rate"; var params = new URLSearchParams(new FormData(form)); xhr.open("POST", url, true); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.onreadystatechange = function() { if (xhr.readyState === 4 && xhr.status === 200) { const responseData = JSON.parse(xhr.responseText); const responseMessage = responseData.response; const newText = document.createTextNode(responseMessage); form.parentNode.replaceChild(newText, form); } }; xhr.send(params); }); }); </script> </section>
https://redis.io/docs/latest/operate/rs/references/metrics/auto-tiering/.html
<section class="prose w-full py-12 max-w-none"> <h1> Auto Tiering Metrics </h1> <p> These metrics are additional metrics for <a href="/docs/latest/operate/rs/databases/auto-tiering/"> Auto Tiering </a> databases. </p> <h4 id="-values-in-ram"> % Values in RAM </h4> <p> Percent of keys whose values are stored in RAM. </p> <p> A low percentage alert means most of the RAM is used for holding keys and not much RAM is available for values. This can be due to a high number of small keys or a few large keys. Inserting more keys might cause the database to run out of memory. </p> <p> If the percent of values in RAM is low for a subset of the database's shards, it might also indicate an unbalanced database. </p> <p> <strong> Components measured </strong> : Database and Shard </p> <h4 id="values-in-flash"> Values in flash </h4> <p> Number of keys with values stored in flash, not including <a href="/docs/latest/operate/rs/databases/durability-ha/replication/"> replication </a> . </p> <p> <strong> Components measured </strong> : Database and Shard </p> <h4 id="values-in-ram"> Values in RAM </h4> <p> Number of keys with values stored in RAM, not including <a href="/docs/latest/operate/rs/databases/durability-ha/replication/"> replication </a> . </p> <p> <strong> Components measured </strong> : Database and Shard </p> <h4 id="flash-key-value-operations"> Flash key-value operations </h4> <p> Number of operations on flash key values (read + write + del) per second. </p> <p> <strong> Components measured </strong> : Node </p> <h4 id="flash-bytessec"> Flash bytes/sec </h4> <p> Number of total bytes read and written per second on flash memory. </p> <p> <strong> Components measured </strong> : Cluster, Node, Database, and Shard </p> <h4 id="flash-io-operationssec"> Flash I/O operations/sec </h4> <p> Number of input/output operations per second on the flash storage device. </p> <p> <strong> Components measured </strong> : Cluster and Node </p> <h4 id="ramflash-access-ratio"> RAM:Flash access ratio </h4> <p> Ratio between logical Redis key value operations and actual flash key value operations. </p> <p> <strong> Components measured </strong> : Database and Shard </p> <h4 id="ram-hit-ratio"> RAM hit ratio </h4> <p> Ratio of requests processed directly from RAM to total number of requests processed. </p> <p> <strong> Components measured </strong> : Database and Shard </p> <h4 id="used-flash"> Used flash </h4> <p> Total amount of memory used to store values in flash. </p> <p> <strong> Components measured </strong> : Database and Shard </p> <h4 id="free-flash"> Free flash </h4> <p> Amount of free space on flash storage. </p> <p> <strong> Components measured </strong> : Cluster and Node </p> <h4 id="flash-fragmentation"> Flash fragmentation </h4> <p> Ratio between the used logical flash memory and the physical flash memory that is used. </p> <p> <strong> Components measured </strong> : Database and Shard </p> <h4 id="used-ram"> Used RAM </h4> <p> Total size of data stored in RAM, including keys, values, overheads, and <a href="/docs/latest/operate/rs/databases/durability-ha/replication/"> replication </a> (if enabled). </p> <p> <strong> Components measured </strong> : Database and Shard </p> <h4 id="ram-dataset-overhead"> RAM dataset overhead </h4> <p> Percentage of the <a href="#ram-limit"> RAM limit </a> that is used for anything other than values, such as key names, dictionaries, and other overheads. </p> <p> <strong> Components measured </strong> : Database and Shard </p> <h4 id="ram-limit"> RAM limit </h4> <p> Maximum amount of RAM that can be used in bytes. </p> <p> <strong> Components measured </strong> : Database </p> <h4 id="ram-usage"> RAM usage </h4> <p> Percentage of the <a href="#ram-limit"> RAM limit </a> used. </p> <p> <strong> Components measured </strong> : Database </p> <h4 id="storage-engine-usage"> Storage engine usage </h4> <p> Total count of shards used, filtered by the sorage engine (Speedb / RockSB) per given database. </p> <p> <strong> Components measured </strong> : Database, Shards </p> <h4 id="calculated-metrics"> Calculated metrics </h4> <p> These RoF statistics can be calculated from other metrics. </p> <ul> <li> <p> RoF average key size with overhead </p> <p> ( <a href="#ram-dataset-overhead"> ram_dataset_overhead </a> * <a href="#used-ram"> used_ram </a> ) / ( <a href="/docs/latest/operate/rs/references/metrics/database-operations/#total-keys"> total_keys </a> * 2) </p> </li> <li> <p> RoF average value size in RAM </p> <p> ((1 - <a href="#ram-dataset-overhead"> ram_dataset_overhead </a> ) * <a href="#used-ram"> used_ram </a> ) / ( <a href="#values-in-ram"> values_in_ram </a> * 2) </p> </li> <li> <p> RoF average value size in flash </p> <p> <a href="#used-flash"> used_flash </a> / <a href="#values-in-flash"> values_in_flash </a> </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/references/metrics/auto-tiering/"/> <div class="flex flex-row justify-between"> <div class="grid justify-center"> <span class="font-mono"> RATE THIS PAGE </span> <div class="star-rating"> <input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/> <label class="star" for="5-stars"> β˜… </label> <input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/> <label class="star" for="4-stars"> β˜… </label> <input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/> <label class="star" for="3-stars"> β˜… </label> <input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/> <label class="star" for="2-stars"> β˜… </label> <input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/> <label class="star" for="1-stars"> β˜… </label> </div> </div> <a class="font-mono no-underline" href="#"> Back to top ↑ </a> </div> <div class="hidden" id="feedback-form"> <div class="grid gap-2"> <textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea> <button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit"> Submit </button> </div> </div> </form> <script> document.addEventListener("DOMContentLoaded", function() { const form = document.querySelector("#page-feedback"); form.addEventListener("submit", function(event) { event.preventDefault(); var xhr = new XMLHttpRequest(); var url = "\/docusight\/api\/rate"; var params = new URLSearchParams(new FormData(form)); xhr.open("POST", url, true); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.onreadystatechange = function() { if (xhr.readyState === 4 && xhr.status === 200) { const responseData = JSON.parse(xhr.responseText); const responseMessage = responseData.response; const newText = document.createTextNode(responseMessage); form.parentNode.replaceChild(newText, form); } }; xhr.send(params); }); }); </script> </section>
https://redis.io/docs/latest/operate/rs/7.4/security/access-control/create-db-roles/.html
<section class="prose w-full py-12 max-w-none"> <h1> Create roles with database access only </h1> <p class="text-lg -mt-5 mb-10"> Create roles with database access only. </p> <p> Roles with database access grant the ability to access and interact with a database's data. Database access privileges are determined by defining <a href="/docs/latest/operate/rs/7.4/security/access-control/redis-acl-overview/"> Redis ACLs </a> and adding them to roles. </p> <p> To create a role that grants database access without granting access to the Redis Enterprise Cluster Manager UI and REST API: </p> <ol> <li> <p> <a href="#define-redis-acls"> Define Redis ACLs </a> that determine database access privileges. </p> </li> <li> <p> <a href="#create-roles-with-acls"> Create a role with ACLs </a> added and leave the <strong> Cluster management role </strong> as <strong> None </strong> . </p> </li> </ol> <h2 id="define-redis-acls"> Define Redis ACLs </h2> <p> To define a Redis ACL rule that you can assign to a role: </p> <ol> <li> <p> From <strong> Access Control &gt; Redis ACLs </strong> , you can either: </p> <ul> <li> <p> Point to a Redis ACL and select <a href="/docs/latest/images/rs/buttons/edit-button.png#no-click" sdata-lightbox="/images/rs/buttons/edit-button.png#no-click"> <img alt="The Edit button" class="inline" src="/docs/latest/images/rs/buttons/edit-button.png#no-click" width="25px"/> </a> to edit an existing Redis ACL. </p> </li> <li> <p> Select <strong> + Add Redis ACL </strong> to create a new Redis ACL. </p> </li> </ul> </li> <li> <p> Enter a descriptive name for the Redis ACL. This will be used to associate the ACL rule with the role. </p> </li> <li> <p> Define the ACL rule. For more information about Redis ACL rules and syntax, see the <a href="/docs/latest/operate/rs/7.4/security/access-control/redis-acl-overview/"> Redis ACL overview </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> The <strong> ACL builder </strong> does not support selectors and key permissions. Use <strong> Free text command </strong> to manually define them instead. </div> </div> </li> <li> <p> Select <strong> Save </strong> . </p> </li> </ol> <div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md"> <div class="p-2 pr-5"> <svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg"> <circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5"> </circle> <path d="M10.5 14V16" stroke="currentColor" stroke-width="2"> </path> <path d="M10.5 5V12" stroke="currentColor" stroke-width="2"> </path> </svg> </div> <div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50"> <div class="font-medium"> Note: </div> For multi-key commands on multi-slot keys, the return value is <code> failure </code> , but the command runs on the keys that are allowed. </div> </div> <h2 id="create-roles-with-acls"> Create roles with ACLs </h2> <p> To create a role that grants database access to users but blocks access to the Redis Enterprise Cluster Manager UI and REST API, set the <strong> Cluster management role </strong> to <strong> None </strong> . </p> <p> To define a role for database access: </p> <ol> <li> <p> From <strong> Access Control </strong> &gt; <strong> Roles </strong> , you can: </p> <ul> <li> <p> Point to a role and select <a href="/docs/latest/images/rs/buttons/edit-button.png#no-click" sdata-lightbox="/images/rs/buttons/edit-button.png#no-click"> <img alt="The Edit button" class="inline" src="/docs/latest/images/rs/buttons/edit-button.png#no-click" width="25px"/> </a> to edit an existing role. </p> </li> <li> <p> Select <strong> + Add role </strong> to create a new role. </p> </li> </ul> <a href="/docs/latest/images/rs/access-control-role-panel.png" sdata-lightbox="/images/rs/access-control-role-panel.png"> <img alt="Add role with name" src="/docs/latest/images/rs/access-control-role-panel.png"/> </a> </li> <li> <p> Enter a descriptive name for the role. This will be used to reference the role when configuring users. </p> </li> <li> <p> Leave <strong> Cluster management role </strong> as the default <strong> None </strong> . </p> <a href="/docs/latest/images/rs/access-control-role-name.png" sdata-lightbox="/images/rs/access-control-role-name.png"> <img alt="Add role with name" src="/docs/latest/images/rs/access-control-role-name.png"/> </a> </li> <li> <p> Select <strong> + Add ACL </strong> . </p> <a href="/docs/latest/images/rs/access-control-role-acl.png" sdata-lightbox="/images/rs/access-control-role-acl.png"> <img alt="Add role database acl" src="/docs/latest/images/rs/access-control-role-acl.png"/> </a> </li> <li> <p> Choose a Redis ACL and databases to associate with the role. </p> <a href="/docs/latest/images/rs/screenshots/access-control/access-control-role-databases.png" sdata-lightbox="/images/rs/screenshots/access-control/access-control-role-databases.png"> <img alt="Add databases to access" src="/docs/latest/images/rs/screenshots/access-control/access-control-role-databases.png"/> </a> </li> <li> <p> Select the check mark <a href="/docs/latest/images/rs/buttons/checkmark-button.png#no-click" sdata-lightbox="/images/rs/buttons/checkmark-button.png#no-click"> <img alt="The Check button" class="inline" src="/docs/latest/images/rs/buttons/checkmark-button.png#no-click" width="25px"/> </a> to confirm. </p> </li> <li> <p> Select <strong> Save </strong> . </p> <a href="/docs/latest/images/rs/access-control-role-save.png" sdata-lightbox="/images/rs/access-control-role-save.png"> <img alt="Add databases to access" src="/docs/latest/images/rs/access-control-role-save.png"/> </a> </li> </ol> <p> You can <a href="/docs/latest/operate/rs/7.4/security/access-control/create-users/#assign-roles-to-users"> assign the new role to users </a> to grant database access. </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/security/access-control/create-db-roles/"/> <div class="flex flex-row justify-between"> <div class="grid justify-center"> <span class="font-mono"> RATE THIS PAGE </span> <div class="star-rating"> <input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/> <label class="star" for="5-stars"> β˜… </label> <input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/> <label class="star" for="4-stars"> β˜… </label> <input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/> <label class="star" for="3-stars"> β˜… </label> <input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/> <label class="star" for="2-stars"> β˜… </label> <input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/> <label class="star" for="1-stars"> β˜… </label> </div> </div> <a class="font-mono no-underline" href="#"> Back to top ↑ </a> </div> <div class="hidden" id="feedback-form"> <div class="grid gap-2"> <textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea> <button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit"> Submit </button> </div> </div> </form> <script> document.addEventListener("DOMContentLoaded", function() { const form = document.querySelector("#page-feedback"); form.addEventListener("submit", function(event) { event.preventDefault(); var xhr = new XMLHttpRequest(); var url = "\/docusight\/api\/rate"; var params = new URLSearchParams(new FormData(form)); xhr.open("POST", url, true); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.onreadystatechange = function() { if (xhr.readyState === 4 && xhr.status === 200) { const responseData = JSON.parse(xhr.responseText); const responseMessage = responseData.response; const newText = document.createTextNode(responseMessage); form.parentNode.replaceChild(newText, form); } }; xhr.send(params); }); }); </script> </section>
https://redis.io/docs/latest/develop/interact/search-and-query/advanced-concepts/stemming.html
<section class="prose w-full py-12"> <h1> Stemming </h1> <p class="text-lg -mt-5 mb-10"> Stemming support </p> <p> RediSearch supports stemming - that is adding the base form of a word to the index. This allows the query for " <code> hiring </code> " to also return results for " <code> hire </code> " and " <code> hired </code> ", for example. </p> <p> The current stemming support is based on the Snowball stemmer library, which supports most European languages, as well as Arabic and other. See the " <a href="#supported-languages"> Supported languages </a> " section below. We hope to include more languages soon (if you need a specific language support, please open an issue). </p> <p> For further details see the <a href="https://snowballstem.org/"> Snowball Stemmer website </a> . </p> <h2 id="how-it-works"> How it works? </h2> <p> Stemming maps different forms of the same word to a common root - "stem" - for example, the English stemmer maps <em> studied </em> , <em> studies </em> and <em> study </em> to <em> studi </em> . So a searching for <em> studied </em> would also find documents which only have the other forms. </p> <p> In order to define which language the Stemmer should apply when building the index, you need to specify the <code> LANGUAGE </code> parameter for the entire index or for the specific field. For more details check the <a href="/docs/latest/develop/commands/ft.create"> FT.CREATE </a> syntax. </p> <p> <strong> Create a index with language definition </strong> </p> <p> Create a index for words in German " <code> wort: </code> " with a single <code> TEXT </code> field " <code> wort </code> " </p> <div class="highlight"> <pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">redis&gt; FT.CREATE idx:german ON HASH PREFIX <span class="m">1</span> <span class="s2">"wort:"</span> LANGUAGE GERMAN SCHEMA wort TEXT</span></span></code></pre> </div> <p> <strong> Adding words </strong> </p> <p> Adding some words with same stem in German, all variations of the word <code> stΓΌck </code> ( <code> piece </code> in english): <code> stΓΌck stΓΌcke stuck stucke </code> =&gt; <code> stuck </code> </p> <div class="highlight"> <pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">redis&gt; HSET wort:1 wort stΓΌck </span></span><span class="line"><span class="cl"><span class="o">(</span>integer<span class="o">)</span> <span class="m">1</span> </span></span><span class="line"><span class="cl">redis&gt; HSET wort:2 wort stΓΌcke </span></span><span class="line"><span class="cl"><span class="o">(</span>integer<span class="o">)</span> <span class="m">1</span> </span></span><span class="line"><span class="cl">redis&gt; HSET wort:3 wort stuck </span></span><span class="line"><span class="cl"><span class="o">(</span>integer<span class="o">)</span> <span class="m">1</span> </span></span><span class="line"><span class="cl">redis&gt; HSET wort:4 wort stucke </span></span><span class="line"><span class="cl"><span class="o">(</span>integer<span class="o">)</span> <span class="m">1</span></span></span></code></pre> </div> <p> <strong> Searching for a common stem </strong> </p> <p> Search for "stuck" (german for "piece"). As of v2.10, it's only necessary to specify the <code> LANGUAGE </code> argument when it wasn't specified to create the index being used to search. Note the results for words that contains " <code> ΓΌ </code> " are encoded in UTF-8. </p> <div class="highlight"> <pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">redis&gt; FT.SEARCH idx:german <span class="s1">'@wort:(stuck)'</span> German </span></span><span class="line"><span class="cl">1<span class="o">)</span> <span class="o">(</span>integer<span class="o">)</span> <span class="m">4</span> </span></span><span class="line"><span class="cl">2<span class="o">)</span> <span class="s2">"wort:3"</span> </span></span><span class="line"><span class="cl">3<span class="o">)</span> 1<span class="o">)</span> <span class="s2">"wort"</span> </span></span><span class="line"><span class="cl"> 2<span class="o">)</span> <span class="s2">"stuck"</span> </span></span><span class="line"><span class="cl">4<span class="o">)</span> <span class="s2">"wort:4"</span> </span></span><span class="line"><span class="cl">5<span class="o">)</span> 1<span class="o">)</span> <span class="s2">"wort"</span> </span></span><span class="line"><span class="cl"> 2<span class="o">)</span> <span class="s2">"stucke"</span> </span></span><span class="line"><span class="cl">6<span class="o">)</span> <span class="s2">"wort:1"</span> </span></span><span class="line"><span class="cl">7<span class="o">)</span> 1<span class="o">)</span> <span class="s2">"wort"</span> </span></span><span class="line"><span class="cl"> 2<span class="o">)</span> <span class="s2">"st\xc3\xbcck"</span> </span></span><span class="line"><span class="cl">8<span class="o">)</span> <span class="s2">"wort:2"</span> </span></span><span class="line"><span class="cl">9<span class="o">)</span> 1<span class="o">)</span> <span class="s2">"wort"</span> </span></span><span class="line"><span class="cl"> 2<span class="o">)</span> <span class="s2">"st\xc3\xbccke"</span></span></span></code></pre> </div> <h2 id="supported-languages"> Supported languages </h2> <p> The following languages are supported and can be passed to the engine when indexing or querying using lowercase: </p> <ul> <li> arabic </li> <li> armenian </li> <li> danish </li> <li> dutch </li> <li> english </li> <li> finnish </li> <li> french </li> <li> german </li> <li> hungarian </li> <li> italian </li> <li> norwegian </li> <li> portuguese </li> <li> romanian </li> <li> russian </li> <li> serbian </li> <li> spanish </li> <li> swedish </li> <li> tamil </li> <li> turkish </li> <li> yiddish </li> <li> chinese (see below) </li> </ul> <h2 id="chinese-support"> Chinese support </h2> <p> Indexing a Chinese document is different than indexing a document in most other languages because of how tokens are extracted. While most languages can have their tokens distinguished by separation characters and whitespace, this is not common in Chinese. </p> <p> Chinese tokenization is done by scanning the input text and checking every character or sequence of characters against a dictionary of predefined terms and determining the most likely match based on the surrounding terms and characters. </p> <p> Redis Stack makes use of the <a href="https://github.com/lionsoul2014/friso"> Friso </a> chinese tokenization library for this purpose. This is largely transparent to the user and often no additional configuration is required. </p> <h2 id="using-custom-dictionaries"> Using custom dictionaries </h2> <p> If you wish to use a custom dictionary, you can do so at the module level when loading the module. The <code> FRISOINI </code> setting can point to the location of a <code> friso.ini </code> file which contains the relevant settings and paths to the dictionary files. </p> <p> Note that there is no default <code> friso.ini </code> file location. RedisSearch comes with its own <code> friso.ini </code> and dictionary files that are compiled into the module binary at build-time. </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/advanced-concepts/stemming/"/> <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/query/vector-search.html
<section class="prose w-full py-12"> <h1> Vector search </h1> <p class="text-lg -mt-5 mb-10"> Query for data based on vector embeddings </p> <p> This article gives you a good overview of how to perform vector search queries with Redis Stack. See the <a href="/docs/latest/develop/get-started/vector-database/"> Redis as a vector database quick start guide </a> for more information about Redis as a vector database. You can also find more detailed information about all the parameters in the <a href="/docs/latest/develop/interact/search-and-query/advanced-concepts/vectors/"> vector reference documentation </a> . </p> <p> A vector search query on a vector field allows you to find all vectors in a vector space that are close to a given vector. You can query for the k-nearest neighbors or vectors within a given radius. </p> <p> The examples in this article use a schema with the following fields: </p> <table> <thead> <tr> <th> JSON field </th> <th> Field alias </th> <th> Field type </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> <code> $.description </code> </td> <td> <code> description </code> </td> <td> <code> TEXT </code> </td> <td> The description of a bicycle as unstructured text </td> </tr> <tr> <td> <code> $.description_embeddings </code> </td> <td> <code> vector </code> </td> <td> <code> VECTOR </code> </td> <td> The vector that a machine learning model derived from the description text </td> </tr> </tbody> </table> <h2 id="k-neareast-neighbours-knn"> K-neareast neighbours (KNN) </h2> <p> The Redis command <a href="/docs/latest/commands/ft.search"> FT.SEARCH </a> takes the index name, the query string, and additional query parameters as arguments. You need to pass the number of nearest neighbors, the vector field name, and the vector's binary representation in the following way: </p> <pre tabindex="0"><code>FT.SEARCH index "(*)=&gt;[KNN num_neighbours @field $vector]" PARAMS 2 vector "binary_data" DIALECT 2 </code></pre> <p> Here is a more detailed explanation of this query: </p> <ol> <li> <strong> Pre-filter </strong> : The first expression within the round brackets is a filter. It allows you to decide which vectors should be taken into account before the vector search is performed. The expression <code> (*) </code> means that all vectors are considered. </li> <li> <strong> Next step </strong> : The <code> =&gt; </code> arrow indicates that the pre-filtering happens before the vector search. </li> <li> <strong> KNN query </strong> : The expression <code> [KNN num_neighbours @field $vector] </code> is a parameterized query expression. A parameter name is indicated by the <code> $ </code> prefix within the query string. </li> <li> <strong> Vector binary data </strong> : You need to use the <code> PARAMS </code> argument to substitute <code> $vector </code> with the binary representation of the vector. The value <code> 2 </code> indicates that <code> PARAMS </code> is followed by two arguments, the parameter name <code> vector </code> and the parameter value. </li> <li> <strong> Dialect </strong> : The vector search feature has been available since version two of the query dialect. </li> </ol> <p> You can read more about the <code> PARAMS </code> argument in the <a href="/docs/latest/commands/ft.search"> FT.SEARCH </a> command reference. </p> <p> The following example shows you how to query for three bikes based on their description embeddings, and by using the field alias <code> vector </code> . The result is returned in ascending order based on the distance. You can see that the query only returns the fields <code> __vector_score </code> and <code> description </code> . The field <code> __vector_score </code> is present by default. Because you can have multiple vector fields in your schema, the vector score field name depends on the name of the vector field. If you change the field name <code> @vector </code> to <code> @foo </code> , the score field name changes to <code> __foo_score </code> . </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="query_vector-stepvector1"> <input checked="" class="radiotab w-0 h-0" data-lang="redis-cli" id="redis-cli_query_vector-stepvector1" name="query_vector-stepvector1" 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_query_vector-stepvector1" title="Open example"> &gt;_ Redis CLI </label> <div aria-labelledby="tab-query_vector-stepvector1" class="panel order-last hidden w-full mt-0 relative" id="panel_redis-cli_query_vector-stepvector1" role="tabpanel" tabindex="0"> <div class="highlight"> <pre class="chroma"><code class="language-plaintext" data-lang="plaintext"><span class="line hl"><span class="cl">FT.SEARCH idx:bikes_vss "(*)=&gt;[KNN 3 @vector $query_vector]" PARAMS 2 "query_vector" "Z\xf8\x15:\xf23\xa1\xbfZ\x1dI&gt;\r\xca9..." SORTBY "__vector_score" ASC RETURN 2 "__vector_score" "description" DIALECT 2</span></span></code></pre> </div> <button class="clipboard-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-10 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="copyCodeToClipboard('#panel_redis-cli_query_vector-stepvector1')" 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="javascript" id="Nodejs_query_vector-stepvector1" name="query_vector-stepvector1" 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_query_vector-stepvector1" title="Open example"> Node.js </label> <div aria-labelledby="tab-query_vector-stepvector1" class="panel order-last hidden w-full mt-0 relative" id="panel_Nodejs_query_vector-stepvector1" 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">'node:assert'</span><span class="p">;</span> </span></span><span class="line"><span class="cl"><span class="kr">import</span> <span class="nx">fs</span> <span class="nx">from</span> <span class="s1">'node:fs'</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 class="kr">import</span> <span class="p">{</span> <span class="nx">SchemaFieldTypes</span><span class="p">,</span> <span class="nx">VectorAlgorithms</span> <span class="p">}</span> <span class="nx">from</span> <span class="s1">'@redis/search'</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">pipeline</span> <span class="p">}</span> <span class="nx">from</span> <span class="s1">'@xenova/transformers'</span><span class="p">;</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="kd">function</span> <span class="nx">float32Buffer</span><span class="p">(</span><span class="nx">arr</span><span class="p">)</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="kr">const</span> <span class="nx">floatArray</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Float32Array</span><span class="p">(</span><span class="nx">arr</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> <span class="kr">const</span> <span class="nx">float32Buffer</span> <span class="o">=</span> <span class="nx">Buffer</span><span class="p">.</span><span class="nx">from</span><span class="p">(</span><span class="nx">floatArray</span><span class="p">.</span><span class="nx">buffer</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="nx">float32Buffer</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="kr">async</span> <span class="kd">function</span> <span class="nx">embedText</span><span class="p">(</span><span class="nx">sentence</span><span class="p">)</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="kd">let</span> <span class="nx">modelName</span> <span class="o">=</span> <span class="s1">'Xenova/all-MiniLM-L6-v2'</span><span class="p">;</span> </span></span><span class="line"><span class="cl"> <span class="kd">let</span> <span class="nx">pipe</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">pipeline</span><span class="p">(</span><span class="s1">'feature-extraction'</span><span class="p">,</span> <span class="nx">modelName</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">vectorOutput</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">pipe</span><span class="p">(</span><span class="nx">sentence</span><span class="p">,</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="nx">pooling</span><span class="o">:</span> <span class="s1">'mean'</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nx">normalize</span><span class="o">:</span> <span class="kc">true</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="kr">const</span> <span class="nx">embedding</span> <span class="o">=</span> <span class="nb">Object</span><span class="p">.</span><span class="nx">values</span><span class="p">(</span><span class="nx">vectorOutput</span><span class="o">?</span><span class="p">.</span><span class="nx">data</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="nx">embedding</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="kd">let</span> <span class="nx">query</span> <span class="o">=</span> <span class="s1">'Bike for small kids'</span><span class="p">;</span> </span></span><span class="line"><span class="cl"><span class="kd">let</span> <span class="nx">vector_query</span> <span class="o">=</span> <span class="nx">float32Buffer</span><span class="p">(</span><span class="kr">await</span> <span class="nx">embedText</span><span class="p">(</span><span class="s1">'That is a very happy person'</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="c1">// create index </span></span></span><span class="line"><span class="cl"><span class="c1"></span><span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">ft</span><span class="p">.</span><span class="nx">create</span><span class="p">(</span><span class="s1">'idx:bicycle'</span><span class="p">,</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="s1">'$.description'</span><span class="o">:</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="nx">type</span><span class="o">:</span> <span class="nx">SchemaFieldTypes</span><span class="p">.</span><span class="nx">TEXT</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nx">AS</span><span class="o">:</span> <span class="s1">'description'</span> </span></span><span class="line"><span class="cl"> <span class="p">},</span> </span></span><span class="line"><span class="cl"> <span class="s1">'$.description_embeddings'</span><span class="o">:</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="nx">type</span><span class="o">:</span> <span class="nx">SchemaFieldTypes</span><span class="p">.</span><span class="nx">VECTOR</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nx">TYPE</span><span class="o">:</span> <span class="s1">'FLOAT32'</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nx">ALGORITHM</span><span class="o">:</span> <span class="nx">VectorAlgorithms</span><span class="p">.</span><span class="nx">FLAT</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nx">DIM</span><span class="o">:</span> <span class="mi">384</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nx">DISTANCE_METRIC</span><span class="o">:</span> <span class="s1">'COSINE'</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nx">AS</span><span class="o">:</span> <span class="s1">'vector'</span> </span></span><span class="line"><span class="cl"> <span class="p">}</span> </span></span><span class="line"><span class="cl"><span class="p">},</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="nx">ON</span><span class="o">:</span> <span class="s1">'JSON'</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nx">PREFIX</span><span class="o">:</span> <span class="s1">'bicycle:'</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="c1">// load data </span></span></span><span class="line"><span class="cl"><span class="c1"></span><span class="kr">const</span> <span class="nx">bicycles</span> <span class="o">=</span> <span class="nx">JSON</span><span class="p">.</span><span class="nx">parse</span><span class="p">(</span><span class="nx">fs</span><span class="p">.</span><span class="nx">readFileSync</span><span class="p">(</span><span class="s1">'data/query_vector.json'</span><span class="p">,</span> <span class="s1">'utf8'</span><span class="p">));</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="kr">await</span> <span class="nb">Promise</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">bicycles</span><span class="p">.</span><span class="nx">map</span><span class="p">((</span><span class="nx">bicycle</span><span class="p">,</span> <span class="nx">bid</span><span class="p">)</span> <span class="p">=&gt;</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">json</span><span class="p">.</span><span class="nx">set</span><span class="p">(</span><span class="sb">`bicycle:</span><span class="si">${</span><span class="nx">bid</span><span class="si">}</span><span class="sb">`</span><span class="p">,</span> <span class="s1">'$'</span><span class="p">,</span> <span class="nx">bicycle</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> <span class="p">})</span> </span></span><span class="line"><span class="cl"><span class="p">);</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line 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">ft</span><span class="p">.</span><span class="nx">search</span><span class="p">(</span><span class="s1">'idx:bicycle'</span><span class="p">,</span> </span></span><span class="line hl"><span class="cl"> <span class="s1">'*=&gt;[KNN 3 @vector $query_vector AS score]'</span><span class="p">,</span> <span class="p">{</span> </span></span><span class="line hl"><span class="cl"> <span class="nx">PARAMS</span><span class="o">:</span> <span class="p">{</span> <span class="nx">query_vector</span><span class="o">:</span> <span class="nx">vector_query</span> <span class="p">},</span> </span></span><span class="line hl"><span class="cl"> <span class="nx">RETURN</span><span class="o">:</span> <span class="p">[</span><span class="s1">'description'</span><span class="p">],</span> </span></span><span class="line hl"><span class="cl"> <span class="nx">DIALECT</span><span class="o">:</span> <span class="mi">2</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="nx">total</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 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">// &gt;&gt;&gt; </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="c1">// total: 3, </span></span></span><span class="line hl"><span class="cl"><span class="c1">// documents: [ </span></span></span><span class="line hl"><span class="cl"><span class="c1">// { id: 'bicycle:0', value: [Object: null prototype] {} }, </span></span></span><span class="line hl"><span class="cl"><span class="c1">// { id: 'bicycle:2', value: [Object: null prototype] {} }, </span></span></span><span class="line hl"><span class="cl"><span class="c1">// { id: 'bicycle:9', value: [Object: null prototype] {} } </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="c1">//} </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">ft</span><span class="p">.</span><span class="nx">search</span><span class="p">(</span><span class="s1">'idx:bicycle'</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s1">'@vector:[VECTOR_RANGE 0.9 $query_vector]=&gt;{$YIELD_DISTANCE_AS: vector_dist}'</span><span class="p">,</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="nx">PARAMS</span><span class="o">:</span> <span class="p">{</span> <span class="nx">query_vector</span><span class="o">:</span> <span class="nx">vector_query</span> <span class="p">},</span> </span></span><span class="line"><span class="cl"> <span class="nx">SORTBY</span><span class="o">:</span> <span class="s1">'vector_dist'</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nx">RETURN</span><span class="o">:</span> <span class="p">[</span><span class="s1">'vector_dist'</span><span class="p">,</span> <span class="s1">'description'</span><span class="p">],</span> </span></span><span class="line"><span class="cl"> <span class="nx">DIALECT</span><span class="o">:</span> <span class="mi">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="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="nx">total</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 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">// &gt;&gt;&gt; </span></span></span><span class="line"><span class="cl"><span class="c1">//{ </span></span></span><span class="line"><span class="cl"><span class="c1">// total: 1, </span></span></span><span class="line"><span class="cl"><span class="c1">// documents: [ { id: 'bicycle:0', value: [Object: null prototype] } ] </span></span></span><span class="line"><span class="cl"><span class="c1">//} </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_query_vector-stepvector1')" 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_query_vector-stepvector1" 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/query-vector.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="python" id="RedisVL_query_vector-stepvector1" name="query_vector-stepvector1" 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="RedisVL_query_vector-stepvector1" title="Open example"> RedisVL </label> <div aria-labelledby="tab-query_vector-stepvector1" class="panel order-last hidden w-full mt-0 relative" id="panel_RedisVL_query_vector-stepvector1" 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">json</span> </span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">warnings</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 class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span> </span></span><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">redisvl.index</span> <span class="kn">import</span> <span class="n">SearchIndex</span> </span></span><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">redisvl.query</span> <span class="kn">import</span> <span class="n">RangeQuery</span><span class="p">,</span> <span class="n">VectorQuery</span> </span></span><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">redisvl.schema</span> <span class="kn">import</span> <span class="n">IndexSchema</span> </span></span><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">sentence_transformers</span> <span class="kn">import</span> <span class="n">SentenceTransformer</span> </span></span><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">def</span> <span class="nf">embed_text</span><span class="p">(</span><span class="n">model</span><span class="p">,</span> <span class="n">text</span><span class="p">):</span> </span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">model</span><span class="o">.</span><span class="n">encode</span><span class="p">(</span><span class="n">text</span><span class="p">))</span><span class="o">.</span><span class="n">astype</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">float32</span><span class="p">)</span><span class="o">.</span><span class="n">tobytes</span><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">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">warnings</span><span class="o">.</span><span class="n">filterwarnings</span><span class="p">(</span><span class="s2">"ignore"</span><span class="p">,</span> <span class="n">category</span><span class="o">=</span><span class="ne">FutureWarning</span><span class="p">,</span> <span class="n">message</span><span class="o">=</span><span class="sa">r</span><span class="s2">".*clean_up_tokenization_spaces.*"</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="n">model</span> <span class="o">=</span> <span class="n">SentenceTransformer</span><span class="p">(</span><span class="s1">'sentence-transformers/all-MiniLM-L6-v2'</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="c1"># create index</span> </span></span><span class="line"><span class="cl"><span class="n">schema</span> <span class="o">=</span> <span class="n">IndexSchema</span><span class="o">.</span><span class="n">from_yaml</span><span class="p">(</span><span class="s1">'data/query_vector_idx.yaml'</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="n">index</span> <span class="o">=</span> <span class="n">SearchIndex</span><span class="p">(</span><span class="n">schema</span><span class="p">,</span> <span class="n">r</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="n">index</span><span class="o">.</span><span class="n">create</span><span class="p">(</span><span class="n">overwrite</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">drop</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="c1"># load data</span> </span></span><span class="line"><span class="cl"><span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="s2">"data/query_vector.json"</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span> </span></span><span class="line"><span class="cl"> <span class="n">bicycles</span> <span class="o">=</span> <span class="n">json</span><span class="o">.</span><span class="n">load</span><span class="p">(</span><span class="n">f</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="n">index</span><span class="o">.</span><span class="n">load</span><span class="p">(</span><span class="n">bicycles</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line hl"><span class="cl"><span class="n">query</span> <span class="o">=</span> <span class="s2">"Bike for small kids"</span> </span></span><span class="line hl"><span class="cl"><span class="n">query_vector</span> <span class="o">=</span> <span class="n">embed_text</span><span class="p">(</span><span class="n">model</span><span class="p">,</span> <span class="n">query</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">query_vector</span><span class="p">[:</span><span class="mi">10</span><span class="p">])</span> <span class="c1"># &gt;&gt;&gt; b'\x02=c=\x93\x0e\xe0=aC'</span> </span></span><span class="line hl"><span class="cl"> </span></span><span class="line hl"><span class="cl"><span class="n">vquery</span> <span class="o">=</span> <span class="n">VectorQuery</span><span class="p">(</span> </span></span><span class="line hl"><span class="cl"> <span class="n">vector</span><span class="o">=</span><span class="n">query_vector</span><span class="p">,</span> </span></span><span class="line hl"><span class="cl"> <span class="n">vector_field_name</span><span class="o">=</span><span class="s2">"description_embeddings"</span><span class="p">,</span> </span></span><span class="line hl"><span class="cl"> <span class="n">num_results</span><span class="o">=</span><span class="mi">3</span><span class="p">,</span> </span></span><span class="line hl"><span class="cl"> <span class="n">return_score</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">return_fields</span><span class="o">=</span><span class="p">[</span><span class="s2">"description"</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="n">res</span> <span class="o">=</span> <span class="n">index</span><span class="o">.</span><span class="n">query</span><span class="p">(</span><span class="n">vquery</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 class="c1"># &gt;&gt;&gt; [{'id': 'bicycle:6b702e8b...', 'vector_distance': '0.399111807346', 'description': 'Kids want...</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="n">vquery</span> <span class="o">=</span> <span class="n">RangeQuery</span><span class="p">(</span> </span></span><span class="line"><span class="cl"> <span class="n">vector</span><span class="o">=</span><span class="n">query_vector</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="n">vector_field_name</span><span class="o">=</span><span class="s2">"description_embeddings"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="n">distance_threshold</span><span class="o">=</span><span class="mf">0.5</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="n">return_score</span><span class="o">=</span><span class="kc">True</span> </span></span><span class="line"><span class="cl"><span class="p">)</span><span class="o">.</span><span class="n">return_fields</span><span class="p">(</span><span class="s2">"description"</span><span class="p">)</span><span class="o">.</span><span class="n">dialect</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">index</span><span class="o">.</span><span class="n">query</span><span class="p">(</span><span class="n">vquery</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 class="c1"># &gt;&gt;&gt; [{'id': 'bicycle:6bcb1bb4...', 'vector_distance': '0.399111807346', 'description': 'Kids want...</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_RedisVL_query_vector-stepvector1')" 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_RedisVL_query_vector-stepvector1" 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-vl/" tabindex="1" title="Quick-Start"> RedisVL 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-vl-python/tree/main/doctests/query_vector.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> </div> <!-- Python query> query = ( Query('(*)=>[KNN 3 @vector $query_vector]') .sort_by('__vector_score') .return_fields('__vector_score', 'description') .dialect(2) ) </!--> <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 binary value of the query vector is significantly shortened in the CLI example above. </div> </div> <h2 id="radius"> Radius </h2> <p> Instead of the number of nearest neighbors, you need to pass the radius along with the index name, the vector field name, and the vector's binary value: </p> <pre tabindex="0"><code>FT.SEARCH index "@field:[VECTOR_RANGE radius $vector]" PARAMS 2 vector "binary_data" DIALECT 2 </code></pre> <p> If you want to sort by distance, then you must yield the distance via the range query parameter <code> $YIELD_DISTANCE_AS </code> : </p> <pre tabindex="0"><code>FT.SEARCH index "@field:[VECTOR_RANGE radius $vector]=&gt;{$YIELD_DISTANCE_AS: dist_field}" PARAMS 2 vector "binary_data" SORTBY dist_field DIALECT 2 </code></pre> <p> Here is a more detailed explanation of this query: </p> <ol> <li> <strong> Range query </strong> : the syntax of a radius query is very similar to the regular range query, except for the keyword <code> VECTOR_RANGE </code> . You can also combine a vector radius query with other queries in the same way as regular range queries. See <a href="/docs/latest/develop/interact/search-and-query/query/combined/"> combined queries article </a> for more details. </li> <li> <strong> Additional step </strong> : the <code> =&gt; </code> arrow means that the range query is followed by evaluating additional parameters. </li> <li> <strong> Range query parameters </strong> : parameters such as <code> $YIELD_DISTANCE_AS </code> can be found in the <a href="/docs/latest/develop/interact/search-and-query/advanced-concepts/vectors/"> vectors reference documentation </a> . </li> <li> <strong> Vector binary data </strong> : you need to use <code> PARAMS </code> to pass the binary representation of the vector. </li> <li> <strong> Dialect </strong> : vector search has been available since version two of the query dialect. </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> By default, <a href="/docs/latest/commands/ft.search/"> <code> FT.SEARCH </code> </a> returns only the first ten results. The <a href="/docs/latest/develop/interact/search-and-query/query/range/"> range query article </a> explains to you how to scroll through the result set. </div> </div> <p> The example below shows a radius query that returns the description and the distance within a radius of <code> 0.5 </code> . The result is sorted by the distance. </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="query_vector-stepvector2"> <input checked="" class="radiotab w-0 h-0" data-lang="redis-cli" id="redis-cli_query_vector-stepvector2" name="query_vector-stepvector2" 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_query_vector-stepvector2" title="Open example"> &gt;_ Redis CLI </label> <div aria-labelledby="tab-query_vector-stepvector2" class="panel order-last hidden w-full mt-0 relative" id="panel_redis-cli_query_vector-stepvector2" role="tabpanel" tabindex="0"> <div class="highlight"> <pre class="chroma"><code class="language-plaintext" data-lang="plaintext"><span class="line hl"><span class="cl">FT.SEARCH idx:bikes_vss "@vector:[VECTOR_RANGE 0.5 $query_vector]=&gt;{$YIELD_DISTANCE_AS: vector_dist}" PARAMS 2 "query_vector" "Z\xf8\x15:\xf23\xa1\xbfZ\x1dI&gt;\r\xca9..." SORTBY vector_dist ASC RETURN 2 vector_dist description DIALECT 2</span></span></code></pre> </div> <button class="clipboard-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-10 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="copyCodeToClipboard('#panel_redis-cli_query_vector-stepvector2')" 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="javascript" id="Nodejs_query_vector-stepvector2" name="query_vector-stepvector2" 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_query_vector-stepvector2" title="Open example"> Node.js </label> <div aria-labelledby="tab-query_vector-stepvector2" class="panel order-last hidden w-full mt-0 relative" id="panel_Nodejs_query_vector-stepvector2" 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">'node:assert'</span><span class="p">;</span> </span></span><span class="line"><span class="cl"><span class="kr">import</span> <span class="nx">fs</span> <span class="nx">from</span> <span class="s1">'node:fs'</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 class="kr">import</span> <span class="p">{</span> <span class="nx">SchemaFieldTypes</span><span class="p">,</span> <span class="nx">VectorAlgorithms</span> <span class="p">}</span> <span class="nx">from</span> <span class="s1">'@redis/search'</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">pipeline</span> <span class="p">}</span> <span class="nx">from</span> <span class="s1">'@xenova/transformers'</span><span class="p">;</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="kd">function</span> <span class="nx">float32Buffer</span><span class="p">(</span><span class="nx">arr</span><span class="p">)</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="kr">const</span> <span class="nx">floatArray</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Float32Array</span><span class="p">(</span><span class="nx">arr</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> <span class="kr">const</span> <span class="nx">float32Buffer</span> <span class="o">=</span> <span class="nx">Buffer</span><span class="p">.</span><span class="nx">from</span><span class="p">(</span><span class="nx">floatArray</span><span class="p">.</span><span class="nx">buffer</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="nx">float32Buffer</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="kr">async</span> <span class="kd">function</span> <span class="nx">embedText</span><span class="p">(</span><span class="nx">sentence</span><span class="p">)</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="kd">let</span> <span class="nx">modelName</span> <span class="o">=</span> <span class="s1">'Xenova/all-MiniLM-L6-v2'</span><span class="p">;</span> </span></span><span class="line"><span class="cl"> <span class="kd">let</span> <span class="nx">pipe</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">pipeline</span><span class="p">(</span><span class="s1">'feature-extraction'</span><span class="p">,</span> <span class="nx">modelName</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">vectorOutput</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">pipe</span><span class="p">(</span><span class="nx">sentence</span><span class="p">,</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="nx">pooling</span><span class="o">:</span> <span class="s1">'mean'</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nx">normalize</span><span class="o">:</span> <span class="kc">true</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="kr">const</span> <span class="nx">embedding</span> <span class="o">=</span> <span class="nb">Object</span><span class="p">.</span><span class="nx">values</span><span class="p">(</span><span class="nx">vectorOutput</span><span class="o">?</span><span class="p">.</span><span class="nx">data</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="nx">embedding</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="kd">let</span> <span class="nx">query</span> <span class="o">=</span> <span class="s1">'Bike for small kids'</span><span class="p">;</span> </span></span><span class="line"><span class="cl"><span class="kd">let</span> <span class="nx">vector_query</span> <span class="o">=</span> <span class="nx">float32Buffer</span><span class="p">(</span><span class="kr">await</span> <span class="nx">embedText</span><span class="p">(</span><span class="s1">'That is a very happy person'</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="c1">// create index </span></span></span><span class="line"><span class="cl"><span class="c1"></span><span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">ft</span><span class="p">.</span><span class="nx">create</span><span class="p">(</span><span class="s1">'idx:bicycle'</span><span class="p">,</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="s1">'$.description'</span><span class="o">:</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="nx">type</span><span class="o">:</span> <span class="nx">SchemaFieldTypes</span><span class="p">.</span><span class="nx">TEXT</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nx">AS</span><span class="o">:</span> <span class="s1">'description'</span> </span></span><span class="line"><span class="cl"> <span class="p">},</span> </span></span><span class="line"><span class="cl"> <span class="s1">'$.description_embeddings'</span><span class="o">:</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="nx">type</span><span class="o">:</span> <span class="nx">SchemaFieldTypes</span><span class="p">.</span><span class="nx">VECTOR</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nx">TYPE</span><span class="o">:</span> <span class="s1">'FLOAT32'</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nx">ALGORITHM</span><span class="o">:</span> <span class="nx">VectorAlgorithms</span><span class="p">.</span><span class="nx">FLAT</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nx">DIM</span><span class="o">:</span> <span class="mi">384</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nx">DISTANCE_METRIC</span><span class="o">:</span> <span class="s1">'COSINE'</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nx">AS</span><span class="o">:</span> <span class="s1">'vector'</span> </span></span><span class="line"><span class="cl"> <span class="p">}</span> </span></span><span class="line"><span class="cl"><span class="p">},</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="nx">ON</span><span class="o">:</span> <span class="s1">'JSON'</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nx">PREFIX</span><span class="o">:</span> <span class="s1">'bicycle:'</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="c1">// load data </span></span></span><span class="line"><span class="cl"><span class="c1"></span><span class="kr">const</span> <span class="nx">bicycles</span> <span class="o">=</span> <span class="nx">JSON</span><span class="p">.</span><span class="nx">parse</span><span class="p">(</span><span class="nx">fs</span><span class="p">.</span><span class="nx">readFileSync</span><span class="p">(</span><span class="s1">'data/query_vector.json'</span><span class="p">,</span> <span class="s1">'utf8'</span><span class="p">));</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="kr">await</span> <span class="nb">Promise</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">bicycles</span><span class="p">.</span><span class="nx">map</span><span class="p">((</span><span class="nx">bicycle</span><span class="p">,</span> <span class="nx">bid</span><span class="p">)</span> <span class="p">=&gt;</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">json</span><span class="p">.</span><span class="nx">set</span><span class="p">(</span><span class="sb">`bicycle:</span><span class="si">${</span><span class="nx">bid</span><span class="si">}</span><span class="sb">`</span><span class="p">,</span> <span class="s1">'$'</span><span class="p">,</span> <span class="nx">bicycle</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> <span class="p">})</span> </span></span><span class="line"><span class="cl"><span class="p">);</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="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">ft</span><span class="p">.</span><span class="nx">search</span><span class="p">(</span><span class="s1">'idx:bicycle'</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s1">'*=&gt;[KNN 3 @vector $query_vector AS score]'</span><span class="p">,</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="nx">PARAMS</span><span class="o">:</span> <span class="p">{</span> <span class="nx">query_vector</span><span class="o">:</span> <span class="nx">vector_query</span> <span class="p">},</span> </span></span><span class="line"><span class="cl"> <span class="nx">RETURN</span><span class="o">:</span> <span class="p">[</span><span class="s1">'description'</span><span class="p">],</span> </span></span><span class="line"><span class="cl"> <span class="nx">DIALECT</span><span class="o">:</span> <span class="mi">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="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="nx">total</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 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">// &gt;&gt;&gt; </span></span></span><span class="line"><span class="cl"><span class="c1">//{ </span></span></span><span class="line"><span class="cl"><span class="c1">// total: 3, </span></span></span><span class="line"><span class="cl"><span class="c1">// documents: [ </span></span></span><span class="line"><span class="cl"><span class="c1">// { id: 'bicycle:0', value: [Object: null prototype] {} }, </span></span></span><span class="line"><span class="cl"><span class="c1">// { id: 'bicycle:2', value: [Object: null prototype] {} }, </span></span></span><span class="line"><span class="cl"><span class="c1">// { id: 'bicycle:9', value: [Object: null prototype] {} } </span></span></span><span class="line"><span class="cl"><span class="c1">// ] </span></span></span><span class="line"><span class="cl"><span class="c1">//} </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">res2</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">ft</span><span class="p">.</span><span class="nx">search</span><span class="p">(</span><span class="s1">'idx:bicycle'</span><span class="p">,</span> </span></span><span class="line hl"><span class="cl"> <span class="s1">'@vector:[VECTOR_RANGE 0.9 $query_vector]=&gt;{$YIELD_DISTANCE_AS: vector_dist}'</span><span class="p">,</span> <span class="p">{</span> </span></span><span class="line hl"><span class="cl"> <span class="nx">PARAMS</span><span class="o">:</span> <span class="p">{</span> <span class="nx">query_vector</span><span class="o">:</span> <span class="nx">vector_query</span> <span class="p">},</span> </span></span><span class="line hl"><span class="cl"> <span class="nx">SORTBY</span><span class="o">:</span> <span class="s1">'vector_dist'</span><span class="p">,</span> </span></span><span class="line hl"><span class="cl"> <span class="nx">RETURN</span><span class="o">:</span> <span class="p">[</span><span class="s1">'vector_dist'</span><span class="p">,</span> <span class="s1">'description'</span><span class="p">],</span> </span></span><span class="line hl"><span class="cl"> <span class="nx">DIALECT</span><span class="o">:</span> <span class="mi">2</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">res2</span><span class="p">.</span><span class="nx">total</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 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">// &gt;&gt;&gt; </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="c1">// total: 1, </span></span></span><span class="line hl"><span class="cl"><span class="c1">// documents: [ { id: 'bicycle:0', value: [Object: null prototype] } ] </span></span></span><span class="line hl"><span class="cl"><span class="c1">//} </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_query_vector-stepvector2')" 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_query_vector-stepvector2" 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/query-vector.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="python" id="RedisVL_query_vector-stepvector2" name="query_vector-stepvector2" 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="RedisVL_query_vector-stepvector2" title="Open example"> RedisVL </label> <div aria-labelledby="tab-query_vector-stepvector2" class="panel order-last hidden w-full mt-0 relative" id="panel_RedisVL_query_vector-stepvector2" 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">json</span> </span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">warnings</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 class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span> </span></span><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">redisvl.index</span> <span class="kn">import</span> <span class="n">SearchIndex</span> </span></span><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">redisvl.query</span> <span class="kn">import</span> <span class="n">RangeQuery</span><span class="p">,</span> <span class="n">VectorQuery</span> </span></span><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">redisvl.schema</span> <span class="kn">import</span> <span class="n">IndexSchema</span> </span></span><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">sentence_transformers</span> <span class="kn">import</span> <span class="n">SentenceTransformer</span> </span></span><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">def</span> <span class="nf">embed_text</span><span class="p">(</span><span class="n">model</span><span class="p">,</span> <span class="n">text</span><span class="p">):</span> </span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">model</span><span class="o">.</span><span class="n">encode</span><span class="p">(</span><span class="n">text</span><span class="p">))</span><span class="o">.</span><span class="n">astype</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">float32</span><span class="p">)</span><span class="o">.</span><span class="n">tobytes</span><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">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">warnings</span><span class="o">.</span><span class="n">filterwarnings</span><span class="p">(</span><span class="s2">"ignore"</span><span class="p">,</span> <span class="n">category</span><span class="o">=</span><span class="ne">FutureWarning</span><span class="p">,</span> <span class="n">message</span><span class="o">=</span><span class="sa">r</span><span class="s2">".*clean_up_tokenization_spaces.*"</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="n">model</span> <span class="o">=</span> <span class="n">SentenceTransformer</span><span class="p">(</span><span class="s1">'sentence-transformers/all-MiniLM-L6-v2'</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="c1"># create index</span> </span></span><span class="line"><span class="cl"><span class="n">schema</span> <span class="o">=</span> <span class="n">IndexSchema</span><span class="o">.</span><span class="n">from_yaml</span><span class="p">(</span><span class="s1">'data/query_vector_idx.yaml'</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="n">index</span> <span class="o">=</span> <span class="n">SearchIndex</span><span class="p">(</span><span class="n">schema</span><span class="p">,</span> <span class="n">r</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="n">index</span><span class="o">.</span><span class="n">create</span><span class="p">(</span><span class="n">overwrite</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">drop</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="c1"># load data</span> </span></span><span class="line"><span class="cl"><span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="s2">"data/query_vector.json"</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span> </span></span><span class="line"><span class="cl"> <span class="n">bicycles</span> <span class="o">=</span> <span class="n">json</span><span class="o">.</span><span class="n">load</span><span class="p">(</span><span class="n">f</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="n">index</span><span class="o">.</span><span class="n">load</span><span class="p">(</span><span class="n">bicycles</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="n">query</span> <span class="o">=</span> <span class="s2">"Bike for small kids"</span> </span></span><span class="line"><span class="cl"><span class="n">query_vector</span> <span class="o">=</span> <span class="n">embed_text</span><span class="p">(</span><span class="n">model</span><span class="p">,</span> <span class="n">query</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">query_vector</span><span class="p">[:</span><span class="mi">10</span><span class="p">])</span> <span class="c1"># &gt;&gt;&gt; b'\x02=c=\x93\x0e\xe0=aC'</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="n">vquery</span> <span class="o">=</span> <span class="n">VectorQuery</span><span class="p">(</span> </span></span><span class="line"><span class="cl"> <span class="n">vector</span><span class="o">=</span><span class="n">query_vector</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="n">vector_field_name</span><span class="o">=</span><span class="s2">"description_embeddings"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="n">num_results</span><span class="o">=</span><span class="mi">3</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="n">return_score</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">return_fields</span><span class="o">=</span><span class="p">[</span><span class="s2">"description"</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="n">res</span> <span class="o">=</span> <span class="n">index</span><span class="o">.</span><span class="n">query</span><span class="p">(</span><span class="n">vquery</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 class="c1"># &gt;&gt;&gt; [{'id': 'bicycle:6b702e8b...', 'vector_distance': '0.399111807346', 'description': 'Kids want...</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line hl"><span class="cl"><span class="n">vquery</span> <span class="o">=</span> <span class="n">RangeQuery</span><span class="p">(</span> </span></span><span class="line hl"><span class="cl"> <span class="n">vector</span><span class="o">=</span><span class="n">query_vector</span><span class="p">,</span> </span></span><span class="line hl"><span class="cl"> <span class="n">vector_field_name</span><span class="o">=</span><span class="s2">"description_embeddings"</span><span class="p">,</span> </span></span><span class="line hl"><span class="cl"> <span class="n">distance_threshold</span><span class="o">=</span><span class="mf">0.5</span><span class="p">,</span> </span></span><span class="line hl"><span class="cl"> <span class="n">return_score</span><span class="o">=</span><span class="kc">True</span> </span></span><span class="line hl"><span class="cl"><span class="p">)</span><span class="o">.</span><span class="n">return_fields</span><span class="p">(</span><span class="s2">"description"</span><span class="p">)</span><span class="o">.</span><span class="n">dialect</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span> </span></span><span class="line hl"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">index</span><span class="o">.</span><span class="n">query</span><span class="p">(</span><span class="n">vquery</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 class="c1"># &gt;&gt;&gt; [{'id': 'bicycle:6bcb1bb4...', 'vector_distance': '0.399111807346', 'description': 'Kids want...</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_RedisVL_query_vector-stepvector2')" 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_RedisVL_query_vector-stepvector2" 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-vl/" tabindex="1" title="Quick-Start"> RedisVL 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-vl-python/tree/main/doctests/query_vector.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> </div> <!-- Python query> query = ( Query('@vector:[VECTOR_RANGE 0.5 $query_vector]=>{$YIELD_DISTANCE_AS: vector_dist}') .sort_by('vector_dist') .return_fields('vector_dist', 'description') .dialect(2) ) </!--> <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/query/vector-search/"/> <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/zrangebyscore/.html
<section class="prose w-full py-12"> <h1 class="command-name"> ZRANGEBYSCORE <span class="text-base"> (deprecated) </span> </h1> <div class="border-l-8 pl-4"> <p> As of Redis version 6.2.0, this command is regarded as deprecated. </p> <p> It can be replaced by <a href="/docs/latest/commands/zrange/"> <code> ZRANGE </code> </a> with the <code> BYSCORE </code> argument when migrating or writing new code. </p> </div> <div class="font-semibold text-redis-ink-900"> Syntax </div> <pre class="command-syntax">ZRANGEBYSCORE key min max [WITHSCORES] [LIMITΒ offset count]</pre> <dl class="grid grid-cols-[auto,1fr] gap-2 mb-12"> <dt class="font-semibold text-redis-ink-900 m-0"> Available since: </dt> <dd class="m-0"> 1.0.5 </dd> <dt class="font-semibold text-redis-ink-900 m-0"> Time complexity: </dt> <dd class="m-0"> O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements being returned. If M is constant (e.g. always asking for the first 10 elements with LIMIT), you can consider it O(log(N)). </dd> <dt class="font-semibold text-redis-ink-900 m-0"> ACL categories: </dt> <dd class="m-0"> <code> @read </code> <span class="mr-1 last:hidden"> , </span> <code> @sortedset </code> <span class="mr-1 last:hidden"> , </span> <code> @slow </code> <span class="mr-1 last:hidden"> , </span> </dd> </dl> <p> Returns all the elements in the sorted set at <code> key </code> with a score between <code> min </code> and <code> max </code> (including elements with score equal to <code> min </code> or <code> max </code> ). The elements are considered to be ordered from low to high scores. </p> <p> The elements having the same score are returned in lexicographical order (this follows from a property of the sorted set implementation in Redis and does not involve further computation). </p> <p> The optional <code> LIMIT </code> argument can be used to only get a range of the matching elements (similar to <em> SELECT LIMIT offset, count </em> in SQL). A negative <code> count </code> returns all elements from the <code> offset </code> . Keep in mind that if <code> offset </code> is large, the sorted set needs to be traversed for <code> offset </code> elements before getting to the elements to return, which can add up to O(N) time complexity. </p> <p> The optional <code> WITHSCORES </code> argument makes the command return both the element and its score, instead of the element alone. This option is available since Redis 2.0. </p> <h2 id="exclusive-intervals-and-infinity"> Exclusive intervals and infinity </h2> <p> <code> min </code> and <code> max </code> can be <code> -inf </code> and <code> +inf </code> , so that you are not required to know the highest or lowest score in the sorted set to get all elements from or up to a certain score. </p> <p> By default, the interval specified by <code> min </code> and <code> max </code> is closed (inclusive). It is possible to specify an open interval (exclusive) by prefixing the score with the character <code> ( </code> . For example: </p> <pre tabindex="0"><code>ZRANGEBYSCORE zset (1 5 </code></pre> <p> Will return all elements with <code> 1 &lt; score &lt;= 5 </code> while: </p> <pre tabindex="0"><code>ZRANGEBYSCORE zset (5 (10 </code></pre> <p> Will return all the elements with <code> 5 &lt; score &lt; 10 </code> (5 and 10 excluded). </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; ZADD myzset 1 "one" (integer) 1 redis&gt; ZADD myzset 2 "two" (integer) 1 redis&gt; ZADD myzset 3 "three" (integer) 1 redis&gt; ZRANGEBYSCORE myzset -inf +inf 1) "one" 2) "two" 3) "three" redis&gt; ZRANGEBYSCORE myzset 1 2 1) "one" 2) "two" redis&gt; ZRANGEBYSCORE myzset (1 2 1) "two" redis&gt; ZRANGEBYSCORE myzset (1 (2 (empty array) </pre> <div class="prompt" style=""> <span> redis&gt; </span> <input autocomplete="off" name="prompt" spellcheck="false" type="text"/> </div> </form> <h2 id="pattern-weighted-random-selection-of-an-element"> Pattern: weighted random selection of an element </h2> <p> Normally <code> ZRANGEBYSCORE </code> is simply used in order to get range of items where the score is the indexed integer key, however it is possible to do less obvious things with the command. </p> <p> For example a common problem when implementing Markov chains and other algorithms is to select an element at random from a set, but different elements may have different weights that change how likely it is they are picked. </p> <p> This is how we use this command in order to mount such an algorithm: </p> <p> Imagine you have elements A, B and C with weights 1, 2 and 3. You compute the sum of the weights, which is 1+2+3 = 6 </p> <p> At this point you add all the elements into a sorted set using this algorithm: </p> <pre tabindex="0"><code>SUM = ELEMENTS.TOTAL_WEIGHT // 6 in this case. SCORE = 0 FOREACH ELE in ELEMENTS SCORE += ELE.weight / SUM ZADD KEY SCORE ELE END </code></pre> <p> This means that you set: </p> <pre tabindex="0"><code>A to score 0.16 B to score .5 C to score 1 </code></pre> <p> Since this involves approximations, in order to avoid C is set to, like, 0.998 instead of 1, we just modify the above algorithm to make sure the last score is 1 (left as an exercise for the reader...). </p> <p> At this point, each time you want to get a weighted random element, just compute a random number between 0 and 1 (which is like calling <code> rand() </code> in most languages), so you can just do: </p> <pre><code>RANDOM_ELE = ZRANGEBYSCORE key RAND() +inf LIMIT 0 1 </code></pre> <h2 id="resp2resp3-reply"> RESP2/RESP3 Reply </h2> <ul> <li> <a href="../../develop/reference/protocol-spec#arrays"> Array reply </a> : a list of the members with, optionally, their scores in the specified score range. </li> </ul> <br/> <h2> History </h2> <ul> <li> Starting with Redis version 2.0.0: Added the <code> WITHSCORES </code> modifier. </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/zrangebyscore/"/> <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.strappend.html
<section class="prose w-full py-12"> <h1 class="command-name"> JSON.STRAPPEND </h1> <div class="font-semibold text-redis-ink-900"> Syntax </div> <pre class="command-syntax">JSON.STRAPPEND key [path] 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/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> Append the <code> json-string </code> values to the string 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 modify. </p> </details> <details open=""> <summary> <code> value </code> </summary> <p> is value to append to one or more strings. </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"> About using strings with JSON commands: </div> To specify a string as an array value to append, wrap the quoted string with an additional set of single quotes. Example: <code> '"silver"' </code> . For more detailed use, see <a href="#examples"> Examples </a> . </div> </div> </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> . </p> </details> <h2 id="return-value"> Return value </h2> <p> JSON.STRAPPEND returns an array of integer replies for each path, the string's new length, or <code> nil </code> , if the matching JSON value is not a string. 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":"foo", "nested": {"a": "hello"}, "nested2": {"a": 31}}'</span> </span></span><span class="line"><span class="cl">OK </span></span><span class="line"><span class="cl">redis&gt; JSON.STRAPPEND doc $..a <span class="s1">'"baz"'</span> </span></span><span class="line"><span class="cl">1<span class="o">)</span> <span class="o">(</span>integer<span class="o">)</span> <span class="m">6</span> </span></span><span class="line"><span class="cl">2<span class="o">)</span> <span class="o">(</span>integer<span class="o">)</span> <span class="m">8</span> </span></span><span class="line"><span class="cl">3<span class="o">)</span> <span class="o">(</span>nil<span class="o">)</span> </span></span><span class="line"><span class="cl">redis&gt; JSON.GET doc $ </span></span><span class="line"><span class="cl"><span class="s2">"[{\"a\":\"foobaz\",\"nested\":{\"a\":\"hellobaz\"},\"nested2\":{\"a\":31}}]"</span></span></span></code></pre> </div> <h2 id="see-also"> See also </h2> <p> <code> JSON.ARRAPEND </code> | <a href="/docs/latest/commands/json.arrinsert/"> <code> JSON.ARRINSERT </code> </a> </p> <h2 id="related-topics"> Related topics </h2> <ul> <li> <a href="/docs/latest/develop/data-types/json/"> RedisJSON </a> </li> <li> <a href="/docs/latest/develop/interact/search-and-query/indexing/"> Index and search JSON documents </a> </li> </ul> <br/> <form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback"> <input class="hidden" name="origin" value="https://redis.io/docs/latest/commands/json.strappend/"/> <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.aliasdel.html
<section class="prose w-full py-12"> <h1 class="command-name"> FT.ALIASDEL </h1> <div class="font-semibold text-redis-ink-900"> Syntax </div> <pre class="command-syntax">FT.ALIASDEL alias </pre> <dl class="grid grid-cols-[auto,1fr] gap-2 mb-12"> <dt class="font-semibold text-redis-ink-900 m-0"> Available in: </dt> <dd class="m-0"> <a href="/docs/stack"> Redis Stack </a> / <a href="/docs/interact/search-and-query"> Search 1.0.0 </a> </dd> <dt class="font-semibold text-redis-ink-900 m-0"> Time complexity: </dt> <dd class="m-0"> O(1) </dd> </dl> <p> Remove an alias from an index </p> <p> <a href="#examples"> Examples </a> </p> <h2 id="required-arguments"> Required arguments </h2> <details open=""> <summary> <code> alias </code> </summary> <p> is index alias to be removed. </p> </details> <h2 id="return"> Return </h2> <p> FT.ALIASDEL 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> Remove an alias from an index </b> </summary> <p> Remove an alias from an index. </p> <div class="highlight"> <pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">127.0.0.1:6379&gt; FT.ALIASDEL <span class="nb">alias</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/ft.aliasadd/"> <code> FT.ALIASADD </code> </a> | <a href="/docs/latest/commands/ft.aliasupdate/"> <code> FT.ALIASUPDATE </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.aliasdel/"/> <div class="flex flex-row justify-between"> <div class="grid justify-center"> <span class="font-mono"> RATE THIS PAGE </span> <div class="star-rating"> <input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/> <label class="star" for="5-stars"> β˜… </label> <input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/> <label class="star" for="4-stars"> β˜… </label> <input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/> <label class="star" for="3-stars"> β˜… </label> <input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/> <label class="star" for="2-stars"> β˜… </label> <input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/> <label class="star" for="1-stars"> β˜… </label> </div> </div> <a class="font-mono no-underline" href="#"> Back to top ↑ </a> </div> <div class="hidden" id="feedback-form"> <div class="grid gap-2"> <textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea> <button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit"> Submit </button> </div> </div> </form> <script> document.addEventListener("DOMContentLoaded", function() { const form = document.querySelector("#page-feedback"); form.addEventListener("submit", function(event) { event.preventDefault(); var xhr = new XMLHttpRequest(); var url = "\/docusight\/api\/rate"; var params = new URLSearchParams(new FormData(form)); xhr.open("POST", url, true); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.onreadystatechange = function() { if (xhr.readyState === 4 && xhr.status === 200) { const responseData = JSON.parse(xhr.responseText); const responseMessage = responseData.response; const newText = document.createTextNode(responseMessage); form.parentNode.replaceChild(newText, form); } }; xhr.send(params); }); }); </script> </section>
https://redis.io/docs/latest/operate/rs/7.4/security/certificates/monitor-certificates/.html
<section class="prose w-full py-12 max-w-none"> <h1> Monitor certificates </h1> <p class="text-lg -mt-5 mb-10"> Monitor certificates on a Redis Enterprise cluster. </p> <p> You can monitor certificates used by Redis Enterprise Software. </p> <h3 id="monitor-certificates-with-prometheus"> Monitor certificates with Prometheus </h3> <p> Redis Enterprise Software exposes the expiration time (in seconds) of each certificate on each node. To learn how to monitor Redis Enterprise Software metrics using Prometheus, see the <a href="/docs/latest/integrate/prometheus-with-redis-enterprise/"> Prometheus integration quick start </a> . </p> <p> Here are some examples of the <code> node_cert_expiration_seconds </code> metric: </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">node_cert_expiration_seconds<span class="o">{</span><span class="nv">cluster</span><span class="o">=</span><span class="s2">"mycluster.local"</span>,logical_name<span class="o">=</span><span class="s2">"cm"</span>,node<span class="o">=</span><span class="s2">"1"</span>,path<span class="o">=</span><span class="s2">"/etc/opt/redislabs/cm_cert.pem"</span><span class="o">}</span> 31104000.0 </span></span><span class="line"><span class="cl">node_cert_expiration_seconds<span class="o">{</span><span class="nv">cluster</span><span class="o">=</span><span class="s2">"mycluster.local"</span>,logical_name<span class="o">=</span><span class="s2">"api"</span>,node<span class="o">=</span><span class="s2">"1"</span>,path<span class="o">=</span><span class="s2">"/etc/opt/redislabs/api_cert.pem"</span><span class="o">}</span> 31104000.0 </span></span><span class="line"><span class="cl">node_cert_expiration_seconds<span class="o">{</span><span class="nv">cluster</span><span class="o">=</span><span class="s2">"mycluster.local"</span>,logical_name<span class="o">=</span><span class="s2">"proxy"</span>,node<span class="o">=</span><span class="s2">"1"</span>,path<span class="o">=</span><span class="s2">"/etc/opt/redislabs/proxy_cert.pem"</span><span class="o">}</span> 31104000.0 </span></span><span class="line"><span class="cl">node_cert_expiration_seconds<span class="o">{</span><span class="nv">cluster</span><span class="o">=</span><span class="s2">"mycluster.local"</span>,logical_name<span class="o">=</span><span class="s2">"metrics_exporter"</span>,node<span class="o">=</span><span class="s2">"1"</span>,path<span class="o">=</span><span class="s2">"/etc/opt/redislabs/metrics_exporter_cert.pem"</span><span class="o">}</span> 31104000.0 </span></span><span class="line"><span class="cl">node_cert_expiration_seconds<span class="o">{</span><span class="nv">cluster</span><span class="o">=</span><span class="s2">"mycluster.local"</span>,logical_name<span class="o">=</span><span class="s2">"syncer"</span>,node<span class="o">=</span><span class="s2">"1"</span>,path<span class="o">=</span><span class="s2">"/etc/opt/redislabs/syncer_cert.pem"</span><span class="o">}</span> 31104000.0 </span></span></code></pre> </div> <p> The following certificates relate to <a href="/docs/latest/operate/rs/7.4/security/encryption/internode-encryption/"> internode communication TLS encryption </a> and are automatically rotated by Redis Enterprise Software: </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">node_cert_expiration_seconds<span class="o">{</span><span class="nv">cluster</span><span class="o">=</span><span class="s2">"mycluster.local"</span>,logical_name<span class="o">=</span><span class="s2">"ccs_internode_encryption"</span>,node<span class="o">=</span><span class="s2">"1"</span>,path<span class="o">=</span><span class="s2">"/etc/opt/redislabs/ccs_internode_encryption_cert.pem"</span><span class="o">}</span> 2592000.0 </span></span><span class="line"><span class="cl">node_cert_expiration_seconds<span class="o">{</span><span class="nv">cluster</span><span class="o">=</span><span class="s2">"mycluster.local"</span>,logical_name<span class="o">=</span><span class="s2">"data_internode_encryption"</span>,node<span class="o">=</span><span class="s2">"1"</span>,path<span class="o">=</span><span class="s2">"/etc/opt/redislabs/data_internode_encryption_cert.pem"</span><span class="o">}</span> 2592000.0 </span></span><span class="line"><span class="cl">node_cert_expiration_seconds<span class="o">{</span><span class="nv">cluster</span><span class="o">=</span><span class="s2">"mycluster.local"</span>,logical_name<span class="o">=</span><span class="s2">"mesh_ca_signed"</span>,node<span class="o">=</span><span class="s2">"1"</span>,path<span class="o">=</span><span class="s2">"/etc/opt/redislabs/mesh_ca_signed_cert.pem"</span><span class="o">}</span> 2592000.0 </span></span><span class="line"><span class="cl">node_cert_expiration_seconds<span class="o">{</span><span class="nv">cluster</span><span class="o">=</span><span class="s2">"mycluster.local"</span>,logical_name<span class="o">=</span><span class="s2">"gossip_ca_signed"</span>,node<span class="o">=</span><span class="s2">"1"</span>,path<span class="o">=</span><span class="s2">"/etc/opt/redislabs/gossip_ca_signed_cert.pem"</span><span class="o">}</span> 2592000.0 </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/security/certificates/monitor-certificates/"/> <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/debezium/mongodb/.html
<section class="prose w-full py-12 max-w-none"> <h1> Write-behind configuration for mongodb </h1> <p class="text-lg -mt-5 mb-10"> Describes the <code> application.properties </code> settings that configure Debezium Server for mongodb </p> <h2 id="applicationproperties"> application.properties </h2> <div class="highlight"> <pre class="chroma"><code class="language-properties" data-lang="properties"><span class="line"><span class="cl"><span class="na">debezium.sink.type</span><span class="o">=</span><span class="s">redis</span> </span></span><span class="line"><span class="cl"><span class="na">debezium.sink.redis.message.format</span><span class="o">=</span><span class="s">extended</span> </span></span><span class="line"><span class="cl"><span class="na">debezium.sink.redis.address</span><span class="o">=</span><span class="s">&lt;RDI_HOST&gt;:&lt;RDI_PORT&gt;</span> </span></span><span class="line"><span class="cl"><span class="c1"># Comment the following line if not using a password for Write-behind.</span> </span></span><span class="line"><span class="cl"><span class="na">debezium.sink.redis.password</span><span class="o">=</span><span class="s">&lt;RDI_PASSWORD&gt;</span> </span></span><span class="line"><span class="cl"><span class="na">debezium.sink.redis.memory.limit.mb</span><span class="o">=</span><span class="s">80</span> </span></span><span class="line"><span class="cl"><span class="c1"># Redis SSL/TLS</span> </span></span><span class="line"><span class="cl"><span class="c1">#debezium.sink.redis.ssl.enabled=true</span> </span></span><span class="line"><span class="cl"><span class="c1"># When Redis is configured with a replica shard, these properties allow to verify that the data has been written to the replica.</span> </span></span><span class="line"><span class="cl"><span class="c1">#debezium.sink.redis.wait.enabled=true</span> </span></span><span class="line"><span class="cl"><span class="c1">#debezium.sink.redis.wait.timeout.ms=1000</span> </span></span><span class="line"><span class="cl"><span class="c1">#debezium.sink.redis.wait.retry.enabled=true</span> </span></span><span class="line"><span class="cl"><span class="c1">#debezium.sink.redis.wait.retry.delay.ms=1000</span> </span></span><span class="line"><span class="cl"><span class="c1">#debezium.source.database.history.redis.ssl.enabled=true</span> </span></span><span class="line"><span class="cl"><span class="c1"># Location of the Java keystore file containing an application process' own certificate and private key.</span> </span></span><span class="line"><span class="cl"><span class="c1">#javax.net.ssl.keyStore=&lt;KEY_STORE_FILE_PATH&gt;</span> </span></span><span class="line"><span class="cl"><span class="c1"># Password to access the private key from the keystore file specified by javax.net.ssl.keyStore. This password is used twice: To unlock the keystore file (store password), and To decrypt the private key stored in the keystore (key password).</span> </span></span><span class="line"><span class="cl"><span class="c1">#javax.net.ssl.keyStorePassword=&lt;KEY_STORE_PASSWORD&gt;</span> </span></span><span class="line"><span class="cl"><span class="c1"># Location of the Java keystore file containing the collection of CA certificates trusted by this application process (trust store).</span> </span></span><span class="line"><span class="cl"><span class="c1">#javax.net.ssl.trustStore=&lt;TRUSE_STORE_FILE_PATH&gt;</span> </span></span><span class="line"><span class="cl"><span class="c1"># Password to unlock the keystore file (store password) specified by javax.net.ssl.trustStore.</span> </span></span><span class="line"><span class="cl"><span class="c1">#javax.net.ssl.trustStorePassword=&lt;TRUST_STORE_PASSWORD&gt;</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="na">debezium.source.connector.class</span><span class="o">=</span><span class="s">io.debezium.connector.mongodb.MongoDbConnector</span> </span></span><span class="line"><span class="cl"><span class="na">debezium.source.mongodb.hosts</span><span class="o">=</span><span class="s">&lt;REPLICATION_SET_NAME&gt;/&lt;MONGO_DB_HOST&gt;:&lt;MONGO_DB_PORT&gt;</span> </span></span><span class="line"><span class="cl"><span class="na">debezium.source.mongodb.connection.mode</span><span class="o">=</span><span class="s">replica_set</span> </span></span><span class="line"><span class="cl"><span class="na">debezium.source.mongodb.user</span><span class="o">=</span><span class="s">&lt;MONGO_DB_USER&gt;</span> </span></span><span class="line"><span class="cl"><span class="na">debezium.source.mongodb.password</span><span class="o">=</span><span class="s">&lt;MONGO_DB_PASSWORD&gt;</span> </span></span><span class="line"><span class="cl"><span class="na">debezium.source.offset.storage</span><span class="o">=</span><span class="s">io.debezium.storage.redis.offset.RedisOffsetBackingStore</span> </span></span><span class="line"><span class="cl"><span class="na">debezium.source.topic.prefix</span><span class="o">=</span><span class="s">&lt;SOURCE_LOGICAL_SERVER_NAME&gt;</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="na">debezium.source.offset.flush.interval.ms</span><span class="o">=</span><span class="s">1000</span> </span></span><span class="line"><span class="cl"><span class="na">debezium.source.tombstones.on.delete</span><span class="o">=</span><span class="s">false</span> </span></span><span class="line"><span class="cl"><span class="na">debezium.source.schema.history.internal</span><span class="o">=</span><span class="s">io.debezium.storage.redis.history.RedisSchemaHistory</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="c1"># Important: Do NOT use `include` and `exclude` database lists at the same time, use either `include` or `exclude`.</span> </span></span><span class="line"><span class="cl"><span class="c1"># An optional, comma-separated list of regular expressions that match database names to be monitored.</span> </span></span><span class="line"><span class="cl"><span class="c1"># By default, all databases are monitored.</span> </span></span><span class="line"><span class="cl"><span class="c1">#debezium.source.database.include.list=&lt;DB_NAME1&gt;,&lt;DB_NAME2&gt;...</span> </span></span><span class="line"><span class="cl"><span class="c1"># An optional, comma-separated list of regular expressions that match database names for which you do not want to capture changes.</span> </span></span><span class="line"><span class="cl"><span class="c1">#debezium.source.database.exclude.list=&lt;DB_NAME1&gt;,&lt;DB_NAME2&gt;...</span> </span></span><span class="line"><span class="cl"><span class="c1"># Important: Do NOT use `include` and `exclude` collection lists at the same time, use either `include` or `exclude`.</span> </span></span><span class="line"><span class="cl"><span class="c1"># An optional, comma-separated list of regular expressions that match collection names to be monitored.</span> </span></span><span class="line"><span class="cl"><span class="c1">#debezium.source.collection.include.list=&lt;DB_NAME.COLLECTION_NAME1&gt;,&lt;DB_NAME.COLLECTION_NAME2&gt;...</span> </span></span><span class="line"><span class="cl"><span class="c1"># An optional, comma-separated list of regular expressions that match collection names for which you do not want to capture changes.</span> </span></span><span class="line"><span class="cl"><span class="c1">#debezium.source.collection.exclude.list=&lt;DB_NAME.COLLECTION_NAME1&gt;,&lt;DB_NAME.COLLECTION_NAME2&gt;...</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="c1">#An optional, comma-separated list of regular expressions that match field names for which you do not want to capture changes.</span> </span></span><span class="line"><span class="cl"><span class="c1">#debezium.source.field_exclude_list=&lt;DB_NAME.COLLECTION_NAME1.FIELD_NAME1&gt;,&lt;DB_NAME.COLLECTION_NAME.FIELD_NAME2&gt;</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="c1"># Whether to include the detailed schema information generated by Debezium in each record written to RDI.</span> </span></span><span class="line"><span class="cl"><span class="c1"># Note: Including the schema reduces the initial sync throughput and is not recommended for large data sets.</span> </span></span><span class="line"><span class="cl"><span class="na">debezium.source.key.converter.schemas.enable</span><span class="o">=</span><span class="s">false</span> </span></span><span class="line"><span class="cl"><span class="na">debezium.source.value.converter.schemas.enable</span><span class="o">=</span><span class="s">false</span> </span></span><span class="line"><span class="cl"><span class="c1"># When detailed schema information is excluded, handle decimal numeric types as strings.</span> </span></span><span class="line"><span class="cl"><span class="na">debezium.source.decimal.handling.mode</span><span class="o">=</span><span class="s">string</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="na">debezium.transforms</span><span class="o">=</span><span class="s">AddPrefix</span> </span></span><span class="line"><span class="cl"><span class="na">debezium.transforms.AddPrefix.type</span><span class="o">=</span><span class="s">org.apache.kafka.connect.transforms.RegexRouter</span> </span></span><span class="line"><span class="cl"><span class="na">debezium.transforms.AddPrefix.regex</span><span class="o">=</span><span class="s">.*</span> </span></span><span class="line"><span class="cl"><span class="na">debezium.transforms.AddPrefix.replacement</span><span class="o">=</span><span class="s">data:$0</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="c1"># Logging</span> </span></span><span class="line"><span class="cl"><span class="c1"># Uncomment the following lines if running Debezium Server as a Java standalone process (non-containerized).</span> </span></span><span class="line"><span class="cl"><span class="c1">#quarkus.log.file.enable=true</span> </span></span><span class="line"><span class="cl"><span class="c1">#quarkus.log.file.path=&lt;LOG_FILE_PATH&gt;</span> </span></span><span class="line"><span class="cl"><span class="c1">#quarkus.log.file.rotation.max-file-size=100M</span> </span></span><span class="line"><span class="cl"><span class="c1">#quarkus.log.file.rotation.rotate-on-boot=true</span> </span></span><span class="line"><span class="cl"><span class="c1">#quarkus.log.file.rotation.file-suffix=.yyyy-MM-dd.gz</span> </span></span><span class="line"><span class="cl"><span class="c1">#quarkus.log.file.rotation.max-backup-index=3</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="c1"># The default minimum log level for every log category, change only quarkus.log.level when needed.</span> </span></span><span class="line"><span class="cl"><span class="na">quarkus.log.min-level</span><span class="o">=</span><span class="s">TRACE</span> </span></span><span class="line"><span class="cl"><span class="c1"># The default log level for every log category.</span> </span></span><span class="line"><span class="cl"><span class="na">quarkus.log.level</span><span class="o">=</span><span class="s">INFO</span> </span></span><span class="line"><span class="cl"><span class="c1"># Determine whether to enable the JSON console formatting extension, which disables "normal" console formatting.</span> </span></span><span class="line"><span class="cl"><span class="na">quarkus.log.console.json</span><span class="o">=</span><span class="s">false</span> </span></span><span class="line"><span class="cl"><span class="c1"># The port on which Debezium exposes Microprofile Health endpoint and other exposed status information.</span> </span></span><span class="line"><span class="cl"><span class="na">quarkus.http.port</span><span class="o">=</span><span class="s">8088</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/integrate/write-behind/reference/debezium/mongodb/"/> <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/xread/.html
<section class="prose w-full py-12"> <h1 class="command-name"> XREAD </h1> <div class="font-semibold text-redis-ink-900"> Syntax </div> <pre class="command-syntax">XREAD [COUNTΒ count] [BLOCKΒ milliseconds] 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"> </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> @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> Read data from one or multiple streams, only returning entries with an ID greater than the last received ID reported by the caller. This command has an option to block if items are not available, in a similar fashion to <a href="/docs/latest/commands/brpop/"> <code> BRPOP </code> </a> or <a href="/docs/latest/commands/bzpopmin/"> <code> BZPOPMIN </code> </a> and others. </p> <p> Please note that before reading this page, if you are new to streams, we recommend to read <a href="/docs/latest/develop/data-types/streams/"> our introduction to Redis Streams </a> . </p> <h2 id="non-blocking-usage"> Non-blocking usage </h2> <p> If the <strong> BLOCK </strong> option is not used, the command is synchronous, and can be considered somewhat related to <a href="/docs/latest/commands/xrange/"> <code> XRANGE </code> </a> : it will return a range of items inside streams, however it has two fundamental differences compared to <a href="/docs/latest/commands/xrange/"> <code> XRANGE </code> </a> even if we just consider the synchronous usage: </p> <ul> <li> This command can be called with multiple streams if we want to read at the same time from a number of keys. This is a key feature of <code> XREAD </code> because especially when blocking with <strong> BLOCK </strong> , to be able to listen with a single connection to multiple keys is a vital feature. </li> <li> While <a href="/docs/latest/commands/xrange/"> <code> XRANGE </code> </a> returns items in a range of IDs, <code> XREAD </code> is more suited in order to consume the stream starting from the first entry which is greater than any other entry we saw so far. So what we pass to <code> XREAD </code> is, for each stream, the ID of the last element that we received from that stream. </li> </ul> <p> For example, if I have two streams <code> mystream </code> and <code> writers </code> , and I want to read data from both the streams starting from the first element they contain, I could call <code> XREAD </code> like in the following example. </p> <p> Note: we use the <strong> COUNT </strong> option in the example, so that for each stream the call will return at maximum two elements per stream. </p> <pre tabindex="0"><code>&gt; XREAD COUNT 2 STREAMS mystream writers 0-0 0-0 1) 1) "mystream" 2) 1) 1) 1526984818136-0 2) 1) "duration" 2) "1532" 3) "event-id" 4) "5" 5) "user-id" 6) "7782813" 2) 1) 1526999352406-0 2) 1) "duration" 2) "812" 3) "event-id" 4) "9" 5) "user-id" 6) "388234" 2) 1) "writers" 2) 1) 1) 1526985676425-0 2) 1) "name" 2) "Virginia" 3) "surname" 4) "Woolf" 2) 1) 1526985685298-0 2) 1) "name" 2) "Jane" 3) "surname" 4) "Austen" </code></pre> <p> The <strong> STREAMS </strong> option is mandatory and MUST be the final option because such option gets a variable length of argument in the following format: </p> <pre><code>STREAMS key_1 key_2 key_3 ... key_N ID_1 ID_2 ID_3 ... ID_N </code></pre> <p> So we start with a list of keys, and later continue with all the associated IDs, representing <em> the last ID we received for that stream </em> , so that the call will serve us only greater IDs from the same stream. </p> <p> For instance in the above example, the last items that we received for the stream <code> mystream </code> has ID <code> 1526999352406-0 </code> , while for the stream <code> writers </code> has the ID <code> 1526985685298-0 </code> . </p> <p> To continue iterating the two streams I'll call: </p> <pre tabindex="0"><code>&gt; XREAD COUNT 2 STREAMS mystream writers 1526999352406-0 1526985685298-0 1) 1) "mystream" 2) 1) 1) 1526999626221-0 2) 1) "duration" 2) "911" 3) "event-id" 4) "7" 5) "user-id" 6) "9488232" 2) 1) "writers" 2) 1) 1) 1526985691746-0 2) 1) "name" 2) "Toni" 3) "surname" 4) "Morrison" 2) 1) 1526985712947-0 2) 1) "name" 2) "Agatha" 3) "surname" 4) "Christie" </code></pre> <p> And so forth. Eventually, the call will not return any item, but just an empty array, then we know that there is nothing more to fetch from our stream (and we would have to retry the operation, hence this command also supports a blocking mode). </p> <h2 id="incomplete-ids"> Incomplete IDs </h2> <p> To use incomplete IDs is valid, like it is valid for <a href="/docs/latest/commands/xrange/"> <code> XRANGE </code> </a> . However here the sequence part of the ID, if missing, is always interpreted as zero, so the command: </p> <pre tabindex="0"><code>&gt; XREAD COUNT 2 STREAMS mystream writers 0 0 </code></pre> <p> is exactly equivalent to </p> <pre tabindex="0"><code>&gt; XREAD COUNT 2 STREAMS mystream writers 0-0 0-0 </code></pre> <h2 id="blocking-for-data"> Blocking for data </h2> <p> In its synchronous form, the command can get new data as long as there are more items available. However, at some point, we'll have to wait for producers of data to use <a href="/docs/latest/commands/xadd/"> <code> XADD </code> </a> to push new entries inside the streams we are consuming. In order to avoid polling at a fixed or adaptive interval the command is able to block if it could not return any data, according to the specified streams and IDs, and automatically unblock once one of the requested keys accept data. </p> <p> It is important to understand that this command <em> fans out </em> to all the clients that are waiting for the same range of IDs, so every consumer will get a copy of the data, unlike to what happens when blocking list pop operations are used. </p> <p> In order to block, the <strong> BLOCK </strong> option is used, together with the number of milliseconds we want to block before timing out. Normally Redis blocking commands take timeouts in seconds, however this command takes a millisecond timeout, even if normally the server will have a timeout resolution near to 0.1 seconds. This time it is possible to block for a shorter time in certain use cases, and if the server internals will improve over time, it is possible that the resolution of timeouts will improve. </p> <p> When the <strong> BLOCK </strong> command is passed, but there is data to return at least in one of the streams passed, the command is executed synchronously <em> exactly like if the BLOCK option would be missing </em> . </p> <p> This is an example of blocking invocation, where the command later returns a null reply because the timeout has elapsed without new data arriving: </p> <pre tabindex="0"><code>&gt; XREAD BLOCK 1000 STREAMS mystream 1526999626221-0 (nil) </code></pre> <h2 id="the-special--id"> The special <code> $ </code> ID. </h2> <p> When blocking sometimes we want to receive just entries that are added to the stream via <a href="/docs/latest/commands/xadd/"> <code> XADD </code> </a> starting from the moment we block. In such a case we are not interested in the history of already added entries. For this use case, we would have to check the stream top element ID, and use such ID in the <code> XREAD </code> command line. This is not clean and requires to call other commands, so instead it is possible to use the special <code> $ </code> ID to signal the stream that we want only the new things. </p> <p> It is <strong> very important </strong> to understand that you should use the <code> $ </code> ID only for the first call to <code> XREAD </code> . Later the ID should be the one of the last reported item in the stream, otherwise you could miss all the entries that are added in between. </p> <p> This is how a typical <code> XREAD </code> call looks like in the first iteration of a consumer willing to consume only new entries: </p> <pre tabindex="0"><code>&gt; XREAD BLOCK 5000 COUNT 100 STREAMS mystream $ </code></pre> <p> Once we get some replies, the next call will be something like: </p> <pre tabindex="0"><code>&gt; XREAD BLOCK 5000 COUNT 100 STREAMS mystream 1526999644174-3 </code></pre> <p> And so forth. </p> <h2 id="the-special--id-1"> The special <code> + </code> ID </h2> <p> You can read the last entry in a single stream easily using the <code> XREVRANGE </code> command, like so: </p> <pre tabindex="0"><code>&gt; XREVRANGE stream + - COUNT 1 </code></pre> <p> But this approach becomes slow as you add more streams because you must issue a separate command for each stream. Instead, starting from Redis 7.4, you can use the <code> + </code> sign as a special ID. This requests the last available entry in a stream. For example: </p> <pre tabindex="0"><code>&gt; XREAD STREAMS streamA streamB streamC streamD + + + + </code></pre> <p> Note that when using this special ID for a stream, the <strong> COUNT </strong> option will be ignored (for the specific stream) since only the last entry can be returned. </p> <h2 id="how-multiple-clients-blocked-on-a-single-stream-are-served"> How multiple clients blocked on a single stream are served </h2> <p> Blocking list operations on lists or sorted sets have a <em> pop </em> behavior. Basically, the element is removed from the list or sorted set in order to be returned to the client. In this scenario you want the items to be consumed in a fair way, depending on the moment clients blocked on a given key arrived. Normally Redis uses the FIFO semantics in this use cases. </p> <p> However note that with streams this is not a problem: stream entries are not removed from the stream when clients are served, so every client waiting will be served as soon as an <a href="/docs/latest/commands/xadd/"> <code> XADD </code> </a> command provides data to the stream. </p> <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/xread/"/> <div class="flex flex-row justify-between"> <div class="grid justify-center"> <span class="font-mono"> RATE THIS PAGE </span> <div class="star-rating"> <input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/> <label class="star" for="5-stars"> β˜… </label> <input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/> <label class="star" for="4-stars"> β˜… </label> <input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/> <label class="star" for="3-stars"> β˜… </label> <input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/> <label class="star" for="2-stars"> β˜… </label> <input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/> <label class="star" for="1-stars"> β˜… </label> </div> </div> <a class="font-mono no-underline" href="#"> Back to top ↑ </a> </div> <div class="hidden" id="feedback-form"> <div class="grid gap-2"> <textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea> <button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit"> Submit </button> </div> </div> </form> <script> document.addEventListener("DOMContentLoaded", function() { const form = document.querySelector("#page-feedback"); form.addEventListener("submit", function(event) { event.preventDefault(); var xhr = new XMLHttpRequest(); var url = "\/docusight\/api\/rate"; var params = new URLSearchParams(new FormData(form)); xhr.open("POST", url, true); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.onreadystatechange = function() { if (xhr.readyState === 4 && xhr.status === 200) { const responseData = JSON.parse(xhr.responseText); const responseMessage = responseData.response; const newText = document.createTextNode(responseMessage); form.parentNode.replaceChild(newText, form); } }; xhr.send(params); }); }); </script> </section>
https://redis.io/docs/latest/operate/rs/references/cli-utilities/rladmin/node/enslave/.html
<section class="prose w-full py-12 max-w-none"> <h1> rladmin node enslave </h1> <p class="text-lg -mt-5 mb-10"> Changes a node's resources to replicas. </p> <p> Changes the resources of a node to replicas. </p> <h2 id="node-enslave"> <code> node enslave </code> </h2> <p> Changes all of the node's endpoints and shards to replicas. </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">rladmin node &lt;ID&gt; enslave </span></span><span class="line"><span class="cl"> <span class="o">[</span>demote_node<span class="o">]</span> </span></span><span class="line"><span class="cl"> <span class="o">[</span>retry_timeout_seconds &lt;seconds&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> Changes all of the node's endpoints and shards to replicas </td> </tr> <tr> <td> demote_node </td> <td> </td> <td> If the node is a primary node, changes the node to replica </td> </tr> <tr> <td> retry_timeout_seconds </td> <td> integer </td> <td> Retries on failure until the specified number of seconds has passed. </td> </tr> </tbody> </table> <h3 id="returns"> Returns </h3> <p> Returns <code> OK </code> if the roles were successfully changed. Otherwise, it returns an error. </p> <p> Use <a href="/docs/latest/operate/rs/references/cli-utilities/rladmin/status/#status-shards"> <code> rladmin status shards </code> </a> to verify that the roles were changed. </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 status shards node <span class="m">2</span> </span></span><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:6 tr02 redis:14 node:2 master 0-4095 3.2MB OK </span></span><span class="line"><span class="cl">db:6 tr02 redis:16 node:2 master 4096-8191 3.12MB OK </span></span><span class="line"><span class="cl">db:6 tr02 redis:18 node:2 master 8192-12287 3.16MB OK </span></span><span class="line"><span class="cl">db:6 tr02 redis:20 node:2 master 12288-16383 3.12MB OK </span></span><span class="line"><span class="cl">$ rladmin status nodes </span></span><span class="line"><span class="cl">CLUSTER NODES: </span></span><span class="line"><span class="cl">NODE:ID ROLE ADDRESS EXTERNAL_ADDRESS HOSTNAME SHARDS CORES FREE_RAM PROVISIONAL_RAM VERSION STATUS </span></span><span class="line"><span class="cl">*node:1 slave 192.0.2.12 198.51.100.1 3d99db1fdf4b 1/100 <span class="m">6</span> 14.43GB/19.54GB 10.87GB/16.02GB 6.2.12-37 OK </span></span><span class="line"><span class="cl">node:2 master 192.0.2.13 198.51.100.2 fc7a3d332458 4/100 <span class="m">6</span> 14.43GB/19.54GB 10.88GB/16.02GB 6.2.12-37 OK </span></span><span class="line"><span class="cl">node:3 slave 192.0.2.14 b87cc06c830f 5/120 <span class="m">6</span> 14.43GB/19.54GB 10.83GB/16.02GB 6.2.12-37 OK </span></span><span class="line"><span class="cl">$ rladmin node <span class="m">2</span> enslave demote_node </span></span><span class="line"><span class="cl">Performing enslave_node action on node:2: 100% </span></span><span class="line"><span class="cl">OK </span></span><span class="line"><span class="cl">$ rladmin status nodes </span></span><span class="line"><span class="cl">CLUSTER NODES: </span></span><span class="line"><span class="cl">NODE:ID ROLE ADDRESS EXTERNAL_ADDRESS HOSTNAME SHARDS CORES FREE_RAM PROVISIONAL_RAM VERSION STATUS </span></span><span class="line"><span class="cl">*node:1 master 192.0.2.12 198.51.100.1 3d99db1fdf4b 1/100 <span class="m">6</span> 14.72GB/19.54GB 10.91GB/16.02GB 6.2.12-37 OK </span></span><span class="line"><span class="cl">node:2 slave 192.0.2.13 198.51.100.2 fc7a3d332458 4/100 <span class="m">6</span> 14.72GB/19.54GB 11.17GB/16.02GB 6.2.12-37 OK </span></span><span class="line"><span class="cl">node:3 slave 192.0.2.14 b87cc06c830f 5/120 <span class="m">6</span> 14.72GB/19.54GB 10.92GB/16.02GB 6.2.12-37 OK </span></span><span class="line"><span class="cl">$ rladmin status shards node <span class="m">2</span> </span></span><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:6 tr02 redis:14 node:2 slave 0-4095 2.99MB OK </span></span><span class="line"><span class="cl">db:6 tr02 redis:16 node:2 slave 4096-8191 3.01MB OK </span></span><span class="line"><span class="cl">db:6 tr02 redis:18 node:2 slave 8192-12287 2.93MB OK </span></span><span class="line"><span class="cl">db:6 tr02 redis:20 node:2 slave 12288-16383 3.06MB OK </span></span></code></pre> </div> <h2 id="node-enslave-endpoints_only"> <code> node enslave endpoints_only </code> </h2> <p> Changes the role for all endpoints on a node to replica. </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">rladmin node &lt;ID&gt; enslave endpoints_only </span></span><span class="line"><span class="cl"> <span class="o">[</span>retry_timeout_seconds &lt;seconds&gt;<span class="o">]</span> </span></span></code></pre> </div> <h3 id="parameters-1"> 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> Changes all of the node's endpoints to replicas </td> </tr> <tr> <td> retry_timeout_seconds </td> <td> integer </td> <td> Retries on failure until the specified number of seconds has passed. </td> </tr> </tbody> </table> <h3 id="returns-1"> Returns </h3> <p> Returns <code> OK </code> if the roles were successfully changed. Otherwise, it returns an error. </p> <p> Use <a href="/docs/latest/operate/rs/references/cli-utilities/rladmin/status/#status-endpoints"> <code> rladmin status endpoints </code> </a> to verify that the roles were changed. </p> <h3 id="example-1"> Example </h3> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">$ rladmin status endpoints </span></span><span class="line"><span class="cl">ENDPOINTS: </span></span><span class="line"><span class="cl">DB:ID NAME ID NODE ROLE SSL </span></span><span class="line"><span class="cl">db:5 tr01 endpoint:5:1 node:1 single No </span></span><span class="line"><span class="cl">db:6 tr02 endpoint:6:1 node:3 all-master-shards No </span></span><span class="line"><span class="cl">$ rladmin node <span class="m">1</span> enslave endpoints_only </span></span><span class="line"><span class="cl">Performing enslave_node action on node:1: 100% </span></span><span class="line"><span class="cl">OK </span></span><span class="line"><span class="cl">$ rladmin status endpoints </span></span><span class="line"><span class="cl">ENDPOINTS: </span></span><span class="line"><span class="cl">DB:ID NAME ID NODE ROLE SSL </span></span><span class="line"><span class="cl">db:5 tr01 endpoint:5:1 node:3 single No </span></span><span class="line"><span class="cl">db:6 tr02 endpoint:6:1 node:3 all-master-shards No </span></span></code></pre> </div> <h2 id="node-enslave-shards_only"> <code> node enslave shards_only </code> </h2> <p> Changes the role for all shards of a node to replica. </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">rladmin node &lt;ID&gt; enslave shards_only </span></span><span class="line"><span class="cl"> <span class="o">[</span>retry_timeout_seconds &lt;seconds&gt;<span class="o">]</span> </span></span></code></pre> </div> <h3 id="parameters-2"> 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> Changes all of the node's shards to replicas </td> </tr> <tr> <td> retry_timeout_seconds </td> <td> integer </td> <td> Retries on failure until the specified number of seconds has passed. </td> </tr> </tbody> </table> <h3 id="returns-2"> Returns </h3> <p> Returns <code> OK </code> if the roles were successfully changed. Otherwise, it returns an error. </p> <p> Use <a href="/docs/latest/operate/rs/references/cli-utilities/rladmin/status/#status-shards"> <code> rladmin status shards </code> </a> to verify that the roles were changed. </p> <h3 id="example-2"> Example </h3> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">$ rladmin status shards node <span class="m">3</span> </span></span><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:5 tr01 redis:12 node:3 master 0-16383 3.04MB OK </span></span><span class="line"><span class="cl">db:6 tr02 redis:15 node:3 master 0-4095 4.13MB OK </span></span><span class="line"><span class="cl">db:6 tr02 redis:17 node:3 master 4096-8191 4.13MB OK </span></span><span class="line"><span class="cl">db:6 tr02 redis:19 node:3 master 8192-12287 4.13MB OK </span></span><span class="line"><span class="cl">db:6 tr02 redis:21 node:3 master 12288-16383 4.13MB OK </span></span><span class="line"><span class="cl">$ rladmin node <span class="m">3</span> enslave shards_only </span></span><span class="line"><span class="cl">Performing enslave_node action on node:3: 100% </span></span><span class="line"><span class="cl">OK </span></span><span class="line"><span class="cl">$ rladmin status shards node <span class="m">3</span> </span></span><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:5 tr01 redis:12 node:3 slave 0-16383 2.98MB OK </span></span><span class="line"><span class="cl">db:6 tr02 redis:15 node:3 slave 0-4095 4.23MB OK </span></span><span class="line"><span class="cl">db:6 tr02 redis:17 node:3 slave 4096-8191 4.11MB OK </span></span><span class="line"><span class="cl">db:6 tr02 redis:19 node:3 slave 8192-12287 4.19MB OK </span></span><span class="line"><span class="cl">db:6 tr02 redis:21 node:3 slave 12288-16383 4.27MB OK </span></span></code></pre> </div> <form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback"> <input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/references/cli-utilities/rladmin/node/enslave/"/> <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/setbit/.html
<section class="prose w-full py-12"> <h1 class="command-name"> SETBIT </h1> <div class="font-semibold text-redis-ink-900"> Syntax </div> <pre class="command-syntax">SETBIT key offset value</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.2.0 </dd> <dt class="font-semibold text-redis-ink-900 m-0"> Time complexity: </dt> <dd class="m-0"> O(1) </dd> <dt class="font-semibold text-redis-ink-900 m-0"> ACL categories: </dt> <dd class="m-0"> <code> @write </code> <span class="mr-1 last:hidden"> , </span> <code> @bitmap </code> <span class="mr-1 last:hidden"> , </span> <code> @slow </code> <span class="mr-1 last:hidden"> , </span> </dd> </dl> <p> Sets or clears the bit at <em> offset </em> in the string value stored at <em> key </em> . </p> <p> The bit is either set or cleared depending on <em> value </em> , which can be either 0 or 1. </p> <p> When <em> key </em> does not exist, a new string value is created. The string is grown to make sure it can hold a bit at <em> offset </em> . The <em> offset </em> argument is required to be greater than or equal to 0, and smaller than 2^32 (this limits bitmaps to 512MB). When the string at <em> key </em> is grown, added bits are set to 0. </p> <p> <strong> Warning </strong> : When setting the last possible bit ( <em> offset </em> equal to 2^32 -1) and the string value stored at <em> key </em> does not yet hold a string value, or holds a small string value, Redis needs to allocate all intermediate memory which can block the server for some time. On a 2010 MacBook Pro, setting bit number 2^32 -1 (512MB allocation) takes ~300ms, setting bit number 2^30 -1 (128MB allocation) takes ~80ms, setting bit number 2^28 -1 (32MB allocation) takes ~30ms and setting bit number 2^26 -1 (8MB allocation) takes ~8ms. Note that once this first allocation is done, subsequent calls to <code> SETBIT </code> for the same <em> key </em> will not have the allocation overhead. </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; SETBIT mykey 7 1 (integer) 0 redis&gt; SETBIT mykey 7 0 (integer) 1 redis&gt; GET mykey "" </pre> <div class="prompt" style=""> <span> redis&gt; </span> <input autocomplete="off" name="prompt" spellcheck="false" type="text"/> </div> </form> <h2 id="pattern-accessing-the-entire-bitmap"> Pattern: accessing the entire bitmap </h2> <p> There are cases when you need to set all the bits of single bitmap at once, for example when initializing it to a default non-zero value. It is possible to do this with multiple calls to the <code> SETBIT </code> command, one for each bit that needs to be set. However, so as an optimization you can use a single <a href="/docs/latest/commands/set/"> <code> SET </code> </a> command to set the entire bitmap. </p> <p> Bitmaps are not an actual data type, but a set of bit-oriented operations defined on the String type (for more information refer to the <a href="/develop/data-types-intro#bitmaps"> Bitmaps section of the Data Types Introduction page </a> ). This means that bitmaps can be used with string commands, and most importantly with <a href="/docs/latest/commands/set/"> <code> SET </code> </a> and <a href="/docs/latest/commands/get/"> <code> GET </code> </a> . </p> <p> Because Redis' strings are binary-safe, a bitmap is trivially encoded as a bytes stream. The first byte of the string corresponds to offsets 0..7 of the bitmap, the second byte to the 8..15 range, and so forth. </p> <p> For example, after setting a few bits, getting the string value of the bitmap would look like this: </p> <pre tabindex="0"><code>&gt; SETBIT bitmapsarestrings 2 1 &gt; SETBIT bitmapsarestrings 3 1 &gt; SETBIT bitmapsarestrings 5 1 &gt; SETBIT bitmapsarestrings 10 1 &gt; SETBIT bitmapsarestrings 11 1 &gt; SETBIT bitmapsarestrings 14 1 &gt; GET bitmapsarestrings "42" </code></pre> <p> By getting the string representation of a bitmap, the client can then parse the response's bytes by extracting the bit values using native bit operations in its native programming language. Symmetrically, it is also possible to set an entire bitmap by performing the bits-to-bytes encoding in the client and calling <a href="/docs/latest/commands/set/"> <code> SET </code> </a> with the resultant string. </p> <h2 id="pattern-setting-multiple-bits"> Pattern: setting multiple bits </h2> <p> <code> SETBIT </code> excels at setting single bits, and can be called several times when multiple bits need to be set. To optimize this operation you can replace multiple <code> SETBIT </code> calls with a single call to the variadic <a href="/docs/latest/commands/bitfield/"> <code> BITFIELD </code> </a> command and the use of fields of type <code> u1 </code> . </p> <p> For example, the example above could be replaced by: </p> <pre tabindex="0"><code>&gt; BITFIELD bitsinabitmap SET u1 2 1 SET u1 3 1 SET u1 5 1 SET u1 10 1 SET u1 11 1 SET u1 14 1 </code></pre> <h2 id="advanced-pattern-accessing-bitmap-ranges"> Advanced Pattern: accessing bitmap ranges </h2> <p> It is also possible to use the <a href="/docs/latest/commands/getrange/"> <code> GETRANGE </code> </a> and <a href="/docs/latest/commands/setrange/"> <code> SETRANGE </code> </a> string commands to efficiently access a range of bit offsets in a bitmap. Below is a sample implementation in idiomatic Redis Lua scripting that can be run with the <a href="/docs/latest/commands/eval/"> <code> EVAL </code> </a> command: </p> <pre tabindex="0"><code>--[[ Sets a bitmap range Bitmaps are stored as Strings in Redis. A range spans one or more bytes, so we can call [`SETRANGE`](/docs/latest/commands/setrange/) when entire bytes need to be set instead of flipping individual bits. Also, to avoid multiple internal memory allocations in Redis, we traverse in reverse. Expected input: KEYS[1] - bitfield key ARGV[1] - start offset (0-based, inclusive) ARGV[2] - end offset (same, should be bigger than start, no error checking) ARGV[3] - value (should be 0 or 1, no error checking) ]]-- -- A helper function to stringify a binary string to semi-binary format local function tobits(str) local r = '' for i = 1, string.len(str) do local c = string.byte(str, i) local b = ' ' for j = 0, 7 do b = tostring(bit.band(c, 1)) .. b c = bit.rshift(c, 1) end r = r .. b end return r end -- Main local k = KEYS[1] local s, e, v = tonumber(ARGV[1]), tonumber(ARGV[2]), tonumber(ARGV[3]) -- First treat the dangling bits in the last byte local ms, me = s % 8, (e + 1) % 8 if me &gt; 0 then local t = math.max(e - me + 1, s) for i = e, t, -1 do redis.call('SETBIT', k, i, v) end e = t end -- Then the danglings in the first byte if ms &gt; 0 then local t = math.min(s - ms + 7, e) for i = s, t, 1 do redis.call('SETBIT', k, i, v) end s = t + 1 end -- Set a range accordingly, if at all local rs, re = s / 8, (e + 1) / 8 local rl = re - rs if rl &gt; 0 then local b = '\255' if 0 == v then b = '\0' end redis.call('SETRANGE', k, rs, string.rep(b, rl)) end </code></pre> <p> <strong> Note: </strong> the implementation for getting a range of bit offsets from a bitmap is left as an exercise to the reader. </p> <h2 id="resp2resp3-reply"> RESP2/RESP3 Reply </h2> <a href="../../develop/reference/protocol-spec#integers"> Integer reply </a> : the original bit value stored at <em> offset </em> . <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/setbit/"/> <div class="flex flex-row justify-between"> <div class="grid justify-center"> <span class="font-mono"> RATE THIS PAGE </span> <div class="star-rating"> <input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/> <label class="star" for="5-stars"> β˜… </label> <input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/> <label class="star" for="4-stars"> β˜… </label> <input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/> <label class="star" for="3-stars"> β˜… </label> <input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/> <label class="star" for="2-stars"> β˜… </label> <input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/> <label class="star" for="1-stars"> β˜… </label> </div> </div> <a class="font-mono no-underline" href="#"> Back to top ↑ </a> </div> <div class="hidden" id="feedback-form"> <div class="grid gap-2"> <textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea> <button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit"> Submit </button> </div> </div> </form> <script> document.addEventListener("DOMContentLoaded", function() { const form = document.querySelector("#page-feedback"); form.addEventListener("submit", function(event) { event.preventDefault(); var xhr = new XMLHttpRequest(); var url = "\/docusight\/api\/rate"; var params = new URLSearchParams(new FormData(form)); xhr.open("POST", url, true); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.onreadystatechange = function() { if (xhr.readyState === 4 && xhr.status === 200) { const responseData = JSON.parse(xhr.responseText); const responseMessage = responseData.response; const newText = document.createTextNode(responseMessage); form.parentNode.replaceChild(newText, form); } }; xhr.send(params); }); }); </script> </section>
https://redis.io/docs/latest/commands/acl-cat/.html
<section class="prose w-full py-12"> <h1 class="command-name"> ACL CAT </h1> <div class="font-semibold text-redis-ink-900"> Syntax </div> <pre class="command-syntax">ACL CAT [category]</pre> <dl class="grid grid-cols-[auto,1fr] gap-2 mb-12"> <dt class="font-semibold text-redis-ink-900 m-0"> Available since: </dt> <dd class="m-0"> 6.0.0 </dd> <dt class="font-semibold text-redis-ink-900 m-0"> Time complexity: </dt> <dd class="m-0"> O(1) since the categories and commands are a fixed set. </dd> <dt class="font-semibold text-redis-ink-900 m-0"> ACL categories: </dt> <dd class="m-0"> <code> @slow </code> <span class="mr-1 last:hidden"> , </span> </dd> </dl> <p> The command shows the available ACL categories if called without arguments. If a category name is given, the command shows all the Redis commands in the specified category. </p> <p> ACL categories are very useful in order to create ACL rules that include or exclude a large set of commands at once, without specifying every single command. For instance, the following rule will let the user <code> karin </code> perform everything but the most dangerous operations that may affect the server stability: </p> <pre><code>ACL SETUSER karin on +@all -@dangerous </code></pre> <p> We first add all the commands to the set of commands that <code> karin </code> is able to execute, but then we remove all the dangerous commands. </p> <p> Checking for all the available categories is as simple as: </p> <pre tabindex="0"><code>&gt; ACL CAT 1) "keyspace" 2) "read" 3) "write" 4) "set" 5) "sortedset" 6) "list" 7) "hash" 8) "string" 9) "bitmap" 10) "hyperloglog" 11) "geo" 12) "stream" 13) "pubsub" 14) "admin" 15) "fast" 16) "slow" 17) "blocking" 18) "dangerous" 19) "connection" 20) "transaction" 21) "scripting" </code></pre> <p> Then we may want to know what commands are part of a given category: </p> <pre tabindex="0"><code>&gt; ACL CAT dangerous 1) "flushdb" 2) "acl" 3) "slowlog" 4) "debug" 5) "role" 6) "keys" 7) "pfselftest" 8) "client" 9) "bgrewriteaof" 10) "replicaof" 11) "monitor" 12) "restore-asking" 13) "latency" 14) "replconf" 15) "pfdebug" 16) "bgsave" 17) "sync" 18) "config" 19) "flushall" 20) "cluster" 21) "info" 22) "lastsave" 23) "slaveof" 24) "swapdb" 25) "module" 26) "restore" 27) "migrate" 28) "save" 29) "shutdown" 30) "psync" 31) "sort" </code></pre> <h2 id="resp2resp3-reply"> RESP2/RESP3 Reply </h2> <p> One of the following: </p> <ul> <li> <a href="../../develop/reference/protocol-spec#arrays"> Array reply </a> : an array of <a href="../../develop/reference/protocol-spec#bulk-strings"> Bulk string reply </a> elements representing ACL categories or commands in a given category. </li> <li> <a href="../../develop/reference/protocol-spec#simple-errors"> Simple error reply </a> : the command returns an error if an invalid category name is given. </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/acl-cat/"/> <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/redisom-for-java/.html
<section class="prose w-full py-12 max-w-none"> <h1> RedisOM for Java </h1> <p class="text-lg -mt-5 mb-10"> Learn how to build with Redis Stack and Spring </p> <p> Redis Stack provides a seamless and straightforward way to use different data models and functionality from Redis, including a document store, a time series data database, probabilistic data structures, and a full-text search engine. </p> <p> Redis Stack is supported by several client libraries, including Node.js, Java, and Python, so that developers can use their preferred language. We'll be using one of the Redis Stack supporting libraries; <a href="https://github.com/redis/redis-om-spring"> Redis OM Spring </a> . Redis OM Spring provides a robust repository and custom object-mapping abstractions built on the powerful Spring Data Redis (SDR) framework. </p> <h2 id="what-youll-need"> What you’ll need: </h2> <ul> <li> Redis Stack: See <a href="/docs/latest/operate/oss_and_stack/install/install-stack/"> /docs/latest/operate/oss_and_stack/install/install-stack/ </a> </li> <li> <a href="/docs/latest/develop/tools/insight/"> Redis Insight </a> </li> <li> Your favorite browser </li> <li> Java 11 or greater </li> </ul> <h2 id="spring-boot-scaffold-with-spring-initializer"> Spring Boot scaffold with Spring Initializer </h2> <p> We’ll start by creating a skeleton app using the <a href="https://start.spring.io"> Spring Initializer </a> , open your browser to <a href="https://start.spring.io"> https://start.spring.io </a> and let's configure our skeleton application as follows: </p> <ul> <li> We’ll use a Maven-based build (check Maven checkbox) </li> <li> And version <strong> <code> 2.6.4 </code> </strong> of Spring Boot which is the current version supported by Redis OM Spring </li> <li> Group: <strong> <code> com.redis.om </code> </strong> </li> <li> Artifact: <strong> <code> skeleton </code> </strong> </li> <li> Name: <strong> <code> skeleton </code> </strong> </li> <li> Description: Skeleton App for Redis OM Spring </li> <li> Package Name: <strong> <code> com.redis.om.skeleton </code> </strong> </li> <li> Packaging: JAR </li> <li> Java: <strong> <code> 11 </code> </strong> </li> <li> Dependencies: <strong> <code> web </code> </strong> , <strong> <code> devtools </code> </strong> and <strong> <code> lombok </code> </strong> . </li> </ul> <p> The <code> web </code> (Spring Web) gives us the ability to build RESTful applications using Spring MVC. With <code> devtools </code> we get fast application restarts and reloads. And <code> lombok </code> reduces boilerplate code like getters and setters. </p> <p> <img alt="Spring Initializer" src="./images/001_stack_spring.png" title="Spring Initializer"/> </p> <p> Click <code> Generate </code> and download the ZIP file, unzip it and load the Maven project into your IDE of choice. </p> <h2 id="adding-redis-om-spring"> Adding Redis OM Spring </h2> <p> Open the Maven <code> pom.xml </code> and between the <code> &lt;dependencies&gt; </code> and <code> &lt;build&gt; </code> sections we’ll add the snapshots repositories so that we can get to latest SNAPSHOT release of redis-om-spring: </p> <div class="highlight"> <pre class="chroma"><code class="language-xml" data-lang="xml"><span class="line"><span class="cl"><span class="nt">&lt;repositories&gt;</span> </span></span><span class="line"><span class="cl"> <span class="nt">&lt;repository&gt;</span> </span></span><span class="line"><span class="cl"> <span class="nt">&lt;id&gt;</span>snapshots-repo<span class="nt">&lt;/id&gt;</span> </span></span><span class="line"><span class="cl"> <span class="nt">&lt;url&gt;</span>https://s01.oss.sonatype.org/content/repositories/snapshots/<span class="nt">&lt;/url&gt;</span> </span></span><span class="line"><span class="cl"> <span class="nt">&lt;/repository&gt;</span> </span></span><span class="line"><span class="cl"><span class="nt">&lt;/repositories&gt;</span></span></span></code></pre> </div> <p> And then in the <code> &lt;dependencies&gt; </code> section add version <code> 0.3.0 </code> of Redis OM Spring: </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>com.redis.om<span class="nt">&lt;/groupId&gt;</span> </span></span><span class="line"><span class="cl"> <span class="nt">&lt;artifactId&gt;</span>redis-om-spring<span class="nt">&lt;/artifactId&gt;</span> </span></span><span class="line"><span class="cl"> <span class="nt">&lt;version&gt;</span>0.3.0-SNAPSHOT<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> <h2 id="adding-swagger"> Adding Swagger </h2> <p> We'll use the Swagger UI to test our web services endpoint. To add Swagger 2 to a Spring REST web service, using the Springfox implementation add the following dependencies to the POM: </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>io.springfox<span class="nt">&lt;/groupId&gt;</span> </span></span><span class="line"><span class="cl"> <span class="nt">&lt;artifactId&gt;</span>springfox-boot-starter<span class="nt">&lt;/artifactId&gt;</span> </span></span><span class="line"><span class="cl"> <span class="nt">&lt;version&gt;</span>3.0.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><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>io.springfox<span class="nt">&lt;/groupId&gt;</span> </span></span><span class="line"><span class="cl"> <span class="nt">&lt;artifactId&gt;</span>springfox-swagger-ui<span class="nt">&lt;/artifactId&gt;</span> </span></span><span class="line"><span class="cl"> <span class="nt">&lt;version&gt;</span>3.0.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> <p> Let's add Swagger Docker Bean to the Spring App class: </p> <div class="highlight"> <pre class="chroma"><code class="language-java" data-lang="java"><span class="line"><span class="cl"><span class="nd">@Bean</span> </span></span><span class="line"><span class="cl"><span class="kd">public</span> <span class="n">Docket</span> <span class="nf">api</span><span class="o">()</span> <span class="o">{</span> </span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="k">new</span> <span class="n">Docket</span><span class="o">(</span><span class="n">DocumentationType</span><span class="o">.</span><span class="na">SWAGGER_2</span><span class="o">)</span> </span></span><span class="line"><span class="cl"> <span class="o">.</span><span class="na">select</span><span class="o">()</span> </span></span><span class="line"><span class="cl"> <span class="o">.</span><span class="na">apis</span><span class="o">(</span><span class="n">RequestHandlerSelectors</span><span class="o">.</span><span class="na">any</span><span class="o">())</span> </span></span><span class="line"><span class="cl"> <span class="o">.</span><span class="na">paths</span><span class="o">(</span><span class="n">PathSelectors</span><span class="o">.</span><span class="na">any</span><span class="o">())</span> </span></span><span class="line"><span class="cl"> <span class="o">.</span><span class="na">build</span><span class="o">();</span> </span></span><span class="line"><span class="cl"><span class="o">}</span></span></span></code></pre> </div> <p> Which will pick up any HTTP endpoints exposed by our application. Add to your app's property file (src/main/resources/application.properties): </p> <div class="highlight"> <pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">spring.mvc.pathmatch.matching-strategy<span class="o">=</span>ANT_PATH_MATCHER</span></span></code></pre> </div> <p> And finally, to enable Swagger on the application, we need to use the <code> EnableSwagger2 </code> annotation, by annotating the main application class: </p> <div class="highlight"> <pre class="chroma"><code class="language-java" data-lang="java"><span class="line"><span class="cl"><span class="nd">@EnableSwagger2</span> </span></span><span class="line"><span class="cl"><span class="nd">@SpringBootApplication</span> </span></span><span class="line"><span class="cl"><span class="kd">public</span> <span class="kd">class</span> <span class="nc">SkeletonApplication</span> <span class="o">{</span> </span></span><span class="line"><span class="cl"> <span class="c1">// ... </span></span></span><span class="line"><span class="cl"><span class="c1"></span><span class="o">}</span></span></span></code></pre> </div> <h2 id="creating-the-domain"> Creating the Domain </h2> <p> Our domain will be fairly simple; <code> Person </code> s that have <code> Address </code> es. Let's start with the <code> Person </code> entity: </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">com.redis.om.skeleton.models</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.Set</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">org.springframework.data.annotation.Id</span><span class="o">;</span> </span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">org.springframework.data.geo.Point</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">com.redis.om.spring.annotations.Document</span><span class="o">;</span> </span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">com.redis.om.spring.annotations.Indexed</span><span class="o">;</span> </span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">com.redis.om.spring.annotations.Searchable</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">lombok.AccessLevel</span><span class="o">;</span> </span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">lombok.AllArgsConstructor</span><span class="o">;</span> </span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">lombok.Data</span><span class="o">;</span> </span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">lombok.NonNull</span><span class="o">;</span> </span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">lombok.RequiredArgsConstructor</span><span class="o">;</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="nd">@RequiredArgsConstructor</span><span class="o">(</span><span class="n">staticName</span> <span class="o">=</span> <span class="s">"of"</span><span class="o">)</span> </span></span><span class="line"><span class="cl"><span class="nd">@AllArgsConstructor</span><span class="o">(</span><span class="n">access</span> <span class="o">=</span> <span class="n">AccessLevel</span><span class="o">.</span><span class="na">PROTECTED</span><span class="o">)</span> </span></span><span class="line"><span class="cl"><span class="nd">@Data</span> </span></span><span class="line"><span class="cl"><span class="nd">@Document</span> </span></span><span class="line"><span class="cl"><span class="kd">public</span> <span class="kd">class</span> <span class="nc">Person</span> <span class="o">{</span> </span></span><span class="line"><span class="cl"> <span class="c1">// Id Field, also indexed </span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="nd">@Id</span> </span></span><span class="line"><span class="cl"> <span class="nd">@Indexed</span> </span></span><span class="line"><span class="cl"> <span class="kd">private</span> <span class="n">String</span> <span class="n">id</span><span class="o">;</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="c1">// Indexed for exact text matching </span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="nd">@Indexed</span> <span class="nd">@NonNull</span> </span></span><span class="line"><span class="cl"> <span class="kd">private</span> <span class="n">String</span> <span class="n">firstName</span><span class="o">;</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="nd">@Indexed</span> <span class="nd">@NonNull</span> </span></span><span class="line"><span class="cl"> <span class="kd">private</span> <span class="n">String</span> <span class="n">lastName</span><span class="o">;</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="c1">//Indexed for numeric matches </span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="nd">@Indexed</span> <span class="nd">@NonNull</span> </span></span><span class="line"><span class="cl"> <span class="kd">private</span> <span class="n">Integer</span> <span class="n">age</span><span class="o">;</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="c1">//Indexed for Full Text matches </span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="nd">@Searchable</span> <span class="nd">@NonNull</span> </span></span><span class="line"><span class="cl"> <span class="kd">private</span> <span class="n">String</span> <span class="n">personalStatement</span><span class="o">;</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="c1">//Indexed for Geo Filtering </span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="nd">@Indexed</span> <span class="nd">@NonNull</span> </span></span><span class="line"><span class="cl"> <span class="kd">private</span> <span class="n">Point</span> <span class="n">homeLoc</span><span class="o">;</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="c1">// Nest indexed object </span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="nd">@Indexed</span> <span class="nd">@NonNull</span> </span></span><span class="line"><span class="cl"> <span class="kd">private</span> <span class="n">Address</span> <span class="n">address</span><span class="o">;</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="nd">@Indexed</span> <span class="nd">@NonNull</span> </span></span><span class="line"><span class="cl"> <span class="kd">private</span> <span class="n">Set</span><span class="o">&lt;</span><span class="n">String</span><span class="o">&gt;</span> <span class="n">skills</span><span class="o">;</span> </span></span><span class="line"><span class="cl"><span class="o">}</span></span></span></code></pre> </div> <p> The <code> Person </code> class has the following properties: </p> <ul> <li> <code> id </code> : An autogenerated <code> String </code> using <a href="https://github.com/ulid/spec"> ULIDs </a> </li> <li> <code> firstName </code> : A <code> String </code> representing their first or given name. </li> <li> <code> lastName </code> : A <code> String </code> representing their last or surname. </li> <li> <code> age </code> : An <code> Integer </code> representing their age in years. </li> <li> <code> personalStatement </code> : A <code> String </code> representing a personal text statement containing facts or other biographical information. </li> <li> <code> homeLoc </code> : A <code> org.springframework.data.geo.Point </code> representing the geo coordinates. </li> <li> <code> address </code> : An entity of type <code> Address </code> representing the Person's postal address. </li> <li> <code> skills </code> : A <code> Set&lt;String&gt; </code> representing a collection of Strings representing skills the Person possesses. </li> </ul> <h3 id="document"> @Document </h3> <p> The <code> Person </code> class ( <code> com.redis.om.skeleton.models.Person </code> ) is annotated with <code> @Document </code> ( <code> com.redis.om.spring.annotations.Document </code> ), which is marks the object as a Redis entity to be persisted as a JSON document by the appropriate type of repository. </p> <h3 id="indexed-and-searchable"> @Indexed and @Searchable </h3> <p> The fields <code> id </code> , <code> firstName </code> , <code> lastName </code> , <code> age </code> , <code> homeLoc </code> , <code> address </code> , and <code> skills </code> are all annotated with <code> @Indexed </code> ( <code> com.redis.om.spring.annotations.Indexed </code> ). On entities annotated with <code> @Document </code> Redis OM Spring will scan the fields and add an appropriate search index field to the schema for the entity. For example, for the <code> Person </code> class an index named <code> com.redis.om.skeleton.models.PersonIdx </code> will be created on application startup. In the index schema, a search field will be added for each <code> @Indexed </code> annotated property. RediSearch, the underlying search engine powering searches, supports Text (full-text searches), Tag (exact-match searches), Numeric (range queries), Geo (geographic range queries), and Vector (vector queries) fields. For <code> @Indexed </code> fields, the appropriate search field (Tag, Numeric, or Geo) is selected based on the property's data type. </p> <p> Fields marked as <code> @Searchable </code> ( <code> com.redis.om.spring.annotations.Searchable </code> ) such as <code> personalStatement </code> in <code> Person </code> are reflected as Full-Text search fields in the search index schema. </p> <h3 id="nested-field-search-features"> Nested Field Search Features </h3> <p> The embedded class <code> Address </code> ( <code> com.redis.om.skeleton.models.Address </code> ) has several properties annotated with <code> @Indexed </code> and <code> @Searchable </code> , which will generate search index fields in Redis. The scanning of these fields is triggered by the <code> @Indexed </code> annotation on the <code> address </code> property in the <code> Person </code> class: </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">com.redis.om.skeleton.models</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">com.redis.om.spring.annotations.Indexed</span><span class="o">;</span> </span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">com.redis.om.spring.annotations.Searchable</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">lombok.Data</span><span class="o">;</span> </span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">lombok.NonNull</span><span class="o">;</span> </span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">lombok.RequiredArgsConstructor</span><span class="o">;</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="nd">@Data</span> </span></span><span class="line"><span class="cl"><span class="nd">@RequiredArgsConstructor</span><span class="o">(</span><span class="n">staticName</span> <span class="o">=</span> <span class="s">"of"</span><span class="o">)</span> </span></span><span class="line"><span class="cl"><span class="kd">public</span> <span class="kd">class</span> <span class="nc">Address</span> <span class="o">{</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="nd">@NonNull</span> </span></span><span class="line"><span class="cl"> <span class="nd">@Indexed</span> </span></span><span class="line"><span class="cl"> <span class="kd">private</span> <span class="n">String</span> <span class="n">houseNumber</span><span class="o">;</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="nd">@NonNull</span> </span></span><span class="line"><span class="cl"> <span class="nd">@Searchable</span><span class="o">(</span><span class="n">nostem</span> <span class="o">=</span> <span class="kc">true</span><span class="o">)</span> </span></span><span class="line"><span class="cl"> <span class="kd">private</span> <span class="n">String</span> <span class="n">street</span><span class="o">;</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="nd">@NonNull</span> </span></span><span class="line"><span class="cl"> <span class="nd">@Indexed</span> </span></span><span class="line"><span class="cl"> <span class="kd">private</span> <span class="n">String</span> <span class="n">city</span><span class="o">;</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="nd">@NonNull</span> </span></span><span class="line"><span class="cl"> <span class="nd">@Indexed</span> </span></span><span class="line"><span class="cl"> <span class="kd">private</span> <span class="n">String</span> <span class="n">state</span><span class="o">;</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="nd">@NonNull</span> </span></span><span class="line"><span class="cl"> <span class="nd">@Indexed</span> </span></span><span class="line"><span class="cl"> <span class="kd">private</span> <span class="n">String</span> <span class="n">postalCode</span><span class="o">;</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="nd">@NonNull</span> </span></span><span class="line"><span class="cl"> <span class="nd">@Indexed</span> </span></span><span class="line"><span class="cl"> <span class="kd">private</span> <span class="n">String</span> <span class="n">country</span><span class="o">;</span> </span></span><span class="line"><span class="cl"><span class="o">}</span></span></span></code></pre> </div> <h2 id="spring-data-repositories"> Spring Data Repositories </h2> <p> With the model in place now, we need to create the bridge between the models and the Redis, a Spring Data Repository. Like other Spring Data Repositories, Redis OM Spring data repository's goal is to reduce the boilerplate code required to implement data access significantly. Create a Java interface like: </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">com.redis.om.skeleton.models.repositories</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">com.redis.om.skeleton.models.Person</span><span class="o">;</span> </span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">com.redis.om.spring.repository.RedisDocumentRepository</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">interface</span> <span class="nc">PeopleRepository</span> <span class="kd">extends</span> <span class="n">RedisDocumentRepository</span><span class="o">&lt;</span><span class="n">Person</span><span class="o">,</span><span class="n">String</span><span class="o">&gt;</span> <span class="o">{</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="o">}</span></span></span></code></pre> </div> <p> That's really all we need to get all the CRUD and Paging/Sorting functionality. The <code> RedisDocumentRepository </code> ( <code> com.redis.om.spring.repository.RedisDocumentRepository </code> ) extends <code> PagingAndSortingRepository </code> ( <code> org.springframework.data.repository.PagingAndSortingRepository </code> ) which extends CrudRepository to provide additional methods to retrieve entities using the pagination and sorting. </p> <h3 id="enableredisdocumentrepositories"> @EnableRedisDocumentRepositories </h3> <p> Before we can fire up the application, we need to enable our Redis Document repositories. Like most Spring Data projects, Redis OM Spring provides an annotation to do so; the <code> @EnableRedisDocumentRepositories </code> . We annotate the main application class: </p> <div class="highlight"> <pre class="chroma"><code class="language-java" data-lang="java"><span class="line"><span class="cl"><span class="nd">@EnableRedisDocumentRepositories</span><span class="o">(</span><span class="n">basePackages</span> <span class="o">=</span> <span class="s">"com.redis.om.skeleton.*"</span><span class="o">)</span> </span></span><span class="line"><span class="cl"><span class="nd">@EnableSwagger2</span> </span></span><span class="line"><span class="cl"><span class="nd">@SpringBootApplication</span> </span></span><span class="line"><span class="cl"><span class="kd">public</span> <span class="kd">class</span> <span class="nc">SkeletonApplication</span> <span class="o">{</span></span></span></code></pre> </div> <h2 id="crud-with-repositories"> CRUD with Repositories </h2> <p> With the repositories enabled, we can use our repo; let's put in some data to see the object mapping in action. Let’s create <code> CommandLineRunner </code> that will execute on application startup: </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">class</span> <span class="nc">SkeletonApplication</span> <span class="o">{</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="nd">@Bean</span> </span></span><span class="line"><span class="cl"> <span class="n">CommandLineRunner</span> <span class="nf">loadTestData</span><span class="o">(</span><span class="n">PeopleRepository</span> <span class="n">repo</span><span class="o">)</span> <span class="o">{</span> </span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">args</span> <span class="o">-&gt;</span> <span class="o">{</span> </span></span><span class="line"><span class="cl"> <span class="n">repo</span><span class="o">.</span><span class="na">deleteAll</span><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">thorSays</span> <span class="o">=</span> <span class="err">β€œ</span><span class="n">The</span> <span class="n">Rabbit</span> <span class="n">Is</span> <span class="n">Correct</span><span class="o">,</span> <span class="n">And</span> <span class="n">Clearly</span> <span class="n">The</span> <span class="n">Smartest</span> <span class="n">One</span> <span class="n">Among</span> <span class="n">You</span><span class="o">.</span><span class="err">”</span><span class="o">;</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="c1">// Serendipity, 248 Seven Mile Beach Rd, Broken Head NSW 2481, Australia </span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="n">Address</span> <span class="n">thorsAddress</span> <span class="o">=</span> <span class="n">Address</span><span class="o">.</span><span class="na">of</span><span class="o">(</span><span class="s">"248"</span><span class="o">,</span> <span class="s">"Seven Mile Beach Rd"</span><span class="o">,</span> <span class="s">"Broken Head"</span><span class="o">,</span> <span class="s">"NSW"</span><span class="o">,</span> <span class="s">"2481"</span><span class="o">,</span> <span class="s">"Australia"</span><span class="o">);</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="n">Person</span> <span class="n">thor</span> <span class="o">=</span> <span class="n">Person</span><span class="o">.</span><span class="na">of</span><span class="o">(</span><span class="s">"Chris"</span><span class="o">,</span> <span class="s">"Hemsworth"</span><span class="o">,</span> <span class="mi">38</span><span class="o">,</span> <span class="n">thorSays</span><span class="o">,</span> <span class="k">new</span> <span class="n">Point</span><span class="o">(</span><span class="mf">153.616667</span><span class="o">,</span> <span class="o">-</span><span class="mf">28.716667</span><span class="o">),</span> <span class="n">thorsAddress</span><span class="o">,</span> <span class="n">Set</span><span class="o">.</span><span class="na">of</span><span class="o">(</span><span class="s">"hammer"</span><span class="o">,</span> <span class="s">"biceps"</span><span class="o">,</span> <span class="s">"hair"</span><span class="o">,</span> <span class="s">"heart"</span><span class="o">));</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="n">repo</span><span class="o">.</span><span class="na">save</span><span class="o">(</span><span class="n">thor</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> In the <code> loadTestData </code> method, we will take an instance of the <code> PeopleRepository </code> (thank you, Spring, for Dependency Injection!). Inside the returned lambda, we will first call the repo’s <code> deleteAll </code> method, which will ensure that we have clean data on each application reload. </p> <p> We create a <code> Person </code> object using the Lombok generated builder method and then save it using the repo’s <code> save </code> method. </p> <h3 id="keeping-tabs-with-redis-insight"> Keeping tabs with Redis Insight </h3> <p> Let’s launch Redis Insight and connect to the localhost at port 6379. With a clean Redis Stack install, we can use the built-in CLI to check the keys in the system: </p> <p> <img alt="Redis Insight" src="./images/002_stack_spring.png" title="Redis Insight"/> </p> <p> For a small amount of data, you can use the <code> keys </code> command (for any significant amount of data, use <code> scan </code> ): </p> <div class="highlight"> <pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">keys *</span></span></code></pre> </div> <p> If you want to keep an eye on the commands issued against the server, Redis Insight provides a profiler. If you click the "profile" button at the bottom of the screen, it should reveal the profiler window, and there you can start the profiler by clicking on the β€œStart Profiler” arrow. </p> <p> Let's start our Spring Boot application by using the Maven command: </p> <div class="highlight"> <pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">./mvnw spring-boot:run</span></span></code></pre> </div> <p> On Redis Insight, if the application starts correctly, you should see a barrage of commands fly by on the profiler: </p> <p> <img alt="Redis Insight" src="./images/003_stack_spring.png" title="Redis Insight"/> </p> <p> Now we can inspect the newly loaded data by simply refreshing the "Keys" view: </p> <p> <img alt="Redis Insight" src="./images/004_stack_spring.png" title="Redis Insight"/> </p> <p> You should now see two keys; one for the JSON document for β€œThor” and one for the Redis Set that Spring Data Redis (and Redis OM Spring) use to maintain the list of primary keys for an entity. </p> <p> You can select any of the keys on the key list to reveal their contents on the details panel. For JSON documents, we get a nice tree-view: </p> <p> <img alt="Redis Insight" src="./images/005_stack_spring.png" title="Redis Insight"/> </p> <p> Several Redis commands were executed on application startup. Let’s break them down so that we can understand what's transpired. </p> <h3 id="index-creation"> Index Creation </h3> <p> The first one is a call to <a href="/docs/latest/commands/ft.create/"> <code> FT.CREATE </code> </a> , which happens after Redis OM Spring scanned the <code> @Document </code> annotations. As you can see, since it encountered the annotation on <code> Person </code> , it creates the <code> PersonIdx </code> index. </p> <div class="highlight"> <pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="s2">"FT.CREATE"</span> </span></span><span class="line"><span class="cl"> <span class="s2">"com.redis.om.skeleton.models.PersonIdx"</span> <span class="s2">"ON"</span> <span class="s2">"JSON"</span> </span></span><span class="line"><span class="cl"> <span class="s2">"PREFIX"</span> <span class="s2">"1"</span> <span class="s2">"com.redis.om.skeleton.models.Person:"</span> </span></span><span class="line"><span class="cl"><span class="s2">"SCHEMA"</span> </span></span><span class="line"><span class="cl"> <span class="s2">"</span>$<span class="s2">.id"</span> <span class="s2">"AS"</span> <span class="s2">"id"</span> <span class="s2">"TAG"</span> </span></span><span class="line"><span class="cl"> <span class="s2">"</span>$<span class="s2">.firstName"</span> <span class="s2">"AS"</span> <span class="s2">"firstName"</span> <span class="s2">"TAG"</span> </span></span><span class="line"><span class="cl"> <span class="s2">"</span>$<span class="s2">.lastName"</span> <span class="s2">"AS"</span> <span class="s2">"lastName"</span> <span class="s2">"TAG"</span> </span></span><span class="line"><span class="cl"> <span class="s2">"</span>$<span class="s2">.age"</span> <span class="s2">"AS"</span> <span class="s2">"age"</span> <span class="s2">"NUMERIC"</span> </span></span><span class="line"><span class="cl"> <span class="s2">"</span>$<span class="s2">.personalStatement"</span> <span class="s2">"AS"</span> <span class="s2">"personalStatement"</span> <span class="s2">"TEXT"</span> </span></span><span class="line"><span class="cl"> <span class="s2">"</span>$<span class="s2">.homeLoc"</span> <span class="s2">"AS"</span> <span class="s2">"homeLoc"</span> <span class="s2">"GEO"</span> </span></span><span class="line"><span class="cl"> <span class="s2">"</span>$<span class="s2">.address.houseNumber"</span> <span class="s2">"AS"</span> <span class="s2">"address_houseNumber"</span> <span class="s2">"TAG"</span> </span></span><span class="line"><span class="cl"> <span class="s2">"</span>$<span class="s2">.address.street"</span> <span class="s2">"AS"</span> <span class="s2">"address_street"</span> <span class="s2">"TEXT"</span> <span class="s2">"NOSTEM"</span> </span></span><span class="line"><span class="cl"> <span class="s2">"</span>$<span class="s2">.address.city"</span> <span class="s2">"AS"</span> <span class="s2">"address_city"</span> <span class="s2">"TAG"</span> </span></span><span class="line"><span class="cl"> <span class="s2">"</span>$<span class="s2">.address.state"</span> <span class="s2">"AS"</span> <span class="s2">"address_state"</span> <span class="s2">"TAG"</span> </span></span><span class="line"><span class="cl"> <span class="s2">"</span>$<span class="s2">.address.postalCode"</span> <span class="s2">"AS"</span> <span class="s2">"address_postalCode"</span> <span class="s2">"TAG"</span> </span></span><span class="line"><span class="cl"> <span class="s2">"</span>$<span class="s2">.address.country"</span> <span class="s2">"AS"</span> <span class="s2">"address_country"</span> <span class="s2">"TAG"</span> </span></span><span class="line"><span class="cl"> <span class="s2">"</span>$<span class="s2">.skills[*]"</span> <span class="s2">"AS"</span> <span class="s2">"skills"</span></span></span></code></pre> </div> <h3 id="cleaning-the-person-repository"> Cleaning the Person Repository </h3> <p> The next set of commands are generated by the call to <code> repo.deleteAll() </code> : </p> <div class="highlight"> <pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="s2">"DEL"</span> <span class="s2">"com.redis.om.skeleton.models.Person"</span> </span></span><span class="line"><span class="cl"><span class="s2">"KEYS"</span> <span class="s2">"com.redis.om.skeleton.models.Person:*"</span></span></span></code></pre> </div> <p> The first call clears the set of Primary Keys that Spring Data Redis maintains (and therefore Redis OM Spring), the second call collects all the keys to delete them, but there are none to delete on this first load of the data. </p> <h3 id="saving-person-entities"> Saving Person Entities </h3> <p> The next repo call is <code> repo.save(thor) </code> that triggers the following sequence: </p> <div class="highlight"> <pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="s2">"SISMEMBER"</span> <span class="s2">"com.redis.om.skeleton.models.Person"</span> <span class="s2">"01FYANFH68J6WKX2PBPX21RD9H"</span> </span></span><span class="line"><span class="cl"><span class="s2">"EXISTS"</span> <span class="s2">"com.redis.om.skeleton.models.Person:01FYANFH68J6WKX2PBPX21RD9H"</span> </span></span><span class="line"><span class="cl"><span class="s2">"JSON.SET"</span> <span class="s2">"com.redis.om.skeleton.models.Person:01FYANFH68J6WKX2PBPX21RD9H"</span> <span class="s2">"."</span> <span class="s2">"{"</span>id<span class="s2">":"</span>01FYANFH68J6WKX2PBPX21RD9H<span class="s2">","</span>firstName<span class="s2">":"</span>Chris<span class="s2">","</span>lastName<span class="s2">":"</span>Hemsworth<span class="s2">","</span>age<span class="s2">":38,"</span>personalStatement<span class="s2">":"</span>The Rabbit Is Correct, And Clearly The Smartest One Among You.<span class="s2">","</span>homeLoc<span class="s2">":"</span>153.616667,-28.716667<span class="s2">","</span>address<span class="s2">":{"</span>houseNumber<span class="s2">":"</span>248<span class="s2">","</span>street<span class="s2">":"</span>Seven Mile Beach Rd<span class="s2">","</span>city<span class="s2">":"</span>Broken Head<span class="s2">","</span>state<span class="s2">":"</span>NSW<span class="s2">","</span>postalCode<span class="s2">":"</span>2481<span class="s2">","</span>country<span class="s2">":"</span>Australia<span class="s2">"},"</span>skills<span class="s2">":["</span>biceps<span class="s2">","</span>hair<span class="s2">","</span>heart<span class="s2">","</span>hammer<span class="s2">"]} </span></span></span><span class="line"><span class="cl"><span class="s2">"</span>SADD<span class="s2">" "</span>com.redis.om.skeleton.models.Person<span class="s2">" "</span>01FYANFH68J6WKX2PBPX21RD9H<span class="s2">"</span></span></span></code></pre> </div> <p> Let's break it down: </p> <ul> <li> The first call uses the generated ULID to check if the id is in the set of primary keys (if it is, it’ll be removed) </li> <li> The second call checks if JSON document exists (if it is, it’ll be removed) </li> <li> The third call uses the <a href="/docs/latest/commands/json.set/"> <code> JSON.SET </code> </a> command to save the JSON payload </li> <li> The last call adds the primary key of the saved document to the set of primary keys </li> </ul> <p> Now that we’ve seen the repository in action via the <code> .save </code> method, we know that the trip from Java to Redis work. Now let’s add some more data to make the interactions more interesting: </p> <div class="highlight"> <pre class="chroma"><code class="language-java" data-lang="java"><span class="line"><span class="cl"><span class="nd">@Bean</span> </span></span><span class="line"><span class="cl"><span class="n">CommandLineRunner</span> <span class="nf">loadTestData</span><span class="o">(</span><span class="n">PeopleRepository</span> <span class="n">repo</span><span class="o">)</span> <span class="o">{</span> </span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">args</span> <span class="o">-&gt;</span> <span class="o">{</span> </span></span><span class="line"><span class="cl"> <span class="n">repo</span><span class="o">.</span><span class="na">deleteAll</span><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">thorSays</span> <span class="o">=</span> <span class="err">β€œ</span><span class="n">The</span> <span class="n">Rabbit</span> <span class="n">Is</span> <span class="n">Correct</span><span class="o">,</span> <span class="n">And</span> <span class="n">Clearly</span> <span class="n">The</span> <span class="n">Smartest</span> <span class="n">One</span> <span class="n">Among</span> <span class="n">You</span><span class="o">.</span><span class="err">”</span><span class="o">;</span> </span></span><span class="line"><span class="cl"> <span class="n">String</span> <span class="n">ironmanSays</span> <span class="o">=</span> <span class="err">β€œ</span><span class="n">Doth</span> <span class="n">mother</span> <span class="n">know</span> <span class="n">you</span> <span class="n">weareth</span> <span class="n">her</span> <span class="n">drapes</span><span class="o">?</span><span class="err">”</span><span class="o">;</span> </span></span><span class="line"><span class="cl"> <span class="n">String</span> <span class="n">blackWidowSays</span> <span class="o">=</span> <span class="err">β€œ</span><span class="n">Hey</span><span class="o">,</span> <span class="n">fellas</span><span class="o">.</span> <span class="n">Either</span> <span class="n">one</span> <span class="n">of</span> <span class="n">you</span> <span class="n">know</span> <span class="n">where</span> <span class="n">the</span> <span class="n">Smithsonian</span> <span class="n">is</span><span class="o">?</span> <span class="n">I</span><span class="err">’</span><span class="n">m</span> <span class="n">here</span> <span class="n">to</span> <span class="n">pick</span> <span class="n">up</span> <span class="n">a</span> <span class="n">fossil</span><span class="o">.</span><span class="err">”</span><span class="o">;</span> </span></span><span class="line"><span class="cl"> <span class="n">String</span> <span class="n">wandaMaximoffSays</span> <span class="o">=</span> <span class="err">β€œ</span><span class="n">You</span> <span class="n">Guys</span> <span class="n">Know</span> <span class="n">I</span> <span class="n">Can</span> <span class="n">Move</span> <span class="n">Things</span> <span class="n">With</span> <span class="n">My</span> <span class="n">Mind</span><span class="o">,</span> <span class="n">Right</span><span class="o">?</span><span class="err">”</span><span class="o">;</span> </span></span><span class="line"><span class="cl"> <span class="n">String</span> <span class="n">gamoraSays</span> <span class="o">=</span> <span class="err">β€œ</span><span class="n">I</span> <span class="n">Am</span> <span class="n">Going</span> <span class="n">To</span> <span class="n">Die</span> <span class="n">Surrounded</span> <span class="n">By</span> <span class="n">The</span> <span class="n">Biggest</span> <span class="n">Idiots</span> <span class="n">In</span> <span class="n">The</span> <span class="n">Galaxy</span><span class="o">.</span><span class="err">”</span><span class="o">;</span> </span></span><span class="line"><span class="cl"> <span class="n">String</span> <span class="n">nickFurySays</span> <span class="o">=</span> <span class="err">β€œ</span><span class="n">Sir</span><span class="o">,</span> <span class="n">I</span><span class="err">’</span><span class="n">m</span> <span class="n">Gonna</span> <span class="n">Have</span> <span class="n">To</span> <span class="n">Ask</span> <span class="n">You</span> <span class="n">To</span> <span class="n">Exit</span> <span class="n">The</span> <span class="n">Donut</span><span class="err">”</span><span class="o">;</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="c1">// Serendipity, 248 Seven Mile Beach Rd, Broken Head NSW 2481, Australia </span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="n">Address</span> <span class="n">thorsAddress</span> <span class="o">=</span> <span class="n">Address</span><span class="o">.</span><span class="na">of</span><span class="o">(</span><span class="s">"248"</span><span class="o">,</span> <span class="s">"Seven Mile Beach Rd"</span><span class="o">,</span> <span class="s">"Broken Head"</span><span class="o">,</span> <span class="s">"NSW"</span><span class="o">,</span> <span class="s">"2481"</span><span class="o">,</span> <span class="s">"Australia"</span><span class="o">);</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="c1">// 11 Commerce Dr, Riverhead, NY 11901 </span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="n">Address</span> <span class="n">ironmansAddress</span> <span class="o">=</span> <span class="n">Address</span><span class="o">.</span><span class="na">of</span><span class="o">(</span><span class="s">"11"</span><span class="o">,</span> <span class="s">"Commerce Dr"</span><span class="o">,</span> <span class="s">"Riverhead"</span><span class="o">,</span> <span class="s">"NY"</span><span class="o">,</span> <span class="s">"11901"</span><span class="o">,</span> <span class="s">"US"</span><span class="o">);</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="c1">// 605 W 48th St, New York, NY 10019 </span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="n">Address</span> <span class="n">blackWidowAddress</span> <span class="o">=</span> <span class="n">Address</span><span class="o">.</span><span class="na">of</span><span class="o">(</span><span class="s">"605"</span><span class="o">,</span> <span class="s">"48th St"</span><span class="o">,</span> <span class="s">"New York"</span><span class="o">,</span> <span class="s">"NY"</span><span class="o">,</span> <span class="s">"10019"</span><span class="o">,</span> <span class="s">"US"</span><span class="o">);</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="c1">// 20 W 34th St, New York, NY 10001 </span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="n">Address</span> <span class="n">wandaMaximoffsAddress</span> <span class="o">=</span> <span class="n">Address</span><span class="o">.</span><span class="na">of</span><span class="o">(</span><span class="s">"20"</span><span class="o">,</span> <span class="s">"W 34th St"</span><span class="o">,</span> <span class="s">"New York"</span><span class="o">,</span> <span class="s">"NY"</span><span class="o">,</span> <span class="s">"10001"</span><span class="o">,</span> <span class="s">"US"</span><span class="o">);</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="c1">// 107 S Beverly Glen Blvd, Los Angeles, CA 90024 </span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="n">Address</span> <span class="n">gamorasAddress</span> <span class="o">=</span> <span class="n">Address</span><span class="o">.</span><span class="na">of</span><span class="o">(</span><span class="s">"107"</span><span class="o">,</span> <span class="s">"S Beverly Glen Blvd"</span><span class="o">,</span> <span class="s">"Los Angeles"</span><span class="o">,</span> <span class="s">"CA"</span><span class="o">,</span> <span class="s">"90024"</span><span class="o">,</span> <span class="s">"US"</span><span class="o">);</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="c1">// 11461 Sunset Blvd, Los Angeles, CA 90049 </span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="n">Address</span> <span class="n">nickFuryAddress</span> <span class="o">=</span> <span class="n">Address</span><span class="o">.</span><span class="na">of</span><span class="o">(</span><span class="s">"11461"</span><span class="o">,</span> <span class="s">"Sunset Blvd"</span><span class="o">,</span> <span class="s">"Los Angeles"</span><span class="o">,</span> <span class="s">"CA"</span><span class="o">,</span> <span class="s">"90049"</span><span class="o">,</span> <span class="s">"US"</span><span class="o">);</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="n">Person</span> <span class="n">thor</span> <span class="o">=</span> <span class="n">Person</span><span class="o">.</span><span class="na">of</span><span class="o">(</span><span class="s">"Chris"</span><span class="o">,</span> <span class="s">"Hemsworth"</span><span class="o">,</span> <span class="mi">38</span><span class="o">,</span> <span class="n">thorSays</span><span class="o">,</span> <span class="k">new</span> <span class="n">Point</span><span class="o">(</span><span class="mf">153.616667</span><span class="o">,</span> <span class="o">-</span><span class="mf">28.716667</span><span class="o">),</span> <span class="n">thorsAddress</span><span class="o">,</span> <span class="n">Set</span><span class="o">.</span><span class="na">of</span><span class="o">(</span><span class="s">"hammer"</span><span class="o">,</span> <span class="s">"biceps"</span><span class="o">,</span> <span class="s">"hair"</span><span class="o">,</span> <span class="s">"heart"</span><span class="o">));</span> </span></span><span class="line"><span class="cl"> <span class="n">Person</span> <span class="n">ironman</span> <span class="o">=</span> <span class="n">Person</span><span class="o">.</span><span class="na">of</span><span class="o">(</span><span class="s">"Robert"</span><span class="o">,</span> <span class="s">"Downey"</span><span class="o">,</span> <span class="mi">56</span><span class="o">,</span> <span class="n">ironmanSays</span><span class="o">,</span> <span class="k">new</span> <span class="n">Point</span><span class="o">(</span><span class="mf">40.9190747</span><span class="o">,</span> <span class="o">-</span><span class="mf">72.5371874</span><span class="o">),</span> <span class="n">ironmansAddress</span><span class="o">,</span> <span class="n">Set</span><span class="o">.</span><span class="na">of</span><span class="o">(</span><span class="s">"tech"</span><span class="o">,</span> <span class="s">"money"</span><span class="o">,</span> <span class="s">"one-liners"</span><span class="o">,</span> <span class="s">"intelligence"</span><span class="o">,</span> <span class="s">"resources"</span><span class="o">));</span> </span></span><span class="line"><span class="cl"> <span class="n">Person</span> <span class="n">blackWidow</span> <span class="o">=</span> <span class="n">Person</span><span class="o">.</span><span class="na">of</span><span class="o">(</span><span class="s">"Scarlett"</span><span class="o">,</span> <span class="s">"Johansson"</span><span class="o">,</span> <span class="mi">37</span><span class="o">,</span> <span class="n">blackWidowSays</span><span class="o">,</span> <span class="k">new</span> <span class="n">Point</span><span class="o">(</span><span class="mf">40.7215259</span><span class="o">,</span> <span class="o">-</span><span class="mf">74.0129994</span><span class="o">),</span> <span class="n">blackWidowAddress</span><span class="o">,</span> <span class="n">Set</span><span class="o">.</span><span class="na">of</span><span class="o">(</span><span class="s">"deception"</span><span class="o">,</span> <span class="s">"martial_arts"</span><span class="o">));</span> </span></span><span class="line"><span class="cl"> <span class="n">Person</span> <span class="n">wandaMaximoff</span> <span class="o">=</span> <span class="n">Person</span><span class="o">.</span><span class="na">of</span><span class="o">(</span><span class="s">"Elizabeth"</span><span class="o">,</span> <span class="s">"Olsen"</span><span class="o">,</span> <span class="mi">32</span><span class="o">,</span> <span class="n">wandaMaximoffSays</span><span class="o">,</span> <span class="k">new</span> <span class="n">Point</span><span class="o">(</span><span class="mf">40.6976701</span><span class="o">,</span> <span class="o">-</span><span class="mf">74.2598641</span><span class="o">),</span> <span class="n">wandaMaximoffsAddress</span><span class="o">,</span> <span class="n">Set</span><span class="o">.</span><span class="na">of</span><span class="o">(</span><span class="s">"magic"</span><span class="o">,</span> <span class="s">"loyalty"</span><span class="o">));</span> </span></span><span class="line"><span class="cl"> <span class="n">Person</span> <span class="n">gamora</span> <span class="o">=</span> <span class="n">Person</span><span class="o">.</span><span class="na">of</span><span class="o">(</span><span class="s">"Zoe"</span><span class="o">,</span> <span class="s">"Saldana"</span><span class="o">,</span> <span class="mi">43</span><span class="o">,</span> <span class="n">gamoraSays</span><span class="o">,</span> <span class="k">new</span> <span class="n">Point</span><span class="o">(-</span><span class="mf">118.399968</span><span class="o">,</span> <span class="mf">34.073087</span><span class="o">),</span> <span class="n">gamorasAddress</span><span class="o">,</span> <span class="n">Set</span><span class="o">.</span><span class="na">of</span><span class="o">(</span><span class="s">"skills"</span><span class="o">,</span> <span class="s">"martial_arts"</span><span class="o">));</span> </span></span><span class="line"><span class="cl"> <span class="n">Person</span> <span class="n">nickFury</span> <span class="o">=</span> <span class="n">Person</span><span class="o">.</span><span class="na">of</span><span class="o">(</span><span class="s">"Samuel L."</span><span class="o">,</span> <span class="s">"Jackson"</span><span class="o">,</span> <span class="mi">73</span><span class="o">,</span> <span class="n">nickFurySays</span><span class="o">,</span> <span class="k">new</span> <span class="n">Point</span><span class="o">(-</span><span class="mf">118.4345534</span><span class="o">,</span> <span class="mf">34.082615</span><span class="o">),</span> <span class="n">nickFuryAddress</span><span class="o">,</span> <span class="n">Set</span><span class="o">.</span><span class="na">of</span><span class="o">(</span><span class="s">"planning"</span><span class="o">,</span> <span class="s">"deception"</span><span class="o">,</span> <span class="s">"resources"</span><span class="o">));</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="n">repo</span><span class="o">.</span><span class="na">saveAll</span><span class="o">(</span><span class="n">List</span><span class="o">.</span><span class="na">of</span><span class="o">(</span><span class="n">thor</span><span class="o">,</span> <span class="n">ironman</span><span class="o">,</span> <span class="n">blackWidow</span><span class="o">,</span> <span class="n">wandaMaximoff</span><span class="o">,</span> <span class="n">gamora</span><span class="o">,</span> <span class="n">nickFury</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> We have 6 People in the database now; since we’re using the devtools in Spring, the app should have reloaded, and the database reseeded with new data. Press enter the key pattern input box in Redis Insight to refresh the view. Notice that we used the repository’s <code> saveAll </code> to save several objects in bulk. </p> <p> <img alt="Redis Insight" src="./images/006_stack_spring.png" title="Redis Insight"/> </p> <h2 id="web-service-endpoints"> Web Service Endpoints </h2> <p> Before we beef up the repository with more interesting queries, let’s create a controller so that we can test our queries using the Swagger UI: </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">com.redis.om.skeleton.controllers</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">com.redis.om.skeleton.models.Person</span><span class="o">;</span> </span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">com.redis.om.skeleton.models.repositories.PeopleRepository</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">org.springframework.beans.factory.annotation.Autowired</span><span class="o">;</span> </span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">org.springframework.web.bind.annotation.GetMapping</span><span class="o">;</span> </span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">org.springframework.web.bind.annotation.RequestMapping</span><span class="o">;</span> </span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">org.springframework.web.bind.annotation.RestController</span><span class="o">;</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="nd">@RestController</span> </span></span><span class="line"><span class="cl"><span class="nd">@RequestMapping</span><span class="o">(</span><span class="s">"/api/v1/people"</span><span class="o">)</span> </span></span><span class="line"><span class="cl"><span class="kd">public</span> <span class="kd">class</span> <span class="nc">PeopleControllerV1</span> <span class="o">{</span> </span></span><span class="line"><span class="cl"> <span class="nd">@Autowired</span> </span></span><span class="line"><span class="cl"> <span class="n">PeopleRepository</span> <span class="n">repo</span><span class="o">;</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="nd">@GetMapping</span><span class="o">(</span><span class="s">"all"</span><span class="o">)</span> </span></span><span class="line"><span class="cl"> <span class="n">Iterable</span><span class="o">&lt;</span><span class="n">Person</span><span class="o">&gt;</span> <span class="nf">all</span><span class="o">()</span> <span class="o">{</span> </span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">repo</span><span class="o">.</span><span class="na">findAll</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> In this controller, we inject a repository and use one of the CRUD methods, <code> findAll() </code> , to return all the <code> Person </code> documents in the database. </p> <p> If we navigate to http://localhost:8080/swagger-ui/ you should see the Swagger UI: </p> <p> <img alt="SwaggerUI" src="./images/007_stack_spring.png" title="SwaggerUI"/> </p> <p> We can see the <code> /all </code> method from our people-controller-v-1, expanding that you should see: </p> <p> <img alt="SwaggerUI" src="./images/008_stack_spring.png" title="SwaggerUI"/> </p> <p> And if you select β€œTry it out” and then β€œExecute,” you should see the resulting JSON array containing all People documents in the database: </p> <p> <img alt="SwaggerUI" src="./images/009_stack_spring.png" title="SwaggerUI"/> </p> <p> Let’s also add the ability to retrieve a Person by its id by using the repo’s findById method: </p> <div class="highlight"> <pre class="chroma"><code class="language-java" data-lang="java"><span class="line"><span class="cl"><span class="nd">@GetMapping</span><span class="o">(</span><span class="s">"{id}"</span><span class="o">)</span> </span></span><span class="line"><span class="cl"><span class="n">Optional</span><span class="o">&lt;</span><span class="n">Person</span><span class="o">&gt;</span> <span class="nf">byId</span><span class="o">(</span><span class="nd">@PathVariable</span> <span class="n">String</span> <span class="n">id</span><span class="o">)</span> <span class="o">{</span> </span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">repo</span><span class="o">.</span><span class="na">findById</span><span class="o">(</span><span class="n">id</span><span class="o">);</span> </span></span><span class="line"><span class="cl"><span class="o">}</span></span></span></code></pre> </div> <p> Refreshing the Swagger UI, we should see the newly added endpoint. We can grab an id using the <a href="/docs/latest/commands/srandmember/"> <code> SRANDMEMBER </code> </a> command on the Redis Insight CLI like this: </p> <div class="highlight"> <pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">SRANDMEMBER com.redis.om.skeleton.models.Person</span></span></code></pre> </div> <p> Plugging the resulting ID in the Swagger UI, we can get the corresponding JSON document: </p> <p> <img alt="SwaggerUI" src="./images/010_stack_spring.png" title="SwaggerUI"/> </p> <h2 id="custom-repository-finders"> Custom Repository Finders </h2> <p> Now that we tested quite a bit of the CRUD functionality, let's add some custom finders to our repository. We’ll start with a finder over a numeric range, on the <code> age </code> property of <code> Person </code> : </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">interface</span> <span class="nc">PeopleRepository</span> <span class="kd">extends</span> <span class="n">RedisDocumentRepository</span><span class="o">&lt;</span><span class="n">Person</span><span class="o">,</span><span class="n">String</span><span class="o">&gt;</span> <span class="o">{</span> </span></span><span class="line"><span class="cl"> <span class="c1">// Find people by age range </span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="n">Iterable</span><span class="o">&lt;</span><span class="n">Person</span><span class="o">&gt;</span> <span class="nf">findByAgeBetween</span><span class="o">(</span><span class="kt">int</span> <span class="n">minAge</span><span class="o">,</span> <span class="kt">int</span> <span class="n">maxAge</span><span class="o">);</span> </span></span><span class="line"><span class="cl"><span class="o">}</span></span></span></code></pre> </div> <p> At runtime, the repository method <code> findByAgeBetween </code> is fulfilled by the framework, so all you need to do is declare it, and Redis OM Spring will handle the querying and mapping of the results. The property or properties to be used are picked after the key phrase "findBy". The "Between" keyword is the predicate that tells the query builder what operation to use. </p> <p> To test it on the Swagger UI, let’s add a corresponding method to the controller: </p> <div class="highlight"> <pre class="chroma"><code class="language-java" data-lang="java"><span class="line"><span class="cl"><span class="nd">@GetMapping</span><span class="o">(</span><span class="s">"age_between"</span><span class="o">)</span> </span></span><span class="line"><span class="cl"><span class="n">Iterable</span><span class="o">&lt;</span><span class="n">Person</span><span class="o">&gt;</span> <span class="nf">byAgeBetween</span><span class="o">(</span> <span class="c1">// </span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="nd">@RequestParam</span><span class="o">(</span><span class="s">"min"</span><span class="o">)</span> <span class="kt">int</span> <span class="n">min</span><span class="o">,</span> <span class="c1">// </span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="nd">@RequestParam</span><span class="o">(</span><span class="s">"max"</span><span class="o">)</span> <span class="kt">int</span> <span class="n">max</span><span class="o">)</span> <span class="o">{</span> </span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">repo</span><span class="o">.</span><span class="na">findByAgeBetween</span><span class="o">(</span><span class="n">min</span><span class="o">,</span> <span class="n">max</span><span class="o">);</span> </span></span><span class="line"><span class="cl"><span class="o">}</span></span></span></code></pre> </div> <p> Refreshing the UI, we can see the new endpoint. Let’s try it with some data: </p> <p> <img alt="SwaggerUI" src="./images/011_stack_spring.png" title="SwaggerUI"/> </p> <p> Invoke the endpoint with the value <code> 30 </code> for <code> min </code> and <code> 37 </code> for <code> max </code> we get two hits; β€œScarlett Johansson” and β€œElizabeth Olsen” are the only two people with ages between 30 and 37. </p> <p> <img alt="SwaggerUI" src="./images/012_stack_spring.png" title="SwaggerUI"/> </p> <p> If we look at the Redis Insight Profiler, we can see the resulting query, which is a range query on the index numeric field <code> age </code> : </p> <p> <img alt="Redis Insight" src="./images/013_stack_spring.png" title="Redis Insight Profiler"/> </p> <p> We can also create query methods with more than one property. For example, if we wanted to do a query by first and last names, we would declare a repository method like: </p> <div class="highlight"> <pre class="chroma"><code class="language-java" data-lang="java"><span class="line"><span class="cl"><span class="c1">// Find people by their first and last name </span></span></span><span class="line"><span class="cl"><span class="c1"></span><span class="n">Iterable</span><span class="o">&lt;</span><span class="n">Person</span><span class="o">&gt;</span> <span class="nf">findByFirstNameAndLastName</span><span class="o">(</span><span class="n">String</span> <span class="n">firstName</span><span class="o">,</span> <span class="n">String</span> <span class="n">lastName</span><span class="o">);</span></span></span></code></pre> </div> <p> Let’s add a corresponding controller method: </p> <div class="highlight"> <pre class="chroma"><code class="language-java" data-lang="java"><span class="line"><span class="cl"><span class="nd">@GetMapping</span><span class="o">(</span><span class="s">"name"</span><span class="o">)</span> </span></span><span class="line"><span class="cl"><span class="n">Iterable</span><span class="o">&lt;</span><span class="n">Person</span><span class="o">&gt;</span> <span class="nf">byFirstNameAndLastName</span><span class="o">(</span><span class="nd">@RequestParam</span><span class="o">(</span><span class="s">"first"</span><span class="o">)</span> <span class="n">String</span> <span class="n">firstName</span><span class="o">,</span> <span class="c1">// </span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="nd">@RequestParam</span><span class="o">(</span><span class="s">"last"</span><span class="o">)</span> <span class="n">String</span> <span class="n">lastName</span><span class="o">)</span> <span class="o">{</span> </span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">repo</span><span class="o">.</span><span class="na">findByFirstNameAndLastName</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> <p> Once again, we can refresh the swagger UI and test the newly created endpoint: </p> <p> <img alt="SwaggerUI" src="./images/014_stack_spring.png" title="SwaggerUI"/> </p> <p> Executing the request with the first name <code> Robert </code> and last name <code> Downey </code> , we get: </p> <p> <img alt="SwaggerUI" src="./images/015_stack_spring.png" title="SwaggerUI"/> </p> <p> And the resulting query on Redis Insight: </p> <p> <img alt="Redis Insight" src="./images/016_stack_spring.png" title="Redis Insight Profiler"/> </p> <p> Now let’s try a Geospatial query. The <code> homeLoc </code> property is a Geo Point, and by using the β€œNear” predicate in our method declaration, we can get a finder that takes a point and a radius around that point to search: </p> <div class="highlight"> <pre class="chroma"><code class="language-java" data-lang="java"><span class="line"><span class="cl"><span class="c1">// Draws a circular geofilter around a spot and returns all people in that </span></span></span><span class="line"><span class="cl"><span class="c1">// radius </span></span></span><span class="line"><span class="cl"><span class="c1"></span><span class="n">Iterable</span><span class="o">&lt;</span><span class="n">Person</span><span class="o">&gt;</span> <span class="nf">findByHomeLocNear</span><span class="o">(</span><span class="n">Point</span> <span class="n">point</span><span class="o">,</span> <span class="n">Distance</span> <span class="n">distance</span><span class="o">);</span> </span></span><span class="line"><span class="cl"><span class="n">And</span> <span class="n">the</span> <span class="n">corresponding</span> <span class="n">controller</span> <span class="n">method</span><span class="o">:</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="nd">@GetMapping</span><span class="o">(</span><span class="s">"homeloc"</span><span class="o">)</span> </span></span><span class="line"><span class="cl"><span class="n">Iterable</span><span class="o">&lt;</span><span class="n">Person</span><span class="o">&gt;</span> <span class="nf">byHomeLoc</span><span class="o">(</span><span class="c1">// </span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="nd">@RequestParam</span><span class="o">(</span><span class="s">"lat"</span><span class="o">)</span> <span class="kt">double</span> <span class="n">lat</span><span class="o">,</span> <span class="c1">// </span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="nd">@RequestParam</span><span class="o">(</span><span class="s">"lon"</span><span class="o">)</span> <span class="kt">double</span> <span class="n">lon</span><span class="o">,</span> <span class="c1">// </span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="nd">@RequestParam</span><span class="o">(</span><span class="s">"d"</span><span class="o">)</span> <span class="kt">double</span> <span class="n">distance</span><span class="o">)</span> <span class="o">{</span> </span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">repo</span><span class="o">.</span><span class="na">findByHomeLocNear</span><span class="o">(</span><span class="k">new</span> <span class="n">Point</span><span class="o">(</span><span class="n">lon</span><span class="o">,</span> <span class="n">lat</span><span class="o">),</span> <span class="k">new</span> <span class="n">Distance</span><span class="o">(</span><span class="n">distance</span><span class="o">,</span> <span class="n">Metrics</span><span class="o">.</span><span class="na">MILES</span><span class="o">));</span> </span></span><span class="line"><span class="cl"><span class="o">}</span></span></span></code></pre> </div> <p> Refreshing the Swagger US, we should now see the <code> byHomeLoc </code> endpoint. Let’s see which of the Avengers live within 10 miles of Suffolk Park Pub in South Wales, Australia... hmmm. </p> <p> <img alt="SwaggerUI" src="./images/017_stack_spring.png" title="SwaggerUI"/> </p> <p> Executing the request, we get the record for Chris Hemsworth: </p> <p> <img alt="SwaggerUI" src="./images/018_stack_spring.png" title="SwaggerUI"/> </p> <p> and in Redis Insight we can see the backing query: </p> <p> <img alt="Redis Insight" src="./images/019_stack_spring.png" title="Redis Insight Profiler"/> </p> <p> Let’s try a full-text search query against the <code> personalStatement </code> property. To do so, we prefix our query method with the word <code> search </code> as shown below: </p> <div class="highlight"> <pre class="chroma"><code class="language-java" data-lang="java"><span class="line"><span class="cl"><span class="c1">// Performs full-text search on a person’s personal Statement </span></span></span><span class="line"><span class="cl"><span class="c1"></span><span class="n">Iterable</span><span class="o">&lt;</span><span class="n">Person</span><span class="o">&gt;</span> <span class="nf">searchByPersonalStatement</span><span class="o">(</span><span class="n">String</span> <span class="n">text</span><span class="o">);</span></span></span></code></pre> </div> <p> And the corresponding controller method: </p> <div class="highlight"> <pre class="chroma"><code class="language-java" data-lang="java"><span class="line"><span class="cl"><span class="nd">@GetMapping</span><span class="o">(</span><span class="s">"statement"</span><span class="o">)</span> </span></span><span class="line"><span class="cl"><span class="n">Iterable</span><span class="o">&lt;</span><span class="n">Person</span><span class="o">&gt;</span> <span class="nf">byPersonalStatement</span><span class="o">(</span><span class="nd">@RequestParam</span><span class="o">(</span><span class="s">"q"</span><span class="o">)</span> <span class="n">String</span> <span class="n">q</span><span class="o">)</span> <span class="o">{</span> </span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">repo</span><span class="o">.</span><span class="na">searchByPersonalStatement</span><span class="o">(</span><span class="n">q</span><span class="o">);</span> </span></span><span class="line"><span class="cl"><span class="o">}</span></span></span></code></pre> </div> <p> Once again, we can try it on the Swagger UI with the text β€œmother”: </p> <p> <img alt="SwaggerUI" src="./images/020_stack_spring.png" title="SwaggerUI"/> </p> <p> Which results in a single hit, the record for Robert Downey Jr.: </p> <p> <img alt="SwaggerUI" src="./images/021_stack_spring.png" title="SwaggerUI"/> </p> <p> Notice that you can pass a query string like β€œmoth*” with wildcards if needed </p> <p> <img alt="SwaggerUI" src="./images/022_stack_spring.png" title="SwaggerUI"/> </p> <h3 id="nested-object-searches"> Nested object searches </h3> <p> You’ve noticed that the <code> address </code> object in <code> Person </code> is mapped as a JSON object. If we want to search by address fields, we use an underscore to access the nested fields. For example, if we wanted to find a Person by their city, the method signature would be: </p> <div class="highlight"> <pre class="chroma"><code class="language-java" data-lang="java"><span class="line"><span class="cl"><span class="c1">// Performing a tag search on city </span></span></span><span class="line"><span class="cl"><span class="c1"></span><span class="n">Iterable</span><span class="o">&lt;</span><span class="n">Person</span><span class="o">&gt;</span> <span class="nf">findByAddress_City</span><span class="o">(</span><span class="n">String</span> <span class="n">city</span><span class="o">);</span></span></span></code></pre> </div> <p> Let’s add the matching controller method so that we can test it: </p> <div class="highlight"> <pre class="chroma"><code class="language-java" data-lang="java"><span class="line"><span class="cl"><span class="nd">@GetMapping</span><span class="o">(</span><span class="s">"city"</span><span class="o">)</span> </span></span><span class="line"><span class="cl"><span class="n">Iterable</span><span class="o">&lt;</span><span class="n">Person</span><span class="o">&gt;</span> <span class="nf">byCity</span><span class="o">(</span><span class="nd">@RequestParam</span><span class="o">(</span><span class="s">"city"</span><span class="o">)</span> <span class="n">String</span> <span class="n">city</span><span class="o">)</span> <span class="o">{</span> </span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">repo</span><span class="o">.</span><span class="na">findByAddress_City</span><span class="o">(</span><span class="n">city</span><span class="o">);</span> </span></span><span class="line"><span class="cl"><span class="o">}</span></span></span></code></pre> </div> <p> Let’s test the byCity endpoint: </p> <p> <img alt="SwaggerUI" src="./images/023_stack_spring.png" title="SwaggerUI"/> </p> <p> As expected, we should get two hits; Scarlett Johansson and Elizabeth Olsen, both with addresses in Nee York: </p> <p> <img alt="SwaggerUI" src="./images/024_stack_spring.png" title="SwaggerUI"/> </p> <p> The skills set is indexed as tag search. To find a Person with any of the skills in a provided list, we can add a repository method like: </p> <div class="highlight"> <pre class="chroma"><code class="language-java" data-lang="java"><span class="line"><span class="cl"><span class="c1">// Search Persons that have one of multiple skills (OR condition) </span></span></span><span class="line"><span class="cl"><span class="c1"></span><span class="n">Iterable</span><span class="o">&lt;</span><span class="n">Person</span><span class="o">&gt;</span> <span class="nf">findBySkills</span><span class="o">(</span><span class="n">Set</span><span class="o">&lt;</span><span class="n">String</span><span class="o">&gt;</span> <span class="n">skills</span><span class="o">);</span></span></span></code></pre> </div> <p> And the corresponding controller method: </p> <div class="highlight"> <pre class="chroma"><code class="language-java" data-lang="java"><span class="line"><span class="cl"><span class="nd">@GetMapping</span><span class="o">(</span><span class="s">"skills"</span><span class="o">)</span> </span></span><span class="line"><span class="cl"><span class="n">Iterable</span><span class="o">&lt;</span><span class="n">Person</span><span class="o">&gt;</span> <span class="nf">byAnySkills</span><span class="o">(</span><span class="nd">@RequestParam</span><span class="o">(</span><span class="s">"skills"</span><span class="o">)</span> <span class="n">Set</span><span class="o">&lt;</span><span class="n">String</span><span class="o">&gt;</span> <span class="n">skills</span><span class="o">)</span> <span class="o">{</span> </span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">repo</span><span class="o">.</span><span class="na">findBySkills</span><span class="o">(</span><span class="n">skills</span><span class="o">);</span> </span></span><span class="line"><span class="cl"><span class="o">}</span></span></span></code></pre> </div> <p> Let's test the endpoint with the value "deception": </p> <p> <img alt="SwaggerUI" src="./images/025_stack_spring.png" title="SwaggerUI"/> </p> <p> The search returns the records for Scarlett Johansson and Samuel L. Jackson: </p> <p> <img alt="SwaggerUI" src="./images/026_stack_spring.png" title="SwaggerUI"/> </p> <p> We can see the backing query using a tag search: </p> <p> <img alt="Redis Insight" src="./images/027_stack_spring.png" title="Redis Insight Profiler"/> </p> <h2 id="fluid-searching-with-entity-streams"> Fluid Searching with Entity Streams </h2> <p> Redis OM Spring Entity Streams provides a Java 8 Streams interface to Query Redis JSON documents using Redis Stack. Entity Streams allow you to process data in a typesafe declarative way similar to SQL statements. Streams can be used to express a query as a chain of operations. </p> <p> Entity Streams in Redis OM Spring provide the same semantics as Java 8 streams. Streams can be made of Redis Mapped entities ( <code> @Document </code> ) or one or more properties of an Entity. Entity Streams progressively build the query until a terminal operation is invoked (such as <code> collect </code> ). Whenever a Terminal operation is applied to a Stream, the Stream cannot accept additional operations to its pipeline, which means that the Stream is started. </p> <p> Let’s start with a simple example, a Spring <code> @Service </code> which includes <code> EntityStream </code> to query for instances of the mapped class <code> Person </code> : </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">com.redis.om.skeleton.services</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.stream.Collectors</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">org.springframework.beans.factory.annotation.Autowired</span><span class="o">;</span> </span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">org.springframework.stereotype.Service</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">com.redis.om.skeleton.models.Person</span><span class="o">;</span> </span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">com.redis.om.skeleton.models.Person</span><span class="n">$</span><span class="o">;</span> </span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">com.redis.om.spring.search.stream.EntityStream</span><span class="o">;</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="nd">@Service</span> </span></span><span class="line"><span class="cl"><span class="kd">public</span> <span class="kd">class</span> <span class="nc">PeopleService</span> <span class="o">{</span> </span></span><span class="line"><span class="cl"> <span class="nd">@Autowired</span> </span></span><span class="line"><span class="cl"> <span class="n">EntityStream</span> <span class="n">entityStream</span><span class="o">;</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="c1">// Find all people </span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="kd">public</span> <span class="n">Iterable</span><span class="o">&lt;</span><span class="n">Person</span><span class="o">&gt;</span> <span class="nf">findAllPeople</span><span class="o">(</span><span class="kt">int</span> <span class="n">minAge</span><span class="o">,</span> <span class="kt">int</span> <span class="n">maxAge</span><span class="o">)</span> <span class="o">{</span> </span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">entityStream</span> <span class="c1">// </span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="o">.</span><span class="na">of</span><span class="o">(</span><span class="n">Person</span><span class="o">.</span><span class="na">class</span><span class="o">)</span> <span class="c1">// </span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="o">.</span><span class="na">collect</span><span class="o">(</span><span class="n">Collectors</span><span class="o">.</span><span class="na">toList</span><span class="o">());</span> </span></span><span class="line"><span class="cl"> <span class="o">}</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="o">}</span></span></span></code></pre> </div> <p> The <code> EntityStream </code> is injected into the <code> PeopleService </code> using <code> @Autowired </code> . We can then get a stream for <code> Person </code> objects by using <code> entityStream.of(Person.class) </code> . The stream represents the equivalent of a <code> SELECT * FROM Person </code> on a relational database. The call to <code> collect </code> will then execute the underlying query and return a collection of all <code> Person </code> objects in Redis. </p> <h3 id="entity-meta-model"> Entity Meta-model </h3> <p> You’re provided with a generated meta-model to produce more elaborate queries, a class with the same name as your model but ending with a dollar sign. In the example below, our entity model is <code> Person </code> ; therefore, we get a meta-model named <code> Person$ </code> . With the meta-model, you have access to the underlying search engine field operations. For example, we have an <code> age </code> property which is an integer. Therefore our meta-model has an <code> AGE </code> property with numeric operations we can use with the stream’s <code> filter </code> method such as <code> between </code> . </p> <div class="highlight"> <pre class="chroma"><code class="language-java" data-lang="java"><span class="line"><span class="cl"><span class="c1">// Find people by age range </span></span></span><span class="line"><span class="cl"><span class="c1"></span><span class="kd">public</span> <span class="n">Iterable</span><span class="o">&lt;</span><span class="n">Person</span><span class="o">&gt;</span> <span class="nf">findByAgeBetween</span><span class="o">(</span><span class="kt">int</span> <span class="n">minAge</span><span class="o">,</span> <span class="kt">int</span> <span class="n">maxAge</span><span class="o">)</span> <span class="o">{</span> </span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">entityStream</span> <span class="c1">// </span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="o">.</span><span class="na">of</span><span class="o">(</span><span class="n">Person</span><span class="o">.</span><span class="na">class</span><span class="o">)</span> <span class="c1">// </span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="o">.</span><span class="na">filter</span><span class="o">(</span><span class="n">Person$</span><span class="o">.</span><span class="na">AGE</span><span class="o">.</span><span class="na">between</span><span class="o">(</span><span class="n">minAge</span><span class="o">,</span> <span class="n">maxAge</span><span class="o">))</span> <span class="c1">// </span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="o">.</span><span class="na">sorted</span><span class="o">(</span><span class="n">Person$</span><span class="o">.</span><span class="na">AGE</span><span class="o">,</span> <span class="n">SortOrder</span><span class="o">.</span><span class="na">ASC</span><span class="o">)</span> <span class="c1">// </span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="o">.</span><span class="na">collect</span><span class="o">(</span><span class="n">Collectors</span><span class="o">.</span><span class="na">toList</span><span class="o">());</span> </span></span><span class="line"><span class="cl"><span class="o">}</span></span></span></code></pre> </div> <p> In this example, we also use the Streams <code> sorted </code> method to declare that our stream will be sorted by the <code> Person$.AGE </code> in <code> ASC </code> ending order. </p> <p> To "AND" property expressions we can chain multiple <code> .filter </code> statements. For example, to recreate the finder by first and last name we can use an Entity Stream in the following way: </p> <div class="highlight"> <pre class="chroma"><code class="language-java" data-lang="java"><span class="line"><span class="cl"><span class="c1">// Find people by their first and last name </span></span></span><span class="line"><span class="cl"><span class="c1"></span><span class="kd">public</span> <span class="n">Iterable</span><span class="o">&lt;</span><span class="n">Person</span><span class="o">&gt;</span> <span class="nf">findByFirstNameAndLastName</span><span class="o">(</span><span class="n">String</span> <span class="n">firstName</span><span class="o">,</span> <span class="n">String</span> <span class="n">lastName</span><span class="o">)</span> <span class="o">{</span> </span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">entityStream</span> <span class="c1">// </span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="o">.</span><span class="na">of</span><span class="o">(</span><span class="n">Person</span><span class="o">.</span><span class="na">class</span><span class="o">)</span> <span class="c1">// </span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="o">.</span><span class="na">filter</span><span class="o">(</span><span class="n">Person$</span><span class="o">.</span><span class="na">FIRST_NAME</span><span class="o">.</span><span class="na">eq</span><span class="o">(</span><span class="n">firstName</span><span class="o">))</span> <span class="c1">// </span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="o">.</span><span class="na">filter</span><span class="o">(</span><span class="n">Person$</span><span class="o">.</span><span class="na">LAST_NAME</span><span class="o">.</span><span class="na">eq</span><span class="o">(</span><span class="n">lastName</span><span class="o">))</span> <span class="c1">// </span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="o">.</span><span class="na">collect</span><span class="o">(</span><span class="n">Collectors</span><span class="o">.</span><span class="na">toList</span><span class="o">());</span> </span></span><span class="line"><span class="cl"><span class="o">}</span></span></span></code></pre> </div> <p> In this article, we explored how Redis OM Spring provides a couple of APIs to tap into the power of Redis Stack’s document database and search features from Spring Boot application. We’ll explore other Redis Stack features via Redis OM Spring in future articles </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-java/"/> <div class="flex flex-row justify-between"> <div class="grid justify-center"> <span class="font-mono"> RATE THIS PAGE </span> <div class="star-rating"> <input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/> <label class="star" for="5-stars"> β˜… </label> <input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/> <label class="star" for="4-stars"> β˜… </label> <input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/> <label class="star" for="3-stars"> β˜… </label> <input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/> <label class="star" for="2-stars"> β˜… </label> <input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/> <label class="star" for="1-stars"> β˜… </label> </div> </div> <a class="font-mono no-underline" href="#"> Back to top ↑ </a> </div> <div class="hidden" id="feedback-form"> <div class="grid gap-2"> <textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea> <button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit"> Submit </button> </div> </div> </form> <script> document.addEventListener("DOMContentLoaded", function() { const form = document.querySelector("#page-feedback"); form.addEventListener("submit", function(event) { event.preventDefault(); var xhr = new XMLHttpRequest(); var url = "\/docusight\/api\/rate"; var params = new URLSearchParams(new FormData(form)); xhr.open("POST", url, true); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.onreadystatechange = function() { if (xhr.readyState === 4 && xhr.status === 200) { const responseData = JSON.parse(xhr.responseText); const responseMessage = responseData.response; const newText = document.createTextNode(responseMessage); form.parentNode.replaceChild(newText, form); } }; xhr.send(params); }); }); </script> </section>
https://redis.io/docs/latest/integrate/redis-data-integration/reference/cli/redis-di-get-rejected/.html
<section class="prose w-full py-12"> <h1> redis-di get-rejected </h1> <p class="text-lg -mt-5 mb-10"> Returns all the stored rejected entries </p> <h2 id="usage"> Usage </h2> <pre tabindex="0"><code>Usage: redis-di get-rejected [OPTIONS] </code></pre> <h2 id="options"> Options </h2> <ul> <li> <p> <code> log_level </code> : </p> <ul> <li> Type: Choice(['DEBUG', 'INFO', 'WARN', 'ERROR', 'CRITICAL']) </li> <li> Default: <code> info </code> </li> <li> Usage: <code> --log-level -l </code> </li> </ul> </li> <li> <p> <code> 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 RDI Database </p> </li> <li> <p> <code> rdi_port </code> (REQUIRED): </p> <ul> <li> Type: &lt;IntRange 1&lt;=x&lt;=65535&gt; </li> <li> Default: <code> none </code> </li> <li> Usage: <code> --rdi-port </code> </li> </ul> <p> Port of RDI Database </p> </li> <li> <p> <code> rdi_user </code> : </p> <ul> <li> Type: STRING </li> <li> Default: <code> none </code> </li> <li> Usage: <code> --rdi-user </code> </li> </ul> <p> RDI Database Username </p> </li> <li> <p> <code> rdi_password </code> : </p> <ul> <li> Type: STRING </li> <li> Default: <code> none </code> </li> <li> Usage: <code> --rdi-password </code> </li> </ul> <p> RDI Database Password </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> rdi_key_password </code> : </p> <ul> <li> Type: STRING </li> <li> Default: <code> none </code> </li> <li> Usage: <code> --rdi-key-password </code> </li> </ul> <p> Password for unlocking an encrypted private key </p> </li> <li> <p> <code> max_records </code> : </p> <ul> <li> Type: <intrange x=""> =1&gt; </intrange> </li> <li> Default: <code> none </code> </li> <li> Usage: <code> --max-records </code> </li> </ul> <p> Maximum rejected records per DLQ </p> </li> <li> <p> <code> oldest </code> : </p> <ul> <li> Type: BOOL </li> <li> Default: <code> false </code> </li> <li> Usage: <code> --oldest -o </code> </li> </ul> <p> Displays the oldest rejected records. If omitted, most recent records will be retrieved </p> </li> <li> <p> <code> dlq_name </code> : </p> <ul> <li> Type: STRING </li> <li> Default: <code> none </code> </li> <li> Usage: <code> --dlq-name </code> </li> </ul> <p> Only prints the rejected records for the specified DLQ (Dead Letter Queue) name </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 get-rejected [OPTIONS] Returns all the stored rejected entries Options: -l, --log-level [DEBUG|INFO|WARN|ERROR|CRITICAL] [default: INFO] --rdi-host TEXT Host/IP of RDI Database [required] --rdi-port INTEGER RANGE Port of RDI Database [1&lt;=x&lt;=65535; required] --rdi-user TEXT RDI Database Username --rdi-password TEXT RDI Database Password --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 --rdi-key-password TEXT Password for unlocking an encrypted private key --max-records INTEGER RANGE Maximum rejected records per DLQ [x&gt;=1] -o, --oldest Displays the oldest rejected records. If omitted, most resent records will be retrieved --dlq-name TEXT Only prints the rejected records for the specified DLQ (Dead Letter Queue) name --help Show this message and exit. </code></pre> <form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback"> <input class="hidden" name="origin" value="https://redis.io/docs/latest/integrate/redis-data-integration/reference/cli/redis-di-get-rejected/"/> <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/.html
<section class="prose w-full py-12 max-w-none"> <h1> Redis Stack and modules release notes </h1> <p class="text-lg -mt-5 mb-10"> Redis Stack and modules release notes </p> <p> See the following release notes for new features, enhancements, and other changes to Redis Stack capabilities. </p> <table> <thead> <tr> <th style="text-align:left"> Release notes </th> <th style="text-align:left"> Description </th> </tr> </thead> <tbody> <tr> <td style="text-align:left"> <a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redisce/"> Redis Community Edition </a> </td> <td style="text-align:left"> Redis Community release notes for version 7.4 and later </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redisstack/"> Redis Stack </a> </td> <td style="text-align:left"> Redis Stack release notes for version 7.2 and later </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redisearch/"> RediSearch </a> </td> <td style="text-align:left"> RediSearch release notes for version 2.10 and earlier </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redisjson/"> RedisJSON </a> </td> <td style="text-align:left"> RedisJSON release notes for version 2.8 and earlier </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redisbloom/"> RedisBloom </a> </td> <td style="text-align:left"> RedisBloom release notes for version 2.8 and earlier </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redistimeseries/"> RedisTimeSeries </a> </td> <td style="text-align:left"> RedisTimeSeries release notes for version 1.12 and earlier </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redisgraph/"> RedisGraph </a> </td> <td style="text-align:left"> RedisGraph release notes for version 2.10 and earlier </td> </tr> <tr> <td style="text-align:left"> <a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redisgears/"> RedisGears </a> </td> <td style="text-align:left"> RedisGears release notes for version 1.2 and earlier </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/"/> <div class="flex flex-row justify-between"> <div class="grid justify-center"> <span class="font-mono"> RATE THIS PAGE </span> <div class="star-rating"> <input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/> <label class="star" for="5-stars"> β˜… </label> <input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/> <label class="star" for="4-stars"> β˜… </label> <input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/> <label class="star" for="3-stars"> β˜… </label> <input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/> <label class="star" for="2-stars"> β˜… </label> <input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/> <label class="star" for="1-stars"> β˜… </label> </div> </div> <a class="font-mono no-underline" href="#"> Back to top ↑ </a> </div> <div class="hidden" id="feedback-form"> <div class="grid gap-2"> <textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea> <button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit"> Submit </button> </div> </div> </form> <script> document.addEventListener("DOMContentLoaded", function() { const form = document.querySelector("#page-feedback"); form.addEventListener("submit", function(event) { event.preventDefault(); var xhr = new XMLHttpRequest(); var url = "\/docusight\/api\/rate"; var params = new URLSearchParams(new FormData(form)); xhr.open("POST", url, true); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.onreadystatechange = function() { if (xhr.readyState === 4 && xhr.status === 200) { const responseData = JSON.parse(xhr.responseText); const responseMessage = responseData.response; const newText = document.createTextNode(responseMessage); form.parentNode.replaceChild(newText, form); } }; xhr.send(params); }); }); </script> </section>
https://redis.io/docs/latest/operate/rc/changelog/june-2024/.html
<section class="prose w-full py-12 max-w-none"> <h1> Redis Cloud changelog (June 2024) </h1> <p class="text-lg -mt-5 mb-10"> New features, enhancements, and other changes added to Redis Cloud during June 2024. </p> <h2 id="enhancements"> Enhancements </h2> <h3 id="redis-cloud-essentials-support-for-terraform"> Redis Cloud Essentials support for Terraform </h3> <p> The <a href="/docs/latest/integrate/terraform-provider-for-redis-cloud/"> Redis Cloud Terraform provider </a> now supports provisioning Redis Cloud Essentials databases. It also supports Active-Active databases with advanced capabilities. </p> <p> See the <a href="https://github.com/RedisLabs/terraform-provider-rediscloud/blob/main/CHANGELOG.md"> Redis Cloud Terraform provider changelog </a> for full version content. </p> <p> See <a href="/docs/latest/integrate/terraform-provider-for-redis-cloud/get-started/"> Get started with Terraform </a> to learn how to install the Redis Cloud provider and create a subscription and 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/rc/changelog/june-2024/"/> <div class="flex flex-row justify-between"> <div class="grid justify-center"> <span class="font-mono"> RATE THIS PAGE </span> <div class="star-rating"> <input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/> <label class="star" for="5-stars"> β˜… </label> <input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/> <label class="star" for="4-stars"> β˜… </label> <input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/> <label class="star" for="3-stars"> β˜… </label> <input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/> <label class="star" for="2-stars"> β˜… </label> <input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/> <label class="star" for="1-stars"> β˜… </label> </div> </div> <a class="font-mono no-underline" href="#"> Back to top ↑ </a> </div> <div class="hidden" id="feedback-form"> <div class="grid gap-2"> <textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea> <button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit"> Submit </button> </div> </div> </form> <script> document.addEventListener("DOMContentLoaded", function() { const form = document.querySelector("#page-feedback"); form.addEventListener("submit", function(event) { event.preventDefault(); var xhr = new XMLHttpRequest(); var url = "\/docusight\/api\/rate"; var params = new URLSearchParams(new FormData(form)); xhr.open("POST", url, true); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.onreadystatechange = function() { if (xhr.readyState === 4 && xhr.status === 200) { const responseData = JSON.parse(xhr.responseText); const responseMessage = responseData.response; const newText = document.createTextNode(responseMessage); form.parentNode.replaceChild(newText, form); } }; xhr.send(params); }); }); </script> </section>
https://redis.io/docs/latest/operate/rs/references/cli-utilities/rladmin/status/.html
<section class="prose w-full py-12 max-w-none"> <h1> rladmin status </h1> <p class="text-lg -mt-5 mb-10"> Displays the current cluster status and topology information. </p> <p> Displays the current cluster status and topology information. </p> <h2 id="status"> <code> status </code> </h2> <p> Displays the current status of all nodes, databases, database endpoints, and shards on the cluster. </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">rladmin status </span></span><span class="line"><span class="cl"> <span class="o">[</span> extra &lt;parameter&gt; <span class="o">]</span> </span></span><span class="line"><span class="cl"> <span class="o">[</span> issues_only<span class="o">]</span> </span></span></code></pre> </div> <h3 id="parameters"> Parameters </h3> <table> <thead> <tr> <th> Parameter </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> extra &lt;parameter&gt; </td> <td> Extra options that show more information </td> </tr> <tr> <td> issues_only </td> <td> Filters out all items that have an <code> OK </code> status </td> </tr> </tbody> </table> <table> <thead> <tr> <th> Extra parameter </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> extra all </td> <td> Shows all <code> extra </code> information </td> </tr> <tr> <td> extra backups </td> <td> Shows periodic backup status </td> </tr> <tr> <td> extra frag </td> <td> Shows fragmented memory available after the restart </td> </tr> <tr> <td> extra nodestats </td> <td> Shows shards per node </td> </tr> <tr> <td> extra rack_id </td> <td> Shows <code> rack_id </code> if customer is not <code> rack_aware </code> </td> </tr> <tr> <td> extra redis_version </td> <td> Shows Redis version of all databases in the cluster </td> </tr> <tr> <td> extra state_machine </td> <td> Shows execution of state machine information </td> </tr> <tr> <td> extra watchdog </td> <td> Shows watchdog status </td> </tr> </tbody> </table> <h3 id="returns"> Returns </h3> <p> Returns tables of the status of all nodes, databases, and database endpoints on the cluster. </p> <p> If <code> issues_only </code> is specified, it only shows instances that do not have an <code> OK </code> status. </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 status extra all </span></span><span class="line"><span class="cl">CLUSTER: </span></span><span class="line"><span class="cl">OK. Cluster master: <span class="m">1</span> <span class="o">(</span>198.51.100.2<span class="o">)</span> </span></span><span class="line"><span class="cl">Cluster health: OK, <span class="o">[</span>1, 0.13333333333333333, 0.03333333333333333<span class="o">]</span> </span></span><span class="line"><span class="cl">failures/minute - avg1 1.00, avg15 0.13, avg60 0.03. </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl">CLUSTER NODES: </span></span><span class="line"><span class="cl">NODE:ID ROLE ADDRESS EXTERNAL_ADDRESS HOSTNAME MASTERS SLAVES OVERBOOKING_DEPTH SHARDS CORES FREE_RAM PROVISIONAL_RAM VERSION SHA RACK-ID STATUS </span></span><span class="line"><span class="cl">node:1 master 198.51.100.2 3d99db1fdf4b <span class="m">4</span> <span class="m">0</span> 10.91GB 4/100 <span class="m">6</span> 14.91GB/19.54GB 10.91GB/16.02GB 6.2.12-37 5c2106 - OK </span></span><span class="line"><span class="cl">node:2 slave 198.51.100.3 fc7a3d332458 <span class="m">0</span> <span class="m">0</span> 11.4GB 0/100 <span class="m">6</span> 14.91GB/19.54GB 11.4GB/16.02GB 6.2.12-37 5c2106 - OK </span></span><span class="line"><span class="cl">*node:3 slave 198.51.100.4 b87cc06c830f <span class="m">0</span> <span class="m">0</span> 11.4GB 0/100 <span class="m">6</span> 14.91GB/19.54GB 11.4GB/16.02GB 6.2.12-37 5c2106 - OK </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl">DATABASES: </span></span><span class="line"><span class="cl">DB:ID NAME TYPE STATUS SHARDS PLACEMENT REPLICATION PERSISTENCE ENDPOINT EXEC_STATE EXEC_STATE_MACHINE BACKUP_PROGRESS MISSING_BACKUP_TIME REDIS_VERSION </span></span><span class="line"><span class="cl">db:3 database3 redis active <span class="m">4</span> dense disabled disabled redis-11103.cluster.local:11103 N/A N/A N/A N/A 6.0.16 </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl">ENDPOINTS: </span></span><span class="line"><span class="cl">DB:ID NAME ID NODE ROLE SSL WATCHDOG_STATUS </span></span><span class="line"><span class="cl">db:3 database3 endpoint:3:1 node:1 single No OK </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl">SHARDS: </span></span><span class="line"><span class="cl">DB:ID NAME ID NODE ROLE SLOTS USED_MEMORY BACKUP_PROGRESS RAM_FRAG WATCHDOG_STATUS STATUS </span></span><span class="line"><span class="cl">db:3 database3 redis:4 node:1 master 0-4095 2.08MB N/A 4.73MB OK OK </span></span><span class="line"><span class="cl">db:3 database3 redis:5 node:1 master 4096-8191 2.08MB N/A 4.62MB OK OK </span></span><span class="line"><span class="cl">db:3 database3 redis:6 node:1 master 8192-12287 2.08MB N/A 4.59MB OK OK </span></span><span class="line"><span class="cl">db:3 database3 redis:7 node:1 master 12288-16383 2.08MB N/A 4.66MB OK OK </span></span></code></pre> </div> <h2 id="status-databases"> <code> status databases </code> </h2> <p> Displays the current status of all databases on the cluster. </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">rladmin status databases </span></span><span class="line"><span class="cl"> <span class="o">[</span> extra &lt;parameters&gt; <span class="o">]</span> </span></span><span class="line"><span class="cl"> <span class="o">[</span> sort &lt;column_titles&gt; <span class="o">]</span> </span></span><span class="line"><span class="cl"> <span class="o">[</span> issues_only <span class="o">]</span> </span></span></code></pre> </div> <h3 id="parameters-1"> Parameters </h3> <table> <thead> <tr> <th> Parameter </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> extra &lt;parameter&gt; </td> <td> Extra options that show more information </td> </tr> <tr> <td> sort &lt;column_titles&gt; </td> <td> Sort results by specified column titles </td> </tr> <tr> <td> issues_only </td> <td> Filters out all items that have an <code> OK </code> status </td> </tr> </tbody> </table> <table> <thead> <tr> <th> Extra parameter </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> extra all </td> <td> Shows all <code> extra </code> information </td> </tr> <tr> <td> extra backups </td> <td> Shows periodic backup status </td> </tr> <tr> <td> extra frag </td> <td> Shows fragmented memory available after the restart </td> </tr> <tr> <td> extra nodestats </td> <td> Shows shards per node </td> </tr> <tr> <td> extra rack_id </td> <td> Shows <code> rack_id </code> if customer is not <code> rack_aware </code> </td> </tr> <tr> <td> extra redis_version </td> <td> Shows Redis version of all databases in the cluster </td> </tr> <tr> <td> extra state_machine </td> <td> Shows execution of state machine information </td> </tr> <tr> <td> extra watchdog </td> <td> Shows watchdog status </td> </tr> </tbody> </table> <h3 id="returns-1"> Returns </h3> <p> Returns a table of the status of all databases on the cluster. </p> <p> If <code> sort &lt;column_titles&gt; </code> is specified, the result is sorted by the specified table columns. </p> <p> If <code> issues_only </code> is specified, it only shows databases that do not have an <code> OK </code> status. </p> <h3 id="example-1"> Example </h3> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">$ rladmin status databases sort REPLICATION PERSISTENCE </span></span><span class="line"><span class="cl">DB:ID NAME TYPE STATUS SHARDS PLACEMENT REPLICATION PERSISTENCE ENDPOINT </span></span><span class="line"><span class="cl">db:1 database1 redis active <span class="m">1</span> dense disabled disabled redis-10269.testdbd11169.localhost:10269 </span></span><span class="line"><span class="cl">db:2 database2 redis active <span class="m">1</span> dense disabled snapshot redis-13897.testdbd11169.localhost:13897 </span></span><span class="line"><span class="cl">db:3 database3 redis active <span class="m">1</span> dense enabled snapshot redis-19416.testdbd13186.localhost:19416 </span></span></code></pre> </div> <h2 id="status-endpoints"> <code> status endpoints </code> </h2> <p> Displays the current status of all endpoints on the cluster. </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">rladmin status endpoints </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> db <span class="o">{</span> db:&lt;id&gt; <span class="p">|</span> &lt;name&gt; <span class="o">}</span> <span class="o">]</span> </span></span><span class="line"><span class="cl"> <span class="o">[</span> extra &lt;parameters&gt; <span class="o">]</span> </span></span><span class="line"><span class="cl"> <span class="o">[</span> sort &lt;column_titles&gt; <span class="o">]</span> </span></span><span class="line"><span class="cl"> <span class="o">[</span> issues_only <span class="o">]</span> </span></span></code></pre> </div> <h3 id="parameters-2"> Parameters </h3> <table> <thead> <tr> <th> Parameter </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> node &lt;id&gt; </td> <td> Only show endpoints for the specified node ID </td> </tr> <tr> <td> db db:&lt;id&gt; </td> <td> Only show endpoints for the specified database ID </td> </tr> <tr> <td> db &lt;name&gt; </td> <td> Only show endpoints for the specified database name </td> </tr> <tr> <td> extra &lt;parameter&gt; </td> <td> Extra options that show more information </td> </tr> <tr> <td> sort &lt;column_titles&gt; </td> <td> Sort results by specified column titles </td> </tr> <tr> <td> issues_only </td> <td> Filters out all items that have an <code> OK </code> status </td> </tr> </tbody> </table> <table> <thead> <tr> <th> Extra parameter </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> extra all </td> <td> Shows all <code> extra </code> information </td> </tr> <tr> <td> extra backups </td> <td> Shows periodic backup status </td> </tr> <tr> <td> extra frag </td> <td> Shows fragmented memory available after the restart </td> </tr> <tr> <td> extra nodestats </td> <td> Shows shards per node </td> </tr> <tr> <td> extra rack_id </td> <td> Shows <code> rack_id </code> if customer is not <code> rack_aware </code> </td> </tr> <tr> <td> extra redis_version </td> <td> Shows Redis version of all endpoints in the cluster </td> </tr> <tr> <td> extra state_machine </td> <td> Shows execution of state machine information </td> </tr> <tr> <td> extra watchdog </td> <td> Shows watchdog status </td> </tr> </tbody> </table> <h3 id="returns-2"> Returns </h3> <p> Returns a table of the status of all endpoints on the cluster. </p> <p> If <code> sort &lt;column_titles&gt; </code> is specified, the result is sorted by the specified table columns. </p> <p> If <code> issues_only </code> is specified, it only shows endpoints that do not have an <code> OK </code> status. </p> <h3 id="example-2"> Example </h3> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">$ rladmin status endpoints </span></span><span class="line"><span class="cl">DB:ID NAME ID NODE ROLE SSL </span></span><span class="line"><span class="cl">db:1 database1 endpoint:1:1 node:1 single No </span></span><span class="line"><span class="cl">db:2 database2 endpoint:2:1 node:2 single No </span></span><span class="line"><span class="cl">db:3 database3 endpoint:3:1 node:3 single No </span></span></code></pre> </div> <h2 id="status-modules"> <code> status modules </code> </h2> <p> Displays the current status of modules installed on the cluster and modules used by databases. This information is not included in the combined status report returned by <a href="#status"> <code> rladmin status </code> </a> . </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">rladmin status modules </span></span><span class="line"><span class="cl"> <span class="o">[</span> db <span class="o">{</span> db:&lt;id1&gt; <span class="p">|</span> &lt;name1&gt; <span class="o">}</span> ... <span class="o">{</span> db:&lt;idN&gt; <span class="p">|</span> &lt;nameN&gt; <span class="o">}</span> <span class="o">]</span> </span></span><span class="line"><span class="cl"> <span class="o">[</span> extra <span class="o">{</span> all <span class="p">|</span> compatible_redis_version <span class="p">|</span> min_redis_version <span class="p">|</span> module_id <span class="o">}</span> <span class="o">]</span> </span></span></code></pre> </div> <h3 id="parameters-3"> Parameters </h3> <table> <thead> <tr> <th> Parameter </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> db db:&lt;id&gt; </td> <td> Provide a list of database IDs to show only modules used by the specified databases <br/> (for example: <code> rladmin status modules db db:1 db:2 </code> ) </td> </tr> <tr> <td> db &lt;name&gt; </td> <td> Provide a list of database names to show only modules used by the specified databases <br/> (for example: <code> rladmin status modules db name1 name2 </code> ) </td> </tr> <tr> <td> extra all </td> <td> Shows all extra information </td> </tr> <tr> <td> extra compatible_redis_version </td> <td> Shows the compatible Redis database version for the module </td> </tr> <tr> <td> extra module_id </td> <td> Shows module IDs </td> </tr> <tr> <td> extraΒ min_redis_version </td> <td> Shows the minimum compatible Redis database version for each module </td> </tr> </tbody> </table> <h3 id="returns-3"> Returns </h3> <p> Returns the status of modules installed on the cluster and modules used by databases. </p> <h3 id="example-3"> Example </h3> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">$ rladmin status modules extra all </span></span><span class="line"><span class="cl">CLUSTER MODULES: </span></span><span class="line"><span class="cl">MODULE VERSION MIN_REDIS_VERSION ID </span></span><span class="line"><span class="cl">RedisBloom 2.4.5 6.0 1b895a180592cbcae5bd3bff6af24be2 </span></span><span class="line"><span class="cl">RedisBloom 2.6.8 7.1 95264e7c9ac9540268c115c86a94659b </span></span><span class="line"><span class="cl">RediSearch <span class="m">2</span> 2.6.12 6.0 2c000539f65272f7a2712ed3662c2b6b </span></span><span class="line"><span class="cl">RediSearch <span class="m">2</span> 2.8.9 7.1 dd9a75710db528afa691767e9310ac6f </span></span><span class="line"><span class="cl">RedisGears 2.0.15 7.1 18c83d024b8ee22e7caf030862026ca6 </span></span><span class="line"><span class="cl">RedisGraph 2.10.12 6.0 5a1f2fdedb8f6ca18f81371ea8d28f68 </span></span><span class="line"><span class="cl">RedisJSON 2.4.7 6.0 28308b101a0203c21fa460e7eeb9344a </span></span><span class="line"><span class="cl">RedisJSON 2.6.8 7.1 b631b6a863edde1b53b2f7a27a49c004 </span></span><span class="line"><span class="cl">RedisTimeSeries 1.8.11 6.0 8fe09b00f56afe5dba160d234a6606af </span></span><span class="line"><span class="cl">RedisTimeSeries 1.10.9 7.1 98a492a017ea6669a162fd3503bf31f3 </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl">DATABASE MODULES: </span></span><span class="line"><span class="cl">DB:ID NAME MODULE VERSION ARGS STATUS </span></span><span class="line"><span class="cl">db:1 search-json-db RediSearch <span class="m">2</span> 2.8.9 PARTITIONS AUTO OK </span></span><span class="line"><span class="cl">db:1 search-json-db RedisJSON 2.6.8 OK </span></span><span class="line"><span class="cl">db:2 timeseries-db RedisTimeSeries 1.10.9 OK </span></span></code></pre> </div> <h2 id="status-nodes"> <code> status nodes </code> </h2> <p> Displays the current status of all nodes on the cluster. </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">rladmin status nodes </span></span><span class="line"><span class="cl"> <span class="o">[</span> extra &lt;parameters&gt; <span class="o">]</span> </span></span><span class="line"><span class="cl"> <span class="o">[</span> sort &lt;column_titles&gt; <span class="o">]</span> </span></span><span class="line"><span class="cl"> <span class="o">[</span> issues_only <span class="o">]</span> </span></span></code></pre> </div> <h3 id="parameters-4"> Parameters </h3> <table> <thead> <tr> <th> Parameter </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> extra &lt;parameter&gt; </td> <td> Extra options that show more information </td> </tr> <tr> <td> sort &lt;column_titles&gt; </td> <td> Sort results by specified column titles </td> </tr> <tr> <td> issues_only </td> <td> Filters out all items that have an <code> OK </code> status </td> </tr> </tbody> </table> <table> <thead> <tr> <th> Extra parameter </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> extra all </td> <td> Shows all <code> extra </code> information </td> </tr> <tr> <td> extra backups </td> <td> Shows periodic backup status </td> </tr> <tr> <td> extra frag </td> <td> Shows fragmented memory available after the restart </td> </tr> <tr> <td> extra nodestats </td> <td> Shows shards per node </td> </tr> <tr> <td> extra rack_id </td> <td> Shows <code> rack_id </code> if customer is not <code> rack_aware </code> </td> </tr> <tr> <td> extra redis_version </td> <td> Shows Redis version of all nodes in the cluster </td> </tr> <tr> <td> extra state_machine </td> <td> Shows execution of state machine information </td> </tr> <tr> <td> extra watchdog </td> <td> Shows watchdog status </td> </tr> </tbody> </table> <h3 id="returns-4"> Returns </h3> <p> Returns a table of the status of all nodes on the cluster. </p> <p> If <code> sort &lt;column_titles&gt; </code> is specified, the result is sorted by the specified table columns. </p> <p> If <code> issues_only </code> is specified, it only shows nodes that do not have an <code> OK </code> status. </p> <h3 id="example-4"> Example </h3> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">$ rladmin status nodes sort PROVISIONAL_RAM HOSTNAME </span></span><span class="line"><span class="cl">CLUSTER NODES: </span></span><span class="line"><span class="cl">NODE:ID ROLE ADDRESS EXTERNAL_ADDRESS HOSTNAME SHARDS CORES FREE_RAM PROVISIONAL_RAM VERSION STATUS </span></span><span class="line"><span class="cl">node:1 master 198.51.100.2 3d99db1fdf4b 4/100 <span class="m">6</span> 14.74GB/19.54GB 10.73GB/16.02GB 6.2.12-37 OK </span></span><span class="line"><span class="cl">*node:3 slave 198.51.100.4 b87cc06c830f 0/100 <span class="m">6</span> 14.74GB/19.54GB 11.22GB/16.02GB 6.2.12-37 OK </span></span><span class="line"><span class="cl">node:2 slave 198.51.100.3 fc7a3d332458 0/100 <span class="m">6</span> 14.74GB/19.54GB 11.22GB/16.02GB 6.2.12-37 OK </span></span></code></pre> </div> <h2 id="status-shards"> <code> status shards </code> </h2> <p> Displays the current status of all shards on the cluster. </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">rladmin status shards </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> db <span class="o">{</span>db:&lt;id&gt; <span class="p">|</span> &lt;name&gt;<span class="o">}</span> <span class="o">]</span> </span></span><span class="line"><span class="cl"> <span class="o">[</span> extra &lt;parameters&gt; <span class="o">]</span> </span></span><span class="line"><span class="cl"> <span class="o">[</span> sort &lt;column_titles&gt; <span class="o">]</span> </span></span><span class="line"><span class="cl"> <span class="o">[</span> issues_only <span class="o">]</span> </span></span></code></pre> </div> <h3 id="parameters-5"> Parameters </h3> <table> <thead> <tr> <th> Parameter </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> node &lt;id&gt; </td> <td> Only show shards for the specified node ID </td> </tr> <tr> <td> db db:&lt;id&gt; </td> <td> Only show shards for the specified database ID </td> </tr> <tr> <td> db &lt;name&gt; </td> <td> Only show shards for the specified database name </td> </tr> <tr> <td> extra &lt;parameter&gt; </td> <td> Extra options that show more information </td> </tr> <tr> <td> sort &lt;column_titles&gt; </td> <td> Sort results by specified column titles </td> </tr> <tr> <td> issues_only </td> <td> Filters out all items that have an <code> OK </code> status </td> </tr> </tbody> </table> <table> <thead> <tr> <th> Extra parameter </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> extra all </td> <td> Shows all <code> extra </code> information </td> </tr> <tr> <td> extra backups </td> <td> Shows periodic backup status </td> </tr> <tr> <td> extra frag </td> <td> Shows fragmented memory available after the restart </td> </tr> <tr> <td> extra shardstats </td> <td> Shows shards per node </td> </tr> <tr> <td> extra rack_id </td> <td> Shows <code> rack_id </code> if customer is not <code> rack_aware </code> </td> </tr> <tr> <td> extra redis_version </td> <td> Shows Redis version of all shards in the cluster </td> </tr> <tr> <td> extra state_machine </td> <td> Shows execution of state machine information </td> </tr> <tr> <td> extra watchdog </td> <td> Shows watchdog status </td> </tr> </tbody> </table> <h3 id="returns-5"> Returns </h3> <p> Returns a table of the status of all shards on the cluster. </p> <p> If <code> sort &lt;column_titles&gt; </code> is specified, the result is sorted by the specified table columns. </p> <p> If <code> issues_only </code> is specified, it only shows shards that do not have an <code> OK </code> status. </p> <h3 id="example-5"> Example </h3> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">$ rladmin status shards sort USED_MEMORY ID </span></span><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:3 database3 redis:6 node:1 master 8192-12287 2.04MB OK </span></span><span class="line"><span class="cl">db:3 database3 redis:4 node:1 master 0-4095 2.08MB OK </span></span><span class="line"><span class="cl">db:3 database3 redis:5 node:1 master 4096-8191 2.08MB OK </span></span><span class="line"><span class="cl">db:3 database3 redis:7 node:1 master 12288-16383 2.08MB OK </span></span></code></pre> </div> <form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback"> <input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/references/cli-utilities/rladmin/status/"/> <div class="flex flex-row justify-between"> <div class="grid justify-center"> <span class="font-mono"> RATE THIS PAGE </span> <div class="star-rating"> <input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/> <label class="star" for="5-stars"> β˜… </label> <input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/> <label class="star" for="4-stars"> β˜… </label> <input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/> <label class="star" for="3-stars"> β˜… </label> <input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/> <label class="star" for="2-stars"> β˜… </label> <input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/> <label class="star" for="1-stars"> β˜… </label> </div> </div> <a class="font-mono no-underline" href="#"> Back to top ↑ </a> </div> <div class="hidden" id="feedback-form"> <div class="grid gap-2"> <textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea> <button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit"> Submit </button> </div> </div> </form> <script> document.addEventListener("DOMContentLoaded", function() { const form = document.querySelector("#page-feedback"); form.addEventListener("submit", function(event) { event.preventDefault(); var xhr = new XMLHttpRequest(); var url = "\/docusight\/api\/rate"; var params = new URLSearchParams(new FormData(form)); xhr.open("POST", url, true); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.onreadystatechange = function() { if (xhr.readyState === 4 && xhr.status === 200) { const responseData = JSON.parse(xhr.responseText); const responseMessage = responseData.response; const newText = document.createTextNode(responseMessage); form.parentNode.replaceChild(newText, form); } }; xhr.send(params); }); }); </script> </section>
https://redis.io/docs/latest/operate/rs/references/rest-api/requests/bdbs/modules/upgrade/.html
<section class="prose w-full py-12 max-w-none"> <h1> Database upgrade modules requests </h1> <p class="text-lg -mt-5 mb-10"> Upgrade Redis module requests </p> <table> <thead> <tr> <th> Method </th> <th> Path </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> <a href="#post-bdb-modules-upgrade"> POST </a> </td> <td> <code> /v1/bdbs/{uid}/modules/upgrade </code> </td> <td> Upgrade module </td> </tr> </tbody> </table> <h2 id="post-bdb-modules-upgrade"> Upgrade module </h2> <pre><code>POST /v1/bdbs/{string: uid}/modules/upgrade </code></pre> <p> Upgrades module version on a specific BDB. </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 /bdbs/1/modules/upgrade </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 class="nt">"module_name"</span><span class="p">:</span> <span class="s2">"ReJson"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"current_semantic_version"</span><span class="p">:</span> <span class="s2">"2.2.1"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"new_module"</span><span class="p">:</span> <span class="s2">"aa3648d79bd4082d414587c42ea0b234"</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">"// Optional fields to fine-tune restart and failover behavior:"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"preserve_roles"</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">"may_discard_data"</span><span class="p">:</span> <span class="kc">false</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 </td> <td> List of dicts representing the modules that will be upgraded. Each dict must include: <br/> <br/> β€’ <strong> current_module </strong> : uid of a module to upgrade <br/> <br/> β€’ <strong> new_module </strong> : UID of the module we want to upgrade to <br/> <br/> β€’ <strong> new_module_args </strong> : args list for the new module </td> </tr> <tr> <td> preserve_roles </td> <td> boolean </td> <td> Preserve shards’ master/replica roles (optional) </td> </tr> <tr> <td> may_discard_data </td> <td> boolean </td> <td> Discard data in a non-replicated non-persistent bdb (optional) </td> </tr> </tbody> </table> <h3 id="post-response"> Response </h3> <p> Returns the upgraded <a href="/docs/latest/operate/rs/references/rest-api/objects/module/"> module 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">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">"name of database #1"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"module_id"</span><span class="p">:</span> <span class="s2">"aa3648d79bd4082d414587c42ea0b234"</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">"ReJson"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"semantic_version"</span><span class="p">:</span> <span class="s2">"2.2.2"</span> </span></span><span class="line"><span class="cl"> <span class="s2">"// additional fields..."</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> 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> missing_module </td> <td> Module is not present in cluster. </td> </tr> <tr> <td> module_downgrade_unsupported </td> <td> Module downgrade is not allowed. </td> </tr> <tr> <td> redis_incompatible_version </td> <td> Module min_redis_version is bigger than the current Redis version. </td> </tr> <tr> <td> redis_pack_incompatible_version </td> <td> Module min_redis_pack_version is bigger than the current Redis Enterprise version. </td> </tr> <tr> <td> unsupported_module_capabilities </td> <td> New version of module does support all the capabilities needed for the database configuration </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 or node 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> The requested configuration is invalid. </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/modules/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/integrate/redisvl/api/filter/.html
<section class="prose w-full py-12 max-w-none"> <h1> Filter </h1> <p class="text-lg -mt-5 mb-10"> The filter APIs </p> <p> <a id="filter-api"> </a> </p> <h2 id="filterexpression"> FilterExpression </h2> <h3 id="class-filterexpression_filternone-operatornone-leftnone-rightnone"> <em> class </em> FilterExpression(_filter=None, operator=None, left=None, right=None) </h3> <p> A FilterExpression is a logical combination of filters in RedisVL. </p> <p> FilterExpressions can be combined using the &amp; and | operators to create complex expressions that evaluate to the Redis Query language. </p> <p> This presents an interface by which users can create complex queries without having to know the Redis Query language. </p> <div class="highlight"> <pre class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">redisvl.query.filter</span> <span class="kn">import</span> <span class="n">Tag</span><span class="p">,</span> <span class="n">Num</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="n">brand_is_nike</span> <span class="o">=</span> <span class="n">Tag</span><span class="p">(</span><span class="s2">"brand"</span><span class="p">)</span> <span class="o">==</span> <span class="s2">"nike"</span> </span></span><span class="line"><span class="cl"><span class="n">price_is_over_100</span> <span class="o">=</span> <span class="n">Num</span><span class="p">(</span><span class="s2">"price"</span><span class="p">)</span> <span class="o">&lt;</span> <span class="mi">100</span> </span></span><span class="line"><span class="cl"><span class="n">f</span> <span class="o">=</span> <span class="n">brand_is_nike</span> <span class="o">&amp;</span> <span class="n">price_is_over_100</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="nb">str</span><span class="p">(</span><span class="n">f</span><span class="p">))</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="o">&gt;&gt;&gt;</span> <span class="p">(</span><span class="nd">@brand</span><span class="p">:{</span><span class="n">nike</span><span class="p">}</span> <span class="nd">@price</span><span class="p">:[</span><span class="o">-</span><span class="n">inf</span> <span class="p">(</span><span class="mi">100</span><span class="p">)])</span> </span></span></code></pre> </div> <p> This can be combined with the VectorQuery class to create a query: </p> <div class="highlight"> <pre class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">redisvl.query</span> <span class="kn">import</span> <span class="n">VectorQuery</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="n">v</span> <span class="o">=</span> <span class="n">VectorQuery</span><span class="p">(</span> </span></span><span class="line"><span class="cl"> <span class="n">vector</span><span class="o">=</span><span class="p">[</span><span class="mf">0.1</span><span class="p">,</span> <span class="mf">0.1</span><span class="p">,</span> <span class="mf">0.5</span><span class="p">,</span> <span class="o">...</span><span class="p">],</span> </span></span><span class="line"><span class="cl"> <span class="n">vector_field_name</span><span class="o">=</span><span class="s2">"product_embedding"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="n">return_fields</span><span class="o">=</span><span class="p">[</span><span class="s2">"product_id"</span><span class="p">,</span> <span class="s2">"brand"</span><span class="p">,</span> <span class="s2">"price"</span><span class="p">],</span> </span></span><span class="line"><span class="cl"> <span class="n">filter_expression</span><span class="o">=</span><span class="n">f</span><span class="p">,</span> </span></span><span class="line"><span class="cl"><span class="p">)</span> </span></span></code></pre> </div> <div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md"> <div class="p-2 pr-5"> <svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg"> <circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5"> </circle> <path d="M10.5 14V16" stroke="currentColor" stroke-width="2"> </path> <path d="M10.5 5V12" stroke="currentColor" stroke-width="2"> </path> </svg> </div> <div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50"> <div class="font-medium"> Note: </div> Filter expressions are typically not called directly. Instead they are built by combining filter statements using the &amp; and | operators. </div> </div> <ul> <li> <strong> Parameters: </strong> <ul> <li> <strong> _filter </strong> ( <em> str </em> <em> | </em> <em> None </em> ) – </li> <li> <strong> operator </strong> ( <em> FilterOperator </em> <em> | </em> <em> None </em> ) – </li> <li> <strong> left </strong> ( <a href="#redisvl.query.filter.FilterExpression"> <em> FilterExpression </em> </a> <em> | </em> <em> None </em> ) – </li> <li> <strong> right </strong> ( <a href="#redisvl.query.filter.FilterExpression"> <em> FilterExpression </em> </a> <em> | </em> <em> None </em> ) – </li> </ul> </li> </ul> <h2 id="tag"> Tag </h2> <h3 id="class-tagfield"> <em> class </em> Tag(field) </h3> <p> A Tag filter can be applied to Tag fields </p> <ul> <li> <strong> Parameters: </strong> <strong> field </strong> ( <em> str </em> ) – </li> </ul> <h3 id="__eq__other"> __eq__(other) </h3> <p> Create a Tag equality filter expression. </p> <ul> <li> <strong> Parameters: </strong> <strong> other </strong> ( <em> Union </em> *[* <em> List </em> *[* <em> str </em> <em> ] </em> <em> , </em> <em> str </em> <em> ] </em> ) – The tag(s) to filter on. </li> <li> <strong> Return type: </strong> <a href="#redisvl.query.filter.FilterExpression"> <em> FilterExpression </em> </a> </li> </ul> <div class="highlight"> <pre class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">redisvl.query.filter</span> <span class="kn">import</span> <span class="n">Tag</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="n">f</span> <span class="o">=</span> <span class="n">Tag</span><span class="p">(</span><span class="s2">"brand"</span><span class="p">)</span> <span class="o">==</span> <span class="s2">"nike"</span> </span></span></code></pre> </div> <h3 id="__ne__other"> __ne__(other) </h3> <p> Create a Tag inequality filter expression. </p> <ul> <li> <strong> Parameters: </strong> <strong> other </strong> ( <em> Union </em> *[* <em> List </em> *[* <em> str </em> <em> ] </em> <em> , </em> <em> str </em> <em> ] </em> ) – The tag(s) to filter on. </li> <li> <strong> Return type: </strong> <a href="#redisvl.query.filter.FilterExpression"> <em> FilterExpression </em> </a> </li> </ul> <div class="highlight"> <pre class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">redisvl.query.filter</span> <span class="kn">import</span> <span class="n">Tag</span> </span></span><span class="line"><span class="cl"><span class="n">f</span> <span class="o">=</span> <span class="n">Tag</span><span class="p">(</span><span class="s2">"brand"</span><span class="p">)</span> <span class="o">!=</span> <span class="s2">"nike"</span> </span></span></code></pre> </div> <h3 id="__str__"> __str__() </h3> <p> Return the Redis Query string for the Tag filter </p> <ul> <li> <strong> Return type: </strong> str </li> </ul> <h2 id="text"> Text </h2> <h3 id="class-textfield"> <em> class </em> Text(field) </h3> <p> A Text is a FilterField representing a text field in a Redis index. </p> <ul> <li> <strong> Parameters: </strong> <strong> field </strong> ( <em> str </em> ) – </li> </ul> <h3 id="__eq__other-1"> __eq__(other) </h3> <p> Create a Text equality filter expression. These expressions yield filters that enforce an exact match on the supplied term(s). </p> <ul> <li> <strong> Parameters: </strong> <strong> other </strong> ( <em> str </em> ) – The text value to filter on. </li> <li> <strong> Return type: </strong> <a href="#redisvl.query.filter.FilterExpression"> <em> FilterExpression </em> </a> </li> </ul> <div class="highlight"> <pre class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">redisvl.query.filter</span> <span class="kn">import</span> <span class="n">Text</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="n">f</span> <span class="o">=</span> <span class="n">Text</span><span class="p">(</span><span class="s2">"job"</span><span class="p">)</span> <span class="o">==</span> <span class="s2">"engineer"</span> </span></span></code></pre> </div> <h3 id="__mod__other"> __mod__(other) </h3> <p> Create a Text β€œLIKE” filter expression. A flexible expression that yields filters that can use a variety of additional operators like wildcards (*), fuzzy matches (%%), or combinatorics (|) of the supplied term(s). </p> <ul> <li> <strong> Parameters: </strong> <strong> other </strong> ( <em> str </em> ) – The text value to filter on. </li> <li> <strong> Return type: </strong> <a href="#redisvl.query.filter.FilterExpression"> <em> FilterExpression </em> </a> </li> </ul> <div class="highlight"> <pre class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">redisvl.query.filter</span> <span class="kn">import</span> <span class="n">Text</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="n">f</span> <span class="o">=</span> <span class="n">Text</span><span class="p">(</span><span class="s2">"job"</span><span class="p">)</span> <span class="o">%</span> <span class="s2">"engine*"</span> <span class="c1"># suffix wild card match</span> </span></span><span class="line"><span class="cl"><span class="n">f</span> <span class="o">=</span> <span class="n">Text</span><span class="p">(</span><span class="s2">"job"</span><span class="p">)</span> <span class="o">%</span> <span class="s2">"</span><span class="si">%%</span><span class="s2">engine</span><span class="si">%%</span><span class="s2">"</span> <span class="c1"># fuzzy match w/ Levenshtein Distance</span> </span></span><span class="line"><span class="cl"><span class="n">f</span> <span class="o">=</span> <span class="n">Text</span><span class="p">(</span><span class="s2">"job"</span><span class="p">)</span> <span class="o">%</span> <span class="s2">"engineer|doctor"</span> <span class="c1"># contains either term in field</span> </span></span><span class="line"><span class="cl"><span class="n">f</span> <span class="o">=</span> <span class="n">Text</span><span class="p">(</span><span class="s2">"job"</span><span class="p">)</span> <span class="o">%</span> <span class="s2">"engineer doctor"</span> <span class="c1"># contains both terms in field</span> </span></span></code></pre> </div> <h3 id="__ne__other-1"> __ne__(other) </h3> <p> Create a Text inequality filter expression. These expressions yield negated filters on exact matches on the supplied term(s). Opposite of an equality filter expression. </p> <ul> <li> <strong> Parameters: </strong> <strong> other </strong> ( <em> str </em> ) – The text value to filter on. </li> <li> <strong> Return type: </strong> <a href="#redisvl.query.filter.FilterExpression"> <em> FilterExpression </em> </a> </li> </ul> <div class="highlight"> <pre class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">redisvl.query.filter</span> <span class="kn">import</span> <span class="n">Text</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="n">f</span> <span class="o">=</span> <span class="n">Text</span><span class="p">(</span><span class="s2">"job"</span><span class="p">)</span> <span class="o">!=</span> <span class="s2">"engineer"</span> </span></span></code></pre> </div> <h3 id="__str__-1"> __str__() </h3> <p> Return the Redis Query string for the Text filter </p> <ul> <li> <strong> Return type: </strong> str </li> </ul> <h2 id="num"> Num </h2> <h3 id="class-numfield"> <em> class </em> Num(field) </h3> <p> A Num is a FilterField representing a numeric field in a Redis index. </p> <ul> <li> <strong> Parameters: </strong> <strong> field </strong> ( <em> str </em> ) – </li> </ul> <h3 id="__eq__other-2"> __eq__(other) </h3> <p> Create a Numeric equality filter expression. </p> <ul> <li> <strong> Parameters: </strong> <strong> other </strong> ( <em> int </em> ) – The value to filter on. </li> <li> <strong> Return type: </strong> <a href="#redisvl.query.filter.FilterExpression"> <em> FilterExpression </em> </a> </li> </ul> <div class="highlight"> <pre class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">redisvl.query.filter</span> <span class="kn">import</span> <span class="n">Num</span> </span></span><span class="line"><span class="cl"><span class="n">f</span> <span class="o">=</span> <span class="n">Num</span><span class="p">(</span><span class="s2">"zipcode"</span><span class="p">)</span> <span class="o">==</span> <span class="mi">90210</span> </span></span></code></pre> </div> <h3 id="__ge__other"> __ge__(other) </h3> <p> Create a Numeric greater than or equal to filter expression. </p> <ul> <li> <strong> Parameters: </strong> <strong> other </strong> ( <em> int </em> ) – The value to filter on. </li> <li> <strong> Return type: </strong> <a href="#redisvl.query.filter.FilterExpression"> <em> FilterExpression </em> </a> </li> </ul> <div class="highlight"> <pre class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">redisvl.query.filter</span> <span class="kn">import</span> <span class="n">Num</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="n">f</span> <span class="o">=</span> <span class="n">Num</span><span class="p">(</span><span class="s2">"age"</span><span class="p">)</span> <span class="o">&gt;=</span> <span class="mi">18</span> </span></span></code></pre> </div> <h3 id="__gt__other"> __gt__(other) </h3> <p> Create a Numeric greater than filter expression. </p> <ul> <li> <strong> Parameters: </strong> <strong> other </strong> ( <em> int </em> ) – The value to filter on. </li> <li> <strong> Return type: </strong> <a href="#redisvl.query.filter.FilterExpression"> <em> FilterExpression </em> </a> </li> </ul> <div class="highlight"> <pre class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">redisvl.query.filter</span> <span class="kn">import</span> <span class="n">Num</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="n">f</span> <span class="o">=</span> <span class="n">Num</span><span class="p">(</span><span class="s2">"age"</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">18</span> </span></span></code></pre> </div> <h3 id="__le__other"> __le__(other) </h3> <p> Create a Numeric less than or equal to filter expression. </p> <ul> <li> <strong> Parameters: </strong> <strong> other </strong> ( <em> int </em> ) – The value to filter on. </li> <li> <strong> Return type: </strong> <a href="#redisvl.query.filter.FilterExpression"> <em> FilterExpression </em> </a> </li> </ul> <div class="highlight"> <pre class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">redisvl.query.filter</span> <span class="kn">import</span> <span class="n">Num</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="n">f</span> <span class="o">=</span> <span class="n">Num</span><span class="p">(</span><span class="s2">"age"</span><span class="p">)</span> <span class="o">&lt;=</span> <span class="mi">18</span> </span></span></code></pre> </div> <h3 id="__lt__other"> __lt__(other) </h3> <p> Create a Numeric less than filter expression. </p> <ul> <li> <strong> Parameters: </strong> <strong> other </strong> ( <em> int </em> ) – The value to filter on. </li> <li> <strong> Return type: </strong> <a href="#redisvl.query.filter.FilterExpression"> <em> FilterExpression </em> </a> </li> </ul> <div class="highlight"> <pre class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">redisvl.query.filter</span> <span class="kn">import</span> <span class="n">Num</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="n">f</span> <span class="o">=</span> <span class="n">Num</span><span class="p">(</span><span class="s2">"age"</span><span class="p">)</span> <span class="o">&lt;</span> <span class="mi">18</span> </span></span></code></pre> </div> <h3 id="__ne__other-2"> __ne__(other) </h3> <p> Create a Numeric inequality filter expression. </p> <ul> <li> <strong> Parameters: </strong> <strong> other </strong> ( <em> int </em> ) – The value to filter on. </li> <li> <strong> Return type: </strong> <a href="#redisvl.query.filter.FilterExpression"> <em> FilterExpression </em> </a> </li> </ul> <div class="highlight"> <pre class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">redisvl.query.filter</span> <span class="kn">import</span> <span class="n">Num</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="n">f</span> <span class="o">=</span> <span class="n">Num</span><span class="p">(</span><span class="s2">"zipcode"</span><span class="p">)</span> <span class="o">!=</span> <span class="mi">90210</span> </span></span></code></pre> </div> <h3 id="__str__-2"> __str__() </h3> <p> Return the Redis Query string for the Numeric filter </p> <ul> <li> <strong> Return type: </strong> str </li> </ul> <h2 id="geo"> Geo </h2> <h3 id="class-geofield"> <em> class </em> Geo(field) </h3> <p> A Geo is a FilterField representing a geographic (lat/lon) field in a Redis index. </p> <ul> <li> <strong> Parameters: </strong> <strong> field </strong> ( <em> str </em> ) – </li> </ul> <h3 id="__eq__other-3"> __eq__(other) </h3> <p> Create a geographic filter within a specified GeoRadius. </p> <ul> <li> <strong> Parameters: </strong> <strong> other </strong> ( <a href="#redisvl.query.filter.GeoRadius"> <em> GeoRadius </em> </a> ) – The geographic spec to filter on. </li> <li> <strong> Return type: </strong> <a href="#redisvl.query.filter.FilterExpression"> <em> FilterExpression </em> </a> </li> </ul> <div class="highlight"> <pre class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">redisvl.query.filter</span> <span class="kn">import</span> <span class="n">Geo</span><span class="p">,</span> <span class="n">GeoRadius</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="n">f</span> <span class="o">=</span> <span class="n">Geo</span><span class="p">(</span><span class="s2">"location"</span><span class="p">)</span> <span class="o">==</span> <span class="n">GeoRadius</span><span class="p">(</span><span class="o">-</span><span class="mf">122.4194</span><span class="p">,</span> <span class="mf">37.7749</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="n">unit</span><span class="o">=</span><span class="s2">"m"</span><span class="p">)</span> </span></span></code></pre> </div> <h3 id="__ne__other-3"> __ne__(other) </h3> <p> Create a geographic filter outside of a specified GeoRadius. </p> <ul> <li> <strong> Parameters: </strong> <strong> other </strong> ( <a href="#redisvl.query.filter.GeoRadius"> <em> GeoRadius </em> </a> ) – The geographic spec to filter on. </li> <li> <strong> Return type: </strong> <a href="#redisvl.query.filter.FilterExpression"> <em> FilterExpression </em> </a> </li> </ul> <div class="highlight"> <pre class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">redisvl.query.filter</span> <span class="kn">import</span> <span class="n">Geo</span><span class="p">,</span> <span class="n">GeoRadius</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="n">f</span> <span class="o">=</span> <span class="n">Geo</span><span class="p">(</span><span class="s2">"location"</span><span class="p">)</span> <span class="o">!=</span> <span class="n">GeoRadius</span><span class="p">(</span><span class="o">-</span><span class="mf">122.4194</span><span class="p">,</span> <span class="mf">37.7749</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="n">unit</span><span class="o">=</span><span class="s2">"m"</span><span class="p">)</span> </span></span></code></pre> </div> <h3 id="__str__-3"> __str__() </h3> <p> Return the Redis Query string for the Geo filter </p> <ul> <li> <strong> Return type: </strong> str </li> </ul> <h2 id="georadius"> GeoRadius </h2> <h3 id="class-georadiuslongitude-latitude-radius1-unitkm"> <em> class </em> GeoRadius(longitude, latitude, radius=1, unit='km') </h3> <p> A GeoRadius is a GeoSpec representing a geographic radius. </p> <p> Create a GeoRadius specification (GeoSpec) </p> <ul> <li> <strong> Parameters: </strong> <ul> <li> <strong> longitude </strong> ( <em> float </em> ) – The longitude of the center of the radius. </li> <li> <strong> latitude </strong> ( <em> float </em> ) – The latitude of the center of the radius. </li> <li> <strong> radius </strong> ( <em> int </em> <em> , </em> <em> optional </em> ) – The radius of the circle. Defaults to 1. </li> <li> <strong> unit </strong> ( <em> str </em> <em> , </em> <em> optional </em> ) – The unit of the radius. Defaults to β€œkm”. </li> </ul> </li> <li> <strong> Raises: </strong> <strong> ValueError </strong> – If the unit is not one of β€œm”, β€œkm”, β€œmi”, or β€œft”. </li> </ul> <h3 id="__init__longitude-latitude-radius1-unitkm"> __init__(longitude, latitude, radius=1, unit='km') </h3> <p> Create a GeoRadius specification (GeoSpec) </p> <ul> <li> <strong> Parameters: </strong> <ul> <li> <strong> longitude </strong> ( <em> float </em> ) – The longitude of the center of the radius. </li> <li> <strong> latitude </strong> ( <em> float </em> ) – The latitude of the center of the radius. </li> <li> <strong> radius </strong> ( <em> int </em> <em> , </em> <em> optional </em> ) – The radius of the circle. Defaults to 1. </li> <li> <strong> unit </strong> ( <em> str </em> <em> , </em> <em> optional </em> ) – The unit of the radius. Defaults to β€œkm”. </li> </ul> </li> <li> <strong> Raises: </strong> <strong> ValueError </strong> – If the unit is not one of β€œm”, β€œkm”, β€œmi”, or β€œft”. </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/integrate/redisvl/api/filter/"/> <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-countkeysinslot/.html
<section class="prose w-full py-12"> <h1 class="command-name"> CLUSTER COUNTKEYSINSLOT </h1> <div class="font-semibold text-redis-ink-900"> Syntax </div> <pre class="command-syntax">CLUSTER COUNTKEYSINSLOT slot</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> @slow </code> <span class="mr-1 last:hidden"> , </span> </dd> </dl> <p> Returns the number of keys in the specified Redis Cluster hash slot. The command only queries the local data set, so contacting a node that is not serving the specified hash slot will always result in a count of zero being returned. </p> <pre tabindex="0"><code>&gt; CLUSTER COUNTKEYSINSLOT 7000 (integer) 50341 </code></pre> <h2 id="resp2resp3-reply"> RESP2/RESP3 Reply </h2> <a href="../../develop/reference/protocol-spec#integers"> Integer reply </a> : The number of keys in the specified hash slot, or an error if the hash slot is invalid. <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-countkeysinslot/"/> <div class="flex flex-row justify-between"> <div class="grid justify-center"> <span class="font-mono"> RATE THIS PAGE </span> <div class="star-rating"> <input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/> <label class="star" for="5-stars"> β˜… </label> <input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/> <label class="star" for="4-stars"> β˜… </label> <input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/> <label class="star" for="3-stars"> β˜… </label> <input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/> <label class="star" for="2-stars"> β˜… </label> <input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/> <label class="star" for="1-stars"> β˜… </label> </div> </div> <a class="font-mono no-underline" href="#"> Back to top ↑ </a> </div> <div class="hidden" id="feedback-form"> <div class="grid gap-2"> <textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea> <button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit"> Submit </button> </div> </div> </form> <script> document.addEventListener("DOMContentLoaded", function() { const form = document.querySelector("#page-feedback"); form.addEventListener("submit", function(event) { event.preventDefault(); var xhr = new XMLHttpRequest(); var url = "\/docusight\/api\/rate"; var params = new URLSearchParams(new FormData(form)); xhr.open("POST", url, true); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.onreadystatechange = function() { if (xhr.readyState === 4 && xhr.status === 200) { const responseData = JSON.parse(xhr.responseText); const responseMessage = responseData.response; const newText = document.createTextNode(responseMessage); form.parentNode.replaceChild(newText, form); } }; xhr.send(params); }); }); </script> </section>
https://redis.io/docs/latest/commands/bf.loadchunk.html
<section class="prose w-full py-12"> <h1 class="command-name"> BF.LOADCHUNK </h1> <div class="font-semibold text-redis-ink-900"> Syntax </div> <pre class="command-syntax">BF.LOADCHUNK key iterator data</pre> <dl class="grid grid-cols-[auto,1fr] gap-2 mb-12"> <dt class="font-semibold text-redis-ink-900 m-0"> Available in: </dt> <dd class="m-0"> <a href="/docs/stack"> Redis Stack </a> / <a href="/docs/data-types/probabilistic"> Bloom 1.0.0 </a> </dd> <dt class="font-semibold text-redis-ink-900 m-0"> Time complexity: </dt> <dd class="m-0"> O(n), where n is the capacity </dd> </dl> <p> Restores a Bloom filter previously saved using <a href="/docs/latest/commands/bf.scandump/"> <code> BF.SCANDUMP </code> </a> . </p> <p> See the <a href="/docs/latest/commands/bf.scandump/"> <code> BF.SCANDUMP </code> </a> command for example usage. </p> <p> <note> <b> Notes </b> </note> </p> <ul> <li> This command overwrites the Bloom filter stored under <code> key </code> . </li> <li> Make sure that the Bloom filter is not changed between invocations. </li> </ul> <h2 id="required-arguments"> Required arguments </h2> <details open=""> <summary> <code> key </code> </summary> <p> is key name for a Bloom filter to restore. </p> </details> <details open=""> <summary> <code> iterator </code> </summary> <p> Iterator value associated with <code> data </code> (returned by <a href="/docs/latest/commands/bf.scandump/"> <code> BF.SCANDUMP </code> </a> ) </p> </details> <details open=""> <summary> <code> data </code> </summary> <p> Current data chunk (returned by <a href="/docs/latest/commands/bf.scandump/"> <code> BF.SCANDUMP </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, wrong data, etc.) </li> </ul> <h2 id="examples"> Examples </h2> <p> See <a href="/docs/latest/commands/bf.scandump/"> <code> BF.SCANDUMP </code> </a> for an example. </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/bf.loadchunk/"/> <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/active-active/global-db-secret/.html
<section class="prose w-full py-12 max-w-none"> <h1> Set global database secret </h1> <p class="text-lg -mt-5 mb-10"> The REAADB contains the field '.spec.globalConfigurations' to set the global database secret. </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> This feature is supported for general availability in releases 6.4.2-6 and later. 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. </div> </div> <h2 id="set-global-database-secret"> Set global database secret </h2> <p> One of the fields available for <code> globalConfigurations </code> is <code> databaseSecretName </code> which can point to a secret containing the database password. To set the database secret name and sync the data to all participating clusters, follow the steps below. </p> <p> To edit other global configruations, see <a href="/docs/latest/operate/kubernetes/active-active/global-config/"> global configuration </a> </p> <ol> <li> On an existing participating cluster, generate a YAML file containing the database secret with the database password. </li> </ol> <p> This example shoes a secret named <code> my-db-secret </code> with the password <code> my-password </code> encoded in base 64. </p> <div class="highlight"> <pre class="chroma"><code class="language-yaml" data-lang="yaml"><span class="line"><span class="cl"><span class="nt">apiVersion</span><span class="p">:</span><span class="w"> </span><span class="l">v1</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">data</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">password</span><span class="p">:</span><span class="w"> </span><span class="l">bXktcGFzcw</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">kind</span><span class="p">:</span><span class="w"> </span><span class="l">Secret</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">metadata</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l">my-db-secret</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">Opaque</span><span class="w"> </span></span></span></code></pre> </div> <ol> <li> <p> Apply the secret file from the previous step, substituting your own value for <code> &lt;db-secret-file&gt; </code> . </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">kubectl apply -f &lt;db-secret-file&gt; </span></span></code></pre> </div> </li> <li> <p> Patch the REAADB custom resource to specify the database secret, substituting your own values for <code> &lt;reaadb-name&gt; </code> and <code> &lt;secret-name&gt; </code> . </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">kubectl patch reaadb &lt;reaadb-name&gt; --type merge --patch <span class="se">\ </span></span></span><span class="line"><span class="cl"><span class="se"></span><span class="s1">'{"spec": {"globalConfigurations": {"databaseSecretName": "secret-name"}}}'</span> </span></span></code></pre> </div> </li> <li> <p> Check the REAADB status for an <code> active </code> status and <code> Valid </code> spec status. </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">kubectl get reaadb &lt;reaadb-name&gt; </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl">NAME STATUS SPEC STATUS GLOBAL CONFIGURATIONS REDB LINKED REDBS </span></span><span class="line"><span class="cl">example-aadb-1 active Valid </span></span></code></pre> </div> </li> <li> <p> On each other participating cluster, check the secret status. </p> <p> ``sh kubectl get reaadb <reaadb-name> -o=jsonpath='{.status.secretsStatus}' </reaadb-name> </p> <pre tabindex="0"><code> The output should show the status as `Invalid`. ```sh [{"name":"my-db-secret","status":"Invalid"}] </code></pre> </li> <li> <p> Sync the secret on each participating cluster. </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">kubectl apply -f &lt;db-secret-file&gt; </span></span></code></pre> </div> </li> <li> <p> Repeat the previous two steps on every participating cluster. </p> </li> </ol> <form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback"> <input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/kubernetes/active-active/global-db-secret/"/> <div class="flex flex-row justify-between"> <div class="grid justify-center"> <span class="font-mono"> RATE THIS PAGE </span> <div class="star-rating"> <input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/> <label class="star" for="5-stars"> β˜… </label> <input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/> <label class="star" for="4-stars"> β˜… </label> <input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/> <label class="star" for="3-stars"> β˜… </label> <input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/> <label class="star" for="2-stars"> β˜… </label> <input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/> <label class="star" for="1-stars"> β˜… </label> </div> </div> <a class="font-mono no-underline" href="#"> Back to top ↑ </a> </div> <div class="hidden" id="feedback-form"> <div class="grid gap-2"> <textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea> <button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit"> Submit </button> </div> </div> </form> <script> document.addEventListener("DOMContentLoaded", function() { const form = document.querySelector("#page-feedback"); form.addEventListener("submit", function(event) { event.preventDefault(); var xhr = new XMLHttpRequest(); var url = "\/docusight\/api\/rate"; var params = new URLSearchParams(new FormData(form)); xhr.open("POST", url, true); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.onreadystatechange = function() { if (xhr.readyState === 4 && xhr.status === 200) { const responseData = JSON.parse(xhr.responseText); const responseMessage = responseData.response; const newText = document.createTextNode(responseMessage); form.parentNode.replaceChild(newText, form); } }; xhr.send(params); }); }); </script> </section>
https://redis.io/docs/latest/operate/rs/references/rest-api/objects/bootstrap/identity/.html
<section class="prose w-full py-12 max-w-none"> <h1> Identity object </h1> <p class="text-lg -mt-5 mb-10"> Documents the identity 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> uid </td> <td> integer </td> <td> Assumed node's UID to join cluster. Used to replace a dead node with a new one. </td> </tr> <tr> <td> accept_servers </td> <td> boolean (default:Β true) </td> <td> If true, no shards will be created on the node </td> </tr> <tr> <td> addr </td> <td> string </td> <td> Internal IP address of node </td> </tr> <tr> <td> external_addr </td> <td> complex object </td> <td> External IP addresses of node. <code> GET </code> <code> /jsonschema </code> to retrieve the object's structure. </td> </tr> <tr> <td> name </td> <td> string </td> <td> Node's name </td> </tr> <tr> <td> override_rack_id </td> <td> boolean </td> <td> When replacing an existing node in a rack-aware cluster, allows the new node to be located in a different rack </td> </tr> <tr> <td> rack_id </td> <td> string </td> <td> Rack ID, overrides cloud config </td> </tr> <tr> <td> use_internal_ipv6 </td> <td> boolean (default:Β false) </td> <td> Node uses IPv6 for internal communication </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/identity/"/> <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.add/.html
<section class="prose w-full py-12"> <h1 class="command-name"> TOPK.ADD </h1> <div class="font-semibold text-redis-ink-900"> Syntax </div> <pre class="command-syntax">TOPK.ADD key items [items ...]</pre> <dl class="grid grid-cols-[auto,1fr] gap-2 mb-12"> <dt class="font-semibold text-redis-ink-900 m-0"> Available in: </dt> <dd class="m-0"> <a href="/docs/stack"> Redis Stack </a> / <a href="/docs/data-types/probabilistic"> Bloom 2.0.0 </a> </dd> <dt class="font-semibold text-redis-ink-900 m-0"> Time complexity: </dt> <dd class="m-0"> O(n * k) where n is the number of items and k is the depth </dd> </dl> <p> Adds an item to the data structure. Multiple items can be added at once. If an item enters the Top-K list, the item which is expelled is returned. This allows dynamic heavy-hitter detection of items being entered or expelled from Top-K list. </p> <h3 id="parameters"> Parameters </h3> <ul> <li> <strong> key </strong> : Name of sketch where item is added. </li> <li> <strong> item </strong> : Item/s to be added. </li> </ul> <h3 id="return"> Return </h3> <p> <a href="/docs/latest/develop/reference/protocol-spec/#arrays"> Array reply </a> of <a href="/docs/latest/develop/reference/protocol-spec/#simple-strings"> Simple string reply </a> - if an element was dropped from the TopK list, <a href="/docs/latest/develop/reference/protocol-spec/#bulk-strings"> Nil reply </a> otherwise.. </p> <h4 id="example"> Example </h4> <pre tabindex="0"><code>redis&gt; TOPK.ADD topk foo bar 42 1) (nil) 2) baz 3) (nil) </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.add/"/> <div class="flex flex-row justify-between"> <div class="grid justify-center"> <span class="font-mono"> RATE THIS PAGE </span> <div class="star-rating"> <input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/> <label class="star" for="5-stars"> β˜… </label> <input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/> <label class="star" for="4-stars"> β˜… </label> <input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/> <label class="star" for="3-stars"> β˜… </label> <input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/> <label class="star" for="2-stars"> β˜… </label> <input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/> <label class="star" for="1-stars"> β˜… </label> </div> </div> <a class="font-mono no-underline" href="#"> Back to top ↑ </a> </div> <div class="hidden" id="feedback-form"> <div class="grid gap-2"> <textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea> <button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit"> Submit </button> </div> </div> </form> <script> document.addEventListener("DOMContentLoaded", function() { const form = document.querySelector("#page-feedback"); form.addEventListener("submit", function(event) { event.preventDefault(); var xhr = new XMLHttpRequest(); var url = "\/docusight\/api\/rate"; var params = new URLSearchParams(new FormData(form)); xhr.open("POST", url, true); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.onreadystatechange = function() { if (xhr.readyState === 4 && xhr.status === 200) { const responseData = JSON.parse(xhr.responseText); const responseMessage = responseData.response; const newText = document.createTextNode(responseMessage); form.parentNode.replaceChild(newText, form); } }; xhr.send(params); }); }); </script> </section>
https://redis.io/docs/latest/operate/rs/7.4/references/rest-api/requests/nodes/check/.html
<section class="prose w-full py-12 max-w-none"> <h1> Check node requests </h1> <p class="text-lg -mt-5 mb-10"> Requests that run checks on a cluster node. </p> <table> <thead> <tr> <th> Method </th> <th> Path </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> <a href="#get-node-check"> GET </a> </td> <td> <code> /v1/nodes/check/{uid} </code> </td> <td> Runs checks on a cluster node </td> </tr> </tbody> </table> <h2 id="get-node-check"> Check node </h2> <pre><code>GET /v1/nodes/check/{int: uid} </code></pre> <p> Runs the following checks on a cluster node: </p> <table> <thead> <tr> <th> Check name </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> bootstrap_status </td> <td> Verifies the local node's bootstrap process completed without errors. </td> </tr> <tr> <td> services </td> <td> Verifies all Redis Enterprise Software services are running. </td> </tr> <tr> <td> port_range </td> <td> Verifies the <a href="https://www.kernel.org/doc/html/latest/networking/ip-sysctl.html"> <code> ip_local_port_range </code> </a> doesn't conflict with the ports Redis Enterprise might assign to shards. </td> </tr> <tr> <td> pidfiles </td> <td> Verifies all active local shards have PID files. </td> </tr> <tr> <td> capabilities </td> <td> Verifies all binaries have the proper capability bits. </td> </tr> <tr> <td> existing_sockets </td> <td> Verifies sockets exist for all processes that require them. </td> </tr> <tr> <td> host_settings </td> <td> Verifies the following: <br/> β€’ Linux <code> overcommit_memory </code> setting is 1. <br/> β€’ <code> transparent_hugepage </code> is disabled. <br/> β€’ Socket maximum connections setting <code> somaxconn </code> is 1024. </td> </tr> <tr> <td> tcp_connectivity </td> <td> Verifies this node can connect to all other alive nodes. </td> </tr> </tbody> </table> <h4 id="required-permissions"> Required permissions </h4> <table> <thead> <tr> <th> Permission name </th> </tr> </thead> <tbody> <tr> <td> <a href="/docs/latest/operate/rs/7.4/references/rest-api/permissions/#view_node_check"> view_node_check </a> </td> </tr> </tbody> </table> <h3 id="get-request"> Request </h3> <h4 id="example-http-request"> Example HTTP request </h4> <pre><code>GET /nodes/check/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> Host </td> <td> cnm.cluster.fqdn </td> <td> Domain name </td> </tr> <tr> <td> Accept </td> <td> application/json </td> <td> Accepted media type </td> </tr> </tbody> </table> <h4 id="url-parameters"> URL parameters </h4> <table> <thead> <tr> <th> Field </th> <th> Type </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> uid </td> <td> integer </td> <td> The node's unique ID. </td> </tr> </tbody> </table> <h3 id="get-response"> Response </h3> <p> Returns a JSON object with the node's check results. </p> <p> When errors occur, the server returns a JSON object with <code> result: false </code> and an <code> error </code> field that provides additional information. If an error occurs during a check, the <code> error </code> field only includes a message for the first check that fails. </p> <p> Possible <code> error </code> messages: </p> <ul> <li> "bootstrap request to cnm_http failed,resp_code: ...,resp_content: ..." </li> <li> "process ... is not running or not responding (...)" </li> <li> "could not communicate with 'supervisorctl': ..." </li> <li> "connectivity check failed retrieving ports for testing" </li> </ul> <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">"node_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">"result"</span><span class="p">:</span> <span class="kc">true</span> </span></span><span class="line"><span class="cl"><span class="p">}</span> </span></span></code></pre> </div> <h3 id="get-status-codes"> Status codes </h3> <table> <thead> <tr> <th> Code </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> <a href="https://www.rfc-editor.org/rfc/rfc9110.html#name-200-ok"> 200 OK </a> </td> <td> No error </td> </tr> </tbody> </table> <form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback"> <input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/7.4/references/rest-api/requests/nodes/check/"/> <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/evalsha_ro/.html
<section class="prose w-full py-12"> <h1 class="command-name"> EVALSHA_RO </h1> <div class="font-semibold text-redis-ink-900"> Syntax </div> <pre class="command-syntax">EVALSHA_RO sha1 numkeys [key [key ...]] [arg [arg ...]]</pre> <dl class="grid grid-cols-[auto,1fr] gap-2 mb-12"> <dt class="font-semibold text-redis-ink-900 m-0"> Available since: </dt> <dd class="m-0"> 7.0.0 </dd> <dt class="font-semibold text-redis-ink-900 m-0"> Time complexity: </dt> <dd class="m-0"> Depends on the script that is executed. </dd> <dt class="font-semibold text-redis-ink-900 m-0"> ACL categories: </dt> <dd class="m-0"> <code> @slow </code> <span class="mr-1 last:hidden"> , </span> <code> @scripting </code> <span class="mr-1 last:hidden"> , </span> </dd> </dl> <p> This is a read-only variant of the <a href="/docs/latest/commands/evalsha/"> <code> EVALSHA </code> </a> command that cannot execute commands that modify data. </p> <p> For more information about when to use this command vs <a href="/docs/latest/commands/evalsha/"> <code> EVALSHA </code> </a> , please refer to <a href="/docs/latest/develop/interact/programmability#read-only-scripts"> Read-only scripts </a> . </p> <p> For more information about <a href="/docs/latest/commands/evalsha/"> <code> EVALSHA </code> </a> scripts please refer to <a href="/docs/latest/develop/interact/programmability/eval-intro/"> Introduction to Eval Scripts </a> . </p> <h2 id="resp2resp3-reply"> RESP2/RESP3 Reply </h2> The return value depends on the script that was executed. <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/evalsha_ro/"/> <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/.html
<section class="prose w-full py-12 max-w-none"> <h1> Understand Redis data types </h1> <p class="text-lg -mt-5 mb-10"> Overview of data types supported by Redis </p> <p> Redis is a data structure server. At its core, Redis provides a collection of native data types that help you solve a wide variety of problems, from <a href="/docs/latest/develop/data-types/strings/"> caching </a> to <a href="/docs/latest/develop/data-types/lists/"> queuing </a> to <a href="/docs/latest/develop/data-types/streams/"> event processing </a> . Below is a short description of each data type, with links to broader overviews and command references. Each overview includes a comprehensive tutorial with code samples. </p> <h2 id="core-data-types"> Core data types </h2> <p> <a href="/docs/latest/operate/oss_and_stack/"> Redis Community Edition </a> implements the following data types: </p> <ul> <li> <a href="#strings"> String </a> </li> <li> <a href="#hashes"> Hash </a> </li> <li> <a href="#lists"> List </a> </li> <li> <a href="#sets"> Set </a> </li> <li> <a href="#sorted-sets"> Sorted set </a> </li> <li> <a href="#streams"> Stream </a> </li> <li> <a href="#bitmaps"> Bitmap </a> </li> <li> <a href="#bitfields"> Bitfield </a> </li> <li> <a href="#geospatial-indexes"> Geospatial </a> </li> </ul> <p> <a href="/docs/latest/operate/oss_and_stack/"> Redis Stack </a> and <a href="/docs/latest/operate/rs/"> Redis Enterprise </a> also include some <a href="#adding-extensions"> extension modules </a> that implement other useful types, such as JSON. See <a href="#extension-data-types"> Extension data types </a> for the full list. </p> <h3 id="strings"> Strings </h3> <p> <a href="/docs/latest/develop/data-types/strings/"> Redis strings </a> are the most basic Redis data type, representing a sequence of bytes. For more information, see: </p> <ul> <li> <a href="/docs/latest/develop/data-types/strings/"> Overview of Redis strings </a> </li> <li> <a href="/docs/latest/commands/?group=string"> Redis string command reference </a> </li> </ul> <h3 id="lists"> Lists </h3> <p> <a href="/docs/latest/develop/data-types/lists/"> Redis lists </a> are lists of strings sorted by insertion order. For more information, see: </p> <ul> <li> <a href="/docs/latest/develop/data-types/lists/"> Overview of Redis lists </a> </li> <li> <a href="/docs/latest/commands/?group=list"> Redis list command reference </a> </li> </ul> <h3 id="sets"> Sets </h3> <p> <a href="/docs/latest/develop/data-types/sets/"> Redis sets </a> are unordered collections of unique strings that act like the sets from your favorite programming language (for example, <a href="https://docs.oracle.com/javase/7/docs/api/java/util/HashSet.html"> Java HashSets </a> , <a href="https://docs.python.org/3.10/library/stdtypes.html#set-types-set-frozenset"> Python sets </a> , and so on). With a Redis set, you can add, remove, and test for existence in O(1) time (in other words, regardless of the number of set elements). For more information, see: </p> <ul> <li> <a href="/docs/latest/develop/data-types/sets/"> Overview of Redis sets </a> </li> <li> <a href="/docs/latest/commands/?group=set"> Redis set command reference </a> </li> </ul> <h3 id="hashes"> Hashes </h3> <p> <a href="/docs/latest/develop/data-types/hashes/"> Redis hashes </a> are record types modeled as collections of field-value pairs. As such, Redis hashes resemble <a href="https://docs.python.org/3/tutorial/datastructures.html#dictionaries"> Python dictionaries </a> , <a href="https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html"> Java HashMaps </a> , and <a href="https://ruby-doc.org/core-3.1.2/Hash.html"> Ruby hashes </a> . For more information, see: </p> <ul> <li> <a href="/docs/latest/develop/data-types/hashes/"> Overview of Redis hashes </a> </li> <li> <a href="/docs/latest/commands/?group=hash"> Redis hashes command reference </a> </li> </ul> <h3 id="sorted-sets"> Sorted sets </h3> <p> <a href="/docs/latest/develop/data-types/sorted-sets/"> Redis sorted sets </a> are collections of unique strings that maintain order by each string's associated score. For more information, see: </p> <ul> <li> <a href="/docs/latest/develop/data-types/sorted-sets/"> Overview of Redis sorted sets </a> </li> <li> <a href="/docs/latest/commands/?group=sorted-set"> Redis sorted set command reference </a> </li> </ul> <h3 id="streams"> Streams </h3> <p> A <a href="/docs/latest/develop/data-types/streams/"> Redis stream </a> is a data structure that acts like an append-only log. Streams help record events in the order they occur and then syndicate them for processing. For more information, see: </p> <ul> <li> <a href="/docs/latest/develop/data-types/streams/"> Overview of Redis Streams </a> </li> <li> <a href="/docs/latest/commands/?group=stream"> Redis Streams command reference </a> </li> </ul> <h3 id="geospatial-indexes"> Geospatial indexes </h3> <p> <a href="/docs/latest/develop/data-types/geospatial/"> Redis geospatial indexes </a> are useful for finding locations within a given geographic radius or bounding box. For more information, see: </p> <ul> <li> <a href="/docs/latest/develop/data-types/geospatial/"> Overview of Redis geospatial indexes </a> </li> <li> <a href="/docs/latest/commands/?group=geo"> Redis geospatial indexes command reference </a> </li> </ul> <h3 id="bitmaps"> Bitmaps </h3> <p> <a href="/docs/latest/develop/data-types/bitmaps/"> Redis bitmaps </a> let you perform bitwise operations on strings. For more information, see: </p> <ul> <li> <a href="/docs/latest/develop/data-types/bitmaps/"> Overview of Redis bitmaps </a> </li> <li> <a href="/docs/latest/commands/?group=bitmap"> Redis bitmap command reference </a> </li> </ul> <h3 id="bitfields"> Bitfields </h3> <p> <a href="/docs/latest/develop/data-types/bitfields/"> Redis bitfields </a> efficiently encode multiple counters in a string value. Bitfields provide atomic get, set, and increment operations and support different overflow policies. For more information, see: </p> <ul> <li> <a href="/docs/latest/develop/data-types/bitfields/"> Overview of Redis bitfields </a> </li> <li> The <a href="/docs/latest/commands/bitfield/"> <code> BITFIELD </code> </a> command. </li> </ul> <h2 id="extension-data-types"> Extension data types </h2> <p> <a href="/docs/latest/operate/oss_and_stack/"> Redis Stack </a> and <a href="/docs/latest/operate/rs/"> Redis Enterprise </a> include some <a href="#adding-extensions"> extension modules </a> that implement the following data types: </p> <ul> <li> <a href="#json"> JSON </a> </li> <li> <a href="#probabilistic-data-types"> Probabilistic data types </a> </li> <li> <a href="#time-series"> Time series </a> </li> </ul> <p> These are not included by default with <a href="/docs/latest/operate/oss_and_stack/"> Redis Community Edition </a> . See <a href="#core-data-types"> Core data types </a> for the list of types that Redis Community Edition supports natively. </p> <h3 id="json"> JSON </h3> <p> <a href="/docs/latest/develop/data-types/json/"> Redis JSON </a> provides structured, hierarchical arrays and key-value objects that match the popular <a href="https://www.json.org/json-en.html"> JSON </a> text file format. You can import JSON text into Redis objects and access, modify, and query individual data elements. For more information, see: </p> <ul> <li> <a href="/docs/latest/develop/data-types/json/"> Overview of Redis JSON </a> </li> <li> <a href="/docs/latest/commands/?group=json"> JSON command reference </a> </li> </ul> <h3 id="probabilistic-data-types"> Probabilistic data types </h3> <p> These data types let you gather and calculate statistics in a way that is approximate but highly efficient. The following types are available: </p> <ul> <li> <a href="#hyperloglog"> HyperLogLog </a> </li> <li> <a href="#bloom-filter"> Bloom filter </a> </li> <li> <a href="#cuckoo-filter"> Cuckoo filter </a> </li> <li> <a href="#t-digest"> t-digest </a> </li> <li> <a href="#top-k"> Top-K </a> </li> <li> <a href="#count-min-sketch"> Count-min sketch </a> </li> </ul> <h3 id="hyperloglog"> HyperLogLog </h3> <p> The <a href="/docs/latest/develop/data-types/probabilistic/hyperloglogs/"> Redis HyperLogLog </a> data structures provide probabilistic estimates of the cardinality (i.e., number of elements) of large sets. For more information, see: </p> <ul> <li> <a href="/docs/latest/develop/data-types/probabilistic/hyperloglogs/"> Overview of Redis HyperLogLog </a> </li> <li> <a href="/docs/latest/commands/?group=hyperloglog"> Redis HyperLogLog command reference </a> </li> </ul> <h3 id="bloom-filter"> Bloom filter </h3> <p> <a href="/docs/latest/develop/data-types/probabilistic/bloom-filter/"> Redis Bloom filters </a> let you check for the presence or absence of an element in a set. For more information, see: </p> <ul> <li> <a href="/docs/latest/develop/data-types/probabilistic/bloom-filter/"> Overview of Redis Bloom filters </a> </li> <li> <a href="/docs/latest/commands/?group=bf"> Bloom filter command reference </a> </li> </ul> <h3 id="cuckoo-filter"> Cuckoo filter </h3> <p> <a href="/docs/latest/develop/data-types/probabilistic/cuckoo-filter/"> Redis Cuckoo filters </a> let you check for the presence or absence of an element in a set. They are similar to <a href="#bloom-filter"> Bloom filters </a> but with slightly different trade-offs between features and performance. For more information, see: </p> <ul> <li> <a href="/docs/latest/develop/data-types/probabilistic/cuckoo-filter/"> Overview of Redis Cuckoo filters </a> </li> <li> <a href="/docs/latest/commands/?group=cf"> Cuckoo filter command reference </a> </li> </ul> <h3 id="t-digest"> t-digest </h3> <p> <a href="/docs/latest/develop/data-types/probabilistic/t-digest/"> Redis t-digest </a> structures estimate percentiles from a stream of data values. For more information, see: </p> <ul> <li> <a href="/docs/latest/develop/data-types/probabilistic/t-digest/"> Redis t-digest overview </a> </li> <li> <a href="/docs/latest/commands/?group=tdigest"> t-digest command reference </a> </li> </ul> <h3 id="top-k"> Top-K </h3> <p> <a href="/docs/latest/develop/data-types/probabilistic/top-k/"> Redis Top-K </a> structures estimate the ranking of a data point within a stream of values. For more information, see: </p> <ul> <li> <a href="/docs/latest/develop/data-types/probabilistic/top-k/"> Redis Top-K overview </a> </li> <li> <a href="/docs/latest/commands/?group=topk"> Top-K command reference </a> </li> </ul> <h3 id="count-min-sketch"> Count-min sketch </h3> <p> <a href="/docs/latest/develop/data-types/probabilistic/count-min-sketch/"> Redis Count-min sketch </a> estimate the frequency of a data point within a stream of values. For more information, see: </p> <ul> <li> <a href="/docs/latest/develop/data-types/probabilistic/count-min-sketch/"> Redis Count-min sketch overview </a> </li> <li> <a href="/docs/latest/commands/?group=cms"> Count-min sketch command reference </a> </li> </ul> <h2 id="time-series"> Time series </h2> <p> <a href="/docs/latest/develop/data-types/timeseries/"> Redis time series </a> structures let you store and query timestamped data points. For more information, see: </p> <ul> <li> <a href="/docs/latest/develop/data-types/timeseries/"> Redis time series overview </a> </li> <li> <a href="/docs/latest/commands/?group=timeseries"> Count-min sketch command reference </a> </li> </ul> <h2 id="adding-extensions"> Adding extensions </h2> <p> To extend the features provided by the included data types, use one of these options: </p> <ol> <li> Write your own custom <a href="/docs/latest/develop/interact/programmability/"> server-side functions in Lua </a> . </li> <li> Write your own Redis module using the <a href="/docs/latest/develop/reference/modules/"> modules API </a> or check out the <a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/"> community-supported modules </a> . </li> <li> Use <a href="/docs/latest/develop/data-types/json/"> JSON </a> , <a href="/docs/latest/develop/interact/search-and-query/"> search </a> , <a href="/docs/latest/develop/data-types/timeseries/"> time series </a> , and other capabilities provided by <a href="/docs/latest/operate/oss_and_stack/"> Redis Stack </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/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/operate/rs/security/audit-events/.html
<section class="prose w-full py-12 max-w-none"> <h1> Audit connection events </h1> <p class="text-lg -mt-5 mb-10"> Describes how to audit connection events. </p> <p> Starting with version 6.2.18, Redis Enterprise Software lets you audit database connection and authentication events. This helps you track and troubleshoot connection activity. </p> <p> The following events are tracked: </p> <ul> <li> Database connection attempts </li> <li> Authentication requests, including requests for new and existing connections </li> <li> Database disconnects </li> </ul> <p> When tracked events are triggered, notifications are sent via TCP to an address and port defined when auditing is enabled. Notifications appear in near real time and are intended to be consumed by an external listener, such as a TCP listener, third-party service, or related utility. </p> <p> For development and testing environments, notifications can be saved to a local file; however, this is neither supported nor intended for production environments. </p> <p> For performance reasons, auditing is not enabled by default. In addition, auditing occurs in the background (asynchronously) and is non-blocking by design. That is, the action that triggered the notification continues without regard to the status of the notification or the listening tool. </p> <h2 id="enable-audit-notifications"> Enable audit notifications </h2> <h3 id="cluster-audits"> Cluster audits </h3> <p> To enable auditing for your cluster, use: </p> <ul> <li> <p> <code> rladmin </code> </p> <pre tabindex="0"><code>rladmin cluster config auditing db_conns \ audit_protocol &lt;TCP|local&gt; \ audit_address &lt;address&gt; \ audit_port &lt;port&gt; \ audit_reconnect_interval &lt;interval in seconds&gt; \ audit_reconnect_max_attempts &lt;number of attempts&gt; </code></pre> <p> where: </p> <ul> <li> <p> <em> audit_protocol </em> indicates the protocol used to process notifications. For production systems, <em> TCP </em> is the only value. </p> </li> <li> <p> <em> audit_address </em> defines the TCP/IP address where one can listen for notifications </p> </li> <li> <p> <em> audit_port </em> defines the port where one can listen for notifications </p> </li> <li> <p> <em> audit_reconnect_interval </em> defines the interval (in seconds) between attempts to reconnect to the listener. Default is 1 second. </p> </li> <li> <p> <em> audit_reconnect_max_attempts </em> defines the maximum number of attempts to reconnect. Default is 0. (infinite) </p> </li> </ul> <p> Development systems can set <em> audit_protocol </em> to <code> local </code> for testing and training purposes; however, this setting is <em> not </em> supported for production use. </p> <p> When <code> audit_protocol </code> is set to <code> local </code> , <code> &lt;address&gt; </code> should be set to a <a href="https://man7.org/linux/man-pages/man7/unix.7.html"> stream socket </a> defined on the machine running Redis Enterprise and <em> <code> &lt;port&gt; </code> </em> should not be specified: </p> <pre tabindex="0"><code>rladmin cluster config auditing db_conns \ audit_protocol local audit_address &lt;output-file&gt; </code></pre> <p> The output file (and path) must be accessible by the user and group running Redis Enterprise Software. </p> </li> <li> <p> the <a href="/docs/latest/operate/rs/references/rest-api/requests/cluster/auditing-db-conns/#put-cluster-audit-db-conns"> REST API </a> </p> <pre tabindex="0"><code>PUT /v1/cluster/auditing/db_conns { "audit_address": "&lt;address&gt;", "audit_port": &lt;port&gt;, "audit_protocol": "TCP", "audit_reconnect_interval": &lt;interval&gt;, "audit_reconnect_max_attempts": &lt;max attempts&gt; } </code></pre> <p> where <code> &lt;address&gt; </code> is a string containing the TCP/IP address, <code> &lt;port&gt; </code> is a numeric value representing the port, <code> &lt;interval&gt; </code> is a numeric value representing the interval in seconds, and <code> &lt;max attempts&gt; </code> is a numeric value representing the maximum number of attempts to execute. </p> </li> </ul> <h3 id="database-audits"> Database audits </h3> <p> Once auditing is enabled for your cluster, you can audit individual databases. To do so, use: </p> <ul> <li> <p> <code> rladmin </code> </p> <pre tabindex="0"><code>rladmin tune db db:&lt;id|name&gt; db_conns_auditing enabled </code></pre> <p> where the value of the <em> db: </em> parameter is either the cluster ID of the database or the database name. </p> <p> To deactivate auditing, set <code> db_conns_auditing </code> to <code> disabled </code> . </p> <p> Use <code> rladmin info </code> to retrieve additional details: </p> <pre tabindex="0"><code>rladmin info db &lt;id|name&gt; rladmin info cluster </code></pre> </li> <li> <p> the <a href="/docs/latest/operate/rs/references/rest-api/requests/bdbs/#put-bdbs"> REST API </a> </p> <pre tabindex="0"><code>PUT /v1/bdbs/1 { "db_conns_auditing": true } </code></pre> <p> To deactivate auditing, set <code> db_conns_auditing </code> to <code> false </code> . </p> </li> </ul> <p> You must enable auditing for your cluster before auditing a database; otherwise, an error appears: </p> <blockquote> <p> <em> Error setting description: Unable to enable DB Connections Auditing before feature configurations are set. <br/> Error setting error_code: db_conns_auditing_config_missing </em> </p> </blockquote> <p> To resolve this error, enable the protocol for your cluster <em> before </em> attempting to audit a database. </p> <h3 id="policy-defaults-for-new-databases"> Policy defaults for new databases </h3> <p> To audit connections for new databases by default, use: </p> <ul> <li> <p> <code> rladmin </code> </p> <pre tabindex="0"><code>rladmin tune cluster db_conns_auditing enabled </code></pre> <p> To deactivate this policy, set <code> db_conns_auditing </code> to <code> disabled </code> . </p> </li> <li> <p> the <a href="/docs/latest/operate/rs/references/rest-api/requests/cluster/policy/#put-cluster-policy"> REST API </a> </p> <pre tabindex="0"><code>PUT /v1/cluster/policy { "db_conns_auditing": true } </code></pre> <p> To deactivate this policy, set <code> db_conns_auditing </code> to <code> false </code> . </p> </li> </ul> <h2 id="notification-examples"> Notification examples </h2> <p> Audit event notifications are reported as JSON objects. </p> <h3 id="new-connection"> New connection </h3> <p> This example reports a new connection for a database: </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">"ts"</span><span class="p">:</span><span class="mi">1655821384</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"new_conn"</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">"id"</span><span class="p">:</span><span class="mi">2285001002</span> <span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"srcip"</span><span class="p">:</span><span class="s2">"127.0.0.1"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"srcp"</span><span class="p">:</span><span class="s2">"39338"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"trgip"</span><span class="p">:</span><span class="s2">"127.0.0.1"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"trgp"</span><span class="p">:</span><span class="s2">"12635"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"hname"</span><span class="p">:</span><span class="s2">""</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"bdb_name"</span><span class="p">:</span><span class="s2">"DB1"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"bdb_uid"</span><span class="p">:</span><span class="s2">"5"</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="authentication-request"> Authentication request </h3> <p> Here is a sample authentication request for a database: </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">"ts"</span><span class="p">:</span><span class="mi">1655821384</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"action"</span><span class="p">:</span><span class="s2">"auth"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"id"</span><span class="p">:</span><span class="mi">2285001002</span> <span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"srcip"</span><span class="p">:</span><span class="s2">"127.0.0.1"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"srcp"</span><span class="p">:</span><span class="s2">"39338"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"trgip"</span><span class="p">:</span><span class="s2">"127.0.0.1"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"trgp"</span><span class="p">:</span><span class="s2">"12635"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"hname"</span><span class="p">:</span><span class="s2">""</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"bdb_name"</span><span class="p">:</span><span class="s2">"DB1"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"bdb_uid"</span><span class="p">:</span><span class="s2">"5"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"status"</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">"username"</span><span class="p">:</span><span class="s2">"user_one"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"identity"</span><span class="p">:</span><span class="s2">"user:1"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"acl-rules"</span><span class="p">:</span><span class="s2">"~* +@all"</span> </span></span><span class="line"><span class="cl"><span class="p">}</span> </span></span></code></pre> </div> <p> The <code> status </code> field reports the following: </p> <ul> <li> <p> Values of 2, 7, or 8 indicate success. </p> </li> <li> <p> Values of 3 or 5 indicate that the client authentication is in progress and should conclude later. </p> </li> <li> <p> Other values indicate failures. </p> </li> </ul> <h3 id="database-disconnect"> Database disconnect </h3> <p> Here's what's reported when a database connection is closed: </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">"ts"</span><span class="p">:</span><span class="mi">1655821384</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"close_conn"</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">"id"</span><span class="p">:</span><span class="mi">2285001002</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"srcip"</span><span class="p">:</span><span class="s2">"127.0.0.1"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"srcp"</span><span class="p">:</span><span class="s2">"39338"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"trgip"</span><span class="p">:</span><span class="s2">"127.0.0.1"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"trgp"</span><span class="p">:</span><span class="s2">"12635"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"hname"</span><span class="p">:</span><span class="s2">""</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"bdb_name"</span><span class="p">:</span><span class="s2">"DB1"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"bdb_uid"</span><span class="p">:</span><span class="s2">"5"</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> <h2 id="notification-field-reference"> Notification field reference </h2> <p> The field value that appears immediately after the timestamp describes the action that triggered the notification. The following values may appear: </p> <ul> <li> <code> new_conn </code> indicates a new external connection </li> <li> <code> new_int_conn </code> indicates a new internal connection </li> <li> <code> close_conn </code> occurs when a connection is closed </li> <li> <code> "action":"auth" </code> indicates an authentication request and can refer to new authentication requests or authorization checks on existing connections </li> </ul> <p> In addition, the following fields may also appear in audit event notifications: </p> <table> <thead> <tr> <th style="text-align:center"> FieldΒ name </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td style="text-align:center"> <code> acl-rules </code> </td> <td> ACL rules associated with the connection, which includes a rule for the <code> default </code> user. </td> </tr> <tr> <td style="text-align:center"> <code> bdb_name </code> </td> <td> Destination database name - The name of the database being accessed. </td> </tr> <tr> <td style="text-align:center"> <code> bdb_uid </code> </td> <td> Destination database ID - The cluster ID of the database being accessed. </td> </tr> <tr> <td style="text-align:center"> <code> hname </code> </td> <td> Client hostname - The hostname of the client. Currently empty; reserved for future use. </td> </tr> <tr> <td style="text-align:center"> <code> id </code> </td> <td> Connection ID - Unique connection ID assigned by the proxy. </td> </tr> <tr> <td style="text-align:center"> <code> identity </code> </td> <td> Identity - A unique ID the proxy assigned to the user for the current connection. </td> </tr> <tr> <td style="text-align:center"> <code> srcip </code> </td> <td> Source IP address - Source TCP/IP address of the client accessing the Redis database. </td> </tr> <tr> <td style="text-align:center"> <code> srcp </code> </td> <td> Source port - Port associated with the source IP address accessing the Redis database. Combine the port with the address to uniquely identify the socket. </td> </tr> <tr> <td style="text-align:center"> <code> status </code> </td> <td> Status result code - An integer representing the result of an authentication request. </td> </tr> <tr> <td style="text-align:center"> <code> trgip </code> </td> <td> Target IP address - The IP address of the destination being accessed by the action. </td> </tr> <tr> <td style="text-align:center"> <code> trgp </code> </td> <td> Target port - The port of the destination being accessed by the action. Combine the port with the destination IP address to uniquely identify the database being accessed. </td> </tr> <tr> <td style="text-align:center"> <code> ts </code> </td> <td> Timestamp - The date and time of the event, in <a href="https://en.wikipedia.org/wiki/Coordinated_Universal_Time"> Coordinated Universal Time </a> (UTC). Granularity is within one second. </td> </tr> <tr> <td style="text-align:center"> <code> username </code> </td> <td> Authentication username - Username associated with the connection; can include <code> default </code> for databases that allow default access. (Passwords are <em> not </em> recorded). </td> </tr> </tbody> </table> <h2 id="status-result-codes"> Status result codes </h2> <p> The <code> status </code> field reports the results of an authentication request as an integer. Here's what different values mean: </p> <table> <thead> <tr> <th style="text-align:center"> ErrorΒ value </th> <th> Error code </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td style="text-align:center"> <code> 0 </code> </td> <td> AUTHENTICATION_FAILED </td> <td> Invalid username and/or password. </td> </tr> <tr> <td style="text-align:center"> <code> 1 </code> </td> <td> AUTHENTICATION_FAILED_TOO_LONG </td> <td> Username or password are too long. </td> </tr> <tr> <td style="text-align:center"> <code> 2 </code> </td> <td> AUTHENTICATION_NOT_REQUIRED </td> <td> Client tried to authenticate, but authentication isn't necessary. </td> </tr> <tr> <td style="text-align:center"> <code> 3 </code> </td> <td> AUTHENTICATION_DIRECTORY_PENDING </td> <td> Attempting to receive authentication info from the directory in async mode. </td> </tr> <tr> <td style="text-align:center"> <code> 4 </code> </td> <td> AUTHENTICATION_DIRECTORY_ERROR </td> <td> Authentication attempt failed because there was a directory connection error. </td> </tr> <tr> <td style="text-align:center"> <code> 5 </code> </td> <td> AUTHENTICATION_SYNCER_IN_PROGRESS </td> <td> Syncer SASL handshake. Return SASL response and wait for the next request. </td> </tr> <tr> <td style="text-align:center"> <code> 6 </code> </td> <td> AUTHENTICATION_SYNCER_FAILED </td> <td> Syncer SASL handshake. Returned SASL response and closed the connection. </td> </tr> <tr> <td style="text-align:center"> <code> 7 </code> </td> <td> AUTHENTICATION_SYNCER_OK </td> <td> Syncer authenticated. Returned SASL response. </td> </tr> <tr> <td style="text-align:center"> <code> 8 </code> </td> <td> AUTHENTICATION_OK </td> <td> Client successfully authenticated. </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/security/audit-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/operate/rs/references/rest-api/objects/services_configuration/pdns_server/.html
<section class="prose w-full py-12 max-w-none"> <h1> PDNS server object </h1> <p class="text-lg -mt-5 mb-10"> Documents the pdns_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 PDNS 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/references/rest-api/objects/services_configuration/pdns_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/terminology/.html
<section class="prose w-full py-12 max-w-none"> <h1> Terminology in Redis Enterprise Software </h1> <p class="text-lg -mt-5 mb-10"> Explains terms used in Redis Enterprise Software and its docs. </p> <p> Here are explanations of some of the terms used in Redis Enterprise Software. </p> <h2 id="node"> Node </h2> <p> A <em> node </em> is a physical machine, virtual machine, container or cloud instance on which the RS installation package was installed and the setup process was run in order to make the machine part of the cluster. </p> <p> Each node is a container for running multiple Redis instances, referred to as "shards". </p> <p> The recommended configuration for a production cluster is an uneven number of nodes, with a minimum of three. Note that in some configurations, certain functionalities might be blocked. For example, if a cluster has only one node you cannot enable database replication, which helps to achieve high availability. </p> <p> A node is made up of several components, as detailed below, and works together with the other cluster nodes. </p> <h2 id="redis-instance-shard"> Redis instance (shard) </h2> <p> As indicated above, each node serves as a container for hosting multiple database instances, referred to as "shards". </p> <p> Redis Enterprise SoftwareΒ supports various database configurations: </p> <ul> <li> <strong> Standard Redis database </strong> - A single Redis shard with no replication or clustering. </li> <li> <strong> Highly available Redis database </strong> - Every database master shard has a replica shard, so that if the master shard fails the cluster can automatically fail over to the replica with minimal impact. Master and replica shards are always placed on separate nodes to ensure high availability. </li> <li> <strong> Clustered Redis database </strong> - The data stored in the database is split across several shards. The number of shards can be defined by the user. Various performance optimization algorithms define where shards are placed within the cluster. During the lifetime of the cluster, these algorithms might migrate a shard between nodes. </li> <li> <strong> Clustered and highly available Redis database </strong> - Each master shard in the clustered database has a replica shard, enabling failover if the master shard fails. </li> </ul> <h2 id="proxy"> Proxy </h2> <p> Each node includes one zero-latency, multi-threaded proxy (written in low-level C) that masks the underlying system complexity. The proxy overseesΒ forwarding Redis operations to the database shardsΒ on behalf of a Redis client. </p> <p> The proxy simplifies the cluster operation, from the application or Redis client point of view, by enabling the use of a standard Redis client. The zero-latency proxy is built over a cut-through architecture and employs various optimization methods. For example, to help ensure high-throughput and low-latency performance, the proxy might use instruction pipelining even if not instructed to do so by the client. </p> <h2 id="database-endpoint"> Database endpoint </h2> <p> Each database is served by a database endpoint that is part of and managed by the proxies. The endpoint overseesΒ forwarding Redis operations to specific database shards. </p> <p> If the master shard fails and the replica shard is promoted to master, the master endpoint is updated to point to the new master shard. </p> <p> If the master endpoint fails, the replica endpoint is promoted to be the new master endpoint and is updated to point to the master shard. </p> <p> Similarly, if both the master shard and the master endpoint fail, then both the replica shard and the replica endpoint are promoted to be the new master shard and master endpoint. </p> <p> Shards and their endpoints do not have to reside within the same node in the cluster. </p> <p> In the case of a clustered database with multiple database shards, only one master endpoint acts as the master endpoint for all master shards, forwarding Redis operations to all shards as needed. </p> <h2 id="cluster-manager"> Cluster manager </h2> <p> The cluster manager overseesΒ all node management-related tasks, and the cluster manager in the master node looks after all the cluster related tasks. </p> <p> The cluster manager is designed in a way that is totally decoupled from the Redis operation. This enables RSΒ to react in a much faster and accurate manner to failure events, so that, for example, a node failure event triggers mass failover operations of all the master endpoints and master shards that are hosted on the failed node. </p> <p> In addition, this architecture guarantees that each Redis shard is only dealing with processing Redis commands in a shared-nothing architecture, thus maintaining the inherent high-throughput and low-latency of each Redis process. Lastly, this architecture guarantees that any change in the cluster manager itself does not affect the Redis operation. </p> <p> Some of the primaryΒ functionalities of the cluster manager include: </p> <ul> <li> Deciding where shards are created </li> <li> Deciding when shards are migrated and to where </li> <li> Monitoring database size </li> <li> Monitoring databases and endpoints across all nodes </li> <li> Running the database resharding process </li> <li> Running the database provisioning and de-provisioning processes </li> <li> Gathering operational statistics </li> <li> Enforcing license and subscription limitations </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/terminology/"/> <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_mediummain&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/commands/hsetnx/.html
<section class="prose w-full py-12"> <h1 class="command-name"> HSETNX </h1> <div class="font-semibold text-redis-ink-900"> Syntax </div> <pre class="command-syntax">HSETNX key field value</pre> <dl class="grid grid-cols-[auto,1fr] gap-2 mb-12"> <dt class="font-semibold text-redis-ink-900 m-0"> Available since: </dt> <dd class="m-0"> 2.0.0 </dd> <dt class="font-semibold text-redis-ink-900 m-0"> Time complexity: </dt> <dd class="m-0"> O(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> @hash </code> <span class="mr-1 last:hidden"> , </span> <code> @fast </code> <span class="mr-1 last:hidden"> , </span> </dd> </dl> <p> Sets <code> field </code> in the hash stored at <code> key </code> to <code> value </code> , only if <code> field </code> does not yet exist. If <code> key </code> does not exist, a new key holding a hash is created. If <code> field </code> already exists, this operation has no effect. </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; HSETNX myhash field "Hello" (integer) 1 redis&gt; HSETNX myhash field "World" (integer) 0 redis&gt; HGET myhash field "Hello" </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> <p> One of the following: </p> <ul> <li> <a href="../../develop/reference/protocol-spec#integers"> Integer reply </a> : <code> 0 </code> if the field already exists in the hash and no operation was performed. </li> <li> <a href="../../develop/reference/protocol-spec#integers"> Integer reply </a> : <code> 1 </code> if the field is a new field in the hash and the value was set. </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/hsetnx/"/> <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/php/queryjson/.html
<section class="prose w-full py-12"> <h1> Example - Index and query JSON documents </h1> <p class="text-lg -mt-5 mb-10"> Learn how to use the Redis query engine with JSON </p> <p> This example shows how to index and query Redis JSON data using <code> predis </code> . </p> <p> Make sure that you have Redis Stack and <code> predis </code> installed, as described in the <a href="#install"> Install </a> section above. </p> <p> Start by importing dependencies: </p> <div class="highlight"> <pre class="chroma"><code class="language-php" data-lang="php"><span class="line"><span class="cl"><span class="o">&lt;?</span><span class="nx">php</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="k">require</span> <span class="s1">'vendor/autoload.php'</span><span class="p">;</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="k">use</span> <span class="nx">Predis\Client</span> <span class="k">as</span> <span class="nx">PredisClient</span><span class="p">;</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="k">use</span> <span class="nx">Predis\Command\Argument\Search\AggregateArguments</span><span class="p">;</span> </span></span><span class="line"><span class="cl"><span class="k">use</span> <span class="nx">Predis\Command\Argument\Search\CreateArguments</span><span class="p">;</span> </span></span><span class="line"><span class="cl"><span class="k">use</span> <span class="nx">Predis\Command\Argument\Search\SearchArguments</span><span class="p">;</span> </span></span><span class="line"><span class="cl"><span class="k">use</span> <span class="nx">Predis\Command\Argument\Search\SchemaFields\NumericField</span><span class="p">;</span> </span></span><span class="line"><span class="cl"><span class="k">use</span> <span class="nx">Predis\Command\Argument\Search\SchemaFields\TextField</span><span class="p">;</span> </span></span><span class="line"><span class="cl"><span class="k">use</span> <span class="nx">Predis\Command\Argument\Search\SchemaFields\TagField</span><span class="p">;</span> </span></span><span class="line"><span class="cl"><span class="k">use</span> <span class="nx">Predis\Command\Argument\Search\SchemaFields\VectorField</span><span class="p">;</span> </span></span></code></pre> </div> <p> Connect to the Redis server: </p> <div class="highlight"> <pre class="chroma"><code class="language-php" data-lang="php"><span class="line"><span class="cl"><span class="nv">$r</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">PredisClient</span><span class="p">([</span> </span></span><span class="line"><span class="cl"> <span class="s1">'scheme'</span> <span class="o">=&gt;</span> <span class="s1">'tcp'</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s1">'host'</span> <span class="o">=&gt;</span> <span class="s1">'127.0.0.1'</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s1">'port'</span> <span class="o">=&gt;</span> <span class="mi">6379</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s1">'password'</span> <span class="o">=&gt;</span> <span class="s1">''</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s1">'database'</span> <span class="o">=&gt;</span> <span class="mi">0</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="p">]);</span> </span></span></code></pre> </div> <p> Create some test data to add to the database: </p> <div class="highlight"> <pre class="chroma"><code class="language-php" data-lang="php"><span class="line"><span class="cl"><span class="nv">$user1</span> <span class="o">=</span> <span class="nx">json_encode</span><span class="p">([</span> </span></span><span class="line"><span class="cl"> <span class="s1">'name'</span> <span class="o">=&gt;</span> <span class="s1">'Paul John'</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s1">'email'</span> <span class="o">=&gt;</span> <span class="s1">'[email protected]'</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s1">'age'</span> <span class="o">=&gt;</span> <span class="mi">42</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s1">'city'</span> <span class="o">=&gt;</span> <span class="s1">'London'</span><span class="p">,</span> </span></span><span class="line"><span class="cl"><span class="p">],</span> <span class="nx">JSON_THROW_ON_ERROR</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="nv">$user2</span> <span class="o">=</span> <span class="nx">json_encode</span><span class="p">([</span> </span></span><span class="line"><span class="cl"> <span class="s1">'name'</span> <span class="o">=&gt;</span> <span class="s1">'Eden Zamir'</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s1">'email'</span> <span class="o">=&gt;</span> <span class="s1">'[email protected]'</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s1">'age'</span> <span class="o">=&gt;</span> <span class="mi">29</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s1">'city'</span> <span class="o">=&gt;</span> <span class="s1">'Tel Aviv'</span><span class="p">,</span> </span></span><span class="line"><span class="cl"><span class="p">],</span> <span class="nx">JSON_THROW_ON_ERROR</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="nv">$user3</span> <span class="o">=</span> <span class="nx">json_encode</span><span class="p">([</span> </span></span><span class="line"><span class="cl"> <span class="s1">'name'</span> <span class="o">=&gt;</span> <span class="s1">'Paul Zamir'</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s1">'email'</span> <span class="o">=&gt;</span> <span class="s1">'[email protected]'</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s1">'age'</span> <span class="o">=&gt;</span> <span class="mi">35</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="s1">'city'</span> <span class="o">=&gt;</span> <span class="s1">'Tel Aviv'</span><span class="p">,</span> </span></span><span class="line"><span class="cl"><span class="p">],</span> <span class="nx">JSON_THROW_ON_ERROR</span><span class="p">);</span> </span></span></code></pre> </div> <p> Create an <a href="/docs/latest/develop/interact/search-and-query/indexing/"> index </a> . In this example, only JSON documents with the key prefix <code> user: </code> are indexed. For more information, see <a href="/docs/latest/develop/interact/search-and-query/query/"> Query syntax </a> . </p> <div class="highlight"> <pre class="chroma"><code class="language-php" data-lang="php"><span class="line"><span class="cl"><span class="nv">$schema</span> <span class="o">=</span> <span class="p">[</span> </span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="nx">TextField</span><span class="p">(</span><span class="s1">'$.name'</span><span class="p">,</span> <span class="s1">'name'</span><span class="p">),</span> </span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="nx">TagField</span><span class="p">(</span><span class="s1">'$.city'</span><span class="p">,</span> <span class="s1">'city'</span><span class="p">),</span> </span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="nx">NumericField</span><span class="p">(</span><span class="s1">'$.age'</span><span class="p">,</span> <span class="s2">"age"</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="k">try</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"><span class="nv">$r</span><span class="o">-&gt;</span><span class="na">ftCreate</span><span class="p">(</span><span class="s2">"idx:users"</span><span class="p">,</span> <span class="nv">$schema</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="p">(</span><span class="k">new</span> <span class="nx">CreateArguments</span><span class="p">())</span> </span></span><span class="line"><span class="cl"> <span class="o">-&gt;</span><span class="na">on</span><span class="p">(</span><span class="s1">'JSON'</span><span class="p">)</span> </span></span><span class="line"><span class="cl"> <span class="o">-&gt;</span><span class="na">prefix</span><span class="p">([</span><span class="s2">"user:"</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">catch</span> <span class="p">(</span><span class="nx">Exception</span> <span class="nv">$e</span><span class="p">)</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="k">echo</span> <span class="nv">$e</span><span class="o">-&gt;</span><span class="na">getMessage</span><span class="p">(),</span> <span class="nx">PHP_EOL</span><span class="p">;</span> </span></span><span class="line"><span class="cl"><span class="p">}</span> </span></span></code></pre> </div> <p> Add the three sets of user data to the database as <a href="/docs/latest/develop/data-types/json/"> JSON </a> objects. If you use keys with the <code> user: </code> prefix then Redis will index the objects automatically as you add them: </p> <div class="highlight"> <pre class="chroma"><code class="language-php" data-lang="php"><span class="line"><span class="cl"><span class="nv">$r</span><span class="o">-&gt;</span><span class="na">jsonset</span><span class="p">(</span><span class="s1">'user:1'</span><span class="p">,</span> <span class="s1">'$'</span><span class="p">,</span> <span class="nv">$user1</span><span class="p">);</span> </span></span><span class="line"><span class="cl"><span class="nv">$r</span><span class="o">-&gt;</span><span class="na">jsonset</span><span class="p">(</span><span class="s1">'user:2'</span><span class="p">,</span> <span class="s1">'$'</span><span class="p">,</span> <span class="nv">$user2</span><span class="p">);</span> </span></span><span class="line"><span class="cl"><span class="nv">$r</span><span class="o">-&gt;</span><span class="na">jsonset</span><span class="p">(</span><span class="s1">'user:3'</span><span class="p">,</span> <span class="s1">'$'</span><span class="p">,</span> <span class="nv">$user3</span><span class="p">);</span> </span></span></code></pre> </div> <p> You can now use the index to search the JSON objects. The <a href="/docs/latest/develop/interact/search-and-query/query/"> query </a> below searches for objects that have the text "Paul" in any field and have an <code> age </code> value in the range 30 to 40: </p> <div class="highlight"> <pre class="chroma"><code class="language-php" data-lang="php"><span class="line"><span class="cl"><span class="nv">$res</span> <span class="o">=</span> <span class="nv">$r</span><span class="o">-&gt;</span><span class="na">ftSearch</span><span class="p">(</span><span class="s2">"idx:users"</span><span class="p">,</span> <span class="s2">"Paul @age:[30 40]"</span><span class="p">);</span> </span></span><span class="line"><span class="cl"><span class="k">echo</span> <span class="nx">json_encode</span><span class="p">(</span><span class="nv">$res</span><span class="p">),</span> <span class="nx">PHP_EOL</span><span class="p">;</span> </span></span><span class="line"><span class="cl"><span class="c1">// &gt;&gt;&gt; [1,"user:3",["$","{\"name\":\"Paul Zamir\",\"email\":\"[email protected]\",\"age\":35,\"city\":\"London\"}"]] </span></span></span></code></pre> </div> <p> Specify query options to return only the <code> city </code> field: </p> <div class="highlight"> <pre class="chroma"><code class="language-php" data-lang="php"><span class="line"><span class="cl"><span class="nv">$arguments</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">SearchArguments</span><span class="p">();</span> </span></span><span class="line"><span class="cl"><span class="nv">$arguments</span><span class="o">-&gt;</span><span class="na">addReturn</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="s1">'$.city'</span><span class="p">,</span> <span class="k">true</span><span class="p">,</span> <span class="s1">'thecity'</span><span class="p">);</span> </span></span><span class="line"><span class="cl"><span class="nv">$arguments</span><span class="o">-&gt;</span><span class="na">dialect</span><span class="p">(</span><span class="mi">2</span><span class="p">);</span> </span></span><span class="line"><span class="cl"><span class="nv">$arguments</span><span class="o">-&gt;</span><span class="na">limit</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">5</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="nv">$res</span> <span class="o">=</span> <span class="nv">$r</span><span class="o">-&gt;</span><span class="na">ftSearch</span><span class="p">(</span><span class="s2">"idx:users"</span><span class="p">,</span> <span class="s2">"Paul"</span><span class="p">,</span> <span class="nv">$arguments</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="k">echo</span> <span class="nx">json_encode</span><span class="p">(</span><span class="nv">$res</span><span class="p">),</span> <span class="nx">PHP_EOL</span><span class="p">;</span> </span></span><span class="line"><span class="cl"><span class="c1">// &gt;&gt;&gt; [2,"user:1",["thecity","London"],"user:3",["thecity","Tel Aviv"]] </span></span></span></code></pre> </div> <p> Use an <a href="/docs/latest/develop/interact/search-and-query/query/aggregation/"> aggregation query </a> to count all users in each city. </p> <div class="highlight"> <pre class="chroma"><code class="language-php" data-lang="php"><span class="line"><span class="cl"><span class="nv">$ftAggregateArguments</span> <span class="o">=</span> <span class="p">(</span><span class="k">new</span> <span class="nx">AggregateArguments</span><span class="p">())</span> </span></span><span class="line"><span class="cl"><span class="o">-&gt;</span><span class="na">groupBy</span><span class="p">(</span><span class="s1">'@city'</span><span class="p">)</span> </span></span><span class="line"><span class="cl"><span class="o">-&gt;</span><span class="na">reduce</span><span class="p">(</span><span class="s1">'COUNT'</span><span class="p">,</span> <span class="k">true</span><span class="p">,</span> <span class="s1">'count'</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="nv">$res</span> <span class="o">=</span> <span class="nv">$r</span><span class="o">-&gt;</span><span class="na">ftAggregate</span><span class="p">(</span><span class="s1">'idx:users'</span><span class="p">,</span> <span class="s1">'*'</span><span class="p">,</span> <span class="nv">$ftAggregateArguments</span><span class="p">);</span> </span></span><span class="line"><span class="cl"><span class="k">echo</span> <span class="nx">json_encode</span><span class="p">(</span><span class="nv">$res</span><span class="p">),</span> <span class="nx">PHP_EOL</span><span class="p">;</span> </span></span><span class="line"><span class="cl"><span class="c1">// &gt;&gt;&gt; [2,["city","London","count","1"],["city","Tel Aviv","count","2"]] </span></span></span></code></pre> </div> <p> See the <a href="/docs/latest/develop/interact/search-and-query/"> Redis query engine </a> docs for a full description of all query features with examples. </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/clients/php/queryjson/"/> <div class="flex flex-row justify-between"> <div class="grid justify-center"> <span class="font-mono"> RATE THIS PAGE </span> <div class="star-rating"> <input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/> <label class="star" for="5-stars"> β˜… </label> <input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/> <label class="star" for="4-stars"> β˜… </label> <input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/> <label class="star" for="3-stars"> β˜… </label> <input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/> <label class="star" for="2-stars"> β˜… </label> <input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/> <label class="star" for="1-stars"> β˜… </label> </div> </div> <a class="font-mono no-underline" href="#"> Back to top ↑ </a> </div> <div class="hidden" id="feedback-form"> <div class="grid gap-2"> <textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea> <button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit"> Submit </button> </div> </div> </form> <script> document.addEventListener("DOMContentLoaded", function() { const form = document.querySelector("#page-feedback"); form.addEventListener("submit", function(event) { event.preventDefault(); var xhr = new XMLHttpRequest(); var url = "\/docusight\/api\/rate"; var params = new URLSearchParams(new FormData(form)); xhr.open("POST", url, true); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.onreadystatechange = function() { if (xhr.readyState === 4 && xhr.status === 200) { const responseData = JSON.parse(xhr.responseText); const responseMessage = responseData.response; const newText = document.createTextNode(responseMessage); form.parentNode.replaceChild(newText, form); } }; xhr.send(params); }); }); </script> </section>
https://redis.io/docs/latest/develop/interact/search-and-query/advanced-concepts/query_syntax.html
<section class="prose w-full py-12"> <h1> Query syntax </h1> <p class="text-lg -mt-5 mb-10"> Learn how to use query syntax </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 query syntax that RediSearch uses has improved over time, adding new features and making queries simpler to write. However, changing the syntax like this could potentially break existing queries that rely on an older version of the syntax. To avoid this problem, RediSearch supports different query syntax <em> dialects </em> to ensure backward compatibility. Any breaking changes to the syntax are introduced in a new dialect, while RediSearch continues to support older dialects. This means you can always choose the correct dialect to support the query you are using. See <a href="/docs/latest/develop/interact/search-and-query/advanced-concepts/dialects/"> Query dialects </a> for full details of the dialects and the RediSearch versions that introduced them. </div> </div> <h2 id="basic-syntax"> Basic syntax </h2> <p> You can use simple syntax for complex queries using these rules: </p> <ul> <li> <p> Exact phrases are wrapped in quotes, for example, <code> "hello world" </code> . </p> </li> <li> <p> Multiword phrases are lists of tokens, for example, <code> foo bar baz </code> , and imply intersection (AND) of the terms. </p> </li> <li> <p> <code> OR </code> unions are expressed with a pipe ( <code> | </code> ) character, for example, <code> hello|hallo|shalom|hola </code> . </p> <p> <strong> Notes </strong> : </p> <p> Consider the differences in parser behavior in example <code> hello world | "goodbye" moon </code> : </p> <ul> <li> In DIALECT 1, this query is interpreted as searching for <code> (hello world | "goodbye") moon </code> . </li> <li> In DIALECT 2 or greater, this query is interpreted as searching for either <code> hello world </code> <strong> OR </strong> <code> "goodbye" moon </code> . </li> </ul> </li> <li> <p> <code> NOT </code> negation of expressions or subqueries is expressed with a subtraction symbol ( <code> - </code> ), for example, <code> hello -world </code> . Purely negative queries such as <code> -foo </code> and <code> -@title:(foo|bar) </code> are also supported. </p> <p> <strong> Notes </strong> : </p> <p> Consider a simple query with negation <code> -hello world </code> : </p> <ul> <li> In DIALECT 1, this query is interpreted as "find values in any field that does not contain <code> hello </code> <strong> AND </strong> does not contain <code> world </code> ". The equivalent is <code> -(hello world) </code> or <code> -hello -world </code> . </li> <li> In DIALECT 2 or greater, this query is interpreted <code> as -hello </code> <strong> AND </strong> <code> world </code> (only <code> hello </code> is negated). </li> <li> In DIALECT 2 or greater, to achieve the default behavior of DIALECT 1, update your query to <code> -(hello world) </code> . </li> </ul> </li> <li> <p> Prefix/infix/suffix matches (all terms starting/containing/ending with a term) are expressed with an asterisk <code> * </code> . For performance reasons, a minimum term length is enforced. The default is 2, but it's configurable. </p> </li> <li> <p> In DIALECT 2 or greater, wildcard pattern matches are expressed as <code> "w'foo*bar?'" </code> . Note the use of double quotes to contain the <em> w </em> pattern. </p> </li> <li> <p> A special wildcard query that returns all results in the index is just the asterisk <code> * </code> . This cannot be combined with other options. </p> </li> <li> <p> As of v2.6.1, <code> DIALECT 3 </code> returns JSON rather than scalars from multivalue attributes. </p> </li> <li> <p> Selection of specific fields using the syntax <code> hello @field:world </code> . </p> </li> <li> <p> Numeric range matches on numeric fields with the syntax <code> @field:[{min} {max}] </code> . </p> </li> <li> <p> Georadius matches on geo fields with the syntax <code> @field:[{lon} {lat} {radius} {m|km|mi|ft}] </code> . </p> </li> <li> <p> As of 2.6, range queries on vector fields with the syntax <code> @field:[VECTOR_RANGE {radius} $query_vec] </code> , where <code> query_vec </code> is given as a query parameter. </p> </li> <li> <p> As of v2.4, k-nearest neighbors (KNN) queries on vector fields with or without pre-filtering with the syntax <code> {filter_query}=&gt;[KNN {num} @field $query_vec] </code> . </p> </li> <li> <p> Tag field filters with the syntax <code> @field:{tag | tag | ...} </code> . See the full documentation on <a href="/docs/latest/develop/interact/search-and-query/advanced-concepts/tags/"> tags </a> . </p> </li> <li> <p> Optional terms or clauses: <code> foo ~bar </code> means bar is optional but documents containing <code> bar </code> will rank higher. </p> </li> <li> <p> Fuzzy matching on terms: <code> %hello% </code> means all terms with Levenshtein distance of 1 from it. Use multiple pairs of '%' brackets, up to three deep, to increase the Levenshtein distance. </p> </li> <li> <p> An expression in a query can be wrapped in parentheses to disambiguate, for example, <code> (hello|hella) (world|werld) </code> . </p> </li> <li> <p> Query attributes can be applied to individual clauses, for example, <code> (foo bar) =&gt; { $weight: 2.0; $slop: 1; $inorder: false; } </code> . </p> </li> <li> <p> Combinations of the above can be used together, for example, <code> hello (world|foo) "bar baz" bbbb </code> . </p> </li> </ul> <h2 id="pure-negative-queries"> Pure negative queries </h2> <p> As of v0.19.3, it is possible to have a query consisting of just a negative expression. For example <code> -hello </code> or <code> -(@title:(foo|bar)) </code> . The results are all the documents not containing the query terms. </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> Any complex expression can be negated this way, however, caution should be taken here: if a negative expression has little or no results, this is equivalent to traversing and ranking all the documents in the index, which can be slow and cause high CPU consumption. </div> </div> <h2 id="field-modifiers"> Field modifiers </h2> <p> You can specify field modifiers in a query, and not just by using the <code> INFIELDS </code> global keyword. </p> <p> To specify which fields the query matches, prepend the expression with the <code> @ </code> symbol, the field name, and a <code> : </code> (colon) symbol, for each expression or subexpression. </p> <p> If a field modifier precedes multiple words or expressions, it applies only to the adjacent expression with DIALECT 1. With DIALECT 2 or greater, you extend the query to other fields. </p> <p> Consider this simple query: <code> @name:James Brown </code> . Here, the field modifier <code> @name </code> is followed by two words: <code> James </code> and <code> Brown </code> . </p> <ul> <li> In DIALECT 1, this query would be interpreted as "find <code> James Brown </code> in the <code> @name </code> field". </li> <li> In DIALECT 2 or greater, this query will be interpreted as "find <code> James </code> in the <code> @name </code> field <strong> AND </strong> <code> Brown </code> in <strong> ANY </strong> text field. In other words, it would be interpreted as <code> (@name:James) Brown </code> . </li> <li> In DIALECT 2 or greater, to achieve the default behavior of DIALECT 1, update your query to <code> @name:(James Brown) </code> . </li> </ul> <p> If a field modifier precedes an expression in parentheses, it applies only to the expression inside the parentheses. The expression should be valid for the specified field, otherwise it is skipped. </p> <p> To create complex filtering on several fields, you can combine multiple modifiers. For example, if you have an index of car models, with a vehicle class, country of origin, and engine type, you can search for SUVs made in Korea with hybrid or diesel engines using the following query: </p> <pre tabindex="0"><code>FT.SEARCH cars "@country:korea @engine:(diesel|hybrid) @class:suv" </code></pre> <p> You can apply multiple modifiers to the same term or grouped terms: </p> <pre tabindex="0"><code>FT.SEARCH idx "@title|body:(hello world) @url|image:mydomain" </code></pre> <p> Now, you search for documents that have <code> "hello" </code> and <code> "world" </code> either in the body or the title and the term <code> mydomain </code> in their <code> url </code> or <code> image </code> fields. </p> <h2 id="numeric-filters-in-query"> Numeric filters in query </h2> <p> If a field in the schema is defined as NUMERIC, it is possible to use the FILTER argument in the Redis request or filter with it by specifying filtering rules in the query. The syntax is <code> @field:[{min} {max}] </code> , for example, <code> @price:[100 200] </code> . </p> <h3 id="a-few-notes-on-numeric-predicates"> A few notes on numeric predicates </h3> <ol> <li> <p> It is possible to specify a numeric predicate as the entire query, whereas it is impossible to do it with the <code> FILTER </code> argument. </p> </li> <li> <p> It is possible to intersect or union multiple numeric filters in the same query, be it for the same field or different ones. </p> </li> <li> <p> <code> -inf </code> , <code> inf </code> and <code> +inf </code> are acceptable numbers in a range. Therefore, <em> greater than 100 </em> is expressed as <code> [(100 inf] </code> . </p> </li> <li> <p> Numeric filters are inclusive. Exclusive min or max are expressed with <code> ( </code> prepended to the number, for example, <code> [(100 (200] </code> . </p> </li> <li> <p> It is possible to negate a numeric filter by prepending a <code> - </code> sign to the filter. For example, returning a result where price differs from 100 is expressed as: <code> @title:foo -@price:[100 100] </code> . </p> </li> </ol> <h2 id="tag-filters"> Tag filters </h2> <p> As of v0.91, you can use a special field type called a <a href="/docs/latest/develop/interact/search-and-query/advanced-concepts/tags/"> <em> tag field </em> </a> , with simpler <a href="/docs/latest/develop/interact/search-and-query/advanced-concepts/escaping/#tokenization-rules-for-tag-fields"> tokenization </a> and encoding in the index. You can't access the values in these fields using a general fieldless search. Instead, you use special syntax: </p> <pre tabindex="0"><code>@field:{ tag | tag | ...} </code></pre> <p> Example: </p> <pre tabindex="0"><code>@cities:{ New York | Los Angeles | Barcelona } </code></pre> <p> Tags can have multiple words or include other punctuation marks other than the field's separator ( <code> , </code> by default). The following characters in tags should be escaped with a backslash ( <code> \ </code> ): <code> $ </code> , <code> { </code> , <code> } </code> , <code> \ </code> , and <code> | </code> . </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 RediSearch 2.4, it was also recommended to escape spaces. The reason was that, if a multiword tag included stopwords, a syntax error was returned. So tags, like "to be or not to be" needed be escaped as "to\ be\ or\ not\ to\ be". For good measure, you also could escape all spaces within tags. Starting with RediSearch 2.4, using <a href="/docs/latest/develop/interact/search-and-query/advanced-concepts/dialects/#dialect-2"> <code> DIALECT 2 </code> </a> or greater you can use spaces in a <code> tag </code> query, even with stopwords. </div> </div> <p> Notice that multiple tags in the same clause create a union of documents containing either tags. To create an intersection of documents containing all tags, you should repeat the tag filter several times. For example: </p> <pre tabindex="0"><code># Return all documents containing all three cities as tags @cities:{ New York } @cities:{Los Angeles} @cities:{ Barcelona } # Now, return all documents containing either city @cities:{ New York | Los Angeles | Barcelona } </code></pre> <p> Tag clauses can be combined into any subclause, used as negative expressions, optional expressions, and so on. </p> <h2 id="geo-filters"> Geo filters </h2> <p> As of v0.21, it is possible to add geo radius queries directly into the query language with the syntax <code> @field:[{lon} {lat} {radius} {m|km|mi|ft}] </code> . This filters the result to a given radius from a lon,lat point, defined in meters, kilometers, miles or feet. See Redis's own <a href="/docs/latest/commands/georadius/"> <code> GEORADIUS </code> </a> command for more details. </p> <p> Radius filters can be added into the query just like numeric filters. For example, in a database of businesses, looking for Chinese restaurants near San Francisco (within a 5km radius) would be expressed as: <code> chinese restaurant @location:[-122.41 37.77 5 km] </code> . </p> <h2 id="polygon-search"> Polygon search </h2> <p> Geospatial databases are essential for managing and analyzing location-based data in a variety of industries. They help organizations make data-driven decisions, optimize operations, and achieve their strategic goals more efficiently. Polygon search extends Redis's geospatial search capabilities to be able to query against a value in a <code> GEOSHAPE </code> attribute. This value must follow a <a href="https://en.wikipedia.org/wiki/Well-known_text_representation_of_geometry"> "well-known text" </a> (WKT) representation of geometry. Two such geometries are supported: </p> <ul> <li> <code> POINT </code> , for example <code> POINT(2 4) </code> . </li> <li> <code> POLYGON </code> , for example <code> POLYGON((2 2, 2 8, 6 11, 10 8, 10 2, 2 2)) </code> . </li> </ul> <p> There is a new schema field type called <code> GEOSHAPE </code> , which can be specified as either: </p> <ul> <li> <code> FLAT </code> for Cartesian X Y coordinates </li> <li> <code> SPHERICAL </code> for geographic longitude and latitude coordinates. This is the default coordinate system. </li> </ul> <p> Finally, there's new <a href="/docs/latest/commands/ft.search/"> <code> FT.SEARCH </code> </a> syntax that allows you to query for polygons that either contain or are within a given geoshape. </p> <p> <code> @field:[{WITHIN|CONTAINS} $geometry] PARAMS 2 geometry {geometry} </code> </p> <p> Here's an example using two stacked polygons that represent a box contained within a house. </p> <p> <img alt="two stacked polygons" src="/docs/latest/develop/interact/search-and-query/img/polygons.png"/> </p> <p> First, create an index using a <code> FLAT </code> <code> GEOSHAPE </code> , representing a 2D X Y coordinate system. </p> <p> <code> FT.CREATE polygon_idx PREFIX 1 shape: SCHEMA g GEOSHAPE FLAT t TEXT </code> </p> <p> Next, create the data structures that represent the geometries in the picture. </p> <div class="highlight"> <pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">HSET shape:1 t <span class="s2">"this is my house"</span> g <span class="s2">"POLYGON((2 2, 2 8, 6 11, 10 8, 10 2, 2 2))"</span> </span></span><span class="line"><span class="cl">HSET shape:2 t <span class="s2">"this is a square in my house"</span> g <span class="s2">"POLYGON((4 4, 4 6, 6 6, 6 4, 4 4))"</span> </span></span></code></pre> </div> <p> Finally, use <a href="/docs/latest/commands/ft.search/"> <code> FT.SEARCH </code> </a> to query the geometries. Note the use of <code> DIALECT 3 </code> , which is required. Here are a few examples. </p> <p> Search for a polygon that contains a specified point: </p> <div class="highlight"> <pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">FT.SEARCH polygon_idx <span class="s2">"@g:[CONTAINS </span><span class="nv">$point</span><span class="s2">]"</span> PARAMS <span class="m">2</span> point <span class="s1">'POINT(8 8)'</span> DIALECT <span class="m">3</span> </span></span><span class="line"><span class="cl">1<span class="o">)</span> <span class="o">(</span>integer<span class="o">)</span> <span class="m">1</span> </span></span><span class="line"><span class="cl">2<span class="o">)</span> <span class="s2">"shape:1"</span> </span></span><span class="line"><span class="cl">3<span class="o">)</span> 1<span class="o">)</span> <span class="s2">"t"</span> </span></span><span class="line"><span class="cl"> 2<span class="o">)</span> <span class="s2">"this is my house"</span> </span></span><span class="line"><span class="cl"> 3<span class="o">)</span> <span class="s2">"g"</span> </span></span><span class="line"><span class="cl"> 4<span class="o">)</span> <span class="s2">"POLYGON((2 2, 2 8, 6 11, 10 8, 10 2, 2 2))"</span> </span></span></code></pre> </div> <p> Search for geometries contained in a specified polygon: </p> <div class="highlight"> <pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">FT.SEARCH polygon_idx <span class="s2">"@g:[WITHIN </span><span class="nv">$poly</span><span class="s2">]"</span> PARAMS <span class="m">2</span> poly <span class="s1">'POLYGON((0 0, 0 100, 100 100, 100 0, 0 0))'</span> DIALECT <span class="m">3</span> </span></span><span class="line"><span class="cl">1<span class="o">)</span> <span class="o">(</span>integer<span class="o">)</span> <span class="m">2</span> </span></span><span class="line"><span class="cl">2<span class="o">)</span> <span class="s2">"shape:2"</span> </span></span><span class="line"><span class="cl">3<span class="o">)</span> 1<span class="o">)</span> <span class="s2">"t"</span> </span></span><span class="line"><span class="cl"> 2<span class="o">)</span> <span class="s2">"this is a square in my house"</span> </span></span><span class="line"><span class="cl"> 3<span class="o">)</span> <span class="s2">"g"</span> </span></span><span class="line"><span class="cl"> 4<span class="o">)</span> <span class="s2">"POLYGON((4 4, 4 6, 6 6, 6 4, 4 4))"</span> </span></span><span class="line"><span class="cl">4<span class="o">)</span> <span class="s2">"shape:1"</span> </span></span><span class="line"><span class="cl">5<span class="o">)</span> 1<span class="o">)</span> <span class="s2">"t"</span> </span></span><span class="line"><span class="cl"> 2<span class="o">)</span> <span class="s2">"this is my house"</span> </span></span><span class="line"><span class="cl"> 3<span class="o">)</span> <span class="s2">"g"</span> </span></span><span class="line"><span class="cl"> 4<span class="o">)</span> <span class="s2">"POLYGON((2 2, 2 8, 6 11, 10 8, 10 2, 2 2))"</span> </span></span></code></pre> </div> <p> Search for a polygon that is not contained in the indexed geometries: </p> <div class="highlight"> <pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">FT.SEARCH polygon_idx <span class="s2">"@g:[CONTAINS </span><span class="nv">$poly</span><span class="s2">]"</span> PARAMS <span class="m">2</span> poly <span class="s1">'POLYGON((14 4, 14 6, 16 6, 16 4, 14 4))'</span> DIALECT <span class="m">3</span> </span></span><span class="line"><span class="cl">1<span class="o">)</span> <span class="o">(</span>integer<span class="o">)</span> <span class="m">0</span> </span></span></code></pre> </div> <p> Search for a polygon that is known to be contained within the geometries (the box): </p> <div class="highlight"> <pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">FT.SEARCH polygon_idx <span class="s2">"@g:[CONTAINS </span><span class="nv">$poly</span><span class="s2">]"</span> PARAMS <span class="m">2</span> poly <span class="s1">'POLYGON((4 4, 4 6, 6 6, 6 4, 4 4))'</span> DIALECT <span class="m">3</span> </span></span><span class="line"><span class="cl">1<span class="o">)</span> <span class="o">(</span>integer<span class="o">)</span> <span class="m">2</span> </span></span><span class="line"><span class="cl">2<span class="o">)</span> <span class="s2">"shape:1"</span> </span></span><span class="line"><span class="cl">3<span class="o">)</span> 1<span class="o">)</span> <span class="s2">"t"</span> </span></span><span class="line"><span class="cl"> 2<span class="o">)</span> <span class="s2">"this is my house"</span> </span></span><span class="line"><span class="cl"> 3<span class="o">)</span> <span class="s2">"g"</span> </span></span><span class="line"><span class="cl"> 4<span class="o">)</span> <span class="s2">"POLYGON((2 2, 2 8, 6 11, 10 8, 10 2, 2 2))"</span> </span></span><span class="line"><span class="cl">4<span class="o">)</span> <span class="s2">"shape:2"</span> </span></span><span class="line"><span class="cl">5<span class="o">)</span> 1<span class="o">)</span> <span class="s2">"t"</span> </span></span><span class="line"><span class="cl"> 2<span class="o">)</span> <span class="s2">"this is a square in my house"</span> </span></span><span class="line"><span class="cl"> 3<span class="o">)</span> <span class="s2">"g"</span> </span></span><span class="line"><span class="cl"> 4<span class="o">)</span> <span class="s2">"POLYGON((4 4, 4 6, 6 6, 6 4, 4 4))"</span> </span></span></code></pre> </div> <p> Note that both the house and box shapes were returned. </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> GEOSHAPE does not support JSON multi-value or SORTABLE options. </div> </div> <p> For more examples, see the <a href="/docs/latest/commands/ft.create/"> <code> FT.CREATE </code> </a> and <a href="/docs/latest/commands/ft.search/"> <code> FT.SEARCH </code> </a> command pages. </p> <h2 id="vector-search"> Vector search </h2> <p> You can add vector similarity queries directly into the query language by: </p> <ol> <li> <p> Using a <strong> range </strong> query with the syntax of <code> @vector:[VECTOR_RANGE {radius} $query_vec] </code> , which filters the results to a given radius from a given query vector. The distance metric derives from the definition of a @vector field in the index schema, for example, Cosine or L2 (as of v2.6.1). </p> </li> <li> <p> Running a k nearest neighbors (KNN) query on a @vector field. The basic syntax is <code> "*=&gt;[ KNN {num|$num} @vector $query_vec ]" </code> . It is also possible to run a hybrid query on filtered results. A hybrid query allows the user to specify a filter criteria that all results in a KNN query must satisfy. The filter criteria can include any type of field (i.e., indexes created on both vectors and other values, such as TEXT, PHONETIC, NUMERIC, GEO, etc.). The general syntax for hybrid query is <code> {some filter query}=&gt;[ KNN {num|$num} @vector $query_vec] </code> , where <code> =&gt; </code> separates the filter query from the vector KNN query. </p> </li> </ol> <p> <strong> Examples: </strong> </p> <ul> <li> <p> Return 10 nearest neighbors entities in which <code> query_vec </code> is closest to the vector stored in <code> @vector_field </code> : </p> <p> <code> *=&gt;[KNN 10 @vector_field $query_vec] </code> </p> </li> <li> <p> Among entities published between 2020 and 2022, return 10 nearest neighbors entities in which <code> query_vec </code> is closest to the vector stored in <code> @vector_field </code> : </p> <p> <code> @published_year:[2020 2022]=&gt;[KNN 10 @vector_field $query_vec] </code> </p> </li> <li> <p> Return every entity for which the distance between the vector stored under its @vector_field and <code> query_vec </code> is at most 0.5, in terms of the @vector_field distance metric: </p> <p> <code> @vector_field:[VECTOR_RANGE 0.5 $query_vec] </code> </p> </li> </ul> <p> As of v2.4, the KNN vector search can be used at most once in a query, while, as of v2.6, the vector range filter can be used multiple times in a query. For more information on vector similarity syntax, see <a href="/docs/latest/develop/interact/search-and-query/advanced-concepts/vectors/"> Querying vector fields </a> , and <a href="/docs/latest/develop/interact/search-and-query/advanced-concepts/vectors#vector-search-examples"> Vector search examples </a> sections. </p> <h2 id="prefix-matching"> Prefix matching </h2> <p> When indexes are updated, Redis maintains a dictionary of all terms in the index. This can be used to match all terms starting with a given prefix. Selecting prefix matches is done by appending <code> * </code> to a prefix token. For example: </p> <pre tabindex="0"><code>hel* world </code></pre> <p> Will be expanded to cover <code> (hello|help|helm|...) world </code> . </p> <h3 id="a-few-notes-on-prefix-searches"> A few notes on prefix searches </h3> <ol> <li> <p> As prefixes can be expanded into many terms, use them with caution. The expansion will create a Union operation of all suffixes. </p> </li> <li> <p> As a protective measure to avoid selecting too many terms, blocking Redis, which is single threaded, there are two limitations on prefix matching: </p> </li> </ol> <ul> <li> <p> Prefixes are limited to 2 letters or more. You can change this number by using the <code> MINPREFIX </code> setting on the module command line. </p> </li> <li> <p> The minimum word length to stem is 4 letters or more. You can change this number by using the <code> MINSTEMLEN </code> setting on the module command line. </p> </li> <li> <p> Expansion is limited to 200 terms or less. You can change this number by using the <code> MAXEXPANSIONS </code> setting on the module command line. </p> </li> </ul> <ol start="3"> <li> <p> Prefix matching fully supports Unicode and is case insensitive. </p> </li> <li> <p> Currently, there is no sorting or bias based on suffix popularity. </p> </li> </ol> <h2 id="infixsuffix-matching"> Infix/suffix matching </h2> <p> As of v2.6.0, the dictionary can be used for infix (contains) or suffix queries by appending <code> * </code> to the token. For example: </p> <pre tabindex="0"><code>*sun* *ing </code></pre> <p> These queries are CPU intensive because they require iteration over the whole dictionary. </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> All notes about prefix searches also apply to infix/suffix queries. </div> </div> <h3 id="using-a-suffix-trie"> Using a suffix trie </h3> <p> A suffix trie maintains a list of terms that match the suffix. If you add a suffix trie to a field using the <code> WITHSUFFIXTRIE </code> keyword, you can create more efficient infix and suffix queries because it eliminates the need to iterate over the whole dictionary. However, the iteration on the union does not change. </p> <p> Suffix queries create a union of the list of terms from the suffix term node. Infix queries use the suffix terms as prefixes to the trie and create a union of all terms from all matching nodes. </p> <h2 id="wildcard-matching"> Wildcard matching </h2> <p> As of v2.6.0, you can use the dictionary for wildcard matching queries with these parameters. </p> <ul> <li> <code> ? </code> - for any single character </li> <li> <code> * </code> - for any character repeating zero or more times </li> <li> ' and \ - for escaping; other special characters are ignored </li> </ul> <p> An example of the syntax is <code> "w'foo*bar?'" </code> . </p> <h3 id="using-a-suffix-trie-1"> Using a suffix trie </h3> <p> A suffix trie maintains a list of terms which match the suffix. If you add a suffix trie to a field using the <code> WITHSUFFIXTRIE </code> keyword, you can create more efficient wildcard matching queries because it eliminates the need to iterate over the whole dictionary. However, the iteration on the union does not change. </p> <p> With a suffix trie, the wildcard pattern is broken into tokens at every <code> * </code> character. A heuristic is used to choose the token with the least terms, and each term is matched with the wildcard pattern. </p> <h2 id="fuzzy-matching"> Fuzzy matching </h2> <p> As of v1.2.0, the dictionary of all terms in the index can also be used to perform <a href="https://en.wikipedia.org/wiki/Approximate_string_matching"> fuzzy matching </a> . Fuzzy matches are performed based on <a href="https://en.wikipedia.org/wiki/Levenshtein_distance"> Levenshtein distance </a> (LD). Fuzzy matching on a term is performed by surrounding the term with '%', for example: </p> <pre tabindex="0"><code>%hello% world </code></pre> <p> This performs fuzzy matching on <code> hello </code> for all terms where LD is 1. </p> <p> As of v1.4.0, the LD of the fuzzy match can be set by the number of '%' characters surrounding it, so that <code> %%hello%% </code> will perform fuzzy matching on 'hello' for all terms where LD is 2. </p> <p> The maximum LD for fuzzy matching is 3. </p> <h2 id="wildcard-queries"> Wildcard queries </h2> <p> As of v1.1.0, you can use a special query to retrieve all the documents in an index. This is meant mostly for the aggregation engine. You can call it by specifying only a single star sign as the query string, in other words, <code> FT.SEARCH myIndex * </code> . </p> <p> You can't combine this with any other filters, field modifiers, or anything inside the query. It is technically possible to use the deprecated <code> FILTER </code> and <code> GEOFILTER </code> request parameters outside the query string in conjunction with a wildcard, but this makes the wildcard meaningless and only hurts performance. </p> <h2 id="query-attributes"> Query attributes </h2> <p> As of v1.2.0, you can apply specific query modifying attributes to specific clauses of the query. </p> <p> The syntax is <code> (foo bar) =&gt; { $attribute: value; $attribute:value; ...} </code> : </p> <pre tabindex="0"><code>(foo bar) =&gt; { $weight: 2.0; $slop: 1; $inorder: true; } ~(bar baz) =&gt; { $weight: 0.5; } </code></pre> <p> The supported attributes are: </p> <ol> <li> <strong> $weight </strong> : determines the weight of the sub-query or token in the overall ranking on the result (default: 1.0). </li> <li> <strong> $slop </strong> : determines the maximum allowed slop (space between terms) in the query clause (default: 0). </li> <li> <strong> $inorder </strong> : whether or not the terms in a query clause must appear in the same order as in the query. This is usually set alongside with <code> $slop </code> (default: false). </li> <li> <strong> $phonetic </strong> : whether or not to perform phonetic matching (default: true). Note: setting this attribute to true for fields which were not created as <code> PHONETIC </code> will produce an error. </li> </ol> <p> As of v2.6.1, the query attributes syntax supports these additional attributes: </p> <ul> <li> <strong> $yield_distance_as </strong> : specifies the distance field name, used for later sorting and/or returning, for clauses that yield some distance metric. It is currently supported for vector queries only (both KNN and range). </li> <li> <strong> vector query params </strong> : pass optional parameters for <a href="/docs/latest/develop/interact/search-and-query/advanced-concepts/vectors#querying-vector-fields"> vector queries </a> in key-value format. </li> </ul> <h2 id="a-few-query-examples"> A few query examples </h2> <ul> <li> <p> Simple phrase query - <code> hello </code> <em> AND </em> <code> world </code> : </p> <pre><code> hello world </code></pre> </li> <li> <p> Exact phrase query - <code> hello </code> <em> FOLLOWED BY </em> <code> world </code> : </p> <pre><code> "hello world" </code></pre> </li> <li> <p> Union - documents containing either <code> hello </code> <em> OR </em> <code> world </code> : </p> <pre><code> hello|world </code></pre> </li> <li> <p> Not - documents containing <code> hello </code> <em> BUT NOT </em> <code> world </code> : </p> <pre><code> hello -world </code></pre> </li> <li> <p> Intersection of unions: </p> <pre><code> (hello|halo) (world|werld) </code></pre> </li> <li> <p> Negation of union: </p> <pre><code> hello -(world|werld) </code></pre> </li> <li> <p> Union inside phrase: </p> <pre><code> (barack|barrack) obama </code></pre> </li> <li> <p> Optional terms with higher priority to ones containing more matches: </p> <pre><code> obama ~barack ~michelle </code></pre> </li> <li> <p> Exact phrase in one field, one word in another field: </p> <pre><code> @title:"barack obama" @job:president </code></pre> </li> <li> <p> Combined <em> AND </em> , <em> OR </em> with field specifiers: </p> <pre><code> @title:"hello world" @body:(foo bar) @category:(articles|biographies) </code></pre> </li> <li> <p> Prefix/infix/suffix queries: </p> <pre><code> hello worl* hel* *worl hello -*worl* </code></pre> </li> <li> <p> Wildcard matching queries: </p> <pre><code> "w'foo??bar??baz'" "w'???????'" "w'hello*world'" </code></pre> </li> <li> <p> Numeric filtering - products named <code> tv </code> with a price range of 200 to 500: </p> <pre><code> @name:tv @price:[200 500] </code></pre> </li> <li> <p> Numeric filtering - users with age greater than 18: </p> <pre><code> @age:[(18 +inf] </code></pre> </li> </ul> <h2 id="mapping-common-sql-predicates-to-redis-query-engine"> Mapping common SQL predicates to Redis Query Engine </h2> <table> <thead> <tr> <th> SQL Condition </th> <th> Redis Query Engine Equivalent </th> <th> Comments </th> </tr> </thead> <tbody> <tr> <td> WHERE x='foo' AND y='bar' </td> <td> @x:foo @y:bar </td> <td> for less ambiguity use (@x:foo) (@y:bar) </td> </tr> <tr> <td> WHERE x='foo' AND y!='bar' </td> <td> @x:foo -@y:bar </td> <td> </td> </tr> <tr> <td> WHERE x='foo' OR y='bar' </td> <td> (@x:foo)|(@y:bar) </td> <td> </td> </tr> <tr> <td> WHERE x IN ('foo', 'bar','hello world') </td> <td> @x:(foo|bar|"hello world") </td> <td> quotes mean exact phrase </td> </tr> <tr> <td> WHERE y='foo' AND x NOT IN ('foo','bar') </td> <td> @y:foo (-@x:foo) (-@x:bar) </td> <td> </td> </tr> <tr> <td> WHERE x NOT IN ('foo','bar') </td> <td> -@x:(foo|bar) </td> <td> </td> </tr> <tr> <td> WHERE num BETWEEN 10 AND 20 </td> <td> @num:[10 20] </td> <td> </td> </tr> <tr> <td> WHERE num &gt;= 10 </td> <td> @num:[10 +inf] </td> <td> </td> </tr> <tr> <td> WHERE num &gt; 10 </td> <td> @num:[(10 +inf] </td> <td> </td> </tr> <tr> <td> WHERE num &lt; 10 </td> <td> @num:[-inf (10] </td> <td> </td> </tr> <tr> <td> WHERE num &lt;= 10 </td> <td> @num:[-inf 10] </td> <td> </td> </tr> <tr> <td> WHERE num &lt; 10 OR num &gt; 20 </td> <td> @num:[-inf (10] | @num:[(20 +inf] </td> <td> </td> </tr> <tr> <td> WHERE name LIKE 'john%' </td> <td> @name:john* </td> <td> </td> </tr> </tbody> </table> <h2 id="technical-notes"> Technical notes </h2> <p> The query parser is built using the Lemon Parser Generator and a Ragel based lexer. You can see the <code> DIALECT 2 </code> grammar definition <a href="https://github.com/RediSearch/RediSearch/blob/master/src/query_parser/v2/parser.y"> at this git repo </a> . </p> <p> You can also see the <a href="/docs/latest/develop/interact/search-and-query/basic-constructs/configuration-parameters#default_dialect"> DEFAULT_DIALECT </a> configuration parameter. </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/advanced-concepts/query_syntax/"/> <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.initbydim.html
<section class="prose w-full py-12"> <h1 class="command-name"> CMS.INITBYDIM </h1> <div class="font-semibold text-redis-ink-900"> Syntax </div> <pre class="command-syntax">CMS.INITBYDIM key width depth</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 Count-Min Sketch to dimensions specified by user. </p> <h3 id="parameters"> Parameters: </h3> <ul> <li> <strong> key </strong> : The name of the sketch. </li> <li> <strong> width </strong> : Number of counters in each array. Reduces the error size. </li> <li> <strong> depth </strong> : Number of counter-arrays. Reduces the probability for an error of a certain size (percentage of total count). </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; CMS.INITBYDIM test 2000 5 OK </code></pre> <br/> <form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback"> <input class="hidden" name="origin" value="https://redis.io/docs/latest/commands/cms.initbydim/"/> <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/active-active/edit-rerc/.html
<section class="prose w-full py-12 max-w-none"> <h1> Edit Redis Enterprise remote clusters </h1> <p class="text-lg -mt-5 mb-10"> Edit the configuration details of an existing RERC with Redis Enterprise for Kubernetes. </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> This feature is supported for general availability in releases 6.4.2-6 and later. 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. and later. </div> </div> <p> Before a RedisEnterpriseCluster (REC) can participate in an Active-Active database, it needs an accompanying RedisEnterpriseRemoteCluster (RERC) custom resource. The RERC contains details allowing the REC to link to the RedisEnterpriseActiveActiveDatabase (REAADB). The RERC resource is listed in the REAADB resource to become a participating cluster for the Active-Active database. </p> <p> The RERC controller periodically connects to the local REC endpoint via its external address, to ensure it’s setup correctly. For this to work, the external load balancer must support <a href="https://en.wikipedia.org/wiki/Network_address_translation#NAT_loopback"> NAT hairpinning </a> . In some cloud environments, this may involve disabling IP preservation for the load balancer target groups. </p> <p> For more details, see the <a href="/docs/latest/operate/kubernetes/reference/redis_enterprise_remote_cluster_api/"> RERC API reference </a> . </p> <h2 id="edit-rerc"> Edit RERC </h2> <p> Use the <code> kubectl patch rerc &lt;rerc-name&gt; --type merge --patch </code> command to patch the local RERC custom resource with your changes. For a full list of available fields, see the <a href="/docs/latest/operate/kubernetes/reference/redis_enterprise_remote_cluster_api/"> RERC API reference </a> . </p> <p> The following example edits the <code> dbFqdnSuffix </code> field for the RERC named <code> rerc-ohare </code> . </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">kubectl patch rerc rerc-ohare --type merge --patch <span class="se">\ </span></span></span><span class="line"><span class="cl"><span class="se"></span><span class="s1">'{"spec":{"dbFqdnSuffix": "-example2-cluster-rec-chicago-ns-illinois.example.com"}}'</span> </span></span></code></pre> </div> <h2 id="update-rerc-secret"> Update RERC secret </h2> <p> If the credentials are changed or updated for a REC participating cluster, you need to manually edit the RERC secret and apply it to all participating clusters. </p> <ol> <li> <p> On the local cluster, update the secret with new credentials and name it with the following convention: <code> redis-enterprise-&lt;rerc-name&gt; </code> . </p> <p> A secret for a remote cluster named <code> rerc-ohare </code> would be similar to the following: </p> <div class="highlight"> <pre class="chroma"><code class="language-yaml" data-lang="yaml"><span class="line"><span class="cl"><span class="nt">apiVersion</span><span class="p">:</span><span class="w"> </span><span class="l">v1</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">data</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">password</span><span class="p">:</span><span class="w"> </span><span class="l">PHNvbWUgcGFzc3dvcmQ+</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">username</span><span class="p">:</span><span class="w"> </span><span class="l">PHNvbWUgdXNlcj4</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">kind</span><span class="p">:</span><span class="w"> </span><span class="l">Secret</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">metadata</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l">redis-enterprise-rerc-ohare</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">Opaque</span><span class="w"> </span></span></span></code></pre> </div> </li> <li> <p> Apply the file. </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">kubectl apply -f &lt;secret-file&gt; </span></span></code></pre> </div> </li> <li> <p> Watch the RERC to verify the status is "Active" and the spec status is "Valid." </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">kubectl get rerc &lt;rerc-name&gt; </span></span></code></pre> </div> <p> The output should look like this: </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl"> NAME STATUS SPEC STATUS LOCAL </span></span><span class="line"><span class="cl"> rerc-ohare Active Valid <span class="nb">true</span> </span></span></code></pre> </div> <p> To troubleshoot invalid configurations, view the RERC custom resource events and the <a href="/docs/latest/operate/kubernetes/logs/"> Redis Enterprise operator logs </a> . </p> </li> <li> <p> Verify the status of each REAADB using that RERC is "Active" and the spec status is "Valid." </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">kubectl get reaadb reaadb-boeing </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl">NAME STATUS SPEC STATUS LINKED REDBS REPLICATION STATUS </span></span><span class="line"><span class="cl">reaadb-boeing active Valid up </span></span></code></pre> </div> <p> To troubleshoot invalid configurations, view the RERC custom resource events and the <a href="/docs/latest/operate/kubernetes/logs/"> Redis Enterprise operator logs </a> . </p> </li> <li> <p> Repeat the above steps on all other participating clusters. </p> </li> </ol> <form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback"> <input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/kubernetes/active-active/edit-rerc/"/> <div class="flex flex-row justify-between"> <div class="grid justify-center"> <span class="font-mono"> RATE THIS PAGE </span> <div class="star-rating"> <input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/> <label class="star" for="5-stars"> β˜… </label> <input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/> <label class="star" for="4-stars"> β˜… </label> <input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/> <label class="star" for="3-stars"> β˜… </label> <input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/> <label class="star" for="2-stars"> β˜… </label> <input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/> <label class="star" for="1-stars"> β˜… </label> </div> </div> <a class="font-mono no-underline" href="#"> Back to top ↑ </a> </div> <div class="hidden" id="feedback-form"> <div class="grid gap-2"> <textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea> <button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit"> Submit </button> </div> </div> </form> <script> document.addEventListener("DOMContentLoaded", function() { const form = document.querySelector("#page-feedback"); form.addEventListener("submit", function(event) { event.preventDefault(); var xhr = new XMLHttpRequest(); var url = "\/docusight\/api\/rate"; var params = new URLSearchParams(new FormData(form)); xhr.open("POST", url, true); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.onreadystatechange = function() { if (xhr.readyState === 4 && xhr.status === 200) { const responseData = JSON.parse(xhr.responseText); const responseMessage = responseData.response; const newText = document.createTextNode(responseMessage); form.parentNode.replaceChild(newText, form); } }; xhr.send(params); }); }); </script> </section>
https://redis.io/docs/latest/operate/rs/7.4/references/rest-api/objects/job_scheduler/.html
<section class="prose w-full py-12 max-w-none"> <h1> Job scheduler object </h1> <p class="text-lg -mt-5 mb-10"> An object for job scheduler settings </p> <p> An API object that represents the job scheduler settings in the cluster. </p> <table> <thead> <tr> <th> Name </th> <th> Type/Value </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> backup_job_settings </td> <td> <a href="/docs/latest/operate/rs/7.4/references/rest-api/objects/job_scheduler/backup_job_settings/"> backup_job_settings </a> object </td> <td> Backup job settings </td> </tr> <tr> <td> cert_rotation_job_settings </td> <td> <a href="/docs/latest/operate/rs/7.4/references/rest-api/objects/job_scheduler/cert_rotation_job_settings/"> cert_rotation_job_settings </a> object </td> <td> Job settings for internal certificate rotation </td> </tr> <tr> <td> log_rotation_job_settings </td> <td> <a href="/docs/latest/operate/rs/7.4/references/rest-api/objects/job_scheduler/log_rotation_job_settings/"> log_rotation_job_settings </a> object </td> <td> Log rotation job settings </td> </tr> <tr> <td> node_checks_job_settings </td> <td> <a href="/docs/latest/operate/rs/7.4/references/rest-api/objects/job_scheduler/node_checks_job_settings/"> node_checks_job_settings </a> object </td> <td> Node checks job settings </td> </tr> <tr> <td> redis_cleanup_job_settings </td> <td> <a href="/docs/latest/operate/rs/7.4/references/rest-api/objects/job_scheduler/redis_cleanup_job_settings/"> redis_cleanup_job_settings </a> object </td> <td> Redis cleanup job settings (deprecated as of Redis Enterprise v6.4.2, replaced with persistence_cleanup_scan_interval) </td> </tr> <tr> <td> rotate_ccs_job_settings </td> <td> <a href="/docs/latest/operate/rs/7.4/references/rest-api/objects/job_scheduler/rotate_ccs_job_settings/"> rotate_ccs_job_settings </a> object </td> <td> Rotate CCS job settings </td> </tr> </tbody> </table> <form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback"> <input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/7.4/references/rest-api/objects/job_scheduler/"/> <div class="flex flex-row justify-between"> <div class="grid justify-center"> <span class="font-mono"> RATE THIS PAGE </span> <div class="star-rating"> <input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/> <label class="star" for="5-stars"> β˜… </label> <input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/> <label class="star" for="4-stars"> β˜… </label> <input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/> <label class="star" for="3-stars"> β˜… </label> <input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/> <label class="star" for="2-stars"> β˜… </label> <input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/> <label class="star" for="1-stars"> β˜… </label> </div> </div> <a class="font-mono no-underline" href="#"> Back to top ↑ </a> </div> <div class="hidden" id="feedback-form"> <div class="grid gap-2"> <textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea> <button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit"> Submit </button> </div> </div> </form> <script> document.addEventListener("DOMContentLoaded", function() { const form = document.querySelector("#page-feedback"); form.addEventListener("submit", function(event) { event.preventDefault(); var xhr = new XMLHttpRequest(); var url = "\/docusight\/api\/rate"; var params = new URLSearchParams(new FormData(form)); xhr.open("POST", url, true); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.onreadystatechange = function() { if (xhr.readyState === 4 && xhr.status === 200) { const responseData = JSON.parse(xhr.responseText); const responseMessage = responseData.response; const newText = document.createTextNode(responseMessage); form.parentNode.replaceChild(newText, form); } }; xhr.send(params); }); }); </script> </section>
https://redis.io/docs/latest/commands/cf.add.html
<section class="prose w-full py-12"> <h1 class="command-name"> CF.ADD </h1> <div class="font-semibold text-redis-ink-900"> Syntax </div> <pre class="command-syntax">CF.ADD key item</pre> <dl class="grid grid-cols-[auto,1fr] gap-2 mb-12"> <dt class="font-semibold text-redis-ink-900 m-0"> Available in: </dt> <dd class="m-0"> <a href="/docs/stack"> Redis Stack </a> / <a href="/docs/data-types/probabilistic"> Bloom 1.0.0 </a> </dd> <dt class="font-semibold text-redis-ink-900 m-0"> Time complexity: </dt> <dd class="m-0"> O(k + i), where k is the number of sub-filters and i is maxIterations </dd> </dl> <p> Adds an item to the cuckoo filter. </p> <p> Cuckoo filters can contain the same item multiple times, and consider each addition as separate. Use <a href="/docs/latest/commands/cf.addnx/"> <code> CF.ADDNX </code> </a> to add an item only if it does not exist. </p> <h2 id="required-arguments"> Required arguments </h2> <details open=""> <summary> <code> key </code> </summary> <p> is key name for a cuckoo filter to add the item to. </p> <p> If <code> key </code> does not exist - a new cuckoo filter is created. </p> </details> <details open=""> <summary> <code> item </code> </summary> <p> is an item to add. </p> </details> <h2 id="return-value"> Return value </h2> <p> Returns one of these replies: </p> <ul> <li> <a href="/docs/latest/develop/reference/protocol-spec/#integers"> Integer reply </a> - where "1" means that the item has been added successfully </li> <li> [] on error (invalid arguments, wrong key type, etc.) and also when the filter is full </li> </ul> <h2 id="complexity"> Complexity </h2> <p> O(n + i), where n is the number of <code> sub-filters </code> and i is <code> maxIterations </code> . Adding items requires up to 2 memory accesses per <code> sub-filter </code> . But as the filter fills up, both locations for an item might be full. The filter attempts to <code> Cuckoo </code> swap items up to <code> maxIterations </code> times. </p> <h2 id="examples"> Examples </h2> <div class="highlight"> <pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">redis&gt; CF.ADD cf item1 </span></span><span class="line"><span class="cl"><span class="o">(</span>integer<span class="o">)</span> <span class="m">1</span> </span></span><span class="line"><span class="cl">redis&gt; CF.ADD cf item1 </span></span><span class="line"><span class="cl"><span class="o">(</span>integer<span class="o">)</span> <span class="m">1</span></span></span></code></pre> </div> <br/> <form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback"> <input class="hidden" name="origin" value="https://redis.io/docs/latest/commands/cf.add/"/> <div class="flex flex-row justify-between"> <div class="grid justify-center"> <span class="font-mono"> RATE THIS PAGE </span> <div class="star-rating"> <input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/> <label class="star" for="5-stars"> β˜… </label> <input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/> <label class="star" for="4-stars"> β˜… </label> <input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/> <label class="star" for="3-stars"> β˜… </label> <input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/> <label class="star" for="2-stars"> β˜… </label> <input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/> <label class="star" for="1-stars"> β˜… </label> </div> </div> <a class="font-mono no-underline" href="#"> Back to top ↑ </a> </div> <div class="hidden" id="feedback-form"> <div class="grid gap-2"> <textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea> <button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit"> Submit </button> </div> </div> </form> <script> document.addEventListener("DOMContentLoaded", function() { const form = document.querySelector("#page-feedback"); form.addEventListener("submit", function(event) { event.preventDefault(); var xhr = new XMLHttpRequest(); var url = "\/docusight\/api\/rate"; var params = new URLSearchParams(new FormData(form)); xhr.open("POST", url, true); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.onreadystatechange = function() { if (xhr.readyState === 4 && xhr.status === 200) { const responseData = JSON.parse(xhr.responseText); const responseMessage = responseData.response; const newText = document.createTextNode(responseMessage); form.parentNode.replaceChild(newText, form); } }; xhr.send(params); }); }); </script> </section>
https://redis.io/docs/latest/operate/rs/references/cli-utilities/crdb-cli/task/list/.html
<section class="prose w-full py-12 max-w-none"> <h1> crdb-cli task list </h1> <p class="text-lg -mt-5 mb-10"> Lists active and recent Active-Active database tasks. </p> <p> Lists active and recent Active-Active database tasks. </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">crdb-cli task list </span></span></code></pre> </div> <h3 id="parameters"> Parameters </h3> <p> None </p> <h3 id="returns"> Returns </h3> <p> A table listing current and recent Active-Active tasks. Each entry includes the following: </p> <table> <thead> <tr> <th> Column </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> Task ID </td> <td> String containing the unique ID associated with the task <br/> Example: <code> e1c49470-ae0b-4df8-885b-9c755dd614d0 </code> </td> </tr> <tr> <td> CRDB-GUID </td> <td> String containing the unique ID associated with the Active-Active database affected by the task <br/> Example: <code> 1d7741cc-1110-4e2f-bc6c-935292783d24 </code> </td> </tr> <tr> <td> Operation </td> <td> String describing the task action <br/> Example: <code> create_crdb </code> </td> </tr> <tr> <td> Status </td> <td> String indicating the task status <br/> Example: <code> finished </code> </td> </tr> <tr> <td> Worker name </td> <td> String identifying the process handling the task <br/> Example: <code> crdb_worker:1:0 </code> </td> </tr> <tr> <td> Started </td> <td> TimeStamp value indicating when the task started ( <a href="https://en.wikipedia.org/wiki/Coordinated_Universal_Time"> UTC </a> ) <br/> Example: <code> 2022-10-12T09:33:41Z </code> </td> </tr> <tr> <td> Ended </td> <td> TimeStamp value indicating when the task ended (UTC) <br/> Example: <code> 2022-10-12T09:33:55Z </code> </td> </tr> </tbody> </table> <h3 id="example"> Example </h3> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">$ crdb-cli task list </span></span><span class="line"><span class="cl">TASK-ID CRDB-GUID OPERATION STATUS WORKER-NAME STARTED ENDED </span></span><span class="line"><span class="cl">&lt;task-ID&gt; &lt;crdb-ID&gt; &lt;operation&gt; &lt;result&gt; &lt;worker-ID&gt; &lt;started&gt; &lt;ended&gt; </span></span></code></pre> </div> <form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback"> <input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/references/cli-utilities/crdb-cli/task/list/"/> <div class="flex flex-row justify-between"> <div class="grid justify-center"> <span class="font-mono"> RATE THIS PAGE </span> <div class="star-rating"> <input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/> <label class="star" for="5-stars"> β˜… </label> <input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/> <label class="star" for="4-stars"> β˜… </label> <input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/> <label class="star" for="3-stars"> β˜… </label> <input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/> <label class="star" for="2-stars"> β˜… </label> <input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/> <label class="star" for="1-stars"> β˜… </label> </div> </div> <a class="font-mono no-underline" href="#"> Back to top ↑ </a> </div> <div class="hidden" id="feedback-form"> <div class="grid gap-2"> <textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea> <button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit"> Submit </button> </div> </div> </form> <script> document.addEventListener("DOMContentLoaded", function() { const form = document.querySelector("#page-feedback"); form.addEventListener("submit", function(event) { event.preventDefault(); var xhr = new XMLHttpRequest(); var url = "\/docusight\/api\/rate"; var params = new URLSearchParams(new FormData(form)); xhr.open("POST", url, true); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.onreadystatechange = function() { if (xhr.readyState === 4 && xhr.status === 200) { const responseData = JSON.parse(xhr.responseText); const responseMessage = responseData.response; const newText = document.createTextNode(responseMessage); form.parentNode.replaceChild(newText, form); } }; xhr.send(params); }); }); </script> </section>
https://redis.io/docs/latest/integrate/redis-data-integration/rdi-archive/.html
<section class="prose w-full py-12"> <h1> Preview version </h1> <p class="text-lg -mt-5 mb-10"> Describes where to view the preview version for RDI products </p> <p> RDI is now in general availability but you can still access an <a href="https://docs.redis.com/rdi-preview/rdi/"> archived version of the docs for the preview version </a> if you need to refer to them. Note that these docs will not be updated and information in the current docs supersedes the content of the preview docs. </p> <p> There is also another RDI product, <strong> Write-behind </strong> , that is still in preview. See the <a href="/docs/latest/integrate/write-behind/"> Write-behind </a> docs 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/integrate/redis-data-integration/rdi-archive/"/> <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-3-beta-july-2018/.html
<section class="prose w-full py-12 max-w-none"> <h1> Redis Enterprise Software Release Notes 5.3 BETA (July 2018) </h1> <p> Redis Enterprise Software (RS) 5.3 is now available. </p> <p> RS 5.3 is a preview version that includes all the capabilities of Redis Enterprise 5.2, plus support for Redis 5.0 with the new data type, which is called Streams. </p> <h2 id="new-features"> New features </h2> <p> RS 5.3 adds support for Redis 5.0 and is based on its latest Release Candidate (RC3). Redis 5.0 exposes the new Redis Streams data type, which provides a super fast in-memory abstraction of an append-only log. For more information and usage examples, check out the Streams documentation here. </p> <h2 id="preview-considerations"> Preview considerations </h2> <p> As a preview version, we do not support upgrading to RS 5.3 from any previous version or upgrading from RS 5.3 to any future version. In addition, we do not commit to fixing bugs in RS 5.3. </p> <h2 id="known-limitations"> Known limitations </h2> <p> The RS 5.3 preview version does not support Enterprise Modules (- RediSearch, ReJSON and ReBloom), Auto Tiering or active-active Redis (CRDB). </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/legacy-release-notes/rs-5-3-beta-july-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/installing-upgrading/install/install-on-linux/.html
<section class="prose w-full py-12 max-w-none"> <h1> Install Redis Enterprise Software on Linux </h1> <p class="text-lg -mt-5 mb-10"> Install Redis Enterprise Software on Linux. </p> <p> After you <a href="/docs/latest/operate/rs/installing-upgrading/install/prepare-install/download-install-package/"> download a Redis Enterprise Software installation package </a> , install it on one of the nodes in the cluster. </p> <p> For installation on machines without an internet connection, see <a href="/docs/latest/operate/rs/installing-upgrading/install/offline-installation/"> Offline installation </a> . </p> <h2 id="install-on-linux"> Install on Linux </h2> <p> To install Redis Enterprise Software, use the command line: </p> <ol> <li> <p> Copy the installation package to the node. </p> </li> <li> <p> On the node, change to the directory where the installation package is located and extract the installation files: </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">tar vxf &lt;tarfile name&gt; </span></span></code></pre> </div> </li> <li> <p> <em> (Optional) </em> Use the <a download="" href="../GPG-KEY-redislabs-packages.gpg"> GPG key file </a> to confirm the authenticity of Ubuntu/Debian or RHEL RPM packages: </p> <ul> <li> <p> For Ubuntu: </p> <ol> <li> Import the key: </li> </ol> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">gpg --import &lt;path to GPG key&gt; </span></span></code></pre> </div> <ol start="2"> <li> Verify the package signature: </li> </ol> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">dpkg-sig --verify &lt;/path-to/package.deb&gt; </span></span></code></pre> </div> </li> <li> <p> For RHEL: </p> <ol> <li> Import the key: </li> </ol> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">rpm --import &lt;path to GPG key&gt; </span></span></code></pre> </div> <ol start="2"> <li> Verify the package signature: </li> </ol> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">rpm --checksig &lt;/path-to/package.rpm&gt; </span></span></code></pre> </div> </li> </ul> </li> <li> <p> To start the installation process, run the installation script. See <a href="/docs/latest/operate/rs/installing-upgrading/install/install-script/"> installation script options </a> for a list of command-line options you can add to the following command: </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">sudo ./install.sh </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> <ul> <li> The Redis Enterprise Software files are installed in the default <a href="/docs/latest/operate/rs/installing-upgrading/install/plan-deployment/file-locations/"> file locations </a> . </li> <li> By default, Redis Enterprise Software runs on the OS as the <code> redislabs </code> user and <code> redislabs </code> group. If needed, you can <a href="/docs/latest/operate/rs/installing-upgrading/install/customize-user-and-group/"> specify a different user and group </a> during the installation. </li> <li> You must either be the root user or use <code> sudo </code> to run the installation script. </li> </ul> </div> </div> </li> <li> <p> Answer the <a href="/docs/latest/operate/rs/installing-upgrading/install/manage-installation-questions/"> installation questions </a> when shown to complete the installation process. </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> To skip the installation questions, use one of the following methods: </p> <ul> <li> Run <code> ./install.sh -y </code> to answer yes to all of the questions. </li> <li> Create an <a href="/docs/latest/operate/rs/installing-upgrading/install/manage-installation-questions/#configure-file-to-answer"> answer file </a> to answer installation questions automatically. </li> </ul> </div> </div> </li> <li> <p> When installation completes successfully, the output displays the Cluster Manager UI's IP address: </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">Summary: </span></span><span class="line"><span class="cl">------- </span></span><span class="line"><span class="cl">ALL TESTS PASSED. </span></span><span class="line"><span class="cl">2017-04-24 10:54:15 <span class="o">[</span>!<span class="o">]</span> Please <span class="nb">logout</span> and login again to make </span></span><span class="line"><span class="cl">sure all environment changes are applied. </span></span><span class="line"><span class="cl">2017-04-24 10:54:15 <span class="o">[</span>!<span class="o">]</span> Point your browser at the following </span></span><span class="line"><span class="cl">URL to <span class="k">continue</span>: </span></span><span class="line"><span class="cl">2017-04-24 10:54:15 <span class="o">[</span>!<span class="o">]</span> https://&lt;your_ip_here&gt;:8443 </span></span></code></pre> </div> </li> <li> <p> Repeat this process for each node in the cluster. </p> </li> </ol> <h2 id="auto-tiering-installation"> Auto Tiering installation </h2> <p> If you want to use Auto Tiering for your databases, review the prerequisites, storage requirements, and <a href="/docs/latest/operate/rs/databases/auto-tiering/"> other considerations </a> for Auto Tiering databases and prepare and format the flash memory. </p> <p> After you <a href="#install-on-linux"> install on Linux </a> , use the <code> prepare_flash </code> script to prepare and format flash memory: </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">sudo /opt/redislabs/sbin/prepare_flash.sh </span></span></code></pre> </div> <p> This script finds unformatted disks and mounts them as RAID partitions in <code> /var/opt/redislabs/flash </code> . </p> <p> To verify the disk configuration, run: </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">sudo lsblk </span></span></code></pre> </div> <h2 id="more-info-and-options"> More info and options </h2> <p> To learn more about customization and find answers to related questions, see: </p> <ul> <li> <a href="/docs/latest/operate/rs/installing-upgrading/configuring/centos-rhel-firewall/"> CentOS/RHEL firewall configuration </a> </li> <li> <a href="/docs/latest/operate/rs/installing-upgrading/configuring/change-location-socket-files/"> Change socket file location </a> </li> <li> <a href="/docs/latest/operate/rs/networking/cluster-dns/"> Cluster DNS configuration </a> </li> <li> <a href="/docs/latest/operate/rs/networking/cluster-lba-setup/"> Cluster load balancer setup </a> </li> <li> <a href="/docs/latest/operate/rs/networking/mdns/"> mDNS client prerequisites </a> </li> <li> <a href="/docs/latest/operate/rs/installing-upgrading/install/plan-deployment/file-locations/"> File locations </a> </li> <li> <a href="/docs/latest/operate/rs/installing-upgrading/install/plan-deployment/supported-platforms/"> Supported platforms </a> </li> </ul> <h2 id="limitations"> Limitations </h2> <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="next-steps"> Next steps </h2> <ol> <li> <p> <a href="/docs/latest/operate/rs/clusters/new-cluster-setup/"> Create </a> or <a href="/docs/latest/operate/rs/clusters/add-node/"> join </a> an existing Redis Enterprise Software cluster. </p> </li> <li> <p> <a href="/docs/latest/operate/rs/databases/create/"> Create a database </a> . </p> <p> For geo-distributed Active-Active replication, create an <a href="/docs/latest/operate/rs/databases/active-active/create/"> Active-Active </a> database. </p> </li> <li> <p> <a href="/docs/latest/operate/rs/security/access-control/create-users/"> Add users </a> to the cluster with specific permissions. To begin, start with <a href="/docs/latest/operate/rs/security/access-control/"> Access control </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/rs/installing-upgrading/install/install-on-linux/"/> <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/data-pipelines/.html
<section class="prose w-full py-12 max-w-none"> <h1> Data pipelines </h1> <p class="text-lg -mt-5 mb-10"> Learn how an RDI pipeline can transform source data before writing </p> <nav> <a href="/docs/latest/integrate/redis-data-integration/data-pipelines/data-pipelines/"> Configure data pipelines </a> <p> Learn how to configure ingest pipelines for data transformation </p> <a href="/docs/latest/integrate/redis-data-integration/data-pipelines/deploy/"> Deploy a pipeline </a> <p> Learn how to deploy an RDI pipeline </p> <a href="/docs/latest/integrate/redis-data-integration/data-pipelines/data-type-handling/"> Data type handling </a> <p> Learn how relational data types are converted to Redis data types </p> <a href="/docs/latest/integrate/redis-data-integration/data-pipelines/data-denormalization/"> Data denormalization </a> <p> Learn about denormalization strategies </p> <a href="/docs/latest/integrate/redis-data-integration/data-pipelines/prepare-dbs/"> Prepare source databases </a> <p> Enable CDC features in your source databases </p> <a href="/docs/latest/integrate/redis-data-integration/data-pipelines/transform-examples/"> Transformation examples </a> <p> Explore some examples of common RDI transformations </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/data-pipelines/"/> <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/crdb/health_report/health_report_configuration/.html
<section class="prose w-full py-12 max-w-none"> <h1> CRDB health report configuration object </h1> <p class="text-lg -mt-5 mb-10"> An object that represents the database configuration to include in an Active-Active database health report. </p> <p> An object that represents the database configuration to include in an Active-Active database health report. </p> <table> <thead> <tr> <th> Name </th> <th> Type/Value </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> causal_consistency </td> <td> boolean </td> <td> Enables causal consistency across Active-Active replicas </td> </tr> <tr> <td> encryption </td> <td> boolean </td> <td> Intercluster encryption </td> </tr> <tr> <td> featureset_version </td> <td> integer </td> <td> CRDB active FeatureSet version </td> </tr> <tr> <td> instances </td> <td> <pre><code>[{ // Unique instance ID "id": integer, // Local database instance ID "db_uid": string, "cluster": { // Cluster FQDN "name": string // Cluster access URL "url": string } }, ...] </code></pre> </td> <td> Local database instances </td> </tr> <tr> <td> name </td> <td> string </td> <td> Name of database </td> </tr> <tr> <td> protocol_version </td> <td> integer </td> <td> CRDB active protocol version </td> </tr> <tr> <td> status </td> <td> string </td> <td> Current status of the configuration. <br/> Possible values: <br/> <strong> posted: </strong> Configuration was posted to all replicas <br/> <strong> ready: </strong> All replicas have finished processing posted configuration (create a database) <br/> <strong> committed </strong> : Posted configuration is now active on all replicas <br/> <strong> commit-completed: </strong> All replicas have finished processing committed configuration (database is active) <br/> <strong> failed: </strong> Configuration failed to post </td> </tr> <tr> <td> version </td> <td> integer </td> <td> Database configuration version </td> </tr> </tbody> </table> <form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback"> <input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/7.4/references/rest-api/objects/crdb/health_report/health_report_configuration/"/> <div class="flex flex-row justify-between"> <div class="grid justify-center"> <span class="font-mono"> RATE THIS PAGE </span> <div class="star-rating"> <input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/> <label class="star" for="5-stars"> β˜… </label> <input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/> <label class="star" for="4-stars"> β˜… </label> <input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/> <label class="star" for="3-stars"> β˜… </label> <input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/> <label class="star" for="2-stars"> β˜… </label> <input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/> <label class="star" for="1-stars"> β˜… </label> </div> </div> <a class="font-mono no-underline" href="#"> Back to top ↑ </a> </div> <div class="hidden" id="feedback-form"> <div class="grid gap-2"> <textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea> <button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit"> Submit </button> </div> </div> </form> <script> document.addEventListener("DOMContentLoaded", function() { const form = document.querySelector("#page-feedback"); form.addEventListener("submit", function(event) { event.preventDefault(); var xhr = new XMLHttpRequest(); var url = "\/docusight\/api\/rate"; var params = new URLSearchParams(new FormData(form)); xhr.open("POST", url, true); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.onreadystatechange = function() { if (xhr.readyState === 4 && xhr.status === 200) { const responseData = JSON.parse(xhr.responseText); const responseMessage = responseData.response; const newText = document.createTextNode(responseMessage); form.parentNode.replaceChild(newText, form); } }; xhr.send(params); }); }); </script> </section>
https://redis.io/docs/latest/develop/tools/redis-for-vscode/release-notes/v1.0.0/.html
<section class="prose w-full py-12"> <h1> Redis for VS Code v1.0.0, September 2024 </h1> <p class="text-lg -mt-5 mb-10"> Redis for VS Code v1.0 </p> <h2 id="100-september-2024"> 1.0.0 (September 2024) </h2> <p> This is the first release of Redis for VS Code. </p> <p> Redis for VS Code is the official Visual Studio Code extension that provides an intuitive and efficient GUI for Redis databases, developed by Redis. </p> <h3 id="headlines"> Headlines </h3> <ul> <li> <p> Universal Redis Support: Connect to any Redis instance, including Redis Community Edition, Redis Cloud, Redis Software, and Redis on Azure Cache. </p> </li> <li> <p> Advanced Connectivity: Supports TLS certificates and SSH tunnels, with an option for automatic data decompression for GZIP, SNAPPY, Brotli, and more. </p> </li> <li> <p> Data types: Supports strings, hashes, lists, sets, sorted sets, and JSON. </p> </li> <li> <p> Human-readable data representation: Offers formatters like ASCII, JSON, Binary, Hex, 32-bit, and 64-bit vectors, and others. </p> </li> <li> <p> Integrated Redis CLI: Leverage Redis CLI with syntax preview as you type commands. </p> </li> </ul> <h3 id="details"> Details </h3> <ul> <li> Database connections: </li> </ul> <p> - Connect to any Redis instance, including Redis Community Edition, Redis Cloud, Redis Software, and Redis on Azure Cache. </p> <p> - View, edit, and manage your Redis database connections. </p> <p> - Supports TLS connections and SSH tunnels for secure access. </p> <p> - Automatically handle data compressed with GZIP, LZ4, SNAPPY, ZSTD, Brotli, or PHP GZCompress. </p> <p> - Choose and work with a specific logical database within your Redis instance. </p> <ul> <li> Redis data structures: </li> </ul> <p> - Use an intuitive tree view interface to browse, filter, and visualize Redis key-value data structures. </p> <p> -Β  Perform create, read, update, and delete operations on the following Redis data types: </p> <p> - Strings </p> <p> - Hashes </p> <p> - Lists </p> <p> - Sets </p> <p> - Sorted sets </p> <p> - JSON </p> <ul> <li> View your data in multiple human-readable formats, including Unicode, ASCII, Binary, HEX, JSON, Msgpack, Pickle, Protobuf, PHP serialized, Java serialized, and Vector (32 and 64-bit). </li> </ul> <p> - Sort by key names and apply filters by pattern or data type for quick and precise data access. </p> <p> - Conduct detailed searches within fields in hashes, indexes in lists, and members in sets and sorted sets. </p> <ul> <li> Redis CLI: </li> </ul> <p> - Access a built-in Redis CLI with improved type-ahead command suggestions, helping you execute commands accurately and efficiently. </p> <h3 id="get-started-with-redis-for-vs-code"> Get started with Redis for VS Code </h3> <p> This repository contains the source code for the Redis for VS Code extension. </p> <p> Install the extension from the <a href="https://marketplace.visualstudio.com/items?itemName=redis.redis-for-vscode"> Visual Studio Code Marketplace </a> to use 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/develop/tools/redis-for-vscode/release-notes/v1.0.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/function-delete/.html
<section class="prose w-full py-12"> <h1 class="command-name"> FUNCTION DELETE </h1> <div class="font-semibold text-redis-ink-900"> Syntax </div> <pre class="command-syntax">FUNCTION DELETE library-name</pre> <dl class="grid grid-cols-[auto,1fr] gap-2 mb-12"> <dt class="font-semibold text-redis-ink-900 m-0"> Available since: </dt> <dd class="m-0"> 7.0.0 </dd> <dt class="font-semibold text-redis-ink-900 m-0"> Time complexity: </dt> <dd class="m-0"> O(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> @slow </code> <span class="mr-1 last:hidden"> , </span> <code> @scripting </code> <span class="mr-1 last:hidden"> , </span> </dd> </dl> <p> Delete a library and all its functions. </p> <p> This command deletes the library called <em> library-name </em> and all functions in it. If the library doesn't exist, the server returns an error. </p> <p> For more information please refer to <a href="/docs/latest/develop/interact/programmability/functions-intro/"> Introduction to Redis Functions </a> . </p> <h2 id="examples"> Examples </h2> <pre tabindex="0"><code>redis&gt; FUNCTION LOAD "#!lua name=mylib \n redis.register_function('myfunc', function(keys, args) return 'hello' end)" "mylib" redis&gt; FCALL myfunc 0 "hello" redis&gt; FUNCTION DELETE mylib OK redis&gt; FCALL myfunc 0 (error) ERR Function not found </code></pre> <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/function-delete/"/> <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/ltrim/.html
<section class="prose w-full py-12"> <h1 class="command-name"> LTRIM </h1> <div class="font-semibold text-redis-ink-900"> Syntax </div> <pre class="command-syntax">LTRIM key start stop</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(N) where N is the number of elements to be removed by the operation. </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> @list </code> <span class="mr-1 last:hidden"> , </span> <code> @slow </code> <span class="mr-1 last:hidden"> , </span> </dd> </dl> <p> Trim an existing list so that it will contain only the specified range of elements specified. Both <code> start </code> and <code> stop </code> are zero-based indexes, where <code> 0 </code> is the first element of the list (the head), <code> 1 </code> the next element and so on. </p> <p> For example: <code> LTRIM foobar 0 2 </code> will modify the list stored at <code> foobar </code> so that only the first three elements of the list will remain. </p> <p> <code> start </code> and <code> end </code> can also be negative numbers indicating offsets from the end of the list, where <code> -1 </code> is the last element of the list, <code> -2 </code> the penultimate element and so on. </p> <p> Out of range indexes will not produce an error: if <code> start </code> is larger than the end of the list, or <code> start &gt; end </code> , the result will be an empty list (which causes <code> key </code> to be removed). If <code> end </code> is larger than the end of the list, Redis will treat it like the last element of the list. </p> <p> A common use of <code> LTRIM </code> is together with <a href="/docs/latest/commands/lpush/"> <code> LPUSH </code> </a> / <a href="/docs/latest/commands/rpush/"> <code> RPUSH </code> </a> . For example: </p> <pre tabindex="0"><code>LPUSH mylist someelement LTRIM mylist 0 99 </code></pre> <p> This pair of commands will push a new element on the list, while making sure that the list will not grow larger than 100 elements. This is very useful when using Redis to store logs for example. It is important to note that when used in this way <code> LTRIM </code> is an O(1) operation because in the average case just one element is removed from the tail of the list. </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; RPUSH mylist "one" (integer) 1 redis&gt; RPUSH mylist "two" (integer) 2 redis&gt; RPUSH mylist "three" (integer) 3 redis&gt; LTRIM mylist 1 -1 "OK" redis&gt; LRANGE mylist 0 -1 1) "two" 2) "three" </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#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/ltrim/"/> <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/examples/manage-subscriptions/.html
<section class="prose w-full py-12 max-w-none"> <h1> Create and manage subscriptions </h1> <p class="text-lg -mt-5 mb-10"> This article describes how to create and manage a subscription using <code> cURL </code> commands. </p> <p> The Redis Cloud REST API lets you create and manage all kinds of subscriptions. The examples in this article refer to Redis Cloud Pro subscriptions. </p> <h2 id="create-a-subscription"> Create a subscription </h2> <p> Use <code> POST /v1/subscriptions </code> to create a subscription. </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">POST <span class="s2">"https://[host]/v1/subscriptions"</span> </span></span><span class="line"><span class="cl"><span class="o">{</span> </span></span><span class="line"><span class="cl"> <span class="s2">"name"</span>: <span class="s2">"Basic subscription example"</span>, </span></span><span class="line"><span class="cl"> <span class="s2">"paymentMethodId"</span>: &lt;payment_id&gt;, </span></span><span class="line"><span class="cl"> <span class="s2">"cloudProviders"</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="s2">"cloudAccountId"</span>: &lt;account_id&gt;, </span></span><span class="line"><span class="cl"> <span class="s2">"regions"</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="s2">"region"</span>: <span class="s2">"us-east-1"</span>, </span></span><span class="line"><span class="cl"> <span class="s2">"networking"</span>: <span class="o">{</span> </span></span><span class="line"><span class="cl"> <span class="s2">"deploymentCIDR"</span>: <span class="s2">"10.0.0.0/24"</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><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="s2">"databases"</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="s2">"name"</span>: <span class="s2">"Redis-database-example"</span>, </span></span><span class="line"><span class="cl"> <span class="s2">"memoryLimitInGb"</span>: 1.1 </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> <p> Modify the following parameters in the sample JSON document to create a subscription on your own account: </p> <ul> <li> <p> <strong> <code> paymentMethodId </code> </strong> - Specify a payment method connected to your account. </p> <p> Use <code> GET /payment-methods </code> to find a payment method ID. </p> <p> You don't need to pass this field in your API request if you subscribed to Redis Cloud through Google Cloud Marketplace. </p> </li> <li> <p> <strong> <code> cloudAccountId </code> </strong> - Set a cloud account ID connected to your account. </p> <p> To list cloud account IDs, use <code> GET /cloud-accounts </code> . To use internal resources, set it to <code> "cloudAccountId": 1 </code> . </p> <p> If you subscribed to Redis Cloud through Google Cloud Marketplace, use <code> 1 </code> for this field. </p> </li> </ul> <p> The request JSON body contains two primary segments: subscription specification and databases specification. When you create a subscription, you must specify one or more databases in the " <code> databases </code> " array. </p> <p> You can include the contents of the JSON document in the <code> POST /subscriptions </code> operation in the <a href="https://api.redislabs.com/v1/swagger-ui.html"> Swagger UI </a> . See <a href="/docs/latest/operate/rc/api/get-started/use-rest-api/#swagger-user-interface"> Swagger user interface </a> for more details. </p> <div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md"> <div class="p-2 pr-5"> <svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg"> <circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5"> </circle> <path d="M10.5 14V16" stroke="currentColor" stroke-width="2"> </path> <path d="M10.5 5V12" stroke="currentColor" stroke-width="2"> </path> </svg> </div> <div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50"> <div class="font-medium"> Note: </div> The Swagger UI generates default JSON examples for <code> POST </code> and <code> PUT </code> operations. You can reference these examples and modify them to fit your specific needs and account settings. The examples will fail if used as-is. </div> </div> <p> The response body contains the <code> taskId </code> for the task that creates the subscription. You can use <code> GET /v1/tasks/&lt;taskId&gt; </code> to track the task's status. </p> <h2 id="update-a-subscription"> Update a subscription </h2> <p> Use <code> PUT /v1/subscriptions/&lt;subscriptionId&gt; </code> to update a subscription. </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">PUT <span class="s2">"https://[host]/v1/subscriptions/&lt;subscriptionId&gt;"</span> </span></span><span class="line"><span class="cl"><span class="o">{</span> </span></span><span class="line"><span class="cl"> <span class="s2">"name"</span>: <span class="s2">"new-subscription-name"</span>, </span></span><span class="line"><span class="cl"> <span class="s2">"paymentMethodId"</span>: &lt;payment_id&gt; </span></span><span class="line"><span class="cl"><span class="o">}</span> </span></span></code></pre> </div> <p> You can only change the following settings with this endpoint: </p> <ul> <li> <p> <strong> <code> name </code> </strong> - Specify a new name for your subscription. </p> </li> <li> <p> <strong> <code> paymentMethodId </code> </strong> - Specify a different payment method connected to your account. </p> <p> Use <code> GET /payment-methods </code> to find a payment method ID. </p> </li> </ul> <p> The response body contains the <code> taskId </code> for the task that updates the subscription. You can use <code> GET /v1/tasks/&lt;taskId&gt; </code> to track the task's status. </p> <h2 id="delete-a-subscription"> Delete a subscription </h2> <p> Use <code> DELETE /v1/subscriptions/&lt;subscriptionId&gt; </code> to delete a subscription. </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">DELETE <span class="s2">"https://[host]/v1/subscriptions/&lt;subscriptionId&gt;"</span> </span></span></code></pre> </div> <p> The response body contains the <code> taskId </code> for the task that deletes the subscription. You can use <code> GET /v1/tasks/&lt;taskId&gt; </code> to track the task's status. </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/api/examples/manage-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/commands/geodist/.html
<section class="prose w-full py-12"> <h1 class="command-name"> GEODIST </h1> <div class="font-semibold text-redis-ink-900"> Syntax </div> <pre class="command-syntax">GEODIST key member1 member2 [m | km | ft | mi]</pre> <dl class="grid grid-cols-[auto,1fr] gap-2 mb-12"> <dt class="font-semibold text-redis-ink-900 m-0"> Available since: </dt> <dd class="m-0"> 3.2.0 </dd> <dt class="font-semibold text-redis-ink-900 m-0"> Time complexity: </dt> <dd class="m-0"> O(1) </dd> <dt class="font-semibold text-redis-ink-900 m-0"> ACL categories: </dt> <dd class="m-0"> <code> @read </code> <span class="mr-1 last:hidden"> , </span> <code> @geo </code> <span class="mr-1 last:hidden"> , </span> <code> @slow </code> <span class="mr-1 last:hidden"> , </span> </dd> </dl> <p> Return the distance between two members in the geospatial index represented by the sorted set. </p> <p> Given a sorted set representing a geospatial index, populated using the <a href="/docs/latest/commands/geoadd/"> <code> GEOADD </code> </a> command, the command returns the distance between the two specified members in the specified unit. </p> <p> If one or both the members are missing, the command returns NULL. </p> <p> The unit must be one of the following, and defaults to meters: </p> <ul> <li> <strong> m </strong> for meters. </li> <li> <strong> km </strong> for kilometers. </li> <li> <strong> mi </strong> for miles. </li> <li> <strong> ft </strong> for feet. </li> </ul> <p> The distance is computed assuming that the Earth is a perfect sphere, so errors up to 0.5% are possible in edge cases. </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; GEOADD Sicily 13.361389 38.115556 "Palermo" 15.087269 37.502669 "Catania" (integer) 2 redis&gt; GEODIST Sicily Palermo Catania "166274.1516" redis&gt; GEODIST Sicily Palermo Catania km "166.2742" redis&gt; GEODIST Sicily Palermo Catania mi "103.3182" redis&gt; GEODIST Sicily Foo Bar (nil) </pre> <div class="prompt" style=""> <span> redis&gt; </span> <input autocomplete="off" name="prompt" spellcheck="false" type="text"/> </div> </form> <h2 id="resp2-reply"> RESP2 Reply </h2> <p> One of the following: </p> <ul> <li> <a href="../../develop/reference/protocol-spec#bulk-strings"> Nil reply </a> : one or both of the elements are missing. </li> <li> <a href="../../develop/reference/protocol-spec#bulk-strings"> Bulk string reply </a> : distance as a double (represented as a string) in the specified units. </li> </ul> <h2 id="resp3-reply"> RESP3 Reply </h2> <p> One of the following: </p> <ul> <li> <a href="../../develop/reference/protocol-spec#nulls"> Null reply </a> : one or both of the elements are missing. </li> <li> <a href="../../develop/reference/protocol-spec#bulk-strings"> Bulk string reply </a> : distance as a double (represented as a string) in the specified units. </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/geodist/"/> <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/sync_async/.html
<section class="prose w-full py-12 max-w-none"> <h1> Sync and async </h1> <p class="text-lg -mt-5 mb-10"> Sync and async functions </p> <div class="banner-article rounded-md"> <p> The Redis Stack triggers and functions feature preview has ended and it will not be promoted to GA. </p> </div> <p> By default, each time a function is invoked, it is executed synchronously. This ensures the atomicity property, meaning that no other commands will be executed on Redis while the function is running. The atomicity property offers several advantages: </p> <ul> <li> Multiple keys can be updated simultaneously, guaranteeing that other clients see the complete update rather than partial updates. </li> <li> The data in Redis remains unchanged while it is being processed. </li> </ul> <p> However, the major disadvantage of the atomicity property is that Redis is blocked throughout the entire invocation, preventing it from serving other clients. </p> <p> Redis Stack's triggers and functions feature aims to provide greater flexibility to function writers by enabling the invocation of functions in the background. When a function is invoked in the background, it cannot directly access the Redis key space. To interact with the Redis key space from the background, the function must block Redis and enter an atomic section where the atomicity property is once again guaranteed. </p> <p> To run triggers and functions in the background, functions can be implemented as JS coroutines using the <code> registerAsyncFunction </code> API. The coroutine is invoked on a background thread and does not block the Redis processes. Here's an example: </p> <div class="highlight"> <pre class="chroma"><code class="language-js" data-lang="js"><span class="line"><span class="cl"><span class="err">#</span><span class="o">!</span><span class="nx">js</span> <span class="nx">api_version</span><span class="o">=</span><span class="mf">1.0</span> <span class="nx">name</span><span class="o">=</span><span class="nx">lib</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="nx">redis</span><span class="p">.</span><span class="nx">registerAsyncFunction</span><span class="p">(</span><span class="s1">'test'</span><span class="p">,</span> <span class="kr">async</span> <span class="kd">function</span><span class="p">(){</span> </span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="s1">'test'</span><span class="p">;</span> </span></span><span class="line"><span class="cl"><span class="p">});</span> </span></span></code></pre> </div> <p> The simple function shown above will return the value 'test' and will execute on a background thread without blocking Redis. This allows Redis to continue accepting commands from other clients while the function is running. </p> <p> The coroutine also accepts an optional client argument, which differs from the client used in synchronous functions. This client argument does not allow direct invocation of Redis commands. Instead, it provides the capability to block Redis and enter an atomic section where the atomicity property is once again guaranteed. Here's an example that demonstrates invoking a ping command from within an async coroutine: </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">'test'</span><span class="p">,</span> <span class="kr">async</span> <span class="kd">function</span><span class="p">(</span><span class="nx">client</span><span class="p">){</span> </span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="nx">client</span><span class="p">.</span><span class="nx">block</span><span class="p">(</span><span class="kd">function</span><span class="p">(</span><span class="nx">redis_client</span><span class="p">){</span> </span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="nx">redis_client</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="s1">'ping'</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> <span class="p">});</span> </span></span><span class="line"><span class="cl"><span class="p">});</span> </span></span></code></pre> </div> <p> Running this function will return a <code> pong </code> reply: </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; TFCALLASYNC lib.test <span class="m">0</span> </span></span><span class="line"><span class="cl"><span class="s2">"PONG"</span> </span></span></code></pre> </div> <p> Notice that this time, in order to invoke the function, we used <code> TFCALLASYNC </code> . <strong> We can only invoke async functions using <code> TFCALLASYNC </code> </strong> . </p> <p> Now let's look at a more complex example. Assume we want to write a function that counts the number of hashes in Redis that have a <code> name </code> property with some value. As a first attempt, we'll write a synchronous function that uses the <a href="/docs/latest/commands/scan/"> <code> SCAN </code> </a> command to scan the key space: </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">'test'</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">expected_name</span><span class="p">){</span> </span></span><span class="line"><span class="cl"> <span class="kd">var</span> <span class="nx">count</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> </span></span><span class="line"><span class="cl"> <span class="kd">var</span> <span class="nx">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="k">do</span><span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="kd">var</span> <span class="nx">res</span> <span class="o">=</span> <span class="nx">client</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="s1">'scan'</span><span class="p">,</span> <span class="nx">cursor</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> <span class="nx">cursor</span> <span class="o">=</span> <span class="nx">res</span><span class="p">[</span><span class="mi">0</span><span class="p">];</span> </span></span><span class="line"><span class="cl"> <span class="kd">var</span> <span class="nx">keys</span> <span class="o">=</span> <span class="nx">res</span><span class="p">[</span><span class="mi">1</span><span class="p">];</span> </span></span><span class="line"><span class="cl"> <span class="nx">keys</span><span class="p">.</span><span class="nx">forEach</span><span class="p">((</span><span class="nx">key</span><span class="p">)</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">'hget'</span><span class="p">,</span> <span class="nx">key</span><span class="p">,</span> <span class="s1">'name'</span><span class="p">)</span> <span class="o">==</span> <span class="nx">expected_name</span><span class="p">)</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="nx">count</span> <span class="o">+=</span> <span class="mi">1</span><span class="p">;</span> </span></span><span class="line"><span class="cl"> <span class="p">}</span> </span></span><span class="line"><span class="cl"> <span class="p">});</span> </span></span><span class="line"><span class="cl"> <span class="p">}</span> <span class="k">while</span><span class="p">(</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="k">return</span> <span class="nx">count</span><span class="p">;</span> </span></span><span class="line"><span class="cl"><span class="p">});</span> </span></span></code></pre> </div> <p> While this function works, it has the potential to block Redis for a long time. So let's modify this function to run in the background as a coroutine: </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">registerAsyncFunction</span><span class="p">(</span><span class="s1">'test'</span><span class="p">,</span> <span class="kr">async</span> <span class="kd">function</span><span class="p">(</span><span class="nx">async_client</span><span class="p">,</span> <span class="nx">expected_name</span><span class="p">){</span> </span></span><span class="line"><span class="cl"> <span class="kd">var</span> <span class="nx">count</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> </span></span><span class="line"><span class="cl"> <span class="kd">var</span> <span class="nx">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="k">do</span><span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="nx">async_client</span><span class="p">.</span><span class="nx">block</span><span class="p">((</span><span class="nx">client</span><span class="p">)=&gt;{</span> </span></span><span class="line"><span class="cl"> <span class="kd">var</span> <span class="nx">res</span> <span class="o">=</span> <span class="nx">client</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="s1">'scan'</span><span class="p">,</span> <span class="nx">cursor</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> <span class="nx">cursor</span> <span class="o">=</span> <span class="nx">res</span><span class="p">[</span><span class="mi">0</span><span class="p">];</span> </span></span><span class="line"><span class="cl"> <span class="kd">var</span> <span class="nx">keys</span> <span class="o">=</span> <span class="nx">res</span><span class="p">[</span><span class="mi">1</span><span class="p">];</span> </span></span><span class="line"><span class="cl"> <span class="nx">keys</span><span class="p">.</span><span class="nx">forEach</span><span class="p">((</span><span class="nx">key</span><span class="p">)</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">'hget'</span><span class="p">,</span> <span class="nx">key</span><span class="p">,</span> <span class="s1">'name'</span><span class="p">)</span> <span class="o">==</span> <span class="nx">expected_name</span><span class="p">)</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="nx">count</span> <span class="o">+=</span> <span class="mi">1</span><span class="p">;</span> </span></span><span class="line"><span class="cl"> <span class="p">}</span> </span></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 class="k">while</span><span class="p">(</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="k">return</span> <span class="nx">count</span><span class="p">;</span> </span></span><span class="line"><span class="cl"><span class="p">});</span> </span></span></code></pre> </div> <p> Both implementations return the same result, but the second function runs in the background and blocks Redis just to analyze the next batch of keys that are returned from the <a href="/docs/latest/commands/scan/"> <code> SCAN </code> </a> command. Other commands will be processed in between <a href="/docs/latest/commands/scan/"> <code> SCAN </code> </a> batches. Notice that the coroutine approach allows the key space to be changed while the scanning it. The function writer will need to decide if this is acceptable. </p> <h1 id="start-sync-and-move-to-async"> Start sync and move to async </h1> <p> The previous example, although functional, has a drawback in terms of performance. Even though Redis is not blocked, it still takes time to return the reply to the user. However, if we modify the requirement slightly and agree to obtain an approximate value, we can achieve much better performance in most cases. This can be done by implementing result caching using a key named <code> &lt;name&gt;_count </code> and setting an expiration time on that key, which triggers recalculation of the value periodically. Here's the updated code: </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">registerAsyncFunction</span><span class="p">(</span><span class="s1">'test'</span><span class="p">,</span> <span class="kr">async</span> <span class="kd">function</span><span class="p">(</span><span class="nx">async_client</span><span class="p">,</span> <span class="nx">expected_name</span><span class="p">){</span> </span></span><span class="line"><span class="cl"> <span class="c1">// check the cache first </span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="kd">var</span> <span class="nx">cached_value</span> <span class="o">=</span> <span class="nx">async_client</span><span class="p">.</span><span class="nx">block</span><span class="p">((</span><span class="nx">client</span><span class="p">)=&gt;{</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">expected_name</span> <span class="o">+</span> <span class="s1">'_count'</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="k">if</span> <span class="p">(</span><span class="nx">cached_value</span> <span class="o">!=</span> <span class="kc">null</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">cached_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></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="kd">var</span> <span class="nx">count</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> </span></span><span class="line"><span class="cl"> <span class="kd">var</span> <span class="nx">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="k">do</span><span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="nx">async_client</span><span class="p">.</span><span class="nx">block</span><span class="p">((</span><span class="nx">client</span><span class="p">)=&gt;{</span> </span></span><span class="line"><span class="cl"> <span class="kd">var</span> <span class="nx">res</span> <span class="o">=</span> <span class="nx">client</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="s1">'scan'</span><span class="p">,</span> <span class="nx">cursor</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> <span class="nx">cursor</span> <span class="o">=</span> <span class="nx">res</span><span class="p">[</span><span class="mi">0</span><span class="p">];</span> </span></span><span class="line"><span class="cl"> <span class="kd">var</span> <span class="nx">keys</span> <span class="o">=</span> <span class="nx">res</span><span class="p">[</span><span class="mi">1</span><span class="p">];</span> </span></span><span class="line"><span class="cl"> <span class="nx">keys</span><span class="p">.</span><span class="nx">forEach</span><span class="p">((</span><span class="nx">key</span><span class="p">)</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">'hget'</span><span class="p">,</span> <span class="nx">key</span><span class="p">,</span> <span class="s1">'name'</span><span class="p">)</span> <span class="o">==</span> <span class="nx">expected_name</span><span class="p">)</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="nx">count</span> <span class="o">+=</span> <span class="mi">1</span><span class="p">;</span> </span></span><span class="line"><span class="cl"> <span class="p">}</span> </span></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 class="k">while</span><span class="p">(</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></span><span class="line"><span class="cl"> <span class="c1">// set count to the cache wil 5 seconds expiration </span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="nx">async_client</span><span class="p">.</span><span class="nx">block</span><span class="p">((</span><span class="nx">client</span><span class="p">)=&gt;{</span> </span></span><span class="line"><span class="cl"> <span class="nx">client</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="s1">'set'</span><span class="p">,</span> <span class="nx">expected_name</span> <span class="o">+</span> <span class="s1">'_count'</span><span class="p">,</span> <span class="nx">count</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> <span class="nx">client</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="s1">'expire'</span><span class="p">,</span> <span class="nx">expected_name</span> <span class="o">+</span> <span class="s1">'_count'</span><span class="p">,</span> <span class="mi">5</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="k">return</span> <span class="nx">count</span><span class="p">;</span> </span></span><span class="line"><span class="cl"><span class="p">});</span> </span></span></code></pre> </div> <p> The above code works as expected. It first checks the cache and if the cache exists it's returned. Otherwise it will perform the calculation and update the cache. But the above example is not optimal. The callback is a coroutine, which means that it will always be calculated on a background thread. Intrinsically, moving to a background thread is costly. The best approach would be to check the cache synchronously and, only if its not there, move to the background. Triggers and functions provides for starting synchronously and then moving asynchronous execution using <code> executeAsync </code> function as required. The new code: </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">registerAsyncFunction</span><span class="p">(</span><span class="s1">'test'</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">expected_name</span><span class="p">){</span> </span></span><span class="line"><span class="cl"> <span class="c1">// check the cache first </span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="kd">var</span> <span class="nx">cached_value</span> <span class="o">=</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">expected_name</span> <span class="o">+</span> <span class="s1">'_count'</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">cached_value</span> <span class="o">!=</span> <span class="kc">null</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">cached_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></span><span class="line"><span class="cl"> <span class="c1">// cache is not set, move to background </span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="k">return</span> <span class="nx">client</span><span class="p">.</span><span class="nx">executeAsync</span><span class="p">(</span><span class="kr">async</span> <span class="kd">function</span><span class="p">(</span><span class="nx">async_client</span><span class="p">)</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="kd">var</span> <span class="nx">count</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> </span></span><span class="line"><span class="cl"> <span class="kd">var</span> <span class="nx">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="k">do</span><span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="nx">async_client</span><span class="p">.</span><span class="nx">block</span><span class="p">((</span><span class="nx">client</span><span class="p">)=&gt;{</span> </span></span><span class="line"><span class="cl"> <span class="kd">var</span> <span class="nx">res</span> <span class="o">=</span> <span class="nx">client</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="s1">'scan'</span><span class="p">,</span> <span class="nx">cursor</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> <span class="nx">cursor</span> <span class="o">=</span> <span class="nx">res</span><span class="p">[</span><span class="mi">0</span><span class="p">];</span> </span></span><span class="line"><span class="cl"> <span class="kd">var</span> <span class="nx">keys</span> <span class="o">=</span> <span class="nx">res</span><span class="p">[</span><span class="mi">1</span><span class="p">];</span> </span></span><span class="line"><span class="cl"> <span class="nx">keys</span><span class="p">.</span><span class="nx">forEach</span><span class="p">((</span><span class="nx">key</span><span class="p">)</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">'hget'</span><span class="p">,</span> <span class="nx">key</span><span class="p">,</span> <span class="s1">'name'</span><span class="p">)</span> <span class="o">==</span> <span class="nx">expected_name</span><span class="p">)</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="nx">count</span> <span class="o">+=</span> <span class="mi">1</span><span class="p">;</span> </span></span><span class="line"><span class="cl"> <span class="p">}</span> </span></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 class="k">while</span><span class="p">(</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></span><span class="line"><span class="cl"> <span class="c1">// set count to the cache wil 5 seconds expiration </span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="nx">async_client</span><span class="p">.</span><span class="nx">block</span><span class="p">((</span><span class="nx">client</span><span class="p">)=&gt;{</span> </span></span><span class="line"><span class="cl"> <span class="nx">client</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="s1">'set'</span><span class="p">,</span> <span class="nx">expected_name</span> <span class="o">+</span> <span class="s1">'_count'</span><span class="p">,</span> <span class="nx">count</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> <span class="nx">client</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="s1">'expire'</span><span class="p">,</span> <span class="nx">expected_name</span> <span class="o">+</span> <span class="s1">'_count'</span><span class="p">,</span> <span class="mi">5</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="k">return</span> <span class="nx">count</span><span class="p">;</span> </span></span><span class="line"><span class="cl"> <span class="p">});</span> </span></span><span class="line"><span class="cl"><span class="p">});</span> </span></span></code></pre> </div> <p> <code> executeAsync </code> will return a <code> Promise </code> object. When triggers and functions sees that the function returns a Promise, it waits for the promise to be resolved and returns its result to the client. The above implementation will be much faster in the case of cache hit. </p> <p> <strong> Notice </strong> that even though we registered a synchronous function (not a coroutine) we still used <code> registerAsyncFunction </code> . This is because our function has the potential of blocking the client, taking the execution to the background. If we had used <code> registerFunction </code> , Triggers and functions would not have allowed the function to block the client and it would have ignored the returned promise object. </p> <p> <strong> Also notice </strong> it is not always possible to wait for a promise to be resolved. If the command is called inside a <code> multi/exec </code> it is not possible to block it and wait for the promise. In such cases the client will get an error. It is possible to check if blocking the client is allowed using the <code> client.isBlockAllowed() </code> function, which will return <code> true </code> if it is OK to wait for a promise to be resolved and <code> false </code> if it is not possible. </p> <h1 id="call-blocking-commands"> Call blocking commands </h1> <p> Redis has a few commands that blocks the client and executed asynchronously when some condition holds (commands like <a href="/docs/latest/commands/blpop/"> blpop </a> ). In general, such commands are not suppose to be called inside a script and calling them will result in running their none blocking logic. For example, <a href="/docs/latest/commands/blpop/"> blpop </a> will basically runs lpop and return empty result if the list it empty. </p> <p> RedisGears allows running blocking commands using <code> client.callAsync </code> API. <code> client.callAsync </code> will execute the blocking command and return a promise object which will be resolved when the command invocation finished (notice that <code> client.callAsync </code> allow calling any command and not just blocking but it will always return a promise object that will be resolve later, so <strong> using it for regular commands is less efficient </strong> ). </p> <p> Example: </p> <div class="highlight"> <pre class="chroma"><code class="language-js" data-lang="js"><span class="line"><span class="cl"><span class="err">#</span><span class="o">!</span><span class="nx">js</span> <span class="nx">api_version</span><span class="o">=</span><span class="mf">1.0</span> <span class="nx">name</span><span class="o">=</span><span class="nx">lib</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="nx">redis</span><span class="p">.</span><span class="nx">registerAsyncFunction</span><span class="p">(</span><span class="s1">'my_blpop'</span><span class="p">,</span> <span class="kr">async</span> <span class="kd">function</span><span class="p">(</span><span class="nx">client</span><span class="p">,</span> <span class="nx">key</span><span class="p">,</span> <span class="nx">expected_val</span><span class="p">)</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="kd">var</span> <span class="nx">res</span> <span class="o">=</span> <span class="kc">null</span> </span></span><span class="line"><span class="cl"> <span class="k">do</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="nx">res</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">block</span><span class="p">((</span><span class="nx">c</span><span class="p">)</span> <span class="p">=&gt;</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="nx">c</span><span class="p">.</span><span class="nx">callAsync</span><span class="p">(</span><span class="s1">'blpop'</span><span class="p">,</span> <span class="nx">key</span><span class="p">,</span> <span class="s1">'0'</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> <span class="p">})</span> </span></span><span class="line"><span class="cl"> <span class="p">}</span> <span class="k">while</span> <span class="p">(</span><span class="nx">res</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">!=</span> <span class="nx">expected_val</span><span class="p">);</span> </span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="nx">res</span><span class="p">;</span> </span></span><span class="line"><span class="cl"><span class="p">});</span> </span></span></code></pre> </div> <p> The following function will continue popping elements from the requested list up until it will encounter the requested value. In case the list is empty it will wait until elements will be added to the list. </p> <p> RedisGears also provided <code> client.callAsyncRaw </code> API, which is the same as <code> client.callAsync </code> but will not decode the replies as utf8. </p> <p> <strong> Notice </strong> : There is no guarantee when the promise returned from <code> client.callAsyn </code> will be resolved. So the <strong> function writer should not make any assumption about atomicity guarantees. </strong> </p> <h1 id="block-redis-failure"> Block Redis failure </h1> <p> Blocking Redis might fail for a few reasons: </p> <ul> <li> Redis reached OOM state and the <code> redis.functionFlags.NO_WRITES </code> or <code> redis.functionFlags.ALLOW_OOM </code> flags are not set (see <a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/deprecated-features/triggers-and-functions/concepts/function_flags/"> functions flags </a> for more information) </li> <li> <code> redis.functionFlags.NO_WRITES </code> flag is not set and the Redis instance changed roles and is now a replica. </li> <li> The ACL user that invoked the function was deleted. </li> </ul> <p> The failure will result in an exception that the function writer can choose to handle or throw it to be caught by triggers and functions. </p> <h1 id="block-redis-timeout"> Block Redis timeout </h1> <p> Blocking Redis for a long time is discouraged and is considered an unsafe operation. The triggers and functions feature attempts to protect the function writer and will time out the blocking function if it continues for too long. The timeout can be set as a <a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/deprecated-features/triggers-and-functions/configuration/"> module configuration </a> along side the fatal failure policy that indicates how to handle the timeout. Policies can be one of the following: </p> <ul> <li> Abort - Stop the function invocation even at the cost of losing the atomicity property. </li> <li> Kill - Keep the atomicity property and do not stop the function invocation. In this case there is a risk of an external process killing the Redis server, thinking that the shard is not responding. </li> </ul> <form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback"> <input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/oss_and_stack/stack-with-enterprise/deprecated-features/triggers-and-functions/concepts/sync_async/"/> <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/debezium/postgresql/.html
<section class="prose w-full py-12 max-w-none"> <h1> Write-behind configuration for postgresql </h1> <p class="text-lg -mt-5 mb-10"> Describes the <code> application.properties </code> settings that configure Debezium Server for postgresql </p> <h2 id="applicationproperties"> application.properties </h2> <div class="highlight"> <pre class="chroma"><code class="language-properties" data-lang="properties"><span class="line"><span class="cl"><span class="na">debezium.sink.type</span><span class="o">=</span><span class="s">redis</span> </span></span><span class="line"><span class="cl"><span class="na">debezium.sink.redis.message.format</span><span class="o">=</span><span class="s">extended</span> </span></span><span class="line"><span class="cl"><span class="na">debezium.sink.redis.address</span><span class="o">=</span><span class="s">&lt;RDI_HOST&gt;:&lt;RDI_PORT&gt;</span> </span></span><span class="line"><span class="cl"><span class="c1"># Comment the following line if not using a password for Write-behind.</span> </span></span><span class="line"><span class="cl"><span class="na">debezium.sink.redis.password</span><span class="o">=</span><span class="s">&lt;RDI_PASSWORD&gt;</span> </span></span><span class="line"><span class="cl"><span class="na">debezium.sink.redis.memory.limit.mb</span><span class="o">=</span><span class="s">80</span> </span></span><span class="line"><span class="cl"><span class="c1"># Redis SSL/TLS</span> </span></span><span class="line"><span class="cl"><span class="c1">#debezium.sink.redis.ssl.enabled=true</span> </span></span><span class="line"><span class="cl"><span class="c1"># When Redis is configured with a replica shard, these properties allow to verify that the data has been written to the replica.</span> </span></span><span class="line"><span class="cl"><span class="c1">#debezium.sink.redis.wait.enabled=true</span> </span></span><span class="line"><span class="cl"><span class="c1">#debezium.sink.redis.wait.timeout.ms=1000</span> </span></span><span class="line"><span class="cl"><span class="c1">#debezium.sink.redis.wait.retry.enabled=true</span> </span></span><span class="line"><span class="cl"><span class="c1">#debezium.sink.redis.wait.retry.delay.ms=1000</span> </span></span><span class="line"><span class="cl"><span class="c1">#debezium.source.database.history.redis.ssl.enabled=true</span> </span></span><span class="line"><span class="cl"><span class="c1"># Location of the Java keystore file containing an application process' own certificate and private key.</span> </span></span><span class="line"><span class="cl"><span class="c1">#javax.net.ssl.keyStore=&lt;KEY_STORE_FILE_PATH&gt;</span> </span></span><span class="line"><span class="cl"><span class="c1"># Password to access the private key from the keystore file specified by javax.net.ssl.keyStore. This password is used twice: To unlock the keystore file (store password), and To decrypt the private key stored in the keystore (key password).</span> </span></span><span class="line"><span class="cl"><span class="c1">#javax.net.ssl.keyStorePassword=&lt;KEY_STORE_PASSWORD&gt;</span> </span></span><span class="line"><span class="cl"><span class="c1"># Location of the Java keystore file containing the collection of CA certificates trusted by this application process (trust store).</span> </span></span><span class="line"><span class="cl"><span class="c1">#javax.net.ssl.trustStore=&lt;TRUSE_STORE_FILE_PATH&gt;</span> </span></span><span class="line"><span class="cl"><span class="c1"># Password to unlock the keystore file (store password) specified by javax.net.ssl.trustStore.</span> </span></span><span class="line"><span class="cl"><span class="c1">#javax.net.ssl.trustStorePassword=&lt;TRUST_STORE_PASSWORD&gt;</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="na">debezium.source.connector.class</span><span class="o">=</span><span class="s">io.debezium.connector.postgresql.PostgresConnector</span> </span></span><span class="line"><span class="cl"><span class="na">debezium.source.plugin.name</span><span class="o">=</span><span class="s">pgoutput</span> </span></span><span class="line"><span class="cl"><span class="na">debezium.source.offset.storage</span><span class="o">=</span><span class="s">io.debezium.storage.redis.offset.RedisOffsetBackingStore</span> </span></span><span class="line"><span class="cl"><span class="na">debezium.source.topic.prefix</span><span class="o">=</span><span class="s">&lt;SOURCE_LOGICAL_SERVER_NAME&gt;</span> </span></span><span class="line"><span class="cl"><span class="na">debezium.source.database.dbname</span><span class="o">=</span><span class="s">&lt;SOURCE_DB_NAME&gt;</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="na">debezium.source.database.hostname</span><span class="o">=</span><span class="s">&lt;SOURCE_DB_HOST&gt;</span> </span></span><span class="line"><span class="cl"><span class="na">debezium.source.database.port</span><span class="o">=</span><span class="s">&lt;SOURCE_DB_PORT&gt;</span> </span></span><span class="line"><span class="cl"><span class="na">debezium.source.database.user</span><span class="o">=</span><span class="s">&lt;SOURCE_DB_USER&gt;</span> </span></span><span class="line"><span class="cl"><span class="na">debezium.source.database.password</span><span class="o">=</span><span class="s">&lt;SOURCE_DB_PASSWORD&gt;</span> </span></span><span class="line"><span class="cl"><span class="na">debezium.source.include.schema.changes</span><span class="o">=</span><span class="s">false</span> </span></span><span class="line"><span class="cl"><span class="c1"># Determines whether the connector should omit publishing change events when there are no modifications in the included columns.</span> </span></span><span class="line"><span class="cl"><span class="c1"># This property takes effect when the `REPLICA IDENTITY` of the table is set to `FULL`.</span> </span></span><span class="line"><span class="cl"><span class="na">debezium.source.skip.messages.without.change</span><span class="o">=</span><span class="s">true</span> </span></span><span class="line"><span class="cl"><span class="na">debezium.source.offset.flush.interval.ms</span><span class="o">=</span><span class="s">1000</span> </span></span><span class="line"><span class="cl"><span class="na">debezium.source.tombstones.on.delete</span><span class="o">=</span><span class="s">false</span> </span></span><span class="line"><span class="cl"><span class="na">debezium.source.schema.history.internal</span><span class="o">=</span><span class="s">io.debezium.storage.redis.history.RedisSchemaHistory</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="c1"># Important: Do NOT use `include` and `exclude` table lists at the same time, use either `include` or `exclude`.</span> </span></span><span class="line"><span class="cl"><span class="c1"># An optional, comma-separated list of regular expressions that match fully-qualified table identifiers of tables whose changes you want to capture.</span> </span></span><span class="line"><span class="cl"><span class="c1">#debezium.source.table.include.list=&lt;SCHEMA_NAME.TABLE_NAME1&gt;,&lt;SCHEMA_NAME.TABLE_NAME2&gt;...</span> </span></span><span class="line"><span class="cl"><span class="c1"># An optional, comma-separated list of regular expressions that match fully-qualified table identifiers for tables whose changes you do not want to capture.</span> </span></span><span class="line"><span class="cl"><span class="c1">#debezium.source.table.exclude.list=&lt;SCHEMA_NAME.TABLE_NAME1&gt;,&lt;SCHEMA_NAME.TABLE_NAME2&gt;...</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="c1"># Important: Do NOT use include and exclude column lists at the same time, use either include or exclude.</span> </span></span><span class="line"><span class="cl"><span class="c1"># An optional, comma-separated list of regular expressions that match the fully-qualified names of columns to include in change event record values.</span> </span></span><span class="line"><span class="cl"><span class="c1">#debezium.source.column.include.list=&lt;SCHEMA_NAME.TABLE_NAME.COLUMN_NAME1&gt;,&lt;SCHEMA_NAME.TABLE_NAME.COLUMN_NAME2&gt;...</span> </span></span><span class="line"><span class="cl"><span class="c1"># An optional, comma-separated list of regular expressions that match the fully-qualified names of columns to exclude from change event record values.</span> </span></span><span class="line"><span class="cl"><span class="c1">#debezium.source.column.exclude.list=&lt;SCHEMA_NAME.TABLE_NAME.COLUMN_NAME1&gt;,&lt;SCHEMA_NAME.TABLE_NAME.COLUMN_NAME2&gt;...</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="c1"># Whether to include the detailed schema information generated by Debezium in each record written to RDI.</span> </span></span><span class="line"><span class="cl"><span class="c1"># Note: Including the schema reduces the initial sync throughput and is not recommended for large data sets.</span> </span></span><span class="line"><span class="cl"><span class="na">debezium.source.key.converter.schemas.enable</span><span class="o">=</span><span class="s">false</span> </span></span><span class="line"><span class="cl"><span class="na">debezium.source.value.converter.schemas.enable</span><span class="o">=</span><span class="s">false</span> </span></span><span class="line"><span class="cl"><span class="c1"># When detailed schema information is excluded, handle decimal numeric types as strings.</span> </span></span><span class="line"><span class="cl"><span class="na">debezium.source.decimal.handling.mode</span><span class="o">=</span><span class="s">string</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="na">debezium.transforms</span><span class="o">=</span><span class="s">AddPrefix</span> </span></span><span class="line"><span class="cl"><span class="na">debezium.transforms.AddPrefix.type</span><span class="o">=</span><span class="s">org.apache.kafka.connect.transforms.RegexRouter</span> </span></span><span class="line"><span class="cl"><span class="na">debezium.transforms.AddPrefix.regex</span><span class="o">=</span><span class="s">.*</span> </span></span><span class="line"><span class="cl"><span class="na">debezium.transforms.AddPrefix.replacement</span><span class="o">=</span><span class="s">data:$0</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="c1"># Logging</span> </span></span><span class="line"><span class="cl"><span class="c1"># Uncomment the following lines if running Debezium Server as a Java standalone process (non-containerized).</span> </span></span><span class="line"><span class="cl"><span class="c1">#quarkus.log.file.enable=true</span> </span></span><span class="line"><span class="cl"><span class="c1">#quarkus.log.file.path=&lt;LOG_FILE_PATH&gt;</span> </span></span><span class="line"><span class="cl"><span class="c1">#quarkus.log.file.rotation.max-file-size=100M</span> </span></span><span class="line"><span class="cl"><span class="c1">#quarkus.log.file.rotation.rotate-on-boot=true</span> </span></span><span class="line"><span class="cl"><span class="c1">#quarkus.log.file.rotation.file-suffix=.yyyy-MM-dd.gz</span> </span></span><span class="line"><span class="cl"><span class="c1">#quarkus.log.file.rotation.max-backup-index=3</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"><span class="c1"># The default minimum log level for every log category, change only quarkus.log.level when needed.</span> </span></span><span class="line"><span class="cl"><span class="na">quarkus.log.min-level</span><span class="o">=</span><span class="s">TRACE</span> </span></span><span class="line"><span class="cl"><span class="c1"># The default log level for every log category.</span> </span></span><span class="line"><span class="cl"><span class="na">quarkus.log.level</span><span class="o">=</span><span class="s">INFO</span> </span></span><span class="line"><span class="cl"><span class="c1"># Determine whether to enable the JSON console formatting extension, which disables "normal" console formatting.</span> </span></span><span class="line"><span class="cl"><span class="na">quarkus.log.console.json</span><span class="o">=</span><span class="s">false</span> </span></span><span class="line"><span class="cl"><span class="c1"># The port on which Debezium exposes Microprofile Health endpoint and other exposed status information.</span> </span></span><span class="line"><span class="cl"><span class="na">quarkus.http.port</span><span class="o">=</span><span class="s">8088</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/integrate/write-behind/reference/debezium/postgresql/"/> <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/fcall_ro/.html
<section class="prose w-full py-12"> <h1 class="command-name"> FCALL_RO </h1> <div class="font-semibold text-redis-ink-900"> Syntax </div> <pre class="command-syntax">FCALL_RO function numkeys [key [key ...]] [arg [arg ...]]</pre> <dl class="grid grid-cols-[auto,1fr] gap-2 mb-12"> <dt class="font-semibold text-redis-ink-900 m-0"> Available since: </dt> <dd class="m-0"> 7.0.0 </dd> <dt class="font-semibold text-redis-ink-900 m-0"> Time complexity: </dt> <dd class="m-0"> Depends on the function that is executed. </dd> <dt class="font-semibold text-redis-ink-900 m-0"> ACL categories: </dt> <dd class="m-0"> <code> @slow </code> <span class="mr-1 last:hidden"> , </span> <code> @scripting </code> <span class="mr-1 last:hidden"> , </span> </dd> </dl> <p> This is a read-only variant of the <a href="/docs/latest/commands/fcall/"> <code> FCALL </code> </a> command that cannot execute commands that modify data. </p> <p> For more information about when to use this command vs <a href="/docs/latest/commands/fcall/"> <code> FCALL </code> </a> , please refer to <a href="/docs/latest/develop/interact/programmability/#read-only_scripts"> Read-only scripts </a> . </p> <p> For more information please refer to <a href="/docs/latest/develop/interact/programmability/functions-intro/"> Introduction to Redis Functions </a> . </p> <h2 id="resp2resp3-reply"> RESP2/RESP3 Reply </h2> The return value depends on the function that was executed. <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/fcall_ro/"/> <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/stats_archiver/.html
<section class="prose w-full py-12 max-w-none"> <h1> rladmin cluster stats_archiver </h1> <p class="text-lg -mt-5 mb-10"> Enables/deactivates the stats archiver. </p> <p> Enables or deactivates the stats archiver, which logs statistics in CSV (comma-separated values) format. </p> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">rladmin cluster stats_archiver <span class="o">{</span> enabled <span class="p">|</span> disabled <span class="o">}</span> </span></span></code></pre> </div> <h3 id="parameters"> Parameters </h3> <table> <thead> <tr> <th> Parameter </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> enabled </td> <td> Turn on the stats archiver </td> </tr> <tr> <td> disabled </td> <td> Turn off the stats archiver </td> </tr> </tbody> </table> <h3 id="returns"> Returns </h3> <p> Returns the updated status of the stats archiver. </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 stats_archiver enabled </span></span><span class="line"><span class="cl">Status: enabled </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/stats_archiver/"/> <div class="flex flex-row justify-between"> <div class="grid justify-center"> <span class="font-mono"> RATE THIS PAGE </span> <div class="star-rating"> <input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/> <label class="star" for="5-stars"> β˜… </label> <input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/> <label class="star" for="4-stars"> β˜… </label> <input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/> <label class="star" for="3-stars"> β˜… </label> <input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/> <label class="star" for="2-stars"> β˜… </label> <input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/> <label class="star" for="1-stars"> β˜… </label> </div> </div> <a class="font-mono no-underline" href="#"> Back to top ↑ </a> </div> <div class="hidden" id="feedback-form"> <div class="grid gap-2"> <textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea> <button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit"> Submit </button> </div> </div> </form> <script> document.addEventListener("DOMContentLoaded", function() { const form = document.querySelector("#page-feedback"); form.addEventListener("submit", function(event) { event.preventDefault(); var xhr = new XMLHttpRequest(); var url = "\/docusight\/api\/rate"; var params = new URLSearchParams(new FormData(form)); xhr.open("POST", url, true); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.onreadystatechange = function() { if (xhr.readyState === 4 && xhr.status === 200) { const responseData = JSON.parse(xhr.responseText); const responseMessage = responseData.response; const newText = document.createTextNode(responseMessage); form.parentNode.replaceChild(newText, form); } }; xhr.send(params); }); }); </script> </section>
https://redis.io/docs/latest/commands/zinterstore/.html
<section class="prose w-full py-12"> <h1 class="command-name"> ZINTERSTORE </h1> <div class="font-semibold text-redis-ink-900"> Syntax </div> <pre class="command-syntax">ZINTERSTORE destination numkeys key [key ...] [WEIGHTSΒ weight [weight ...]] [AGGREGATEΒ &lt;SUM | MIN | MAX&gt;]</pre> <dl class="grid grid-cols-[auto,1fr] gap-2 mb-12"> <dt class="font-semibold text-redis-ink-900 m-0"> Available since: </dt> <dd class="m-0"> 2.0.0 </dd> <dt class="font-semibold text-redis-ink-900 m-0"> Time complexity: </dt> <dd class="m-0"> O(N*K)+O(M*log(M)) worst case with N being the smallest input sorted set, K being the number of input sorted sets and M being the number of elements in the resulting sorted set. </dd> <dt class="font-semibold text-redis-ink-900 m-0"> ACL categories: </dt> <dd class="m-0"> <code> @write </code> <span class="mr-1 last:hidden"> , </span> <code> @sortedset </code> <span class="mr-1 last:hidden"> , </span> <code> @slow </code> <span class="mr-1 last:hidden"> , </span> </dd> </dl> <p> Computes the intersection of <code> numkeys </code> sorted sets given by the specified keys, and stores the result in <code> destination </code> . It is mandatory to provide the number of input keys ( <code> numkeys </code> ) before passing the input keys and the other (optional) arguments. </p> <p> By default, the resulting score of an element is the sum of its scores in the sorted sets where it exists. Because intersection requires an element to be a member of every given sorted set, this results in the score of every element in the resulting sorted set to be equal to the number of input sorted sets. </p> <p> For a description of the <code> WEIGHTS </code> and <code> AGGREGATE </code> options, see <a href="/docs/latest/commands/zunionstore/"> <code> ZUNIONSTORE </code> </a> . </p> <p> If <code> destination </code> already exists, it is overwritten. </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; ZADD zset1 1 "one" (integer) 1 redis&gt; ZADD zset1 2 "two" (integer) 1 redis&gt; ZADD zset2 1 "one" (integer) 1 redis&gt; ZADD zset2 2 "two" (integer) 1 redis&gt; ZADD zset2 3 "three" (integer) 1 redis&gt; ZINTERSTORE out 2 zset1 zset2 WEIGHTS 2 3 (integer) 2 redis&gt; ZRANGE out 0 -1 WITHSCORES 1) "one" 2) "5" 3) "two" 4) "10" </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 number of members in the resulting sorted set at the <em> destination </em> . <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/zinterstore/"/> <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/stats/.html
<section class="prose w-full py-12 max-w-none"> <h1> Database stats requests </h1> <p class="text-lg -mt-5 mb-10"> Database statistics requests </p> <table> <thead> <tr> <th> Method </th> <th> Path </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> <a href="#get-all-bdbs-stats"> GET </a> </td> <td> <code> /v1/bdbs/stats </code> </td> <td> Get stats for all databases </td> </tr> <tr> <td> <a href="#get-bdbs-stats"> GET </a> </td> <td> <code> /v1/bdbs/stats/{uid} </code> </td> <td> Get stats for a specific database </td> </tr> </tbody> </table> <h2 id="get-all-bdbs-stats"> Get all database stats </h2> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">GET /v1/bdbs/stats </span></span></code></pre> </div> <p> Get statistics for all databases. </p> <h3 id="permissions"> Permissions </h3> <table> <thead> <tr> <th> Permission name </th> <th> Roles </th> </tr> </thead> <tbody> <tr> <td> <a href="/docs/latest/operate/rs/references/rest-api/permissions/#view_all_bdb_stats"> view_all_bdb_stats </a> </td> <td> admin <br/> cluster_member <br/> cluster_viewer <br/> db_member <br/> db_viewer <br/> user_manager </td> </tr> </tbody> </table> <h3 id="get-all-request"> Request </h3> <h4 id="example-http-request"> Example HTTP request </h4> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">GET /bdbs/stats?interval<span class="o">=</span>1hour<span class="p">&amp;</span><span class="nv">stime</span><span class="o">=</span>2014-08-28T10:00:00Z </span></span></code></pre> </div> <h4 id="headers"> Headers </h4> <table> <thead> <tr> <th> Key </th> <th> Value </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> Host </td> <td> cnm.cluster.fqdn </td> <td> Domain name </td> </tr> <tr> <td> Accept </td> <td> application/json </td> <td> Accepted media type </td> </tr> </tbody> </table> <h4 id="query-parameters"> Query parameters </h4> <table> <thead> <tr> <th> Field </th> <th> Type </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> interval </td> <td> string </td> <td> Time interval for for which we want stats: 1sec/10sec/5min/15min/1hour/12hour/1week (optional) </td> </tr> <tr> <td> stime </td> <td> ISO_8601 </td> <td> Start time from which we want the stats. Should comply with the <a href="https://en.wikipedia.org/wiki/ISO_8601"> ISO_8601 </a> format (optional) </td> </tr> <tr> <td> etime </td> <td> ISO_8601 </td> <td> End time after which we don't want the stats. Should comply with the <a href="https://en.wikipedia.org/wiki/ISO_8601"> ISO_8601 </a> format (optional) </td> </tr> </tbody> </table> <h3 id="get-all-response"> Response </h3> <p> Returns <a href="/docs/latest/operate/rs/references/rest-api/objects/statistics/"> statistics </a> for all databases. </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="s2">"1"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"intervals"</span><span class="p">:</span> <span class="p">[</span> </span></span><span class="line"><span class="cl"> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="nt">"interval"</span><span class="p">:</span> <span class="s2">"1hour"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"stime"</span><span class="p">:</span> <span class="s2">"2015-05-27T12:00:00Z"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"etime"</span><span class="p">:</span> <span class="s2">"2015-05-28T12:59:59Z"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"avg_latency"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"conns"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"egress_bytes"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"etime"</span><span class="p">:</span> <span class="s2">"2015-05-28T00:00:00Z"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"evicted_objects"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"expired_objects"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"ingress_bytes"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"instantaneous_ops_per_sec"</span><span class="p">:</span> <span class="mf">0.00011973180076628352</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"last_req_time"</span><span class="p">:</span> <span class="s2">"1970-01-01T00:00:00Z"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"last_res_time"</span><span class="p">:</span> <span class="s2">"1970-01-01T00:00:00Z"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"used_memory"</span><span class="p">:</span> <span class="mf">5656299.362068966</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"mem_size_lua"</span><span class="p">:</span> <span class="mf">35840.0</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"monitor_sessions_count"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"no_of_keys"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"other_req"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"other_res"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"read_hits"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"read_misses"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"read_req"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"read_res"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"total_connections_received"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"total_req"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"total_res"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"write_hits"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"write_misses"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"write_req"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"write_res"</span><span class="p">:</span> <span class="mf">0.0</span> </span></span><span class="line"><span class="cl"> <span class="p">},</span> </span></span><span class="line"><span class="cl"> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="nt">"interval"</span><span class="p">:</span> <span class="s2">"1hour"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"interval"</span><span class="p">:</span> <span class="s2">"1hour"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"stime"</span><span class="p">:</span> <span class="s2">"2015-05-27T13:00:00Z"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"etime"</span><span class="p">:</span> <span class="s2">"2015-05-28T13:59:59Z"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"avg_latency"</span><span class="p">:</span> <span class="mf">599.08</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"// additional fields..."</span> </span></span><span class="line"><span class="cl"> <span class="p">}</span> </span></span><span class="line"><span class="cl"> <span class="p">]</span> </span></span><span class="line"><span class="cl"> <span class="p">},</span> </span></span><span class="line"><span class="cl"> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="nt">"uid"</span><span class="p">:</span> <span class="s2">"2"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"intervals"</span><span class="p">:</span> <span class="p">[</span> </span></span><span class="line"><span class="cl"> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="nt">"interval"</span><span class="p">:</span> <span class="s2">"1hour"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"stime"</span><span class="p">:</span> <span class="s2">"2015-05-27T12:00:00Z"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"etime"</span><span class="p">:</span> <span class="s2">"2015-05-28T12:59:59Z"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"avg_latency"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"// additional fields..."</span> </span></span><span class="line"><span class="cl"> <span class="p">},</span> </span></span><span class="line"><span class="cl"> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="nt">"interval"</span><span class="p">:</span> <span class="s2">"1hour"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"stime"</span><span class="p">:</span> <span class="s2">"2015-05-27T13:00:00Z"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"etime"</span><span class="p">:</span> <span class="s2">"2015-05-28T13:59:59Z"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl"> <span class="nt">"// additional fields..."</span> </span></span><span class="line"><span class="cl"> <span class="p">}</span> </span></span><span class="line"><span class="cl"> <span class="p">]</span> </span></span><span class="line"><span class="cl"> <span class="p">}</span> </span></span><span class="line"><span class="cl"><span class="p">]</span> </span></span></code></pre> </div> <h4 id="get-all-status-codes"> Status codes </h4> <table> <thead> <tr> <th> Code </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1"> 200 OK </a> </td> <td> No error </td> </tr> <tr> <td> <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5"> 404 Not Found </a> </td> <td> No bdbs exist </td> </tr> </tbody> </table> <h3 id="example-requests"> Example requests </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 GET </span></span><span class="line"><span class="cl"> https://<span class="o">[</span>host<span class="o">][</span>:port<span class="o">]</span>/v1/bdbs/stats?interval<span class="o">=</span>1hour </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></span><span class="line"><span class="cl"><span class="n">url</span> <span class="o">=</span> <span class="s2">"https://[host][:port]/v1/bdbs/stats?interval=1hour"</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">"GET"</span><span class="p">,</span> <span class="n">url</span><span class="p">,</span> <span class="n">auth</span><span class="o">=</span><span class="n">auth</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="get-bdbs-stats"> Get database stats </h2> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">GET /v1/bdbs/stats/<span class="o">{</span>int: uid<span class="o">}</span> </span></span></code></pre> </div> <p> Get statistics for a specific database. </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/references/rest-api/permissions/#view_bdb_stats"> view_bdb_stats </a> </td> <td> admin <br/> cluster_member <br/> cluster_viewer <br/> db_member <br/> db_viewer <br/> user_manager </td> </tr> </tbody> </table> <h3 id="get-request"> Request </h3> <h4 id="example-http-request-1"> Example HTTP request </h4> <div class="highlight"> <pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">GET /bdbs/stats/1?interval<span class="o">=</span>1hour<span class="p">&amp;</span><span class="nv">stime</span><span class="o">=</span>2014-08-28T10:00:00Z </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 unique ID of the BDB requested. </td> </tr> </tbody> </table> <h4 id="query-parameters-1"> Query parameters </h4> <table> <thead> <tr> <th> Field </th> <th> Type </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> interval </td> <td> string </td> <td> Time interval for for which we want stats: 1sec/10sec/5min/15min/1hour/12hour/1week (optional) </td> </tr> <tr> <td> stime </td> <td> ISO_8601 </td> <td> Start time from which we want the stats. Should comply with the <a href="https://en.wikipedia.org/wiki/ISO_8601"> ISO_8601 </a> format (optional) </td> </tr> <tr> <td> etime </td> <td> ISO_8601 </td> <td> End time after which we don't want the stats. Should comply with the <a href="https://en.wikipedia.org/wiki/ISO_8601"> ISO_8601 </a> format (optional) </td> </tr> </tbody> </table> <h3 id="get-response"> Response </h3> <p> Returns <a href="/docs/latest/operate/rs/references/rest-api/objects/statistics/"> statistics </a> for a specific database. </p> <h4 id="example-json-body-1"> Example JSON body </h4> <div class="highlight"> <pre class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="nt">"uid"</span><span class="p">:</span> <span class="s2">"1"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"intervals"</span><span class="p">:</span> <span class="p">[</span> </span></span><span class="line"><span class="cl"> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="nt">"interval"</span><span class="p">:</span> <span class="s2">"1hour"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"stime"</span><span class="p">:</span> <span class="s2">"2015-05-27T12:00:00Z"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"etime"</span><span class="p">:</span> <span class="s2">"2015-05-28T12:59:59Z"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"avg_latency"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"conns"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"egress_bytes"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"evicted_objects"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"pubsub_channels"</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"pubsub_patterns"</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"expired_objects"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"ingress_bytes"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"instantaneous_ops_per_sec"</span><span class="p">:</span> <span class="mf">0.00011973180076628352</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"last_req_time"</span><span class="p">:</span> <span class="s2">"1970-01-01T00:00:00Z"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"last_res_time"</span><span class="p">:</span> <span class="s2">"1970-01-01T00:00:00Z"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"used_memory"</span><span class="p">:</span> <span class="mf">5656299.362068966</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"mem_size_lua"</span><span class="p">:</span> <span class="mf">35840.0</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"monitor_sessions_count"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"no_of_keys"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"other_req"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"other_res"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"read_hits"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"read_misses"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"read_req"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"read_res"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"total_connections_received"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"total_req"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"total_res"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"write_hits"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"write_misses"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"write_req"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"write_res"</span><span class="p">:</span> <span class="mf">0.0</span> </span></span><span class="line"><span class="cl"> <span class="p">},</span> </span></span><span class="line"><span class="cl"> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="nt">"interval"</span><span class="p">:</span> <span class="s2">"1hour"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"stime"</span><span class="p">:</span> <span class="s2">"2015-05-27T13:00:00Z"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"etime"</span><span class="p">:</span> <span class="s2">"2015-05-28T13:59:59Z"</span><span class="p">,</span> </span></span><span class="line"><span class="cl"> <span class="nt">"// additional fields..."</span> </span></span><span class="line"><span class="cl"> <span class="p">}</span> </span></span><span class="line"><span class="cl"> <span class="p">]</span> </span></span><span class="line"><span class="cl"><span class="p">}</span> </span></span></code></pre> </div> <h4 id="get-status-codes"> Status codes </h4> <table> <thead> <tr> <th> Code </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1"> 200 OK </a> </td> <td> No error </td> </tr> <tr> <td> <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5"> 404 Not Found </a> </td> <td> bdb does not exist </td> </tr> <tr> <td> <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.7"> 406 Not Acceptable </a> </td> <td> bdb isn't currently active </td> </tr> <tr> <td> <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.4"> 503 Service Unavailable </a> </td> <td> bdb is in recovery state </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/stats/"/> <div class="flex flex-row justify-between"> <div class="grid justify-center"> <span class="font-mono"> RATE THIS PAGE </span> <div class="star-rating"> <input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/> <label class="star" for="5-stars"> β˜… </label> <input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/> <label class="star" for="4-stars"> β˜… </label> <input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/> <label class="star" for="3-stars"> β˜… </label> <input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/> <label class="star" for="2-stars"> β˜… </label> <input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/> <label class="star" for="1-stars"> β˜… </label> </div> </div> <a class="font-mono no-underline" href="#"> Back to top ↑ </a> </div> <div class="hidden" id="feedback-form"> <div class="grid gap-2"> <textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea> <button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit"> Submit </button> </div> </div> </form> <script> document.addEventListener("DOMContentLoaded", function() { const form = document.querySelector("#page-feedback"); form.addEventListener("submit", function(event) { event.preventDefault(); var xhr = new XMLHttpRequest(); var url = "\/docusight\/api\/rate"; var params = new URLSearchParams(new FormData(form)); xhr.open("POST", url, true); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.onreadystatechange = function() { if (xhr.readyState === 4 && xhr.status === 200) { const responseData = JSON.parse(xhr.responseText); const responseMessage = responseData.response; const newText = document.createTextNode(responseMessage); form.parentNode.replaceChild(newText, form); } }; xhr.send(params); }); }); </script> </section>
https://redis.io/docs/latest/develop/connect/insight/tutorials/insight-stream-consumer/.html
<section class="prose w-full py-12"> <h1> Manage streams and consumer groups in Redis Insight </h1> <p class="text-lg -mt-5 mb-10"> Learn how to manage streams and consumer groups in Redis Insight </p> <p> A <em> stream </em> is an append-only log file. When you add data to it, you cannot change it. That may seem like a disadvantage; however, a stream serves as a log or single source of truth. It can also be used as a buffer between processes that work at different speeds and do not need to know about each other. For more conceptual information about streams, see <a href="/docs/latest/develop/data-types/streams/"> Redis Streams </a> . </p> <p> In this topic, you will learn how to add and work with streams as well as consumer groups in Redis Insight. </p> <p> Here's a stream that models temperature and humidity sensors. Processes interacting with the stream perform one of two roles: <em> consumer </em> and <em> producer </em> . The point of a stream is that it's not going to end, so you cannot capture whole datasets and do some processing on them. </p> <p> In this stream, sensors are considered <em> producers </em> , which broadcast data. A <em> consumer </em> reads from the stream and does some work on it. For example, if the temperature is above a certain threshold, it puts a message out to turn on the air conditioner in that unit or notify the maintenance. </p> <img src="../images/stream.png"/> <p> It is possible to have multiple consumers doing different jobs, one measuring humidity, and another taking temperature measurements over periods of time. Redis stores a copy of the entire dataset in memory, which is a finite resource. To avoid runaway data, streams can be trimmed when you add something to them. When adding to a stream with <a href="/docs/latest/commands/xadd/"> <code> XADD </code> </a> , you can optionally specify that the stream should be trimmed to a specific or approximate number of the newest entries, or to only include entries whose ID is higher than the ID specified. You can also manage the storage required for streaming data using key expiry. For example, by writing each day's data to its own stream in Redis and expiring each stream's key after a period of time, say a week. An ID can be any number, but each new entry in the stream must have an ID whose value is higher than the last ID added to the stream. </p> <h2 id="adding-new-entries"> Adding new entries </h2> <p> Use <a href="/docs/latest/commands/xadd/"> <code> XADD </code> </a> with <code> * </code> for the ID to have Redis automatically generate a new ID for you consisting of a millisecond precision timestamp, a dash and a sequence number. For example <code> 1656416957625-0 </code> . Then supply the field names and values to store in the new stream entry. </p> <p> There are a couple of ways of retrieving things. You can retrieve entries by time range or you could ask for everything that's happened since a timestamp or ID that you specify. Using a single command you can ask for anything from 10:30 until 11:15 am on a given day. </p> <h2 id="consumer-groups"> Consumer groups </h2> <p> A more realistic use case would be a system with many temperature sensors whose data Redis puts in a stream, records the time they arrive, and orders them. </p> <img src="../images/consumer.png"/> <p> On the right side we have two consumers that read the stream. One of them is alerting if the temperature is over a certain number and texting the maintenance crew that they need to do something, and the other is a data warehouse that is taking the data and putting it into a database. </p> <p> They run independently of each other. Up in the right, we have another sort of task. Let's assume that alerting and data warehouse are really fast. You get a message whether the temperature is larger than a specific value, which might take a millisecond. And alerting can keep up with the data flow. One way you can scale consumers is <em> consumer groups </em> , which allows multiple instances of the same consumer or same code to work as a team to process the stream. </p> <h2 id="managing-streams-in-redis-insight"> Managing streams in Redis Insight </h2> <p> You can add a stream in Redis Insight in two ways: create a new stream or add to an existing stream. </p> <p> To create a stream, start by selecting the key type (stream). You cannot set time to live (TTL) because it cannot be put on a message in a stream; it can only be done on a Redis key. Name the stream <em> mystream </em> . Then, set the <em> Entry ID </em> to <code> * </code> to default to timestamp. If you have your own ID generation strategy, enter the next ID from your sequence. Remember that the ID must be higher than the ID of any other entry in the stream. </p> <p> Then, enter fields and values using + to add more than one (for example, name and location). Now you have a stream that appears in the <strong> Streams </strong> view and you can continue adding fields and values to it. </p> <p> Redis Insight runs read commands for you so you can see the stream entries in the <strong> Streams </strong> view. And the <strong> Consumer Groups </strong> view shows each consumers in a given consumer group and the last time Redis allocated a message, what the ID of it was and how many times that process has happened, and whether a consumer has you have told Redis that you are finished working with that task using the <a href="/docs/latest/commands/xack/"> <code> XACK </code> </a> command. </p> <h2 id="monitor-temperature-and-humidity-from-sensors-in-redis-insight"> Monitor temperature and humidity from sensors in Redis Insight </h2> <p> This example shows how to bring an existing stream into Redis Insight and work with it. </p> <h3 id="setup"> Setup </h3> <ol> <li> Install <a href="https://redis.com/redis-enterprise/redis-insight/?_ga=2.48624486.1318387955.1655817244-1963545967.1655260674#insight-form"> Redis Insight </a> . </li> <li> Download and install <a href="https://nodejs.org/en/download/"> Node.js </a> (LTS version). </li> <li> Install <a href="/docs/latest/operate/oss_and_stack/install/"> Redis </a> . In Docker, check that Redis is running locally on the default port 6379 (with no password set). </li> <li> Clone the <a href="https://github.com/redis-developer/introducing-redis-talk"> code repository </a> for this example. See the <a href="https://github.com/redis-developer/introducing-redis-talk/tree/main/streams"> README </a> for more information about this example and installation tips. </li> <li> On your command-line, navigate to the folder containing the code repository and install the Node.js package manager (npm). </li> </ol> <div class="highlight"> <pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">npm install</span></span></code></pre> </div> <h3 id="run-the-producer"> Run the producer </h3> <p> To start the producer, which will add a new entry to the stream every few seconds, enter: </p> <div class="highlight"> <pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">npm run producer </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl">&gt; [email protected] producer </span></span><span class="line"><span class="cl">&gt; node producer.js </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl">Starting producer... </span></span><span class="line"><span class="cl">Adding reading <span class="k">for</span> location: 62, temperature: 40.3, humidity: 36.5 </span></span><span class="line"><span class="cl">Added as 1632771056648-0 </span></span><span class="line"><span class="cl">Adding reading <span class="k">for</span> location: 96, temperature: 15.4, humidity: <span class="m">70</span> </span></span><span class="line"><span class="cl">Added as 1632771059039-0 </span></span><span class="line"><span class="cl">...</span></span></code></pre> </div> <p> The producer runs indefinitely. Select <code> Ctrl+C </code> to stop it. You can start multiple instances of the producer if you want to add entries to the stream faster. </p> <h3 id="run-the-consumer"> Run the consumer </h3> <p> To start the consumer, which reads from the stream every few seconds, enter: </p> <div class="highlight"> <pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">npm run consumer </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl">&gt; [email protected] consumer </span></span><span class="line"><span class="cl">&gt; node consumer.js </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl">Starting consumer... </span></span><span class="line"><span class="cl">Resuming from ID 1632744741693-0 </span></span><span class="line"><span class="cl">Reading stream... </span></span><span class="line"><span class="cl">Received entry 1632771056648-0: </span></span><span class="line"><span class="cl"><span class="o">[</span> <span class="s1">'location'</span>, <span class="s1">'62'</span>, <span class="s1">'temp'</span>, <span class="s1">'40.3'</span>, <span class="s1">'humidity'</span>, <span class="s1">'36.5'</span> <span class="o">]</span> </span></span><span class="line"><span class="cl">Finished working with entry 1632771056648-0 </span></span><span class="line"><span class="cl">Reading stream... </span></span><span class="line"><span class="cl">Received entry 1632771059039-0: </span></span><span class="line"><span class="cl"><span class="o">[</span> <span class="s1">'location'</span>, <span class="s1">'96'</span>, <span class="s1">'temp'</span>, <span class="s1">'15.4'</span>, <span class="s1">'humidity'</span>, <span class="s1">'70'</span> <span class="o">]</span></span></span></code></pre> </div> <p> The consumer stores the last entry ID that it read in a Redis string at the key <code> consumer:lastid </code> . It uses this string to pick up from where it left off after it is restarted. Try this out by stopping it with <code> Ctrl+C </code> and restarting it. </p> <p> Once the consumer has processed every entry in the stream, it will wait indefinitely for instances of the producer to add more: </p> <div class="highlight"> <pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">Reading stream... </span></span><span class="line"><span class="cl">No new entries since entry 1632771060229-0. </span></span><span class="line"><span class="cl">Reading stream... </span></span><span class="line"><span class="cl">No new entries since entry 1632771060229-0. </span></span><span class="line"><span class="cl">Reading stream...</span></span></code></pre> </div> <p> Stop it using <code> Ctrl+C </code> . </p> <h3 id="run-a-consumer-group"> Run a consumer group </h3> <p> A consumer group consists of multiple consumer instances working together. Redis manages allocation of entries read from the stream to members of a consumer group. A consumer in a group will receive a subset of the entries, with the group as a whole receiving all of them. When working in a consumer group, a consumer process must acknowledge receipt/processing of each entry. </p> <p> Using multiple terminal windows, start three instances of the consumer group consumer, giving each a unique name: </p> <div class="highlight"> <pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">npm run consumergroup consumer1 </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl">&gt; [email protected] consumergroup </span></span><span class="line"><span class="cl">&gt; node consumer_group.js -- <span class="s2">"consumer1"</span> </span></span><span class="line"><span class="cl"> </span></span><span class="line"><span class="cl">Starting consumer consumer1... </span></span><span class="line"><span class="cl">Consumer group temphumidity_consumers exists, not created. </span></span><span class="line"><span class="cl">Reading stream... </span></span><span class="line"><span class="cl">Received entry 1632771059039-0: </span></span><span class="line"><span class="cl"><span class="o">[</span> <span class="s1">'location'</span>, <span class="s1">'96'</span>, <span class="s1">'temp'</span>, <span class="s1">'15.4'</span>, <span class="s1">'humidity'</span>, <span class="s1">'70'</span> <span class="o">]</span> </span></span><span class="line"><span class="cl">Acknowledged processing of entry 1632771059039-0. </span></span><span class="line"><span class="cl">Reading stream...</span></span></code></pre> </div> <p> In a second terminal: </p> <div class="highlight"> <pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">npm run consumergroup consumer2</span></span></code></pre> </div> <p> And in a third: </p> <div class="highlight"> <pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">npm run consumergroup consumer3</span></span></code></pre> </div> <p> The consumers will run indefinitely, waiting for new messages to be added to the stream by a producer instance when they have collectively consumed the entire stream. Note that in this model, each consumer instance does not receive all of the entries from the stream, but the three members of the group each receive a subset. </p> <h3 id="view-the-stream-in-redis-insight"> View the stream in Redis Insight </h3> <ol> <li> Launch Redis Insight. </li> <li> Select <code> localhost:6379 </code> </li> <li> Select <strong> STREAM </strong> . Optionally, select full screen from the upper right corner to expand the view. </li> </ol> <img src="../images/insight_streams.png"/> <p> You can now toggle between <strong> Stream </strong> and <strong> Consumer Groups </strong> views to see your data. As mentioned earlier in this topic, a stream is an append-only log so you can't modify the contents of an entry, but you can delete an entire entry. A case when that's useful is in the event of a so-called <em> poison-pill message </em> that can cause consumers to crash. You can physically remove such messages in the <strong> Streams </strong> view or use the <a href="/docs/latest/commands/xdel/"> <code> XDEL </code> </a> command at the command-line interface (CLI). </p> <p> You can continue interacting with your stream at the CLI. For example, to get the current length of a stream, use the <a href="/docs/latest/commands/xlen/"> <code> XLEN </code> </a> command: </p> <div class="highlight"> <pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">XLEN ingest:temphumidity</span></span></code></pre> </div> <p> Use streams for auditing and processing events in banking, gaming, supply chain, IoT, social media, and so on. </p> <h2 id="related-topics"> Related topics </h2> <ul> <li> <a href="/docs/latest/develop/data-types/streams/"> Redis Streams </a> </li> <li> <a href="https://www.youtube.com/watch?v=q2UOkQmIo9Q"> Introducing Redis Streams with Redis Insight, node.js, and Python </a> (video) </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/tutorials/insight-stream-consumer/"/> <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/data-transformation-block-types/remove_field/.html
<section class="prose w-full py-12 max-w-none"> <h1> remove_field </h1> <p class="text-lg -mt-5 mb-10"> Remove fields </p> <p> Remove fields </p> <p> <strong> Option 1 (alternative): </strong> Remove multiple fields </p> <p> <strong> Properties </strong> </p> <table> <thead> <tr> <th> Name </th> <th> Type </th> <th> Description </th> <th> Required </th> </tr> </thead> <tbody> <tr> <td> <a href="#option1fields"> <strong> fields </strong> </a> </td> <td> <code> object[] </code> </td> <td> Fields <br/> </td> <td> yes </td> </tr> </tbody> </table> <p> <strong> Additional Properties: </strong> not allowed </p> <p> <strong> Example </strong> </p> <div class="highlight"> <pre class="chroma"><code class="language-yaml" data-lang="yaml"><span class="line"><span class="cl"><span class="nt">source</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">server_name</span><span class="p">:</span><span class="w"> </span><span class="l">redislabs</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">schema</span><span class="p">:</span><span class="w"> </span><span class="l">dbo</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">table</span><span class="p">:</span><span class="w"> </span><span class="l">emp</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">transform</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="nt">uses</span><span class="p">:</span><span class="w"> </span><span class="l">remove_field</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">with</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">fields</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="nt">field</span><span class="p">:</span><span class="w"> </span><span class="l">credit_card</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="nt">field</span><span class="p">:</span><span class="w"> </span><span class="l">name.mname</span><span class="w"> </span></span></span></code></pre> </div> <p> <strong> Option 2 (alternative): </strong> Remove one field </p> <p> <strong> Properties </strong> </p> <table> <thead> <tr> <th> Name </th> <th> Type </th> <th> Description </th> <th> Required </th> </tr> </thead> <tbody> <tr> <td> <strong> field </strong> </td> <td> <code> string </code> </td> <td> Field <br/> </td> <td> yes </td> </tr> </tbody> </table> <p> <strong> Additional Properties: </strong> not allowed <br/> <strong> Example </strong> </p> <div class="highlight"> <pre class="chroma"><code class="language-yaml" data-lang="yaml"><span class="line"><span class="cl"><span class="nt">source</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">server_name</span><span class="p">:</span><span class="w"> </span><span class="l">redislabs</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">schema</span><span class="p">:</span><span class="w"> </span><span class="l">dbo</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">table</span><span class="p">:</span><span class="w"> </span><span class="l">emp</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">transform</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="nt">uses</span><span class="p">:</span><span class="w"> </span><span class="l">remove_field</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">with</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">field</span><span class="p">:</span><span class="w"> </span><span class="l">credit_card</span><span class="w"> </span></span></span></code></pre> </div> <p> <a name="option1fields"> </a> </p> <h2 id="option-1-fields-array"> Option 1: fields[]: array </h2> <p> Fields </p> <p> <strong> Items </strong> </p> <p> <strong> Item Properties </strong> </p> <table> <thead> <tr> <th> Name </th> <th> Type </th> <th> Description </th> <th> Required </th> </tr> </thead> <tbody> <tr> <td> <strong> field </strong> </td> <td> <code> string </code> </td> <td> Field <br/> </td> <td> yes </td> </tr> </tbody> </table> <p> <strong> Item Additional Properties: </strong> not allowed </p> <p> <strong> Example </strong> </p> <div class="highlight"> <pre class="chroma"><code class="language-yaml" data-lang="yaml"><span class="line"><span class="cl">- {}<span class="w"> </span></span></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/integrate/write-behind/reference/data-transformation-block-types/remove_field/"/> <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.tagvals/.html
<section class="prose w-full py-12"> <h1 class="command-name"> FT.TAGVALS </h1> <div class="font-semibold text-redis-ink-900"> Syntax </div> <pre class="command-syntax">FT.TAGVALS index field_name </pre> <dl class="grid grid-cols-[auto,1fr] gap-2 mb-12"> <dt class="font-semibold text-redis-ink-900 m-0"> Available in: </dt> <dd class="m-0"> <a href="/docs/stack"> Redis Stack </a> / <a href="/docs/interact/search-and-query"> Search 1.0.0 </a> </dd> <dt class="font-semibold text-redis-ink-900 m-0"> Time complexity: </dt> <dd class="m-0"> O(N) </dd> </dl> <p> Return a distinct set of values indexed in a Tag field </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> <details open=""> <summary> <code> field_name </code> </summary> <p> is name of a Tag file defined in the schema. </p> </details> <p> Use FT.TAGVALS if your tag indexes things like cities, categories, and so on. </p> <h2 id="limitations"> Limitations </h2> <p> FT.TAGVALS provides no paging or sorting, and the tags are not alphabetically sorted. FT.TAGVALS only operates on <a href="/docs/latest/develop/interact/search-and-query/advanced-concepts/tags/"> tag fields </a> . The returned strings are lowercase with whitespaces removed, but otherwise unchanged. </p> <h2 id="return"> Return </h2> <p> FT.TAGVALS returns an array reply of all distinct tags in the tag index. </p> <h2 id="examples"> Examples </h2> <details open=""> <summary> <b> Return a set of values indexed in a Tag field </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.TAGVALS idx myTag </span></span><span class="line"><span class="cl">1<span class="o">)</span> <span class="s2">"Hello"</span> </span></span><span class="line"><span class="cl">2<span class="o">)</span> <span class="s2">"World"</span></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> </p> <h2 id="related-topics"> Related topics </h2> <ul> <li> <a href="/docs/latest/develop/interact/search-and-query/advanced-concepts/tags/"> Tag fields </a> </li> <li> <a href="/docs/latest/develop/interact/search-and-query/"> RediSearch </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/ft.tagvals/"/> <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>