Skip to content
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

Idea: Go back to supporting Prefixes in S3 #10550

Open
cassanovaw opened this issue Jan 31, 2025 · 6 comments
Open

Idea: Go back to supporting Prefixes in S3 #10550

cassanovaw opened this issue Jan 31, 2025 · 6 comments
Labels
enhancement New feature or request

Comments

@cassanovaw
Copy link

What is the problem you are trying to solve?

My S3 bucket needs to support prefixed values. In other words in my main bucket is named foo I essentially want the ability to specify a subdirectory bucket such as foo/mirmir-alertmanager, foo/mirmi-blocks, foo/mimir-ruler.

mimir:

common:
  storage:
    backend: s3
    s3:
      endpoint: s3.us-east-1.amazonaws.com
      region: us-east-1
      secret_access_key: "${AWS_SECRET_ACCESS_KEY}" # This is a secret injected via an environment variable
      access_key_id: "${AWS_ACCESS_KEY_ID}"
alertmanager_storage:
  s3:
    bucket_name: foo/mimir-alertmanager
    endpoint: s3.us-east-1.amazonaws.com
    region: us-east-1
    secret_access_key: "${AWS_SECRET_ACCESS_KEY}" # This is a secret injected via an environment variable
    access_key_id: "${AWS_ACCESS_KEY_ID}"
blocks_storage:
  s3:
    bucket_name: foo/mimir-blocks
    endpoint: s3.us-east-1.amazonaws.com
    region: us-east-1
    secret_access_key: "${AWS_SECRET_ACCESS_KEY}" # This is a secret injected via an environment variable
    access_key_id: "${AWS_ACCESS_KEY_ID}"
ruler_storage:
  s3:
    bucket_name: foo/mimir-ruler
    endpoint: s3.us-east-1.amazonaws.com
    region: us-east-1
    secret_access_key: "${AWS_SECRET_ACCESS_KEY}" # This is a secret injected via an environment variable
    access_key_id: "${AWS_ACCESS_KEY_ID}"

Which solution do you envision (roughly)?

Support a prefix bucket

Have you considered any alternatives?

An alternative in S3 is to create 3 new buckets at the base which I don't want to necessarily do.

Any additional context to share?

It seems like this used to work.

How long do you think this would take to be developed?

Not sure

What are the documentation dependencies?

No response

Proposer?

No response

@cassanovaw cassanovaw added the enhancement New feature or request label Jan 31, 2025
@56quarters
Copy link
Contributor

Have you tried using the storage_prefix setting for each storage block? It should do exactly what you're suggesting if I'm not mistaken. docs

@cassanovaw
Copy link
Author

cassanovaw commented Jan 31, 2025 via email

@cassanovaw
Copy link
Author

cassanovaw commented Jan 31, 2025 via email

@56quarters
Copy link
Contributor

So I guess you are saying I can move the bucket_name up to common.storage.s3 and then in each of the sections for alertmanager_storage, blocks_storage, and ruler storage add a new configuration parameter called storage_prefix.

Yeah, that's what I'm thinking.

It seems like it used to be just the word prefix back in the Cortex days?

Possibly, a bunch of config got moved around and renamed when Mimir was forked from Cortex.

Loki seems to create the necessary buckets structure automatically..... Does Mimir do the same or do I need to pre create the subdirectory buckets in S3?

Object storage doesn't really have directories, it just a prefix on the keys created. So Mimir will create keys with the appropriate prefix and it should just work.

@cassanovaw
Copy link
Author

cassanovaw commented Jan 31, 2025 via email

@cassanovaw
Copy link
Author

cassanovaw commented Feb 11, 2025

@56quarters

Thank you for your help.

Changing prefix to storage_prefix allowed the chart to deploy successfully.
Incidentally, the bucket names listed in https://grafana.com/docs/mimir/latest/configure/configure-object-storage-backend/ did not work...For example, alert-manager did NOT work alertmanager did. I wonder if this is because the example assumed that I would not be using a prefix.

31 common:
32 storage:
33 backend: s3
34 s3:
35 bucket_name:
36 endpoint: s3.us-east-1.amazonaws.com
37 region: us-east-1
38 secret_access_key: "${AWS_SECRET_ACCESS_KEY}" #
39 access_key_id: "${AWS_ACCESS_KEY_ID}"
40 alertmanager_storage:
41 storage_prefix: alertmanager
42 blocks_storage:
43 storage_prefix: mimirblocks
44 ruler_storage:
45 storage_prefix: mimirruler

The deployment itself worked....But I do not seen any new prefix buckets getting created in S3.
What I do see is a directory named __mimir_cluster under which is mimir_cluster_seed.json.
I also see a directory called mimirblocks ( that matches my above ) and in that directory another __mimir_cluster/mirmir_cluster_seed.json.

Does that imply that I need to manually create the folders for Alertmanager and mimirruler at the root of my S3 bucket?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants