Postgresql – Initial recovery Postgres with backup in sync commit mode

backuplogspostgresqlrecoverytransaction-log

I've got a master and a slave postgres 9.1.3 database. I would like to init the backup database for the first time.

I did the following steps:

  1. Stopped master
  2. Copied all files to Slave
  3. Create recory.conf on slave
  4. started master
  5. started slave

This process seems to work, but I've got the feeling something is wrong, because it's been a few hours now and there are still postgres: wal receiver process streaming 1/1FAA88 and postgres: startup process recovering 000000010000000100000000 processes on the slave.

The slave should be up after a few seconds because it already consists of all needed data…

I don't archive my WALs.

Do I have to use pg_start_backup before copying the files to the slave?

I tried this:

  1. Disable sync commits
  2. restart master
  3. master pg_start_backup
  4. stop master
  5. copy files
  6. start master
  7. master pg_stop_backup (docs say "don't do that when sync commit = on", I guessed the master resends all files in pg_xlog when it starts?)
  8. Enable sync commit
  9. restart master
  10. create recovery file on slave
  11. start slave

But then I get an error on he slave about some missing WALs.

I found alot of tutorials with using WAL archive, but I don't have a WAL archive.

Can anyone give me the correct steps?

Best Answer

If you don't archive wal's then how do you suppose the slave is going to get them?

You have to archive, and then recovery.conf should read from the archive.