Migrating your Mastodon PostgreSQL database to its own server.
Ready for another Mastodon guide? Well today we’re going to go over how to migrate your PostgreSQL database to its own server in a few easy steps! This will remove quite a bit of the resource usage from your main Mastodon server since the database loves CPU and RAM.
Create a mastodon user on the new database server.
Switch back to the Mastodon server and edit the .env.production file with the database server IP address.
Switch back to root and start the Mastodon services.
systemctl start mastodon-sidekiq
systemctl start mastodon-web
systemctl start mastodon-streaming
Stop and disable the PostgreSQL service. systemctl stop postgresql
systemctl disable postgresql
And that’s all there is to it. Make sure you don’t have any firewall rules blocking your connection between the servers and everything should be working properly with your PostgreSQL database on its own server now.