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 Prometheus/TSDB blocks from multiple sources #9

Closed
wants to merge 1 commit into from

Conversation

jordap
Copy link
Collaborator

@jordap jordap commented Feb 26, 2024

Adds flag to Prometheus that enables vertical compaction and makes it possible to copy 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 work 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 anything else I've seen so far.

@jordap jordap closed this Feb 26, 2024
@jordap
Copy link
Collaborator Author

jordap commented Feb 26, 2024

This is actually not needed because this flag should be the default in newer versions of Prometheus (>= 2.29). Moving discussion to #10.

@jordap jordap deleted the jorda/allow-multiple-tsdb-blocks branch February 26, 2024 06:59
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 this pull request may close these issues.

1 participant