V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
YahWx
V2EX  ›  PostgreSQL

Postgresql 升级问题

  •  
  •   YahWx · 2023-01-03 17:26:23 +08:00 · 1356 次点击
    这是一个创建于 450 天前的主题,其中的信息可能已经有所发展或是发生改变。
    根据(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`这一步会将我之前的配置文件复制过去?求解答。
    6 条回复    2023-11-14 08:34:07 +08:00
    YahWx
        1
    YahWx  
    OP
       2023-01-03 17:28:11 +08:00
    不好意思加入 v 站这么久,第一次发帖,不知道还不支持 markdown😊,排版很乱,见谅。
    YahWx
        2
    YahWx  
    OP
       2023-01-03 17:30:11 +08:00
    总之问题就是,我以前自定义的配置文件比如我自定义了 listen addre ,或者 port ,或者其它参数的配置文件,在升级之后我是否需要重新配置?
    mschultz
        3
    mschultz  
       2023-01-04 01:08:25 +08:00   ❤️ 1
    需要重新配置。

    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
        4
    cstj0505  
       2023-01-04 09:38:27 +08:00   ❤️ 1
    lz ,pg 有中文手册的,http://www.postgres.cn/docs/13/index.html
    YahWx
        5
    YahWx  
    OP
       2023-01-04 21:39:55 +08:00
    @mschultz #3 @cstj0505 #4 谢谢,看了下确实是🤣
    xshell
        6
    xshell  
       135 天前
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3137 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 13:01 · PVG 21:01 · LAX 06:01 · JFK 09:01
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.