I’d like to migrate to Cloud 66 from Ninefold - do you have a guide as to how I can dump/restore my database with you guys?
Posted: almost 2 years
Hi there, these are the instructions we recommend:
Dump (with Ninefold):
pg_dump -Fc <database_name> > /tmp/2.bak
Stop the Cloud 66 PSQL instance:
Start by SSHing to your PSQL server.
sudo -u postgres psql -c "SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity WHERE pg_stat_activity.datname = '$POSTGRESQL_DATABASE' AND pg_stat_activity.pid <> pg_backend_pid();"
sudo -u postgres psql -c "DROP DATABASE $POSTGRESQL_DATABASE"
sudo -u postgres psql -c "CREATE DATABASE $POSTGRESQL_DATABASE WITH encoding '<YOUR_ENCODING>'"
These commands will effectively stop the PSQL server and remove all existing tables to avoid any issues. You can also kill the Rails server by running:
sudo service nginx stop
- Restore (with Cloud 66):
sudo -u postgres pg_restore -d $$POSTGRESQL_DATABASE /tmp/2.bak
Could you please give this a try and let me know how it goes?
You must be logged in to answer this question