-
Notifications
You must be signed in to change notification settings - Fork 816
Remove support schema flags, only use config file. #2221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
26132e3
Remove support schema flags, only use config file.
gouthamve a399efa
Update docs to use the schema file.
gouthamve bd33178
Deprecate not remove the config flag.
gouthamve 6bdec79
Make integration tests pass?
gouthamve b4eb090
Remove support schema flags, only use config file.
gouthamve c9b082c
Update docs to use the schema file.
gouthamve 733bef2
Deprecate not remove the config flag.
gouthamve e20975a
Update docs/configuration/schema-config-reference.md
pracucci 5d3e503
Fixed schema config doc
pracucci 4bd8a88
Fixes after rebase
pracucci 91a7944
Remove duplicated entry from CHANGELOG
pracucci File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
--- | ||
title: "Schema Configuration" | ||
linkTitle: "Schema Configuration" | ||
weight: 1 | ||
slug: schema-configuration | ||
--- | ||
|
||
Cortex uses a NoSQL Store to store its index and optionally an Object store to store its chunks. Cortex has overtime evolved its schema to be more optimal and better fit the use cases and query patterns that arose. | ||
|
||
Currently there are 9 schemas that are used in production but we recommend running with `v9` schema when possible. You can move from one schema to another if a new schema fits your purpose better, but you still need to configure Cortex to make sure it can read the old data in the old schemas. | ||
|
||
You can configure the schemas using a YAML config file, that you can point to using the `-schema-config-file` flag. It has the following YAML spec: | ||
|
||
```yaml | ||
configs: []<period_config> | ||
``` | ||
|
||
Where `period_config` is | ||
``` | ||
# In YYYY-MM-DD format, for example: 2020-03-01. | ||
from: <string> | ||
# The index client to use, valid options: aws-dynamo, bigtable, bigtable-hashed, cassandra, boltdb. | ||
store: <string> | ||
# The object client to use. If none is specified, `store` is used for storing chunks as well. Valid options: s3, aws-dynamo, bigtable, bigtable-hashed, gcs, cassandra, filesystem. | ||
object_store: <string> | ||
# The schema version to use. Valid ones are v1, v2, v3,... v6, v9, v10, v11. Recommended for production: v9. | ||
schema: <string> | ||
index: <periodic_table_config> | ||
chunks: <periodic_table_config> | ||
``` | ||
|
||
Where `periodic_table_config` is | ||
``` | ||
# The prefix to use for the tables. | ||
prefix: <string> | ||
# We typically run Cortex with new tables every week to keep the index size low and to make retention easier. This sets the period at which new tables are created and used. Typically 168h (1week). | ||
period: <duration> | ||
# The tags that can be set on the dynamo table. | ||
tags: <map[string]string> | ||
``` | ||
|
||
Now an example of this file (also something recommended when starting out) is: | ||
``` | ||
configs: | ||
- from: "2020-03-01" # Or typically a week before the Cortex cluster was created. | ||
schema: v9 | ||
index: | ||
period: 168h | ||
prefix: cortex_index_ | ||
# Chunks section is optional and required only if you're not using a | ||
# separate object store. | ||
chunks: | ||
period: 168h | ||
prefix: cortex_chunks | ||
store: aws-dynamo/bigtable-hashed/cassandra/boltdb | ||
object_store: <above options>/s3/gcs/azure/filesystem | ||
``` | ||
|
||
An example of an advanced schema file with a lot of changes: | ||
``` | ||
configs: | ||
# Starting from 2018-08-23 Cortex should store chunks and indexes | ||
# on Google BigTable using weekly periodic tables. The chunks table | ||
# names will be prefixed with "dev_chunks_", while index tables will be | ||
# prefixed with "dev_index_". | ||
- from: "2018-08-23" | ||
schema: v9 | ||
chunks: | ||
period: 168h0m0s | ||
prefix: dev_chunks_ | ||
index: | ||
period: 168h0m0s | ||
prefix: dev_index_ | ||
store: gcp-columnkey | ||
|
||
# Starting 2018-02-13 we moved from BigTable to GCS for storing the chunks. | ||
- from: "2019-02-13" | ||
schema: v9 | ||
chunks: | ||
period: 168h | ||
prefix: dev_chunks_ | ||
index: | ||
period: 168h | ||
prefix: dev_index_ | ||
object_store: gcs | ||
store: gcp-columnkey | ||
|
||
# Starting 2019-02-24 we moved our index from bigtable-columnkey to bigtable-hashed | ||
# which improves the distribution of keys. | ||
- from: "2019-02-24" | ||
schema: v9 | ||
chunks: | ||
period: 168h | ||
prefix: dev_chunks_ | ||
index: | ||
period: 168h | ||
prefix: dev_index_ | ||
object_store: gcs | ||
store: bigtable-hashed | ||
|
||
# Starting 2019-03-05 we moved from v9 schema to v10 schema. | ||
- from: "2019-03-05" | ||
schema: v10 | ||
chunks: | ||
period: 168h | ||
prefix: dev_chunks_ | ||
index: | ||
period: 168h | ||
prefix: dev_index_ | ||
object_store: gcs | ||
store: bigtable-hashed | ||
``` | ||
|
||
Note how we started out with v9 and just Bigtable, but later migrated to GCS as the object store, finally moving to v10. This is a complex schema file showing several changes changes over the time, while a typical schema config file usually has just one or two schema versions. | ||
|
||
### Migrating from flags to schema file | ||
|
||
Legacy versions of Cortex did support the ability to configure schema via flags. If you are still using flags, you need to migrate your configuration from flags to the config file. | ||
|
||
If you're using: | ||
gouthamve marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
* `chunk.storage-client`: then set the corresponding `object_store` field correctly in the schema file. | ||
* `dynamodb.daily-buckets-from`: then set the corresponding `from` date with `v2` schema. | ||
* `dynamodb.base64-buckets-from`: then set the corresponding `from` date with `v3` schema. | ||
* `dynamodb.v{4,5,6,9}-schema-from`: then set the corresponding `from` date with schema `v{4,5,6,9}` | ||
* `bigtable.column-key-from`: then set the corresponding `from` date and use the `store` as `bigtable-columnkey`. | ||
* `dynamodb.use-periodic-tables`: then set the right `index` and `chunk` fields with corresponding values from `dynamodb.periodic-table.{prefix, period, tag}` and `dynamodb.chunk-table.{prefix, period, tag}` flags. Note that the default period is 7 days, so please set the `period` as `168h` in the config file if none is set in the flags. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,16 +45,8 @@ spec: | |
- -ingester.claim-on-rollout=true | ||
- -consul.hostname=consul.default.svc.cluster.local:8500 | ||
- -s3.url=s3://abc:[email protected]:4569 | ||
- -dynamodb.original-table-name=cortex | ||
- -dynamodb.url=dynamodb://user:[email protected]:8000 | ||
- -dynamodb.periodic-table.prefix=cortex_weekly_ | ||
- -dynamodb.periodic-table.from=2017-01-06 | ||
- -dynamodb.daily-buckets-from=2017-01-10 | ||
- -dynamodb.base64-buckets-from=2017-01-17 | ||
- -dynamodb.v4-schema-from=2017-02-05 | ||
- -dynamodb.v5-schema-from=2017-02-22 | ||
- -dynamodb.v6-schema-from=2017-03-19 | ||
- -dynamodb.chunk-table.from=2017-04-17 | ||
- -schema-config-file=/etc/cortex/schema.yaml | ||
- -memcached.hostname=memcached.default.svc.cluster.local | ||
- -memcached.timeout=100ms | ||
- -memcached.service=memcached | ||
|
@@ -66,3 +58,10 @@ spec: | |
port: 80 | ||
initialDelaySeconds: 15 | ||
timeoutSeconds: 1 | ||
volumeMounts: | ||
- name: config-volume | ||
mountPath: /etc/cortex | ||
volumes: | ||
- name: config-volume | ||
configMap: | ||
name: schema-config |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,20 +22,19 @@ spec: | |
- -server.http-listen-port=80 | ||
- -consul.hostname=consul.default.svc.cluster.local:8500 | ||
- -s3.url=s3://abc:[email protected]:4569 | ||
- -querier.frontend-address=query-frontend.default.svc.cluster.local:9095 | ||
- -dynamodb.original-table-name=cortex | ||
- -dynamodb.url=dynamodb://user:[email protected]:8000 | ||
- -dynamodb.periodic-table.prefix=cortex_weekly_ | ||
- -dynamodb.periodic-table.from=2017-01-06 | ||
- -dynamodb.daily-buckets-from=2017-01-10 | ||
- -dynamodb.base64-buckets-from=2017-01-17 | ||
- -dynamodb.v4-schema-from=2017-02-05 | ||
- -dynamodb.v5-schema-from=2017-02-22 | ||
- -dynamodb.v6-schema-from=2017-03-19 | ||
- -dynamodb.chunk-table.from=2017-04-17 | ||
- -schema-config-file=/etc/cortex/schema.yaml | ||
- -querier.frontend-address=query-frontend.default.svc.cluster.local:9095 | ||
- -memcached.hostname=memcached.default.svc.cluster.local | ||
- -memcached.timeout=100ms | ||
- -memcached.service=memcached | ||
- -distributor.replication-factor=1 | ||
ports: | ||
- containerPort: 80 | ||
volumeMounts: | ||
- name: config-volume | ||
mountPath: /etc/cortex | ||
volumes: | ||
- name: config-volume | ||
configMap: | ||
name: schema-config |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,19 +25,18 @@ spec: | |
- -ruler.alertmanager-url=http://alertmanager.default.svc.cluster.local/api/prom/alertmanager/ | ||
- -consul.hostname=consul.default.svc.cluster.local:8500 | ||
- -s3.url=s3://abc:[email protected]:4569/s3 | ||
- -dynamodb.original-table-name=cortex | ||
- -dynamodb.url=dynamodb://user:[email protected]:8000 | ||
- -dynamodb.periodic-table.prefix=cortex_weekly_ | ||
- -dynamodb.periodic-table.from=2017-01-06 | ||
- -dynamodb.daily-buckets-from=2017-01-10 | ||
- -dynamodb.base64-buckets-from=2017-01-17 | ||
- -dynamodb.v4-schema-from=2017-02-05 | ||
- -dynamodb.v5-schema-from=2017-02-22 | ||
- -dynamodb.v6-schema-from=2017-03-19 | ||
- -dynamodb.chunk-table.from=2017-04-17 | ||
- -schema-config-file=/etc/cortex/schema.yaml | ||
- -memcached.hostname=memcached.default.svc.cluster.local | ||
- -memcached.timeout=100ms | ||
- -memcached.service=memcached | ||
- -distributor.replication-factor=1 | ||
ports: | ||
- containerPort: 80 | ||
volumeMounts: | ||
- name: config-volume | ||
mountPath: /etc/cortex | ||
volumes: | ||
- name: config-volume | ||
configMap: | ||
name: schema-config |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
kind: ConfigMap | ||
apiVersion: v1 | ||
metadata: | ||
name: schema-config | ||
data: | ||
schema.yaml: | | ||
configs: | ||
- from: "2020-01-01" | ||
schema: v9 | ||
index: | ||
period: 168h0m0s | ||
prefix: cortex_weekly_ | ||
store: aws-dynamo | ||
object_store: s3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,10 +20,14 @@ spec: | |
args: | ||
- -target=table-manager | ||
- -server.http-listen-port=80 | ||
- -dynamodb.original-table-name=cortex | ||
- -dynamodb.url=dynamodb://user:[email protected]:8000 | ||
- -dynamodb.periodic-table.prefix=cortex_weekly_ | ||
- -dynamodb.periodic-table.from=2017-01-06 | ||
- -dynamodb.chunk-table.from=2017-04-17 | ||
- -schema-config-file=/etc/cortex/schema.yaml | ||
ports: | ||
- containerPort: 80 | ||
volumeMounts: | ||
- name: config-volume | ||
mountPath: /etc/cortex | ||
volumes: | ||
- name: config-volume | ||
configMap: | ||
name: schema-config |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.