Ubuntu – postgreSQL replication and failover with repmgr on Ubuntu

databasefailoverpostgresqlreplicationUbuntu

I'm new to Linux and have been tasked with setting up a redundant Linux DB server with PostgreSQL. preferably the fail-over needs to be automatic, but a manual process will be fine for now.

What I have done thus far is setup two identical DB servers on Ubuntu 11.10 with PostgreSQL 9.1 and repmgr1.1.0 by following the steps on 2ndQuadrant.

The only problem is that it is only for replication, which is working fine, thank you 2ndQuadrant. Now I want to test a fail-over by shutting down the master DB and promoting the Hot Standby to master, but this fails with sh: pg_ctl: not found and then that the postgreSQL service can't be started.

My postgreSQL setup is default install via apt-get and is setup for a master-hot_standby. please could someone assist me in setting up a simple replication of postgresql between 2 servers with a HA failover step-by-step.

Best Answer

It's a bit late to answer this question now. Nevertheless, I came across this issue past week and couldn't find the answer in the context of "repmgr".

pg_ctl resides in the bin directory of your Postgres installation. The bin directory is not in the PATH environment variable. You can not set the environment variable either which makes this problem a tricky one.

You should specify the pg_bindir variable in your repmgr.conf file which resolves this issue. Add following line by updating the path in your conf file.

pg_bindir=/path/to/postgres/bin