Postgresql 升级问题

2023-01-03 17:26:23 +08:00
 YahWx
根据(Postgresql Arch Wiki)[https://wiki.archlinux.org/title/PostgreSQL#Initial_configuration]里面提到的升级方式,有点疑惑需要解答。

PG 的数据库默认 Path:/var/lib/postgres/data
它的配置文件 Path:/var/lib/postgres/data/postgresql.conf

和数据库在同一目录下。

然后按照 ArchWiki 的升级方法,使用 pg_upgrade 升级,先要 copy 一份旧的数据库`mv /var/lib/postgres/data /var/lib/postgres/olddata`,之后再执行新版本的 initdb:`initdb -D /var/lib/postgres/data --locale= xy_XY.UTF-8 --encoding= UTF8 --data-checksums`

那么我之前在旧版的配置文件`/var/lib/postgres/data/postgresql.conf`在升级之后需要重新配置吗?
还是说`pg_upgrade -b /opt/pgsql- PG_VERSION /bin -B /usr/bin -d /var/lib/postgres/olddata -D /var/lib/postgres/data`这一步会将我之前的配置文件复制过去?求解答。
1386 次点击
所在节点    PostgreSQL
6 条回复
YahWx
2023-01-03 17:28:11 +08:00
不好意思加入 v 站这么久,第一次发帖,不知道还不支持 markdown😊,排版很乱,见谅。
YahWx
2023-01-03 17:30:11 +08:00
总之问题就是,我以前自定义的配置文件比如我自定义了 listen addre ,或者 port ,或者其它参数的配置文件,在升级之后我是否需要重新配置?
mschultz
2023-01-04 01:08:25 +08:00
需要重新配置。

This is documented: https://www.postgresql.org/docs/current/pgupgrade.html



12. Restore pg_hba.conf

If you modified pg_hba.conf, restore its original settings. It might also be necessary to adjust other configuration files in the new cluster to match the old cluster, e.g., postgresql.conf (and any files included by it), postgresql.auto.conf.
cstj0505
2023-01-04 09:38:27 +08:00
lz ,pg 有中文手册的,http://www.postgres.cn/docs/13/index.html
YahWx
2023-01-04 21:39:55 +08:00
@mschultz #3 @cstj0505 #4 谢谢,看了下确实是🤣
xshell
166 天前

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/906314

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX