doc: update docs/postgres.md (#436)

This commit is contained in:
baoer 2023-09-19 22:39:42 +08:00 committed by GitHub
parent 71eb82ae3a
commit 5e12094078
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -623,6 +623,31 @@ $ sudo systemctl restart postgresql
另见:[复制](https://www.postgresql.org/docs/current/sql-copy.html) 另见:[复制](https://www.postgresql.org/docs/current/sql-copy.html)
### 跨版本升级
pg_upgrade 跨版本升级
```shell
$ /usr/lib/postgresql/16/bin/pg_upgrade \
-b /usr/lib/postgresql/15/bin \
-B /usr/lib/postgresql/16/bin \
-d /var/lib/postgresql/15/main \
-D /var/lib/postgresql/16/main \
-o " -c config_file=/etc/postgresql/15/main/postgresql.conf" \
-O " -c config_file=/etc/postgresql/16/main/postgresql.conf"
```
-   `-b`   旧版本二进制文件目录
-   `-B`   新版本二进制文件目录
-   `-d`   旧版本数据目录
-   `-D`   新版本数据目录
-   `-o`   旧版本主配置文件
-   `-O`   新版本主配置文件
-   `-c`  `check`,不执行升级,可先加`-c`检查是否有报错,没有报错再运行升级
<!--rehype:className=style-none-->
使用 `pg_upgrade -?` 获取完整的选项列表
另见 另见
---- ----