You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,7 @@
10
10
*[FEATURE] Added user sub rings to distribute users to a subset of ingesters. #1947
11
11
*`--experimental.distributor.user-subring-size`
12
12
*[FEATURE] Added flag `-experimental.ruler.enable-api` to enable the ruler api which implements the Prometheus API `/api/v1/rules` and `/api/v1/alerts` endpoints under the configured `-http.prefix`. #1999
13
+
*[FEATURE] Added sharding support to compactor when using the experimental TSDB blocks storage. #2113
13
14
*[ENHANCEMENT] Experimental TSDB: Export TSDB Syncer metrics from Compactor component, they are prefixed with `cortex_compactor_`. #2023
14
15
*[ENHANCEMENT] Experimental TSDB: Added dedicated flag `-experimental.tsdb.bucket-store.tenant-sync-concurrency` to configure the maximum number of concurrent tenants for which blocks are synched. #2026
15
16
*[ENHANCEMENT] Experimental TSDB: Expose metrics for objstore operations (prefixed with `cortex_<component>_thanos_objstore_`, component being one of `ingester`, `querier` and `compactor`). #2027
Copy file name to clipboardExpand all lines: docs/operations/blocks-storage.md
+69-5Lines changed: 69 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,7 +41,7 @@ The blocks chunks and the entire index is never fully downloaded by the queriers
41
41
42
42
The index header is also stored to the local disk, in order to avoid to re-download it on subsequent restarts of a querier. For this reason, it's recommended - but not required - to run the querier with a persistent local disk. For example, if you're running the Cortex cluster in Kubernetes, you may use a StatefulSet with a persistent volume claim for the queriers.
43
43
44
-
### Sharding and Replication
44
+
### Series sharding and replication
45
45
46
46
The series sharding and replication doesn't change based on the storage engine, so the general overview provided by the "[Cortex architecture](../architecture.md)" documentation applies to the blocks storage as well.
47
47
@@ -60,6 +60,17 @@ The **horizontal compaction** triggers after the vertical compaction and compact
60
60
61
61
The compactor is **stateless**.
62
62
63
+
#### Compactor sharding
64
+
65
+
The compactor optionally supports sharding. When sharding is enabled, multiple compactor instances can coordinate to split the workload and shard blocks by tenant. All the blocks of a tenant are processed by a single compactor instance at any given time, but compaction for different tenants may simultaneously run on different compactor instances.
66
+
67
+
Whenever the pool of compactors increase or decrease (ie. following up a scale up/down), tenants are resharded across the available compactor instances without any manual intervention. Compactors coordinate via the Cortex [hash ring](../architecture.md#the-hash-ring).
68
+
69
+
#### Compactor HTTP endpoints
70
+
71
+
-`GET /compactor_ring`<br />
72
+
Displays the status of the compactors ring, including the tokens owned by each compactor and an option to remove (forget) instances from the ring.
73
+
63
74
## Configuration
64
75
65
76
The general [configuration documentation](../configuration/_index.md) also applied to a Cortex cluster running the blocks storage, with few differences:
@@ -251,14 +262,67 @@ compactor:
251
262
# interval.
252
263
# CLI flag: -compactor.compaction-retries
253
264
[compaction_retries: <int> | default = 3]
265
+
266
+
# Shard tenants across multiple compactor instances. Sharding is required if
267
+
# you run multiple compactor instances, in order to coordinate compactions
268
+
# and avoid race conditions leading to the same tenant blocks simultaneously
269
+
# compacted by different instances.
270
+
# CLI flag: -compactor.sharding-enabled
271
+
[sharding_enabled: <bool> | default = false]
272
+
273
+
# Configures the ring used when sharding is enabled.
274
+
sharding_ring:
275
+
kvstore:
276
+
# Backend storage to use for the ring. Supported values are: consul, etcd,
277
+
# inmemory, multi, memberlist (experimental).
278
+
# CLI flag: -compactor.ring.store
279
+
[store: <string> | default = "consul"]
280
+
281
+
# The prefix for the keys in the store. Should end with a /.
282
+
# CLI flag: -compactor.ring.prefix
283
+
[prefix: <string> | default = "collectors/"]
284
+
285
+
# The consul_config configures the consul client.
286
+
# The CLI flags prefix for this block config is: compactor.ring
287
+
[consul: <consul_config>]
288
+
289
+
# The etcd_config configures the etcd client.
290
+
# The CLI flags prefix for this block config is: compactor.ring
291
+
[etcd: <etcd_config>]
292
+
293
+
# The memberlist_config configures the Gossip memberlist.
294
+
# The CLI flags prefix for this block config is: compactor.ring
295
+
[memberlist: <memberlist_config>]
296
+
297
+
multi:
298
+
# Primary backend storage used by multi-client.
299
+
# CLI flag: -compactor.ring.multi.primary
300
+
[primary: <string> | default = ""]
301
+
302
+
# Secondary backend storage used by multi-client.
303
+
# CLI flag: -compactor.ring.multi.secondary
304
+
[secondary: <string> | default = ""]
305
+
306
+
# Mirror writes to secondary store.
307
+
# CLI flag: -compactor.ring.multi.mirror-enabled
308
+
[mirror_enabled: <boolean> | default = false]
309
+
310
+
# Timeout for storing value to secondary store.
311
+
# CLI flag: -compactor.ring.multi.mirror-timeout
312
+
[mirror_timeout: <duration> | default = 2s]
313
+
314
+
# Period at which to heartbeat to the ring.
315
+
# CLI flag: -compactor.ring.heartbeat-period
316
+
[heartbeat_period: <duration> | default = 5m]
317
+
318
+
# The heartbeat timeout after which compactors are considered unhealthy
319
+
# within the ring.
320
+
# CLI flag: -compactor.ring.heartbeat-timeout
321
+
[heartbeat_timeout: <duration> | default = 1m]
254
322
```
255
323
256
324
## Known issues
257
325
258
-
### Horizontal scalability
259
-
260
-
The compactor currently doesn't support horizontal scalability and only 1 replica of the compactor should run at any given time within a Cortex cluster.
261
-
262
326
### Migrating from the chunks to the blocks storage
263
327
264
328
Currently, no smooth migration path is provided to migrate from chunks to blocks storage. For this reason, the blocks storage can only be enabled in new Cortex clusters.
f.StringVar(&cfg.DataDir, "compactor.data-dir", "./data", "Data directory in which to cache blocks and process compactions")
54
62
f.DurationVar(&cfg.CompactionInterval, "compactor.compaction-interval", time.Hour, "The frequency at which the compaction runs")
55
63
f.IntVar(&cfg.CompactionRetries, "compactor.compaction-retries", 3, "How many times to retry a failed compaction during a single compaction interval")
64
+
f.BoolVar(&cfg.ShardingEnabled, "compactor.sharding-enabled", false, "Shard tenants across multiple compactor instances. Sharding is required if you run multiple compactor instances, in order to coordinate compactions and avoid race conditions leading to the same tenant blocks simultaneously compacted by different instances.")
56
65
}
57
66
58
67
// Compactor is a multi-tenant TSDB blocks compactor based on Thanos.
0 commit comments