I am learning about PostgreSQL streaming replication and so far I have learned how to create a slave cluster using:
pg_basebackup -x -R -D main -h host -p port
I also have learned that I can promote a slave to be a master like this:
pg_ctl -D main promote
pg_ctlcluster 9.4 main promote
(if you are working on Ubuntu).
What I like to do now is to say that my previous master is now a slave of the new master. So far I have learned that I can do it by removing the data directory of server, and running
pg_basebackup again. This means that I have to wait until all of my files are copied back from the new master the old one, which means a lot of data traffic.
Is there another way to do the same thing without copying all the data again?