YahWx

Postgresql 升级问题

  •  
  •   YahWx · Jan 3, 2023 · 2323 views
    This topic created in 1239 days ago, the information mentioned may be changed or developed.
    根据(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 replies    2023-11-14 08:34:07 +08:00
    YahWx
        1
    YahWx  
    OP
       Jan 3, 2023
    不好意思加入 v 站这么久,第一次发帖,不知道还不支持 markdown😊,排版很乱,见谅。
    YahWx
        2
    YahWx  
    OP
       Jan 3, 2023
    总之问题就是,我以前自定义的配置文件比如我自定义了 listen addre ,或者 port ,或者其它参数的配置文件,在升级之后我是否需要重新配置?
    mschultz
        3
    mschultz  
       Jan 4, 2023   ❤️ 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  
       Jan 4, 2023   ❤️ 1
    lz ,pg 有中文手册的,http://www.postgres.cn/docs/13/index.html
    YahWx
        5
    YahWx  
    OP
       Jan 4, 2023
    @mschultz #3 @cstj0505 #4 谢谢,看了下确实是🤣
    xshell
        6
    xshell  
       Nov 14, 2023
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1173 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 41ms · UTC 17:48 · PVG 01:48 · LAX 10:48 · JFK 13:48
    ♥ Do have faith in what you're doing.