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

Allow merging multiple Prometheus databases #10

Open
jordap opened this issue Feb 26, 2024 · 0 comments · May be fixed by #80
Open

Allow merging multiple Prometheus databases #10

jordap opened this issue Feb 26, 2024 · 0 comments · May be fixed by #80

Comments

@jordap
Copy link
Collaborator

jordap commented Feb 26, 2024

It is possible to use data from multiple Prometheus instances without manually rewriting the database: simply copy blocks from one Prometheus data directory to the target Prometheus data directory.

For example, Prometheus data directories usually look like this:

01HQAK3HN2YAJ8XJPB3B5P88XX/
01HQBW9EBQEANHPGTEP5YDF5D0/ 
01HQC355KQ5V8WPCFKA3DJ8E9H/
chunks_head/
queries.active 
wal/

In this case the first 3 subdirectories starting with 01HQ* are blocks that have been compacted.

The main caveat is this works well enough for already compacted TSDB blocks, but it doesn't necessarily work well for the head block (the block that holds the most recent data), and so there is a chance we are losing the last ~2 hours of the Prometheus databases we are merging.

It would be ideal if we can simply flush the head block with the Prometheus API or with promtool. There are a number of proposals, but nothing that looks like it has made it to Prometheus yet.

Alternatives I'm thinking of are playing with snapshots to force writing the head block, or forcing it directly with a custom tool that calls FlushWAL() on the Prometheus database. While not perfect, this approach to combining multiple Prometheus databases is more promising than other options.

This issue is meant to keep track of progress and findings related to this topic.

@jordap jordap linked a pull request Aug 9, 2024 that will close this issue
3 tasks
@jordap jordap linked a pull request Oct 2, 2024 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant