Skip to content

HOWTO: PostgreSQL 9.4 Streaming Replication Automatic Failover with repmgr PART 2: using repmgr WITNESS

January 23, 2016

Continue from: https://iamsto.wordpress.com/2016/01/21/howto-postgresql-replication-with-automatic-fail-over-using-repmgr-a-k-a-replication-manager/

 

In this case we have 3 servers in the setup: DB_MASTERNODE, DB_SLAVENODE, DB_WITNESS , where our db_witness server is the server which host the application.

 

Initialize the witness server PostgreSQL Data dir structure and promote the server as witness in the database cluster:

# su - postgres
-bash-4.1$ /usr/pgsql-9.4/bin/repmgr -d repmgr -U repmgr -h rw-db1 -D /var/lib/pgsql/9.4/data -f /etc/repmgr/9.4/repmgr.conf --initdb-no-pwprompt witness create ; tail /var/log/repmgr/repmgr-9.4.log

-bash-4.1$ repmgr -f /etc/repmgr/9.4/repmgr.conf cluster show

[2016-01-23 11:01:20] [NOTICE] Redirecting logging output to ‘/var/log/repmgr/repmgr-9.4.log’
Role | Connection String
* master | host=MASTERNODE dbname=repmgr user=repmgr
standby | host=SLAVENODE dbname=repmgr user=repmgr
witness | host=MASTERNODE dbname=repmgr user=repmgr

 

 

Advertisements

From → databases, postgresql

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: