PostgreSQL 14 到 16 的升级(多版本适用)在 Nginx 配置 HTTPS 访问

SimpleMaxR Lv2

写在前面

进行操作前,前务必确保数据安全备份。操作可能导致数据丢失,本文使用的数据库为实验环境。

环境

操作步骤

安装新版本的 PostgreSQL

1
brew install postgresql@16

停止 PostgreSQL 服务

1
2
brew services stop postgresql@14
brew services stop postgresql@16

运行 pg_upgrade 命令
pg_upgrade 命令包含四个参数。
注意是运行新版本 Postgres 的 pg_upgrade;这里的版本号根据具体情况替换

1
2
3
4
5
/opt/homebrew/Cellar/postgresql@16/16.2_1/bin/pg_upgrade \ 
-b /opt/homebrew/Cellar/postgresql@14/14.1/bin \
-d /opt/homebrew/var/postgresql@14 \
-B /opt/homebrew/Cellar/postgresql@16/16.2_1/bin \
-D /opt/homebrew/var/postgresql@16

成功后得到如下输出

1
2
3
4
5
// 省略一些输出...
Upgrade Complete
----------------
Optimizer statistics are not transferred by pg_upgrade. Once you start the new server, consider running: /opt/homebrew/Cellar/postgresql@16/16.2_1/bin/vacuumdb --all --analyze-in-stages
Running this script will delete the old cluster's data files: ./delete_old_cluster.sh
  • Title: PostgreSQL 14 到 16 的升级(多版本适用)在 Nginx 配置 HTTPS 访问
  • Author: SimpleMaxR
  • Created at : 2024-04-15 21:29:43
  • Updated at : 2025-02-11 12:15:45
  • Link: https://www.hgzre.tech/2024/04/15/PostgreSQL-14-到-16-的升级(多版本适用)在-Nginx-配置-HTTPS-访问/
  • License: This work is licensed under CC BY-NC-SA 4.0.
Comments
On this page
PostgreSQL 14 到 16 的升级(多版本适用)在 Nginx 配置 HTTPS 访问