Обсуждение: Cloning databases using rsync
I regularly copy all my postgresql data onto another computer and access it locally there. This works if I use pg_dump, transfer the output file, and feed that file into psql. However, I would prefer to copy the databases using rsync instead of pg_dump, because it's simpler and faster. (I know the server has to be down to avoid corruption.) rsync -avx --delete 132.205.86.95:/var/lib/postgresql /var/lib After doing this, when I run psql I get psql: FATAL: database "xxxxx", OID 12345, has disappeared from pg_database where "xxxxx" and 12345 depend on the database. /var/lib/postgresql is identical on both systems, and so is /etc/postgresql other than host-specific things like IP addresses. The version is the same (8.0). The directory "12345" exists. Any ideas of what else might have to be copied? David
David Gaudine <davidg@alcor.concordia.ca> writes: > I regularly copy all my postgresql data onto another computer and access > it locally there. This works if I use pg_dump, transfer the output > file, and feed that file into psql. However, I would prefer to copy > the databases using rsync instead of pg_dump, because it's simpler and > faster. (I know the server has to be down to avoid corruption.) This should work as long as both machines are identical processor architectures and have identical Postgres versions compiled with identical options. (Note that 8.1 tries harder than previous versions to detect option mismatch during server startup, but I wouldn't swear that it's bulletproof either.) I suspect you've broken one of these rules. regards, tom lane
Tom Lane wrote: >This should work as long as both machines are identical processor >architectures and have identical Postgres versions compiled with >identical options. (Note that 8.1 tries harder than previous versions >to detect option mismatch during server startup, but I wouldn't swear >that it's bulletproof either.) I suspect you've broken one of these >rules. > > That encouraged me to try again. I previously claimed that /etc/postgresql was the same on both systems (except stuff like IP addresses), but to make sure I used rsync to copy /etc/postgresql to the second system. Now it works, so I must have missed something in there, although I still can't see any difference. David