私のサーバーには、Matrixシナプスマスターサーバーをホストする仮想マシンがあります。
バージョン9.6はEOLなので、postgresqlを更新する必要があります。
データベースは/var/lib/postgresql/9.6/main
すでに56GBです。
次のスクリプトを使用してデータベースをSQLファイルにダンプします。
#!/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;
約9GBの圧縮ファイルを取得します。
9.6でPostgresクラスタをアップグレードする最も簡単な方法は何ですか?
ベストアンサー1
最善の方法は、データベース全体をダンプして新しいクラスタにインポートすることです。
sudo -u postgres pg_dumpall --cluster 9.6/main > dump.sql
sudo -u postgres psql -d postgres --cluster 13/main -f dump.sql
バラよりhttps://decatec.de/linux/postgresql-upgrade-auf-neue-version-durchfuehren