Thread: Cloning database without dump/restore
Only port 5432 is opened in server. Database can cloned using pg_dup / pg_restore If server is located in internet this requires huge amount of time and bandwidth. How to clone database fast ? How to create server side pl/pgsql script which use code like in pg_dump/pg_restore and or in pg_migrator and clones existing database or other idea ? Andrus.
read documentation on backups.
snapshot might be the keyword you're looking for. regards andreas On 11/05/2010 09:06 AM, Andrus wrote: > Only port 5432 is opened in server. Database can cloned using pg_dup / > pg_restore > If server is located in internet this requires huge amount of time and > bandwidth. > > How to clone database fast ? > How to create server side pl/pgsql script which use code like in > pg_dump/pg_restore and or in pg_migrator and clones existing database > or other idea ? > > Andrus. >
On 11/05/10 1:06 AM, Andrus wrote: > Only port 5432 is opened in server. Database can cloned using pg_dup / > pg_restore > If server is located in internet this requires huge amount of time and > bandwidth. > you can't log onto the server, no ssh? thats a harsh constraint. moving the data to another server will require significant amounts of time and bandwidth, yes. I don't believe there's any way to avoid that. > How to clone database fast ? > How to create server side pl/pgsql script which use code like in > pg_dump/pg_restore and or in pg_migrator and clones existing database > or other idea ? roughly, for every object in the database (pick through the pg_catalog), create an equivalent table in the new database... wait. pl/pgsql can't connect to another database, at least not without a package like dblink ... then copy all the data from the source table to the destination table. This will have to move the same amount of data over the network to the new server, there's no way to avoid that.
"Andrus" <kobruleht2@hot.ee> writes: > How to clone database fast ? > How to create server side pl/pgsql script which use code like in > pg_dump/pg_restore and or in pg_migrator and clones existing database or > other idea ? See pg_basebackup here: https://github.com/dimitri/pg_basebackup I'm wouldn't expect it to be "fast" though. -- Dimitri Fontaine http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support