I am trying to create a postgres replication configuration using two servers. The steps are similar to PostgreSQL 9.4 Replication with RepMgr and PgBouncer on Ubuntu 14.04
. I am using repmgr + pgbouncer as my replication configuration. Say I have two host dhost1 and dhost2. Repmgr meta data db is repmgrdb and user is repmgr_user.
dhost1 has pgbouncer and Repmgr's configuration and it is the master. The Repmgr's configuration in dbhost1 is mentioned below:
>cluster = test
>node = 1
>node_name = dhost1
>use_replication_slots = 1
>conninfo='host=dhost1 user=repmgr_user dbname=repmgrdb'
>pg_bindir=/usr/lib/postgresql/9.5/bin
> ## repmgr.conf at master ##
dhost2 also has Repmgr's config and it is in slave mode. It's config is mentioned below
>cluster = test
>node = 2
>node_name = dhost2
>use_replication_slots = 1
>conninfo='host=dhost2 user=repmgr_user dbname=repmgrdb'
>pg_bindir=/usr/lib/postgresql/9.5/bin
> ## repmgr.conf at slave ##
I am able to register to the master successfully and can be seen master in cluster show command.
on slave side I using pg_basebackup method to clone master with command
repmgr -f /etc/repmgr/repmgr.conf --force -h -U repmgr_user -d repmgrdb -v standby clone
For the above command I get the below error:
>[2016-08-08 10:05:26] [NOTICE] using configuration file "/etc/repmgr/repmgr.conf"
>[2016-08-08 10:05:26] [NOTICE] setting data directory to: /var/lib/postgresql/9.5/main
>[2016-08-08 10:05:26] [HINT] use -D/--data-dir to explicitly specify a data directory
>[2016-08-08 10:05:26] [NOTICE] starting backup (using pg_basebackup)...
>[2016-08-08 10:05:26] [HINT] this may take some time; consider using the -c/--fast-checkpoint option
>[2016-08-08 10:05:31] [NOTICE] copying configuration files from master
>[2016-08-08 10:05:31] [ERROR] aborting, remote host <dhost1_ip_address_goes_here> is not reachable.
>[2016-08-08 10:05:31] [ERROR] unable to take a base backup of the master server>
>[2016-08-08 10:05:31] [WARNING] destination directory (/var/lib/postgresql/9.5/main) may need to be cleaned up manually
I also have set password-less ssh for postgres user between dhost1 and dhost2.
Also I have been able to take pg_basebackup from command
pg_basebackup -h -P -v -U repmgr_user -X stream -D 9.5/main -R
I am very beginner for postgresql replication please suggest me answers.