Grafana HA -PostgreSQL HA implementation on Linux

This is regarding the Grafana HA -PostgreSQL HA implementation. I am trying to use the repmgr (Replication Manager) for automatic failover in PostgreSQL HA for Grafana .

repmgr is working as expected that once primary server goes down, the standby server promotes to the primary , but the issue is with Grafana that when the primary goes down ,the Grafana also goes down as the configured database is unavailable and doesn’t listen to it and throws an error=“dial tcp *****: connect: connection refused”.

where I am using the database details of postgreSQL.

type = postgres
host = *****
;name = ****
user = ****
password = ****

Can you please advise me further that Grafana is able to recognize standby server when it promotes to primary server (since actual Primary server goes down).

Hi,

I suggest you need to change your approach from Postgres Replication using FailOver as follow:
https://wiki.clusterlabs.org/wiki/PostgresHowto

Using corosync, pacemaker and DRBD can make system HA using Failover flawless.

Build the grafana and postgresql using corosync, pacemaker and DRBD to make the disk and server starting together, and also using VIP.
The critical point is the disk that need to synced. In postgres is definitely the disk is very important. In grafana you need to consider the grafana.db as grafana backend that stored the configuration, and this is need sync also…
If you’re using Postgres as grafana backend database, it’s simpler, because all the configuration stored in the same postgres database.
The Virtual IP also need to consider that your reverse proxy always ask to the same IP address even one of the server was down. Corosync, pacemaker and DRBD will take over the condition of the failure.

Regards,
Fadjar Tandabawana

Hi,

Thanks for the suggestion . I have implemented postgreSQL HA with repmgr.

Thanks.

Could you please explain your set up (architecture, order of implementation, and execution) as I am new to PostgreSQL and repmgr. From what you have explained above seems to be the solution that I am looking for. I’ve 2 Grafana servers, I will be installing PostgreSQL on another 2 servers.