1

I want to have a clone of a postgresql database. If I copy the entire data directory from one machine and replace another machine's data directory with it, will there be any problems? both of them have the same OS, btw (CentOS)

2 Answers 2

2

Certainly if you stop the server and then copy it, that's fine. If you don't, the cloned server will have to do recovery, which isn't so good. Or just use pg_dumpall to produce a script to recreate the data on the new machine.

Sign up to request clarification or add additional context in comments.

Comments

2

You can invoke pg_start_backup() and then copy the datadir. All changes will then be written to a "log" and committed later on when you run pg_stop_backup().

http://www.postgresql.org/docs/8.1/static/backup-online.html

Se section 23.3.2. Making a Base Backup

I then think you can restore the files on another machine running identical versions of postgresql under the same architecture.

section 23.3.3. Recovering with an On-line Backup will explain how to restore the backup you have made.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.