Skip to content

Commit 1b29f10

Browse files
authored
Tim e Series - Configuration.md - reorganized and added content
1 parent 4c97608 commit 1b29f10

File tree

1 file changed

+115
-99
lines changed

1 file changed

+115
-99
lines changed

content/develop/data-types/timeseries/configuration.md

Lines changed: 115 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -14,35 +14,68 @@ linkTitle: Configuration
1414
title: Configuration Parameters
1515
weight: 3
1616
---
17-
{{< note >}}
18-
As of Redis Community Edition 8.0, configuration parameters for the time series data structure are now set in the following ways:
19-
* At load time via your `redis.conf` file.
20-
* At run time (where applicable) using the [`CONFIG SET`]({{< relref "/commands/config-set" >}}) command.
17+
## Redis CE - Setting configuration parameters
2118

22-
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).
23-
{{< /note >}}
19+
Previous to version 8.0, all time series configuration parameters were load-time parameters.
20+
21+
In order to change the values of a load-time parameter, you have to use one of the following methods:
22+
23+
- Pass them as command-line arguments following the `loadmodule` argument when starting redis-server
24+
25+
`redis-server --loadmodule ./{modulename}.so [OPT VAL]...`
26+
27+
- Add them as arguments to the `loadmodule` directive in your configuration file (e.g., `redis.conf`):
28+
29+
`loadmodule ./{modulename}.so [OPT VAL]...`
30+
31+
- Using the `MODULE LOAD path [arg [arg ...]]` command.
32+
33+
- Using the `MODULE LOADEX path [CONFIG name value [CONFIG name value ...]] [ARGS args [args ....]]` command.
34+
35+
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.
36+
You can still set runtime parameters at load-time, but it is less recommended.
37+
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.
38+
39+
This means:
40+
41+
- `CONFIG SET parameter value [parameter value ...] `
42+
43+
Set one or more configuration parameters.
44+
45+
- `CONFIG GET parameter [parameter ...]`
46+
47+
Read the current value of one of more parameters.
48+
49+
- `CONFIG REWRITE`
50+
51+
Rewrite your Redis configuration file (e.g., the `redis.conf` file) to reflect the configuration changes.
52+
53+
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.
54+
55+
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`.
56+
57+
Note that on a cluster, `CONFIG SET` and `CONFIG REWRITE` have to be called on each node separately.
58+
59+
We also introduced new configuration parameters, and aligned the naming scheme of the module configuration parameters with Redis configuration parameters.
60+
When using the `CONFIG` command, you must use the new names.
2461

2562
## Time series configuration parameters
2663

2764
| Parameter name<br />(version < 8.0) | Parameter name<br />(version &#8805; 8.0) | Run-time | Redis<br />Software | Redis<br />Cloud |
2865
| :------- | :------- | :------- | :------- | :------- |
29-
| CHUNK_SIZE_BYTES | [ts-chunk-size-bytes](#ts-chunk-size-bytes) | :white_check_mark: | <span title="Supported">&#x2705; Supported</span><br /><span><br /></span> | <span title="Supported">&#x2705; Flexible & Annual</span><br /><span title="Not supported"><nobr>&#x274c; Free & Fixed</nobr></span> |
30-
| COMPACTION_POLICY | [ts-compaction-policy](#ts-compaction-policy) | :white_check_mark: | <span title="Supported">&#x2705; Supported</span><br /><span><br /></span> | <span title="Supported">&#x2705; Flexible & Annual</span><br /><span title="Not supported"><nobr>&#x274c; Free & Fixed</nobr></span> |
31-
| DUPLICATE_POLICY | [ts-duplicate-policy](#ts-duplicate-policy) | :white_check_mark: | <span title="Supported">&#x2705; Supported</span><br /><span><br /></span> | <span title="Supported">&#x2705; Flexible & Annual</span><br /><span title="Not supported"><nobr>&#x274c; Free & Fixed</nobr></span> |
32-
| ENCODING | [ts-encoding](#ts-encoding) | :white_check_mark: | <span title="Supported">&#x2705; Supported</span><br /><span><br /></span> | <span title="Supported">&#x2705; Flexible & Annual</span><br /><span title="Not supported"><nobr>&#x274c; Free & Fixed</nobr></span> |
33-
| IGNORE_MAX_TIME_DIFF | [ts-ignore-max-time-diff](#ts-ignore-max-time-diff-and-ts-ignore-max-val-diff) | :white_check_mark: |||
34-
| IGNORE_MAX_VAL_DIFF | [ts-ignore-max-val-diff](#ts-ignore-max-time-diff-and-ts-ignore-max-val-diff) | :white_check_mark: |||
35-
| NUM_THREADS | [ts-num-threads](#ts-num-threads) | :white_large_square: | <span title="Supported">&#x2705; Supported</span><br /><span><br /></span> | <span title="Supported">&#x2705; Flexible & Annual</span><br /><span title="Not supported"><nobr>&#x274c; Free & Fixed</nobr></span> |
36-
| RETENTION_POLICY | [ts-retention-policy](#ts-retention-policy) | :white_check_mark: | <span title="Supported">&#x2705; Supported</span><br /><span><br /></span> | <span title="Supported">&#x2705; Flexible & Annual</span><br /><span title="Not supported"><nobr>&#x274c; Free & Fixed</nobr></span> |
37-
| OSS_GLOBAL_PASSWORD | Deprecated in v8.0.0. Replace with the `masterauth` password. | :white_check_mark: |||
38-
39-
{{< note >}}
40-
Parameter names for Redis CE versions < 8.0, while deprecated, will still be supported in version 8.0.
41-
{{< /note >}}
66+
| CHUNK_SIZE_BYTES | [ts-chunk-size-bytes](#chunk_size_bytes--ts-chunk-size-bytes) | :white_check_mark: | <span title="Supported">&#x2705; Supported</span><br /><span><br /></span> | <span title="Supported">&#x2705; Flexible & Annual</span><br /><span title="Not supported"><nobr>&#x274c; Free & Fixed</nobr></span> |
67+
| COMPACTION_POLICY | [ts-compaction-policy](#compaction_policy--ts-compaction-policy) | :white_check_mark: | <span title="Supported">&#x2705; Supported</span><br /><span><br /></span> | <span title="Supported">&#x2705; Flexible & Annual</span><br /><span title="Not supported"><nobr>&#x274c; Free & Fixed</nobr></span> |
68+
| DUPLICATE_POLICY | [ts-duplicate-policy](#duplicate_policy--ts-duplicate-policy) | :white_check_mark: | <span title="Supported">&#x2705; Supported</span><br /><span><br /></span> | <span title="Supported">&#x2705; Flexible & Annual</span><br /><span title="Not supported"><nobr>&#x274c; Free & Fixed</nobr></span> |
69+
| RETENTION_POLICY | [ts-retention-policy](#retention_policy--ts-retention-policy) | :white_check_mark: | <span title="Supported">&#x2705; Supported</span><br /><span><br /></span> | <span title="Supported">&#x2705; Flexible & Annual</span><br /><span title="Not supported"><nobr>&#x274c; Free & Fixed</nobr></span> |
70+
| ENCODING | [ts-encoding](#encoding--ts-encoding) | :white_check_mark: | <span title="Supported">&#x2705; Supported</span><br /><span><br /></span> | <span title="Supported">&#x2705; Flexible & Annual</span><br /><span title="Not supported"><nobr>&#x274c; Free & Fixed</nobr></span> |
71+
| 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: |||
72+
| 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: |||
73+
| NUM_THREADS | [ts-num-threads](#num_threads--ts-num-threads) | :white_large_square: | <span title="Supported">&#x2705; Supported</span><br /><span><br /></span> | <span title="Not Supported">&#x274c; Flexible & Annual</span><br /><span title="Not supported"><nobr>&#x274c; Free & Fixed</nobr></span> |
74+
| OSS_GLOBAL_PASSWORD | Deprecated in v8.0 | :white_check_mark: |||
4275

4376
---
4477

45-
### ts-chunk-size-bytes
78+
### CHUNK_SIZE_BYTES / ts-chunk-size-bytes
4679

4780
Default initial allocation size, in bytes, for the data part of each new chunk.
4881
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
5487

5588
Default: `4096`
5689

57-
### ts-compaction-policy
90+
### COMPACTION_POLICY / ts-compaction-policy
5891

5992
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/" >}}).
6093

@@ -64,17 +97,7 @@ Default: No compaction rules.
6497

6598
**Discussion**
6699

67-
#### Example
68-
69-
```
70-
$ redis-server --loadmodule ./redistimeseries.so NUM_THREADS 3
71-
```
72-
73-
### COMPACTION_POLICY
74-
75-
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/" >}}).
76-
77-
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.
100+
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.
78101

79102
Each rule is separated by a semicolon (`;`), the rule consists of multiple fields that are separated by a colon (`:`):
80103

@@ -127,7 +150,7 @@ Each rule is separated by a semicolon (`;`), the rule consists of multiple field
127150
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).
128151

129152
{{% warning %}}
130-
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.
153+
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.
131154
{{% /warning %}}
132155

133156
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
145168
- `max:1M:1h` - Aggregate using `max` over one-minute windows and retain the last hour
146169
- `twa:1d:0m:360M` - Aggregate daily [06:00 .. 06:00) using `twa`; no expiration
147170

148-
### ts-duplicate-policy
171+
### DUPLICATE_POLICY / ts-duplicate-policy
149172

150173
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:
151174

152-
#### Example
153-
154-
```
155-
$ redis-server --loadmodule ./redistimeseries.so COMPACTION_POLICY max:1m:1h;min:10s:5d:10d;last:5M:10m;avg:2h:10d;avg:3d:100d
156-
```
157-
158-
### RETENTION_POLICY
159-
160-
Default retention period, in milliseconds, for newly created keys.
161-
162-
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.
163-
164-
The value `0` means no expiration.
165-
166-
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`.
167-
168-
#### Default
169-
170-
0
171-
172-
#### Example
173-
174-
Setting the default retention to 300 days:
175-
176-
```
177-
$ redis-server --loadmodule ./redistimeseries.so RETENTION_POLICY 25920000000
178-
```
179-
180-
### DUPLICATE_POLICY
181-
182-
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:
183-
184175
| policy | description |
185176
| ---------- | ---------------------------------------------------------------- |
186177
| `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
205196
1. The `ts-duplicate-policy` configuration parameter.
206197
1. The default policy.
207198

208-
### ts-encoding
199+
#### Example
200+
201+
Version < 8.0:
202+
203+
```
204+
$ redis-server --loadmodule ./redistimeseries.so COMPACTION_POLICY max:1m:1h;min:10s:5d:10d;last:5M:10m;avg:2h:10d;avg:3d:100d
205+
```
206+
207+
Version >= 8.0:
208+
209+
```
210+
$ CONFIG SET ts-compaction-policy max:1m:1h;min:10s:5d:10d;last:5M:10m;avg:2h:10d;avg:3d:100d
211+
```
212+
213+
### RETENTION_POLICY / ts-retention-policy
214+
215+
Default retention period, in milliseconds, for newly created keys.
216+
217+
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.
218+
219+
Type: integer
220+
221+
Valid range: `[0 .. 9,223,372,036,854,775,807]`
222+
223+
Default: `0`
224+
225+
The value `0` means no expiration.
226+
227+
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`.
228+
229+
#### Example
230+
231+
Setting the default retention to 300 days
232+
233+
Version < 8.0:
234+
235+
```
236+
$ redis-server --loadmodule ./redistimeseries.so RETENTION_POLICY 25920000000
237+
```
238+
239+
Version >= 8.0:
240+
241+
```
242+
$ CONFIG SET ts-retention-policy 25920000000
243+
```
244+
245+
### ENCODING / ts-encoding
209246

