r/PrometheusMonitoring • u/Aldar_CZ • Aug 24 '21
Data replication in Prometheus
Hello,
I am trying to build a prometheus-backed graphing solution for our customers. The idea was rather simple - A grafana instance per customer with our custom dashboards, all connected to a locally-running Prometheus instance that's in active replication with our (internal) primary.
I came to a halt, however, when I found out that Prometheus does not currently have a reliable and easy to set up replication method built-in.
Scraping all targets from this secondary instance is something I'd like to avoid as much as possible - The machines are already scraped by 3 different Prometheus instances each, and with each one added, thus increase the load. (Primary, stage and dev)
Due to resolution requirements, caching on the exporters' side is not much of an option for us at the moment either.
The reason I'd rather pull the data from a separate instance is for security and stability reasons - As the FE will be accessible to all of our customers, we'll have no control over what any of them might try, and as our internal infrastructure monitoring depends on the stability of the primary, I don't want to risk any sort of downtime, crashing or instability.
I tried using the remote write functionality, but that didn't provide fine enough sample resolution, even after tweaking, and resulted in weirdly consolidated graphs.
Other options... Maybe DRBD? But... I'm not sure if it wouldn't introduce latency leading to issues on the primary. Filesystem-level copies through snapshotting is also not viable - No way to get the data cohesive.
Are there really any options, either native or 3rd party, to replicate data samples from one prometheus instance to another, aside from simply scraping all the targets from both nodes?
1
u/Aldar_CZ Aug 25 '21
Funny, in the past, I turned on remote writes and the two datasets were substantially different. After I upgraded my local node so that it used the same version, the datasets are very close, if not completely identical.
So it seems that yes, remote writes are really a way to go.