Debian PostgreSQL版本升级分小版本和大版本,流程如下:
pg_dumpall工具备份所有数据库。sudo systemctl stop postgresql。sudo apt update。sudo apt install postgresql-<目标版本>。sudo systemctl start postgresql。pg_dumpall导出旧数据库。sudo systemctl stop postgresql。sudo /usr/lib/postgresql/<新版本>/bin/pg_ctl initdb -D /var/lib/postgresql/<新版本>/main/。pg_upgrade工具升级,或通过逻辑转储导入数据。sudo systemctl start postgresql@<新版本>-main。psql连接新服务检查版本。