210247
Note: Before v1.6 this configuration parameter was named `CHUNK_TYPE`.
211248

@@ -217,7 +254,7 @@ Valid values: `COMPRESSED`, `UNCOMPRESSED`
217254

218255
Default: `COMPRESSED`
219256

220-
### ts-ignore-max-time-diff and ts-ignore-max-val-diff
257+
### IGNORE_MAX_TIME_DIFF / ts-ignore-max-time-diff and IGNORE_MAX_VAL_DIFF / ts-ignore-max-val-diff
221258

222259
Default values for newly created keys.
223260

@@ -247,7 +284,7 @@ A new sample is considered a duplicate and is ignored if the following condition
247284

248285
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`.
249286

250-
### ts-num-threads
287+
### NUM_THREADS / ts-num-threads
251288

252289
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!
253290

@@ -263,42 +300,21 @@ Redis Cloud defaults:
263300
- Flexible & Annual: Set by plan
264301
- Free & Fixed: `1`
265302

266-
### ts-retention-policy
267-
268-
Default retention period, in milliseconds, for newly created keys.
269-
270-
Type: integer
271-
272-
Valid range: `[0 .. 9,223,372,036,854,775,807]`
273-
274-
Default: `0`
275-
276-
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.
277-
278-
The value `0` means no expiration.
279-
280-
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`.
281-
282-
## Setting configuration parameters on module load (deprecated)
283-
284-
These methods are deprecated beginning with Redis CE v8.0.0.
285-
286-
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:
303+
#### Example
287304

288-
In [redis.conf]({{< relref "/operate/oss_and_stack/management/config" >}}):
305+
Version < 8.0:
289306

290-
```sh
291-
loadmodule ./redistimeseries.so [OPT VAL]...
307+
```
308+
$ redis-server --loadmodule ./redistimeseries.so NUM_THREADS 3
292309
```
293310

294-
From the [Redis CLI]({{< relref "/develop/tools/cli" >}}), using the [MODULE LOAD]({{< relref "/commands/module-load" >}}) command:
311+
Version >= 8.0:
295312

296313
```
297-
127.0.0.6379> MODULE LOAD redistimeseries.so [OPT VAL]...
314+
$ redis-server --loadmodule ./redistimeseries.so ts-num-threads 3
298315
```
299316

300-
From the command line:
301317

302-
```sh
303-
$ redis-server --loadmodule ./redistimeseries.so [OPT VAL]...
304-
```
318+
### OSS_GLOBAL_PASSWORD
319+
320+
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.

0 commit comments

Comments
 (0)