I am doing postgresql replication by issuing:
On the master:
>select pg_start_backup('clone', true);
>\q
#tar -cz main -f main.tar.gz
(Explanation: main is the data directory on my system /var/lib/postgresql/9.6/main)
Then I transfer main.tar.gz to the slave....
On the slave:
--Uncompressing main.tar.gz....
#tar -zxf main.tar.gz
--Copying previously created recovery.conf
#cp recovery.conf main/
--And then just starts the slave
#service postgresql start
On the master:
--And stoping backup mode on the master:
>select pg_stop_backup();
What I get is that replication is working fine, and it really works nice.
But I am with doubt after reading the official documentation that after the copy I should copy pg_xlog in an additional step... https://wiki.postgresql.org/wiki/Binary_Replication_Tutorial
But I never do that, and never experienced a problem - do a lot of tests, like counting every table lines, in both master and slave and much more, but what worst can happen?
pg_basebackup
to do all that in a single step-X fetch
or-X stream