Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
For smaller environments that can tolerate a little downtime, use a straightforward pg_dump/pg_restore process. Here are the steps.
Save the database structure from your development database:
pg_dump \ --format=plain \ --no-owner \ --schema-only \ --file=schema.sql \ --schema=target_schema \ postgres://user:pass@host:5432/dbConnect to the Citus cluster using psql and create the schema:
\i schema.sqlRun your
create_distributed_tableandcreate_reference_tablestatements. If you get an error about foreign keys, it's typically due to the order of operations. Drop foreign keys before distributing tables and then readd them.Put the application into maintenance mode, and disable any other writes to the old database.
Save the data from the original production database to disk with
pg_dump:pg_dump \ --format=custom \ --no-owner \ --data-only \ --file=data.dump \ --schema=target_schema \ postgres://user:pass@host:5432/dbImport into Citus using
pg_restore:# remember to use connection details for Citus, # not the source database pg_restore \ --host=host \ --dbname=dbname \ --username=username \ data.dump # it'll prompt you for the connection passwordTest application.
Launch!