-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Allow for multiple store configurations from the same provider #7276
Comments
Signed-off-by: Ashwanth Goli <[email protected]> **What this PR does / why we need it**: This PR adds support for named stores which allows users to define multiple object store configurations for a storage type. Named stores can be referred to from other sections of the config similar to how provider type is being used `i.e aws, gcs...`. Named store reference should be of the format: `<store_type>.<key_name>` Below is an example configuration with two named stores defined for aws `store-1, store-2`. Schema config is referring to one of them as `aws.store-1` ``` storage_config: aws: endpoint: s3://common-bucket region: us-east1 access_key_id: abc123 secret_access_key: def789 named_stores: aws: store-1: endpoint: s3://foo-bucket region: us-west1 access_key_id: 123abc secret_access_key: 789def store-2: endpoint: s3://bar-bucket region: us-west2 access_key_id: 456def secret_access_key: 789abc schema_config: configs: - from: "2020-07-31" index: period: 24h prefix: loki_prod_index_ object_store: aws.store-1 schema: v11 store: boltdb-shipper ``` **Which issue(s) this PR fixes**: Fixes #7276 **Special notes for your reviewer**: Configuration defined in common storage config has no effect on the named stores. Common storage config only overrides storageConfig if it's not explicitly set - same behavior as before. This should be a non-intrusive change. Signed-off-by: Ashwanth Goli <[email protected]>
Reopening since the PR that closed this goes some way to addressing this, but isn't the full solution AFAIK. |
Signed-off-by: Ashwanth Goli <[email protected]> **What this PR does / why we need it**: Currently loki initializes a single instance of index-shipper to [handle all the table ranges](https://github.com/grafana/loki/blob/ff7b46297345b215fbf49c2cd4c364d125b6290b/pkg/storage/factory.go#L188) (from across periods) for a given index type `boltdb-shipper, tsdb`. Since index-shipper only has the object client handle to the store defined by `shared_store_type`, it limits the index uploads to a single store. Setting `shared_store_type` to a different store at a later point in time would mean losing access to the indexes stored in the previously configured store. With this PR, we initialize a separate index-shipper & table manager for each period if `shared_store_type` is not explicity configured. This offers the flexibility to store index in multiple stores (across providers). **Note**: - usage of `shared_store_type` in this commit text refers to one of these config options depending on the index in use: `-boltdb.shipper.shared-store`, `-tsdb.shipper.shared-store` - `shared_store_type` used to default to the `object_store` from the latest `period_config` if not explicitly configured. This PR removes these defaults in favor of supporting index uploads to multiple stores. **Which issue(s) this PR fixes**: Fixes #7276 **Special notes for your reviewer**: All the instances of downloads table manager operate on the same cacheDir. But it shouldn't be a problem as the tableRanges do not overlap across periods. **Checklist** - [X] Reviewed the `CONTRIBUTING.md` guide - [ ] Documentation added - [X] Tests updated - [x] `CHANGELOG.md` updated - [x] Changes that require user attention or interaction to upgrade are documented in `docs/sources/upgrading/_index.md` --------- Signed-off-by: Ashwanth Goli <[email protected]> Co-authored-by: J Stickler <[email protected]>
**What this PR does / why we need it**: This PR adds multi-store support for compactors. Since loki allows users to configure mutiple stores using schema_config, compactor should be able to operate on multiple object stores that contain index. Currently, it can perform compaction on indexes in a single store. To maintain backward compatibility: if `boltdb.shipper.compactor.shared-store` is set, compactor will only operate on that store, else compactor will be initialized to operate on all the object store indexes (`boltdb, tsdb`) defined in the schema config. This PR also adds a new config option to define where delete requests are to be stored - `boltdb.shipper.compactor.delete-request-store`. If it's not set, `boltdb.shipper.compactor.shared-store` is used for storing them, this is to ensure no config changes are required by the users when upgrading. Refer to [docs/sources/upgrading/_index.md](https://github.com/grafana/loki/blob/a85d01c9cd3c62a62b29a20274b71d3c51f1d11a/docs/sources/upgrading/_index.md) for more details. **Which issue(s) this PR fixes:** Fixes #7276 **Checklist** - [X] Reviewed the `CONTRIBUTING.md` guide - [X] Documentation added - [X] Tests updated - [X] `CHANGELOG.md` updated - [X] Changes that require user attention or interaction to upgrade are documented in `docs/sources/upgrading/_index.md` --------- Signed-off-by: Ashwanth Goli <[email protected]>
getting the error "CrashLoopBackOff" everytime the loki pod is restarted or even after recreation. The version upgrade. changes in the sku_name from Premium_LRS to Premium_ZRS has also been tried. But still the issue is not getting resolved. Im using statefulset for the same. **level=error ts=2023-09-06T04:04:20.391118868Z caller=index_set.go:285 table-name=loki_index_19580 msg="sync failed, retrying it" err="invalid database" |
Is your feature request related to a problem? Please describe.
Loki currently supports period_configs for specifying index & chunk schema changes over time. A user can select a
store
with each config, and this effectively allows users to switch providers should they need to. Queries that span multiple periods will route requests to the appropriate store.Example:
We currently do not support multiple store configurations for the same provider, however.
At Grafana Labs, we require this feature due to a misconfiguration of an Azure Blob bucket. Its replication policy was set to be LRS (locally redundant within a zone), but we actually need it to be ZRS (zonally redundant within a region). Migrating the data from one bucket to another is impractical and slow, so we would prefer to setup a new bucket, and read/write new chunks/indexes to this bucket. Data in the old bucket will be deleted according to its retention period.
Describe the solution you'd like
I would like to be able to define multiple store configurations from the same provider, and use these configurations within period_configs definitions.
Additionally, if we could add a path prefix to prepend to all path lookups in the bucket, that would also solve some outstanding feature-requests (listed below), and it seems like related work. This is not required to deliver on the main value of this ticket, but it might be possible with some drive-by refactoring that needs to be done anyway.
Describe alternatives you've considered
There is no meaningful alternative right now.
Additional context
Related issues: #5889, possibly even #5757
I've hacked up a basic implementation which works, but it's very rough. It also adds to the
common -> storage
config, which I think might be a better place for this thanstorage_config
, but I'm not sure what'll work out to be easiest or most useful.The text was updated successfully, but these errors were encountered: