Move postgresql database to separate machine
In current setup , we're running multiple web services like Matrix,diaspora,poddery on a single machine. Due to limited resources of the machine , we had a frequent downtime of services . To solve this problem, its better have the separate machine for postgresql database on the Same openstack instance. Let me know what others think .
Shamil Sun 17 Dec 2017 4:22AM
:thumbsup: And we should do it quickly too.
Pirate Praveen Sun 17 Dec 2017 4:30AM
@isaagar make a plan, list out the steps, then schedule a down time. We should announce it to our users. We can review the steps.
I Sagar Sun 17 Dec 2017 10:08AM
@praveenarimbrathod @noteness Yes, amar already provided one machine with 40 GB disk space.
Shamil Sun 17 Dec 2017 10:17AM
Should we start replicating the database on that VM then? ( according to https://gitlab.com/piratemovin/diasp.in/wikis/setting_up_backup )
Then, decide a time, stop all services and promote the slave to master and make the services use the new database?
I Sagar Sun 17 Dec 2017 10:19AM
Yes, i thought of that and interesting to see how slave becomes master :)
I Sagar Sun 17 Dec 2017 10:36AM
New machine has public IP which I'll share and add the others ssh keys
Following are the steps for setup.
1. Find the configuration of all web services dependent on the postgresql where we need to change it according to our new setup. (Adding it in the wiki will be helpful before starting the setup)
2. Encrypt the 40 GB disk of the new machine.
3. Setup the postgrsql on new machine (replica ? new version 9.6?).
4. Shutdown all services and Sync the database to the new machine. (~12G and will be faster locally)
5. Make changes in the configuration of services and start the services.
Shamil Sun 17 Dec 2017 4:19PM
Shutdown all services and Sync the database to the new machine. (~12G and will be faster locally)
Do we need to shutdown all the services while replicating? Can't we just use pg_basebackup
?
I Sagar Mon 18 Dec 2017 8:29AM
Not needed while replicating but we haven't decided with the approach. Whether it is replica setup or just manual moving of database to the new machine.And, to keep the new instance in sync with existing we have stop services from committing in the database before syncing to the new machine.
I Sagar Mon 18 Dec 2017 1:15PM
@praveenarimbrathod @noteness @devraj Lets finalize the steps.
Pirate Praveen · Sat 16 Dec 2017 11:58AM
looks good to me. Just make sure we have proper working backups before starting the migration.