Sample Header Ad - 728x90

Upgrade matrix synapse postgresql database from 9.6 to 11

0 votes
2 answers
1299 views
I have a VM on my server where I host a Matrix synapse homeserver. Now I need to update postgresql, because version 9.6 is EOL. The database in /var/lib/postgresql/9.6/main already has 56 GByte. I dumped the database in sql files with this script:
#!/bin/bash
DB=synapse
U=irc-bridge
# directory to dump files without trailing slash:
DIR=/home/synapse/postgres-backup
mkdir -p $DIR
TABLES="$(psql -q -d $DB -U $U -t -c "SELECT table_name FROM information_schema.tables WHERE table_type='BASE TABLE' ORDER BY table_name")"
w=$(echo $TABLES|wc -w)
echo $w tables
i=0
for table in $TABLES; do
  i=$((i + 1))
  echo "$i/$w: backup $table ..."
  pg_dump -U $U -t $table $DB | gzip > $DIR/$table.sql.gz;
done;
I get about 9 GByte of zipped Files. What would be the easyest path to upgrade the Postgres cluster up from 9.6?
Asked by rubo77 (30435 rep)
Jun 28, 2022, 09:21 AM
Last activity: Jan 16, 2023, 09:27 AM