From 1b29f102a8e8e6a9948885caa7d7d8027f536df7 Mon Sep 17 00:00:00 2001 From: Lior Kogan Date: Sat, 19 Apr 2025 22:05:56 +0300 Subject: [PATCH 01/15] Tim e Series - Configuration.md - reorganized and added content --- .../data-types/timeseries/configuration.md | 214 ++++++++++-------- 1 file changed, 115 insertions(+), 99 deletions(-) diff --git a/content/develop/data-types/timeseries/configuration.md b/content/develop/data-types/timeseries/configuration.md index bf311626c7..b6961e8876 100644 --- a/content/develop/data-types/timeseries/configuration.md +++ b/content/develop/data-types/timeseries/configuration.md @@ -14,35 +14,68 @@ linkTitle: Configuration title: Configuration Parameters weight: 3 --- -{{< note >}} -As of Redis Community Edition 8.0, configuration parameters for the time series data structure are now set in the following ways: -* At load time via your `redis.conf` file. -* At run time (where applicable) using the [`CONFIG SET`]({{< relref "/commands/config-set" >}}) command. +## Redis CE - Setting configuration parameters -Also, Redis CE 8.0 persists probabilistic configuration parameters just like any other configuration parameters (e.g., using the [`CONFIG REWRITE`]({{< relref "/commands/config-rewrite/" >}}) command). -{{< /note >}} +Previous to version 8.0, all time series configuration parameters were load-time parameters. + +In order to change the values of a load-time parameter, you have to use one of the following methods: + +- Pass them as command-line arguments following the `loadmodule` argument when starting redis-server + + `redis-server --loadmodule ./{modulename}.so [OPT VAL]...` + +- Add them as arguments to the `loadmodule` directive in your configuration file (e.g., `redis.conf`): + + `loadmodule ./{modulename}.so [OPT VAL]...` + +- Using the `MODULE LOAD path [arg [arg ...]]` command. + +- Using the `MODULE LOADEX path [CONFIG name value [CONFIG name value ...]] [ARGS args [args ....]]` command. + +With the introduction of Redis 8.0, most of the time series configuration parameters are now runtime parameters. This means that their values can be changed at runtime. +You can still set runtime parameters at load-time, but it is less recommended. +Instead, you should use the Redis `CONFIG` command with time series runtime configuration parameters, in exactly the same way you would do for Redis runtime configuration parameters. + +This means: + +- `CONFIG SET parameter value [parameter value ...] ` + + Set one or more configuration parameters. + +- `CONFIG GET parameter [parameter ...]` + + Read the current value of one of more parameters. + +- `CONFIG REWRITE` + + Rewrite your Redis configuration file (e.g., the `redis.conf` file) to reflect the configuration changes. + +You can also specify the value directly in your Redis configuration file (e.g., the `redis.conf` file) the same way you would do for Redis runtime configuration parameters. + +Once a value is set with `CONFIG SET`, or added manually to your configuration file, it will overwrite values set with `--loadmodule`, `loadmodule`, `MODULE LOAD`, or `MODULE LOADEX`. + +Note that on a cluster, `CONFIG SET` and `CONFIG REWRITE` have to be called on each node separately. + +We also introduced new configuration parameters, and aligned the naming scheme of the module configuration parameters with Redis configuration parameters. +When using the `CONFIG` command, you must use the new names. ## Time series configuration parameters | Parameter name
(version < 8.0) | Parameter name
(version ≥ 8.0) | Run-time | Redis
Software | Redis
Cloud | | :------- | :------- | :------- | :------- | :------- | -| CHUNK_SIZE_BYTES | [ts-chunk-size-bytes](#ts-chunk-size-bytes) | :white_check_mark: | ✅ Supported

| ✅ Flexible & Annual
❌ Free & Fixed | -| COMPACTION_POLICY | [ts-compaction-policy](#ts-compaction-policy) | :white_check_mark: | ✅ Supported

| ✅ Flexible & Annual
❌ Free & Fixed | -| DUPLICATE_POLICY | [ts-duplicate-policy](#ts-duplicate-policy) | :white_check_mark: | ✅ Supported

| ✅ Flexible & Annual
❌ Free & Fixed | -| ENCODING | [ts-encoding](#ts-encoding) | :white_check_mark: | ✅ Supported

| ✅ Flexible & Annual
❌ Free & Fixed | -| IGNORE_MAX_TIME_DIFF | [ts-ignore-max-time-diff](#ts-ignore-max-time-diff-and-ts-ignore-max-val-diff) | :white_check_mark: ||| -| IGNORE_MAX_VAL_DIFF | [ts-ignore-max-val-diff](#ts-ignore-max-time-diff-and-ts-ignore-max-val-diff) | :white_check_mark: ||| -| NUM_THREADS | [ts-num-threads](#ts-num-threads) | :white_large_square: | ✅ Supported

| ✅ Flexible & Annual
❌ Free & Fixed | -| RETENTION_POLICY | [ts-retention-policy](#ts-retention-policy) | :white_check_mark: | ✅ Supported

| ✅ Flexible & Annual
❌ Free & Fixed | -| OSS_GLOBAL_PASSWORD | Deprecated in v8.0.0. Replace with the `masterauth` password. | :white_check_mark: ||| - -{{< note >}} -Parameter names for Redis CE versions < 8.0, while deprecated, will still be supported in version 8.0. -{{< /note >}} +| CHUNK_SIZE_BYTES | [ts-chunk-size-bytes](#chunk_size_bytes--ts-chunk-size-bytes) | :white_check_mark: | ✅ Supported

| ✅ Flexible & Annual
❌ Free & Fixed | +| COMPACTION_POLICY | [ts-compaction-policy](#compaction_policy--ts-compaction-policy) | :white_check_mark: | ✅ Supported

| ✅ Flexible & Annual
❌ Free & Fixed | +| DUPLICATE_POLICY | [ts-duplicate-policy](#duplicate_policy--ts-duplicate-policy) | :white_check_mark: | ✅ Supported

| ✅ Flexible & Annual
❌ Free & Fixed | +| RETENTION_POLICY | [ts-retention-policy](#retention_policy--ts-retention-policy) | :white_check_mark: | ✅ Supported

| ✅ Flexible & Annual
❌ Free & Fixed | +| ENCODING | [ts-encoding](#encoding--ts-encoding) | :white_check_mark: | ✅ Supported

| ✅ Flexible & Annual
❌ Free & Fixed | +| IGNORE_MAX_TIME_DIFF | [ts-ignore-max-time-diff](#ignore_max_time_diff--ts-ignore-max-time-diff-and-ignore_max_val_diff--ts-ignore-max-val-diff) | :white_check_mark: ||| +| IGNORE_MAX_VAL_DIFF | [ts-ignore-max-val-diff](#ignore_max_time_diff--ts-ignore-max-time-diff-and-ignore_max_val_diff--ts-ignore-max-val-diff) | :white_check_mark: ||| +| NUM_THREADS | [ts-num-threads](#num_threads--ts-num-threads) | :white_large_square: | ✅ Supported

| ❌ Flexible & Annual
❌ Free & Fixed | +| OSS_GLOBAL_PASSWORD | Deprecated in v8.0 | :white_check_mark: ||| --- -### ts-chunk-size-bytes +### CHUNK_SIZE_BYTES / ts-chunk-size-bytes Default initial allocation size, in bytes, for the data part of each new chunk. This default value is applied to each new time series upon its creation. @@ -54,7 +87,7 @@ Valid range: `[48 .. 1048576]`; must be a multiple of 8 Default: `4096` -### ts-compaction-policy +### COMPACTION_POLICY / ts-compaction-policy Default compaction rules for newly created keys with [`TS.ADD`]({{< relref "/commands/ts.add/" >}}), [`TS.INCRBY`]({{< relref "/commands/ts.incrby/" >}}), and [`TS.DECRBY`]({{< relref "/commands/ts.decrby/" >}}). @@ -64,17 +97,7 @@ Default: No compaction rules. **Discussion** -#### Example - -``` -$ redis-server --loadmodule ./redistimeseries.so NUM_THREADS 3 -``` - -### COMPACTION_POLICY - -Default compaction rules for newly created key with [`TS.ADD`]({{< relref "commands/ts.add/" >}}), [`TS.INCRBY`]({{< relref "commands/ts.incrby/" >}}), and [`TS.DECRBY`]({{< relref "commands/ts.decrby/" >}}). - -Note that `COMPACTION_POLICY` has no effect on keys created with [`TS.CREATE`]({{< relref "commands/ts.create/" >}}). To understand the motivation for this behavior, consider the following scenario: Suppose a `COMPACTION_POLICY` is defined, but then one wants to manually create an additional compaction rule (using [`TS.CREATERULE`]({{< relref "commands/ts.createrule/" >}})) which requires first creating an empty destination key (using [`TS.CREATE`]({{< relref "commands/ts.create/" >}})). But now there is a problem: due to the `COMPACTION_POLICY`, automatic compactions would be undesirably created for that destination key. +Note that this configuration parameter has no effect on keys created with [`TS.CREATE`]({{< relref "commands/ts.create/" >}}). To understand the motivation for this behavior, consider the following scenario: Suppose a default compaction policy is defined, but then one wants to manually create an additional compaction rule (using [`TS.CREATERULE`]({{< relref "commands/ts.createrule/" >}})) which requires first creating an empty destination key (using [`TS.CREATE`]({{< relref "commands/ts.create/" >}})). But now there is a problem: due to the default compaction policy, automatic compactions would be undesirably created for that destination key. Each rule is separated by a semicolon (`;`), the rule consists of multiple fields that are separated by a colon (`:`): @@ -127,7 +150,7 @@ Each rule is separated by a semicolon (`;`), the rule consists of multiple field Assure that there is a bucket that starts at exactly _alignTimestamp_ after the epoch and align all other buckets accordingly. Default value: 0 (aligned with the epoch). Example: if _bucketDuration_ is 24 hours, setting _alignTimestamp_ to `6h` (6 hours after the Epoch) will ensure that each bucket’s timeframe is [06:00 .. 06:00). {{% warning %}} -In a clustered environment, if you set `COMPACTION_POLICY`, you must use [hash tags]({{< relref "/operate/oss_and_stack/reference/cluster-spec" >}}#hash-tags) for all time series key names. This ensures that Redis will create each compaction in the same hash slot as its source key. If you don't, the system may fail to compact the data without displaying any error messages. +In a clustered environment, if you set this configuration parameter, you must use [hash tags]({{< relref "/operate/oss_and_stack/reference/cluster-spec" >}}#hash-tags) for all time series key names. This ensures that Redis will create each compaction in the same hash slot as its source key. If you don't, the system may fail to compact the data without displaying any error messages. {{% /warning %}} When a compaction policy is defined, compaction rules will be created automatically for newly created time series, and their key would be set to: @@ -145,42 +168,10 @@ When a compaction policy is defined, compaction rules will be created automatica - `max:1M:1h` - Aggregate using `max` over one-minute windows and retain the last hour - `twa:1d:0m:360M` - Aggregate daily [06:00 .. 06:00) using `twa`; no expiration -### ts-duplicate-policy +### DUPLICATE_POLICY / ts-duplicate-policy The default policy for handling insertion ([`TS.ADD`]({{< relref "/commands/ts.add/" >}}) and [`TS.MADD`]({{< relref "/commands/ts.madd/" >}})) of multiple samples with identical timestamps, with one of the following values: -#### Example - -``` -$ redis-server --loadmodule ./redistimeseries.so COMPACTION_POLICY max:1m:1h;min:10s:5d:10d;last:5M:10m;avg:2h:10d;avg:3d:100d -``` - -### RETENTION_POLICY - -Default retention period, in milliseconds, for newly created keys. - -Retention period is the maximum age of samples compared to highest reported timestamp, per key. Samples are expired based solely on the difference between their timestamp and the timestamps passed to subsequent [`TS.ADD`]({{< relref "commands/ts.add/" >}}), [`TS.MADD`]({{< relref "commands/ts.madd/" >}}), [`TS.INCRBY`]({{< relref "commands/ts.incrby/" >}}), and [`TS.DECRBY`]({{< relref "commands/ts.decrby/" >}}) calls. - -The value `0` means no expiration. - -When both `COMPACTION_POLICY` and `RETENTION_POLICY` are specified, the retention of newly created compactions is according to the retention time specified in `COMPACTION_POLICY`. - -#### Default - -0 - -#### Example - -Setting the default retention to 300 days: - -``` -$ redis-server --loadmodule ./redistimeseries.so RETENTION_POLICY 25920000000 -``` - -### DUPLICATE_POLICY - -Is policy for handling insertion ([`TS.ADD`]({{< relref "commands/ts.add/" >}}) and [`TS.MADD`]({{< relref "commands/ts.madd/" >}})) of multiple samples with identical timestamps, with one of the following values: - | policy | description | | ---------- | ---------------------------------------------------------------- | | `BLOCK` | Ignore any newly reported value and reply with an error | @@ -205,7 +196,53 @@ Since the duplication policy can be provided at different levels, the actual pre 1. The `ts-duplicate-policy` configuration parameter. 1. The default policy. -### ts-encoding +#### Example + +Version < 8.0: + +``` +$ redis-server --loadmodule ./redistimeseries.so COMPACTION_POLICY max:1m:1h;min:10s:5d:10d;last:5M:10m;avg:2h:10d;avg:3d:100d +``` + +Version >= 8.0: + +``` +$ CONFIG SET ts-compaction-policy max:1m:1h;min:10s:5d:10d;last:5M:10m;avg:2h:10d;avg:3d:100d +``` + +### RETENTION_POLICY / ts-retention-policy + +Default retention period, in milliseconds, for newly created keys. + +Retention period is the maximum age of samples compared to highest reported timestamp, per key. Samples are expired based solely on the difference between their timestamp and the timestamps passed to subsequent [`TS.ADD`]({{< relref "commands/ts.add/" >}}), [`TS.MADD`]({{< relref "commands/ts.madd/" >}}), [`TS.INCRBY`]({{< relref "commands/ts.incrby/" >}}), and [`TS.DECRBY`]({{< relref "commands/ts.decrby/" >}}) calls. + +Type: integer + +Valid range: `[0 .. 9,223,372,036,854,775,807]` + +Default: `0` + +The value `0` means no expiration. + +When both `COMPACTION_POLICY` / `ts-compaction-policy` and `RETENTION_POLICY` / `ts-retention-policy` are specified, the retention of newly created compactions is according to the retention time specified in `COMPACTION_POLICY` / `ts-compaction-policy`. + +#### Example + +Setting the default retention to 300 days + +Version < 8.0: + +``` +$ redis-server --loadmodule ./redistimeseries.so RETENTION_POLICY 25920000000 +``` + +Version >= 8.0: + +``` +$ CONFIG SET ts-retention-policy 25920000000 +``` + +### ENCODING / ts-encoding Note: Before v1.6 this configuration parameter was named `CHUNK_TYPE`. @@ -217,7 +254,7 @@ Valid values: `COMPRESSED`, `UNCOMPRESSED` Default: `COMPRESSED` -### ts-ignore-max-time-diff and ts-ignore-max-val-diff +### IGNORE_MAX_TIME_DIFF / ts-ignore-max-time-diff and IGNORE_MAX_VAL_DIFF / ts-ignore-max-val-diff Default values for newly created keys. @@ -247,7 +284,7 @@ A new sample is considered a duplicate and is ignored if the following condition where `max_timestamp` is the timestamp of the sample with the largest timestamp in the time series, and `value_at_max_timestamp` is the value at `max_timestamp`. -### ts-num-threads +### NUM_THREADS / ts-num-threads The maximum number of per-shard threads for cross-key queries when using cluster mode ([`TS.MRANGE`]({{< relref "/commands/ts.mrange/" >}}), [`TS.MREVRANGE`]({{< relref "/commands/ts.mrevrange/" >}}), [`TS.MGET`]({{< relref "/commands/ts.mget/" >}}), and [`TS.QUERYINDEX`]({{< relref "/commands/ts.queryindex/" >}})). The value must be equal to or greater than `1`. Note that increasing this value may either increase or decrease the performance! @@ -263,42 +300,21 @@ Redis Cloud defaults: - Flexible & Annual: Set by plan - Free & Fixed: `1` -### ts-retention-policy - -Default retention period, in milliseconds, for newly created keys. - -Type: integer - -Valid range: `[0 .. 9,223,372,036,854,775,807]` - -Default: `0` - -Retention period is the maximum age of samples compared to highest reported timestamp, per key. Samples are expired based solely on the difference between their timestamps and the timestamps passed to subsequent [`TS.ADD`]({{< relref "/commands/ts.add/" >}}), [`TS.MADD`]({{< relref "/commands/ts.madd/" >}}), [`TS.INCRBY`]({{< relref "/commands/ts.incrby/" >}}), and [`TS.DECRBY`]({{< relref "/commands/ts.decrby/" >}}) calls. - -The value `0` means no expiration. - -When both `ts-compaction-policy` and `ts-retention-policy` are specified, the retention of newly created compactions is according to the retention time specified in `ts-compaction-policy`. - -## Setting configuration parameters on module load (deprecated) - -These methods are deprecated beginning with Redis CE v8.0.0. - -Setting configuration parameters at load-time is done by appending arguments after the `--loadmodule` argument when starting a server from the command line or after the `loadmodule` directive in a Redis config file. For example: +#### Example -In [redis.conf]({{< relref "/operate/oss_and_stack/management/config" >}}): +Version < 8.0: -```sh -loadmodule ./redistimeseries.so [OPT VAL]... +``` +$ redis-server --loadmodule ./redistimeseries.so NUM_THREADS 3 ``` -From the [Redis CLI]({{< relref "/develop/tools/cli" >}}), using the [MODULE LOAD]({{< relref "/commands/module-load" >}}) command: +Version >= 8.0: ``` -127.0.0.6379> MODULE LOAD redistimeseries.so [OPT VAL]... +$ redis-server --loadmodule ./redistimeseries.so ts-num-threads 3 ``` -From the command line: -```sh -$ redis-server --loadmodule ./redistimeseries.so [OPT VAL]... -``` \ No newline at end of file +### OSS_GLOBAL_PASSWORD + +Previous to version 8.0, when using a cluster with time series, you had to set the `OSS_GLOBAL_PASSWORD` configuration parameter on all the cluster nodes. Starting with version 8.0, this parameter is obsolete, and ignored if present. Redis now utilizes a new shared secret mechanism to allow sending internal commands between cluster nodes. From efbf5c574f0bcaaeb97ad91f4736af302207aeaa Mon Sep 17 00:00:00 2001 From: Lior Kogan Date: Sat, 19 Apr 2025 22:14:05 +0300 Subject: [PATCH 02/15] Update configuration.md --- content/develop/data-types/timeseries/configuration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/develop/data-types/timeseries/configuration.md b/content/develop/data-types/timeseries/configuration.md index b6961e8876..97e242f091 100644 --- a/content/develop/data-types/timeseries/configuration.md +++ b/content/develop/data-types/timeseries/configuration.md @@ -50,7 +50,7 @@ This means: Rewrite your Redis configuration file (e.g., the `redis.conf` file) to reflect the configuration changes. -You can also specify the value directly in your Redis configuration file (e.g., the `redis.conf` file) the same way you would do for Redis runtime configuration parameters. +Starting with Redis 8.0, you can also specify time series configuration parameters directly in your Redis configuration file (e.g., the `redis.conf` file) the same way you would do for Redis configuration parameters. Once a value is set with `CONFIG SET`, or added manually to your configuration file, it will overwrite values set with `--loadmodule`, `loadmodule`, `MODULE LOAD`, or `MODULE LOADEX`. From d02d285dceac4a4ccfbe0087762f1ec6dc214ab3 Mon Sep 17 00:00:00 2001 From: Lior Kogan Date: Sat, 19 Apr 2025 22:16:23 +0300 Subject: [PATCH 03/15] Update configuration.md --- content/develop/data-types/timeseries/configuration.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/content/develop/data-types/timeseries/configuration.md b/content/develop/data-types/timeseries/configuration.md index 97e242f091..8a933a1c29 100644 --- a/content/develop/data-types/timeseries/configuration.md +++ b/content/develop/data-types/timeseries/configuration.md @@ -33,8 +33,7 @@ In order to change the values of a load-time parameter, you have to use one of t - Using the `MODULE LOADEX path [CONFIG name value [CONFIG name value ...]] [ARGS args [args ....]]` command. With the introduction of Redis 8.0, most of the time series configuration parameters are now runtime parameters. This means that their values can be changed at runtime. -You can still set runtime parameters at load-time, but it is less recommended. -Instead, you should use the Redis `CONFIG` command with time series runtime configuration parameters, in exactly the same way you would do for Redis runtime configuration parameters. +You can set runtime configuration parameters at load-time, but instead, it is recommended to use the Redis `CONFIG` command with time series runtime configuration parameters, the same way you would do for Redis runtime configuration parameters. This means: From bae2054325f2c77635843b24400be78cbe552fc2 Mon Sep 17 00:00:00 2001 From: Lior Kogan Date: Sat, 19 Apr 2025 22:19:55 +0300 Subject: [PATCH 04/15] Update configuration.md --- content/develop/data-types/timeseries/configuration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/develop/data-types/timeseries/configuration.md b/content/develop/data-types/timeseries/configuration.md index 8a933a1c29..7c9db7122d 100644 --- a/content/develop/data-types/timeseries/configuration.md +++ b/content/develop/data-types/timeseries/configuration.md @@ -70,7 +70,7 @@ When using the `CONFIG` command, you must use the new names. | IGNORE_MAX_TIME_DIFF | [ts-ignore-max-time-diff](#ignore_max_time_diff--ts-ignore-max-time-diff-and-ignore_max_val_diff--ts-ignore-max-val-diff) | :white_check_mark: ||| | IGNORE_MAX_VAL_DIFF | [ts-ignore-max-val-diff](#ignore_max_time_diff--ts-ignore-max-time-diff-and-ignore_max_val_diff--ts-ignore-max-val-diff) | :white_check_mark: ||| | NUM_THREADS | [ts-num-threads](#num_threads--ts-num-threads) | :white_large_square: | ✅ Supported

| ❌ Flexible & Annual
❌ Free & Fixed | -| OSS_GLOBAL_PASSWORD | Deprecated in v8.0 | :white_check_mark: ||| +| [OSS_GLOBAL_PASSWORD](#oss_global_password) | Deprecated in v8.0 | :white_check_mark: ||| --- From 6f08360fc1c99e9c68a90e3ee349338840d5104c Mon Sep 17 00:00:00 2001 From: Lior Kogan Date: Sat, 19 Apr 2025 22:23:14 +0300 Subject: [PATCH 05/15] Update configuration.md --- content/develop/data-types/timeseries/configuration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/develop/data-types/timeseries/configuration.md b/content/develop/data-types/timeseries/configuration.md index 7c9db7122d..33bde28db8 100644 --- a/content/develop/data-types/timeseries/configuration.md +++ b/content/develop/data-types/timeseries/configuration.md @@ -55,7 +55,7 @@ Once a value is set with `CONFIG SET`, or added manually to your configuration f Note that on a cluster, `CONFIG SET` and `CONFIG REWRITE` have to be called on each node separately. -We also introduced new configuration parameters, and aligned the naming scheme of the module configuration parameters with Redis configuration parameters. +In Redis 8.0, we also introduced new names for the time series configuration parameters, to align the naming scheme of the time series configuration parameters with Redis configuration parameters. When using the `CONFIG` command, you must use the new names. ## Time series configuration parameters From 7161f430e323b9beaadf60ad0ffb57b9f6db5e61 Mon Sep 17 00:00:00 2001 From: Lior Kogan Date: Sun, 20 Apr 2025 10:15:21 +0300 Subject: [PATCH 06/15] Update configuration.md --- .../data-types/timeseries/configuration.md | 35 ++++++++++++++----- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/content/develop/data-types/timeseries/configuration.md b/content/develop/data-types/timeseries/configuration.md index 33bde28db8..085a50ea14 100644 --- a/content/develop/data-types/timeseries/configuration.md +++ b/content/develop/data-types/timeseries/configuration.md @@ -18,7 +18,7 @@ weight: 3 Previous to version 8.0, all time series configuration parameters were load-time parameters. -In order to change the values of a load-time parameter, you have to use one of the following methods: +In order to set the values of load-time parameters, you have to use one of the following methods: - Pass them as command-line arguments following the `loadmodule` argument when starting redis-server @@ -32,8 +32,8 @@ In order to change the values of a load-time parameter, you have to use one of t - Using the `MODULE LOADEX path [CONFIG name value [CONFIG name value ...]] [ARGS args [args ....]]` command. -With the introduction of Redis 8.0, most of the time series configuration parameters are now runtime parameters. This means that their values can be changed at runtime. -You can set runtime configuration parameters at load-time, but instead, it is recommended to use the Redis `CONFIG` command with time series runtime configuration parameters, the same way you would do for Redis runtime configuration parameters. +With the introduction of Redis 8.0, most of the time series configuration parameters are now runtime parameters. This means that you can change their values at runtime. +You can also set runtime configuration parameters at load-time, but it is simpler to use the Redis `CONFIG` command with time series runtime configuration parameters, the same way you would do for Redis runtime configuration parameters. This means: @@ -49,13 +49,13 @@ This means: Rewrite your Redis configuration file (e.g., the `redis.conf` file) to reflect the configuration changes. -Starting with Redis 8.0, you can also specify time series configuration parameters directly in your Redis configuration file (e.g., the `redis.conf` file) the same way you would do for Redis configuration parameters. +Starting with Redis 8.0, you can also specify time series configuration parameters directly in your Redis configuration file (e.g., your `redis.conf` file) the same way you would do for Redis configuration parameters. -Once a value is set with `CONFIG SET`, or added manually to your configuration file, it will overwrite values set with `--loadmodule`, `loadmodule`, `MODULE LOAD`, or `MODULE LOADEX`. +Once a value is set with `CONFIG SET` or added manually to your configuration file, it will overwrite values set with `--loadmodule`, `loadmodule`, `MODULE LOAD`, or `MODULE LOADEX`. Note that on a cluster, `CONFIG SET` and `CONFIG REWRITE` have to be called on each node separately. -In Redis 8.0, we also introduced new names for the time series configuration parameters, to align the naming scheme of the time series configuration parameters with Redis configuration parameters. +In Redis 8.0, we also introduced new names for the time series configuration parameters, to align the naming with Redis configuration parameters. When using the `CONFIG` command, you must use the new names. ## Time series configuration parameters @@ -85,6 +85,21 @@ Type: integer Valid range: `[48 .. 1048576]`; must be a multiple of 8 Default: `4096` +#### Example + +Setting the default chunk size to 1024 bytes + +Version < 8.0: + +``` +$ redis-server --loadmodule ./redistimeseries.so CHUNK_SIZE_BYTES 1024 +``` + +Version >= 8.0: + +``` +redis> CONFIG SET ts-chunk-size-bytes 1024 +``` ### COMPACTION_POLICY / ts-compaction-policy @@ -197,6 +212,8 @@ Since the duplication policy can be provided at different levels, the actual pre #### Example +Setting a compaction policy composed of 5 compaction rules + Version < 8.0: ``` @@ -206,7 +223,7 @@ $ redis-server --loadmodule ./redistimeseries.so COMPACTION_POLICY max:1m:1h;min Version >= 8.0: ``` -$ CONFIG SET ts-compaction-policy max:1m:1h;min:10s:5d:10d;last:5M:10m;avg:2h:10d;avg:3d:100d +redis> CONFIG SET ts-compaction-policy max:1m:1h;min:10s:5d:10d;last:5M:10m;avg:2h:10d;avg:3d:100d ``` ### RETENTION_POLICY / ts-retention-policy @@ -238,7 +255,7 @@ $ redis-server --loadmodule ./redistimeseries.so RETENTION_POLICY 25920000000 Version >= 8.0: ``` -$ CONFIG SET ts-retention-policy 25920000000 +redis> CONFIG SET ts-retention-policy 25920000000 ``` ### ENCODING / ts-encoding @@ -310,7 +327,7 @@ $ redis-server --loadmodule ./redistimeseries.so NUM_THREADS 3 Version >= 8.0: ``` -$ redis-server --loadmodule ./redistimeseries.so ts-num-threads 3 +redis> redis-server --loadmodule ./redistimeseries.so ts-num-threads 3 ``` From 5a62dd53f03ea56aceb12d3aa812a50c88e8d3b4 Mon Sep 17 00:00:00 2001 From: Lior Kogan Date: Sun, 20 Apr 2025 10:22:31 +0300 Subject: [PATCH 07/15] Update configuration.md --- .../data-types/timeseries/configuration.md | 38 +++++++++---------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/content/develop/data-types/timeseries/configuration.md b/content/develop/data-types/timeseries/configuration.md index 085a50ea14..88eeb08079 100644 --- a/content/develop/data-types/timeseries/configuration.md +++ b/content/develop/data-types/timeseries/configuration.md @@ -177,11 +177,27 @@ When a compaction policy is defined, compaction rules will be created automatica _key_agg_dur_aln_ where _key_ is the key of the source time series, _agg_ is the aggregator (in uppercase), _dur_ is the bucket duration in milliseconds, and _aln_ is the time bucket alignment in milliseconds. Example: `key_SUM_60000_1000`. -**Examples** +#### Example rules - `max:1M:1h` - Aggregate using `max` over one-minute windows and retain the last hour - `twa:1d:0m:360M` - Aggregate daily [06:00 .. 06:00) using `twa`; no expiration +#### Example + +Setting a compaction policy composed of 5 compaction rules + +Version < 8.0: + +``` +$ redis-server --loadmodule ./redistimeseries.so COMPACTION_POLICY max:1m:1h;min:10s:5d:10d;last:5M:10m;avg:2h:10d;avg:3d:100d +``` + +Version >= 8.0: + +``` +redis> CONFIG SET ts-compaction-policy max:1m:1h;min:10s:5d:10d;last:5M:10m;avg:2h:10d;avg:3d:100d +``` + ### DUPLICATE_POLICY / ts-duplicate-policy The default policy for handling insertion ([`TS.ADD`]({{< relref "/commands/ts.add/" >}}) and [`TS.MADD`]({{< relref "/commands/ts.madd/" >}})) of multiple samples with identical timestamps, with one of the following values: @@ -199,8 +215,6 @@ The default value is applied to each new time series upon its creation. Type: string -Default: `BLOCK` - **Precedence order** Since the duplication policy can be provided at different levels, the actual precedence of the used policy will be: @@ -208,23 +222,7 @@ Since the duplication policy can be provided at different levels, the actual pre 1. [`TS.ADD`]({{< relref "/commands/ts.add/" >}})'s `ON_DUPLICATE_POLICY` optional argument. 1. Key-level policy, as set with [`TS.CREATE`]({{< relref "/commands/ts.create/" >}})'s and [`TS.ALTER`]({{< relref "/commands/ts.alter/" >}})'s `DUPLICATE_POLICY` optional argument. 1. The `ts-duplicate-policy` configuration parameter. -1. The default policy. - -#### Example - -Setting a compaction policy composed of 5 compaction rules - -Version < 8.0: - -``` -$ redis-server --loadmodule ./redistimeseries.so COMPACTION_POLICY max:1m:1h;min:10s:5d:10d;last:5M:10m;avg:2h:10d;avg:3d:100d -``` - -Version >= 8.0: - -``` -redis> CONFIG SET ts-compaction-policy max:1m:1h;min:10s:5d:10d;last:5M:10m;avg:2h:10d;avg:3d:100d -``` +1. The default hard-coded policy (`BLOCK`) ### RETENTION_POLICY / ts-retention-policy From 1253e8cfd810073f13f6d37c7243b826876f1cbc Mon Sep 17 00:00:00 2001 From: Lior Kogan Date: Sun, 20 Apr 2025 10:38:05 +0300 Subject: [PATCH 08/15] Update configuration.md --- .../data-types/timeseries/configuration.md | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/content/develop/data-types/timeseries/configuration.md b/content/develop/data-types/timeseries/configuration.md index 88eeb08079..1df3741b37 100644 --- a/content/develop/data-types/timeseries/configuration.md +++ b/content/develop/data-types/timeseries/configuration.md @@ -76,15 +76,21 @@ When using the `CONFIG` command, you must use the new names. ### CHUNK_SIZE_BYTES / ts-chunk-size-bytes -Default initial allocation size, in bytes, for the data part of each new chunk. -This default value is applied to each new time series upon its creation. -Actual chunks may consume more memory. +The initial allocation size, in bytes, for the data part of each new chunk. Actual chunks may consume more memory. +Changing this value does not affect existing chunks. Type: integer Valid range: `[48 .. 1048576]`; must be a multiple of 8 -Default: `4096` +#### Precedence order + +Since the chunk size can be provided at different levels, the actual precedence of the used chunk size will be: + +1. Key-level policy, as set with [`TS.CREATE`]({{< relref "/commands/ts.create/" >}})'s and [`TS.ALTER`]({{< relref "/commands/ts.alter/" >}})'s `CHUNK_SIZE` optional argument. +1. The `ts-chunk-size-bytes` configuration parameter. +1. The default hard-coded chunk size (`4096`) + #### Example Setting the default chunk size to 1024 bytes @@ -109,8 +115,6 @@ Type: string Default: No compaction rules. -**Discussion** - Note that this configuration parameter has no effect on keys created with [`TS.CREATE`]({{< relref "commands/ts.create/" >}}). To understand the motivation for this behavior, consider the following scenario: Suppose a default compaction policy is defined, but then one wants to manually create an additional compaction rule (using [`TS.CREATERULE`]({{< relref "commands/ts.createrule/" >}})) which requires first creating an empty destination key (using [`TS.CREATE`]({{< relref "commands/ts.create/" >}})). But now there is a problem: due to the default compaction policy, automatic compactions would be undesirably created for that destination key. Each rule is separated by a semicolon (`;`), the rule consists of multiple fields that are separated by a colon (`:`): @@ -215,7 +219,7 @@ The default value is applied to each new time series upon its creation. Type: string -**Precedence order** +#### Precedence order Since the duplication policy can be provided at different levels, the actual precedence of the used policy will be: From 7b4f8f4b09cc2279a15558d5a4b6ab926ba9b00b Mon Sep 17 00:00:00 2001 From: Lior Kogan Date: Sun, 20 Apr 2025 11:07:13 +0300 Subject: [PATCH 09/15] Update configuration.md --- .../data-types/timeseries/configuration.md | 41 +++++++++++++++---- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/content/develop/data-types/timeseries/configuration.md b/content/develop/data-types/timeseries/configuration.md index 1df3741b37..aabe6bd2e2 100644 --- a/content/develop/data-types/timeseries/configuration.md +++ b/content/develop/data-types/timeseries/configuration.md @@ -89,7 +89,7 @@ Since the chunk size can be provided at different levels, the actual precedence 1. Key-level policy, as set with [`TS.CREATE`]({{< relref "/commands/ts.create/" >}})'s and [`TS.ALTER`]({{< relref "/commands/ts.alter/" >}})'s `CHUNK_SIZE` optional argument. 1. The `ts-chunk-size-bytes` configuration parameter. -1. The default hard-coded chunk size (`4096`) +1. The hard-coded default: `4096` #### Example @@ -221,12 +221,12 @@ Type: string #### Precedence order -Since the duplication policy can be provided at different levels, the actual precedence of the used policy will be: +Since the duplication policy can be provided at different levels, the actual precedence of the used duplication policy will be: 1. [`TS.ADD`]({{< relref "/commands/ts.add/" >}})'s `ON_DUPLICATE_POLICY` optional argument. 1. Key-level policy, as set with [`TS.CREATE`]({{< relref "/commands/ts.create/" >}})'s and [`TS.ALTER`]({{< relref "/commands/ts.alter/" >}})'s `DUPLICATE_POLICY` optional argument. 1. The `ts-duplicate-policy` configuration parameter. -1. The default hard-coded policy (`BLOCK`) +1. The hard-coded default: `BLOCK` ### RETENTION_POLICY / ts-retention-policy @@ -238,12 +238,18 @@ Type: integer Valid range: `[0 .. 9,223,372,036,854,775,807]` -Default: `0` - The value `0` means no expiration. When both `COMPACTION_POLICY` / `ts-compaction-policy` and `RETENTION_POLICY` / `ts-retention-policy` are specified, the retention of newly created compactions is according to the retention time specified in `COMPACTION_POLICY` / `ts-compaction-policy`. +#### Precedence order + +Since the retention can be provided at different levels, the actual precedence of the used retention will be: + +1. Key-level retention, as set with [`TS.CREATE`]({{< relref "/commands/ts.create/" >}})'s and [`TS.ALTER`]({{< relref "/commands/ts.alter/" >}})'s `RETENTION` optional argument. +1. The `ts-retention-policy` configuration parameter. +1. No retention. + #### Example Setting the default retention to 300 days @@ -264,13 +270,34 @@ redis> CONFIG SET ts-retention-policy 25920000000 Note: Before v1.6 this configuration parameter was named `CHUNK_TYPE`. -Default chunk encoding for automatically created time series keys when [ts-compaction-policy](#ts-compaction-policy) is configured. +Default chunk encoding for automatically created compactions when [ts-compaction-policy](#ts-compaction-policy) is configured. Type: string Valid values: `COMPRESSED`, `UNCOMPRESSED` -Default: `COMPRESSED` +#### Precedence order + +Since the encoding can be provided at different levels, the actual precedence of the used encoding will be: + +1. The `ts-encoding` configuration parameter. +1. The hard-coded default: `COMPRESSED` + +#### Example + +Setting the default encoding `UNCOMPRESSED` + +Version < 8.0: + +``` +$ redis-server --loadmodule ./redistimeseries.so ENCODING UNCOMPRESSED +``` + +Version >= 8.0: + +``` +redis> CONFIG SET ts-encoding UNCOMPRESSED +``` ### IGNORE_MAX_TIME_DIFF / ts-ignore-max-time-diff and IGNORE_MAX_VAL_DIFF / ts-ignore-max-val-diff From cd249d41818483855abadfbd00c0d87cf38730e7 Mon Sep 17 00:00:00 2001 From: Lior Kogan Date: Sun, 20 Apr 2025 11:17:07 +0300 Subject: [PATCH 10/15] Update configuration.md --- .../data-types/timeseries/configuration.md | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/content/develop/data-types/timeseries/configuration.md b/content/develop/data-types/timeseries/configuration.md index aabe6bd2e2..d3b3c5f31d 100644 --- a/content/develop/data-types/timeseries/configuration.md +++ b/content/develop/data-types/timeseries/configuration.md @@ -315,8 +315,6 @@ Defaults: - `ts-ignore-max-time-diff`: 0 - `ts-ignore-max-val-diff`: 0.0 -**Discussion** - Many sensors report data periodically. Often, the difference between the measured value and the previous measured value is negligible and related to random noise or to measurement accuracy limitations. In such situations it may be preferable not to add the new measurement to the time series. A new sample is considered a duplicate and is ignored if the following conditions are met: @@ -329,6 +327,20 @@ A new sample is considered a duplicate and is ignored if the following condition where `max_timestamp` is the timestamp of the sample with the largest timestamp in the time series, and `value_at_max_timestamp` is the value at `max_timestamp`. +#### Example + +Version < 8.0: + +``` +$ redis-server --loadmodule ./redistimeseries.so IGNORE_MAX_TIME_DIFF 10 IGNORE_MAX_VAL_DIFF 0.1 +``` + +Version >= 8.0: + +``` +redis> CONFIG SET ts-ignore-max-time-diff 10 ts-ignore-max-val-diff 0.1 +``` + ### NUM_THREADS / ts-num-threads The maximum number of per-shard threads for cross-key queries when using cluster mode ([`TS.MRANGE`]({{< relref "/commands/ts.mrange/" >}}), [`TS.MREVRANGE`]({{< relref "/commands/ts.mrevrange/" >}}), [`TS.MGET`]({{< relref "/commands/ts.mget/" >}}), and [`TS.QUERYINDEX`]({{< relref "/commands/ts.queryindex/" >}})). The value must be equal to or greater than `1`. Note that increasing this value may either increase or decrease the performance! From 0f0639c9e0a22e000863416c76a4305bf07b92a4 Mon Sep 17 00:00:00 2001 From: Lior Kogan Date: Sun, 20 Apr 2025 11:22:23 +0300 Subject: [PATCH 11/15] Update configuration.md --- .../develop/data-types/timeseries/configuration.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/content/develop/data-types/timeseries/configuration.md b/content/develop/data-types/timeseries/configuration.md index d3b3c5f31d..775ddf8deb 100644 --- a/content/develop/data-types/timeseries/configuration.md +++ b/content/develop/data-types/timeseries/configuration.md @@ -278,8 +278,6 @@ Valid values: `COMPRESSED`, `UNCOMPRESSED` #### Precedence order -Since the encoding can be provided at different levels, the actual precedence of the used encoding will be: - 1. The `ts-encoding` configuration parameter. 1. The hard-coded default: `COMPRESSED` @@ -311,10 +309,6 @@ Valid ranges: - `ts-ignore-max-time-diff`: `[0 .. 9,223,372,036,854,775,807]` - `ts-ignore-max-val-diff`: `[0 .. 1.7976931348623157e+308]` -Defaults: -- `ts-ignore-max-time-diff`: 0 -- `ts-ignore-max-val-diff`: 0.0 - Many sensors report data periodically. Often, the difference between the measured value and the previous measured value is negligible and related to random noise or to measurement accuracy limitations. In such situations it may be preferable not to add the new measurement to the time series. A new sample is considered a duplicate and is ignored if the following conditions are met: @@ -327,6 +321,11 @@ A new sample is considered a duplicate and is ignored if the following condition where `max_timestamp` is the timestamp of the sample with the largest timestamp in the time series, and `value_at_max_timestamp` is the value at `max_timestamp`. +#### Precedence order + +1. The `ts-ignore-max-time-diff` and `ts-ignore-max-val-diff` configuration parameters. +1. The hard-coded defaults: `0` and `0.0`. + #### Example Version < 8.0: From edbb1a040bc885e1d5af9b9d66fcfb2440a19d69 Mon Sep 17 00:00:00 2001 From: Lior Kogan Date: Sun, 20 Apr 2025 11:34:46 +0300 Subject: [PATCH 12/15] Update configuration.md --- content/develop/data-types/timeseries/configuration.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/content/develop/data-types/timeseries/configuration.md b/content/develop/data-types/timeseries/configuration.md index 775ddf8deb..10ad9d9d48 100644 --- a/content/develop/data-types/timeseries/configuration.md +++ b/content/develop/data-types/timeseries/configuration.md @@ -113,8 +113,6 @@ Default compaction rules for newly created keys with [`TS.ADD`]({{< relref "/com Type: string -Default: No compaction rules. - Note that this configuration parameter has no effect on keys created with [`TS.CREATE`]({{< relref "commands/ts.create/" >}}). To understand the motivation for this behavior, consider the following scenario: Suppose a default compaction policy is defined, but then one wants to manually create an additional compaction rule (using [`TS.CREATERULE`]({{< relref "commands/ts.createrule/" >}})) which requires first creating an empty destination key (using [`TS.CREATE`]({{< relref "commands/ts.create/" >}})). But now there is a problem: due to the default compaction policy, automatic compactions would be undesirably created for that destination key. Each rule is separated by a semicolon (`;`), the rule consists of multiple fields that are separated by a colon (`:`): @@ -181,6 +179,11 @@ When a compaction policy is defined, compaction rules will be created automatica _key_agg_dur_aln_ where _key_ is the key of the source time series, _agg_ is the aggregator (in uppercase), _dur_ is the bucket duration in milliseconds, and _aln_ is the time bucket alignment in milliseconds. Example: `key_SUM_60000_1000`. +#### Precedence order + +1. The `ts-compaction-policy` configuration parameter. +1. No compaction rules. + #### Example rules - `max:1M:1h` - Aggregate using `max` over one-minute windows and retain the last hour From 4d4481557d767a89989bcd720439fefdeea150d4 Mon Sep 17 00:00:00 2001 From: Lior Kogan Date: Sun, 20 Apr 2025 11:37:50 +0300 Subject: [PATCH 13/15] Update configuration.md --- content/develop/data-types/timeseries/configuration.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/content/develop/data-types/timeseries/configuration.md b/content/develop/data-types/timeseries/configuration.md index 10ad9d9d48..b6c793a9f7 100644 --- a/content/develop/data-types/timeseries/configuration.md +++ b/content/develop/data-types/timeseries/configuration.md @@ -85,7 +85,7 @@ Valid range: `[48 .. 1048576]`; must be a multiple of 8 #### Precedence order -Since the chunk size can be provided at different levels, the actual precedence of the used chunk size will be: +Since the chunk size can be provided at different levels, the actual precedence of the chunk size will be: 1. Key-level policy, as set with [`TS.CREATE`]({{< relref "/commands/ts.create/" >}})'s and [`TS.ALTER`]({{< relref "/commands/ts.alter/" >}})'s `CHUNK_SIZE` optional argument. 1. The `ts-chunk-size-bytes` configuration parameter. @@ -224,7 +224,7 @@ Type: string #### Precedence order -Since the duplication policy can be provided at different levels, the actual precedence of the used duplication policy will be: +Since the duplication policy can be provided at different levels, the actual precedence of the duplication policy will be: 1. [`TS.ADD`]({{< relref "/commands/ts.add/" >}})'s `ON_DUPLICATE_POLICY` optional argument. 1. Key-level policy, as set with [`TS.CREATE`]({{< relref "/commands/ts.create/" >}})'s and [`TS.ALTER`]({{< relref "/commands/ts.alter/" >}})'s `DUPLICATE_POLICY` optional argument. @@ -247,7 +247,7 @@ When both `COMPACTION_POLICY` / `ts-compaction-policy` and `RETENTION_POLICY` / #### Precedence order -Since the retention can be provided at different levels, the actual precedence of the used retention will be: +Since the retention can be provided at different levels, the actual precedence of the retention will be: 1. Key-level retention, as set with [`TS.CREATE`]({{< relref "/commands/ts.create/" >}})'s and [`TS.ALTER`]({{< relref "/commands/ts.alter/" >}})'s `RETENTION` optional argument. 1. The `ts-retention-policy` configuration parameter. @@ -286,7 +286,7 @@ Valid values: `COMPRESSED`, `UNCOMPRESSED` #### Example -Setting the default encoding `UNCOMPRESSED` +Setting the default encoding to `UNCOMPRESSED` Version < 8.0: From e03fa1132a2a256769b609644a076463c12531f1 Mon Sep 17 00:00:00 2001 From: Lior Kogan Date: Sun, 20 Apr 2025 11:40:30 +0300 Subject: [PATCH 14/15] Update configuration.md --- content/develop/data-types/timeseries/configuration.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/content/develop/data-types/timeseries/configuration.md b/content/develop/data-types/timeseries/configuration.md index b6c793a9f7..cefd57c0ec 100644 --- a/content/develop/data-types/timeseries/configuration.md +++ b/content/develop/data-types/timeseries/configuration.md @@ -85,7 +85,7 @@ Valid range: `[48 .. 1048576]`; must be a multiple of 8 #### Precedence order -Since the chunk size can be provided at different levels, the actual precedence of the chunk size will be: +Since the chunk size can be provided at different levels, the actual precedence of the chunk size is: 1. Key-level policy, as set with [`TS.CREATE`]({{< relref "/commands/ts.create/" >}})'s and [`TS.ALTER`]({{< relref "/commands/ts.alter/" >}})'s `CHUNK_SIZE` optional argument. 1. The `ts-chunk-size-bytes` configuration parameter. @@ -169,7 +169,7 @@ Each rule is separated by a semicolon (`;`), the rule consists of multiple field In a clustered environment, if you set this configuration parameter, you must use [hash tags]({{< relref "/operate/oss_and_stack/reference/cluster-spec" >}}#hash-tags) for all time series key names. This ensures that Redis will create each compaction in the same hash slot as its source key. If you don't, the system may fail to compact the data without displaying any error messages. {{% /warning %}} -When a compaction policy is defined, compaction rules will be created automatically for newly created time series, and their key would be set to: +When a compaction policy is defined, compaction rules are created automatically for newly created time series, and the compaction key name would be: * If the time bucket alignment is 0: @@ -224,7 +224,7 @@ Type: string #### Precedence order -Since the duplication policy can be provided at different levels, the actual precedence of the duplication policy will be: +Since the duplication policy can be provided at different levels, the actual precedence of the duplication policy is: 1. [`TS.ADD`]({{< relref "/commands/ts.add/" >}})'s `ON_DUPLICATE_POLICY` optional argument. 1. Key-level policy, as set with [`TS.CREATE`]({{< relref "/commands/ts.create/" >}})'s and [`TS.ALTER`]({{< relref "/commands/ts.alter/" >}})'s `DUPLICATE_POLICY` optional argument. @@ -247,7 +247,7 @@ When both `COMPACTION_POLICY` / `ts-compaction-policy` and `RETENTION_POLICY` / #### Precedence order -Since the retention can be provided at different levels, the actual precedence of the retention will be: +Since the retention can be provided at different levels, the actual precedence of the retention is: 1. Key-level retention, as set with [`TS.CREATE`]({{< relref "/commands/ts.create/" >}})'s and [`TS.ALTER`]({{< relref "/commands/ts.alter/" >}})'s `RETENTION` optional argument. 1. The `ts-retention-policy` configuration parameter. From 97a9a48700c4409f827381e2a753d1ebade3a001 Mon Sep 17 00:00:00 2001 From: "David W. Dougherty" Date: Tue, 22 Apr 2025 09:33:11 -0700 Subject: [PATCH 15/15] Copy edits --- .../data-types/timeseries/configuration.md | 53 +++++++++---------- 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/content/develop/data-types/timeseries/configuration.md b/content/develop/data-types/timeseries/configuration.md index cefd57c0ec..839df43078 100644 --- a/content/develop/data-types/timeseries/configuration.md +++ b/content/develop/data-types/timeseries/configuration.md @@ -14,26 +14,25 @@ linkTitle: Configuration title: Configuration Parameters weight: 3 --- -## Redis CE - Setting configuration parameters +## Redis Community Edition - set configuration parameters -Previous to version 8.0, all time series configuration parameters were load-time parameters. +Before version 8.0, all time series configuration parameters are load-time parameters. +Use one of the following methods to set the values of load-time configuration parameters: -In order to set the values of load-time parameters, you have to use one of the following methods: - -- Pass them as command-line arguments following the `loadmodule` argument when starting redis-server +- Pass them as command-line arguments following the `loadmodule` argument when starting `redis-server`: `redis-server --loadmodule ./{modulename}.so [OPT VAL]...` -- Add them as arguments to the `loadmodule` directive in your configuration file (e.g., `redis.conf`): +- Add them as arguments to the `loadmodule` directive in your configuration file (for example, `redis.conf`): `loadmodule ./{modulename}.so [OPT VAL]...` -- Using the `MODULE LOAD path [arg [arg ...]]` command. +- Use the `MODULE LOAD path [arg [arg ...]]` command. -- Using the `MODULE LOADEX path [CONFIG name value [CONFIG name value ...]] [ARGS args [args ....]]` command. +- Use the `MODULE LOADEX path [CONFIG name value [CONFIG name value ...]] [ARGS args [args ....]]` command. -With the introduction of Redis 8.0, most of the time series configuration parameters are now runtime parameters. This means that you can change their values at runtime. -You can also set runtime configuration parameters at load-time, but it is simpler to use the Redis `CONFIG` command with time series runtime configuration parameters, the same way you would do for Redis runtime configuration parameters. +Starting with Redis 8.0, most time series configuration parameters are runtime parameters. +While you can set runtime parameters at load time, using the Redis `CONFIG` command is easier and works the same way as with Redis runtime configuration parameters. This means: @@ -47,16 +46,16 @@ This means: - `CONFIG REWRITE` - Rewrite your Redis configuration file (e.g., the `redis.conf` file) to reflect the configuration changes. + Rewrite your Redis configuration file (for example, the `redis.conf` file) to reflect the configuration changes. -Starting with Redis 8.0, you can also specify time series configuration parameters directly in your Redis configuration file (e.g., your `redis.conf` file) the same way you would do for Redis configuration parameters. +Starting with Redis 8.0, you can specify time series configuration parameters directly in your Redis configuration file the same way you would for Redis configuration parameters. Once a value is set with `CONFIG SET` or added manually to your configuration file, it will overwrite values set with `--loadmodule`, `loadmodule`, `MODULE LOAD`, or `MODULE LOADEX`. -Note that on a cluster, `CONFIG SET` and `CONFIG REWRITE` have to be called on each node separately. +In a cluster, you must run `CONFIG SET` and `CONFIG REWRITE` on each node separately. -In Redis 8.0, we also introduced new names for the time series configuration parameters, to align the naming with Redis configuration parameters. -When using the `CONFIG` command, you must use the new names. +In Redis 8.0, new names for the time series configuration parameters were introduced to align the naming with the Redis configuration parameters. +You must use the new names when using the `CONFIG` command. ## Time series configuration parameters @@ -85,7 +84,7 @@ Valid range: `[48 .. 1048576]`; must be a multiple of 8 #### Precedence order -Since the chunk size can be provided at different levels, the actual precedence of the chunk size is: +Because the chunk size can be provided at different levels, the actual precedence of the chunk size is: 1. Key-level policy, as set with [`TS.CREATE`]({{< relref "/commands/ts.create/" >}})'s and [`TS.ALTER`]({{< relref "/commands/ts.alter/" >}})'s `CHUNK_SIZE` optional argument. 1. The `ts-chunk-size-bytes` configuration parameter. @@ -93,7 +92,7 @@ Since the chunk size can be provided at different levels, the actual precedence #### Example -Setting the default chunk size to 1024 bytes +Set the default chunk size to 1024 bytes: Version < 8.0: @@ -113,7 +112,7 @@ Default compaction rules for newly created keys with [`TS.ADD`]({{< relref "/com Type: string -Note that this configuration parameter has no effect on keys created with [`TS.CREATE`]({{< relref "commands/ts.create/" >}}). To understand the motivation for this behavior, consider the following scenario: Suppose a default compaction policy is defined, but then one wants to manually create an additional compaction rule (using [`TS.CREATERULE`]({{< relref "commands/ts.createrule/" >}})) which requires first creating an empty destination key (using [`TS.CREATE`]({{< relref "commands/ts.create/" >}})). But now there is a problem: due to the default compaction policy, automatic compactions would be undesirably created for that destination key. +Note that this configuration parameter does not affect keys you create with [`TS.CREATE`]({{< relref "commands/ts.create/" >}}). To understand why, consider the following scenario: Suppose you define a default compaction policy but then want to manually create an additional compaction rule (using [`TS.CREATERULE`]({{< relref "commands/ts.createrule/" >}})), which requires you to first create an empty destination key (using `TS.CREATE`). This approach creates a problem: the default compaction policy would cause Redis to automatically create undesired compactions for the destination key. Each rule is separated by a semicolon (`;`), the rule consists of multiple fields that are separated by a colon (`:`): @@ -163,7 +162,7 @@ Each rule is separated by a semicolon (`;`), the rule consists of multiple field * h - hour * d - day - Assure that there is a bucket that starts at exactly _alignTimestamp_ after the epoch and align all other buckets accordingly. Default value: 0 (aligned with the epoch). Example: if _bucketDuration_ is 24 hours, setting _alignTimestamp_ to `6h` (6 hours after the Epoch) will ensure that each bucket’s timeframe is [06:00 .. 06:00). + Ensure that there is a bucket that starts at exactly _alignTimestamp_ after the Epoch and align all other buckets accordingly. Default value: 0 (aligned with the Epoch). Example: if _bucketDuration_ is 24 hours, setting _alignTimestamp_ to `6h` (6 hours after the Epoch) will ensure that each bucket’s timeframe is [06:00 .. 06:00). {{% warning %}} In a clustered environment, if you set this configuration parameter, you must use [hash tags]({{< relref "/operate/oss_and_stack/reference/cluster-spec" >}}#hash-tags) for all time series key names. This ensures that Redis will create each compaction in the same hash slot as its source key. If you don't, the system may fail to compact the data without displaying any error messages. @@ -191,7 +190,7 @@ When a compaction policy is defined, compaction rules are created automatically #### Example -Setting a compaction policy composed of 5 compaction rules +Set a compaction policy composed of 5 compaction rules: Version < 8.0: @@ -224,7 +223,7 @@ Type: string #### Precedence order -Since the duplication policy can be provided at different levels, the actual precedence of the duplication policy is: +Because the duplication policy can be provided at different levels, the actual precedence of the duplication policy is: 1. [`TS.ADD`]({{< relref "/commands/ts.add/" >}})'s `ON_DUPLICATE_POLICY` optional argument. 1. Key-level policy, as set with [`TS.CREATE`]({{< relref "/commands/ts.create/" >}})'s and [`TS.ALTER`]({{< relref "/commands/ts.alter/" >}})'s `DUPLICATE_POLICY` optional argument. @@ -233,9 +232,9 @@ Since the duplication policy can be provided at different levels, the actual pre ### RETENTION_POLICY / ts-retention-policy -Default retention period, in milliseconds, for newly created keys. +The default retention period, in milliseconds, for newly created keys. -Retention period is the maximum age of samples compared to highest reported timestamp, per key. Samples are expired based solely on the difference between their timestamp and the timestamps passed to subsequent [`TS.ADD`]({{< relref "commands/ts.add/" >}}), [`TS.MADD`]({{< relref "commands/ts.madd/" >}}), [`TS.INCRBY`]({{< relref "commands/ts.incrby/" >}}), and [`TS.DECRBY`]({{< relref "commands/ts.decrby/" >}}) calls. +The retention period is the maximum age of samples compared to the highest reported timestamp, per key. Samples are expired based solely on the difference between their timestamps and the timestamps passed to subsequent [`TS.ADD`]({{< relref "commands/ts.add/" >}}), [`TS.MADD`]({{< relref "commands/ts.madd/" >}}), [`TS.INCRBY`]({{< relref "commands/ts.incrby/" >}}), and [`TS.DECRBY`]({{< relref "commands/ts.decrby/" >}}) calls. Type: integer @@ -247,7 +246,7 @@ When both `COMPACTION_POLICY` / `ts-compaction-policy` and `RETENTION_POLICY` / #### Precedence order -Since the retention can be provided at different levels, the actual precedence of the retention is: +Because the retention can be provided at different levels, the actual precedence of the retention is: 1. Key-level retention, as set with [`TS.CREATE`]({{< relref "/commands/ts.create/" >}})'s and [`TS.ALTER`]({{< relref "/commands/ts.alter/" >}})'s `RETENTION` optional argument. 1. The `ts-retention-policy` configuration parameter. @@ -255,7 +254,7 @@ Since the retention can be provided at different levels, the actual precedence o #### Example -Setting the default retention to 300 days +Set the default retention to 300 days: Version < 8.0: @@ -286,7 +285,7 @@ Valid values: `COMPRESSED`, `UNCOMPRESSED` #### Example -Setting the default encoding to `UNCOMPRESSED` +Set the default encoding to `UNCOMPRESSED`: Version < 8.0: @@ -376,4 +375,4 @@ redis> redis-server --loadmodule ./redistimeseries.so ts-num-threads 3 ### OSS_GLOBAL_PASSWORD -Previous to version 8.0, when using a cluster with time series, you had to set the `OSS_GLOBAL_PASSWORD` configuration parameter on all the cluster nodes. Starting with version 8.0, this parameter is obsolete, and ignored if present. Redis now utilizes a new shared secret mechanism to allow sending internal commands between cluster nodes. +Prior to version 8.0, when using time series in a cluster, you had to set the `OSS_GLOBAL_PASSWORD` configuration parameter on all cluster nodes. As of version 8.0, Redis no longer uses this parameter and ignores it if present. Redis now uses a new shared secret mechanism to send internal commands between cluster nodes.