Postgres replication: Do I need to rsync pg_xlog files if I have archiving setup in master? I am trying to replicate a master to slave, without shutting down my master.

In the tutorial here: http://wiki.postgresql.org/wiki/Binary_Replication_Tutorial, they recommend these steps:


pg_start_backup()
rsync -av --exclude pg_xlog --exclude postgresql.conf --exclude postgresql.pid \ 
 data/*  :/var/lib/postgresql/data/
pg_stop_backup()
rsync -av data/pg_xlog :/var/lib/postgresql/data/


Steps 1-3 are straightforward. However, If I setup archiving in the master and archiving in my slave, do I need to execute step 4? Will it mess things up? Should I NOT setup archiving until everything is rsync'd and my slave is running?

My master's config file looks like this:

wal_level = hot_standby
archive_mode = on
archive_command = 'rsync -a %p &lt;INSERT SLAVE IP&gt;:/var/lib/pgsql/data/archive/%f'


Likewise, my slave has a recovery.conf with a restore_command.
That tutorial appears to be old, and also says "work in progress" at the top. I'll amend it if I have time. Please refer to the main documentation.

If you have continuous archiving set up you don't need to manually rsync the WAL, because your archive_command will do that for you.

You may also wish to consider using pg_basebackup instead of manually rsync'ing the datadir. It'll take care of everything for you over the PostgreSQL replication protocol. If you weren't using WAL archiving you'd use -X stream mode to get it to copy the WAL for you too, but you don't need that.