prometheus-postgresql-adapter icon indicating copy to clipboard operation
prometheus-postgresql-adapter copied to clipboard

HA mode does not prevent being writing with two adapters

Open corama opened this issue 6 years ago • 1 comments

I have posted my questions in another subject, but no one reply. So, I have to open a new one, just want to get quick answer.

We set up two adapters in two machines, and according the reference link: https://blog.timescale.com/prometheus-ha-postgresql-8de68d19b6f5/, we set advisory-lock-id to the same value of 1321, and leader timeout to 16s, while the scraping interval is 15s. Here is the command which we start up adapter, and start up two adapters in two machine using the same command: prometheus-postgresql-adapter -log.level=info -pg.max-open-conns=200 -web.listen-address=:9201 -leader-election.pg-advisory-lock-id=1231 -leader-election.pg-advisory-lock.prometheus-timeout=16s -pg.host=*** -pg.port=*** -pg.database=*** -pg.user=*** -pg.password=*** -pg.prometheus-chunk-interval=24h0m0s -pg.schema=**** >> /var/log/prometheus-postgresql-adapter-9201.log 2>&1 &

The strange thing is that, we started up two prometheus and one each pointed to one of the two adapters, and, the logs showing up that the all two adapters can write metrics into PG. Here are the screenshots for log files:

As I understand it, only one adapter accepts write quests, and there other not. So, I need some help on this ?

corama avatar Aug 13 '19 11:08 corama

I cannot upload the pic of the log output. Please refer to the link , which I have commented on the similar issue: https://github.com/timescale/prometheus-postgresql-adapter/issues/77

corama avatar Aug 13 '19 12:08 corama