Self-hosted Matrix server: move database to a new server
-
On both servers, create a
~/.pgpass
file with the database usernames and passwords. Each line is the login credentials for one database, in the formathostname:port:database-name:username:password
-
On the old server, shut-down Synapse and the plugins
sudo systemctl stop synapse
-
On the new server, shut-down Synapse and the plugins
ssh stephen@constanza.irons.nz pg_dump -C -h localhost -U synapse synapse | psql -h localhost -U synapse synapse
This took a few minutes; this is a small Synapse installation
The databases are not exposed to the internet, so ssh is used to create a session on the remote side.