You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

带Citus扩展的PostgreSQL 14升级至15的疑问

CentOS 7下PostgreSQL 14→15+Citus同步升级解决方案

核心问题说明

官方升级指南未明确CentOS 7环境下需安装对应PG15的Citus RPM包citus111_15,导致仅升级PostgreSQL而遗漏Citus。按指南"先更Citus再升PG"的逻辑,需先安装适配目标PG版本的Citus包,再执行PG升级。

具体操作步骤

  1. 确保Citus YUM源已配置
    若未添加过官方源,执行:
    curl https://install.citusdata.com/community/rpm.sh | sudo bash
    
  2. 安装适配PG15的Citus 11.1包
    直接安装对应版本的RPM:
    sudo yum install citus111_15
    
  3. 停止旧版PG服务
    sudo systemctl stop postgresql-14
    
  4. 初始化PG15数据目录(首次操作)
    /usr/pgsql-15/bin/postgresql-15-setup initdb
    
  5. 执行PG升级(关联Citus配置)
    使用pg_upgrade时需指定Citus的预加载库参数,确保升级后Citus正常工作:
    sudo -iu postgres /usr/pgsql-15/bin/pg_upgrade \
      --old-datadir=/var/lib/pgsql/14/data \
      --new-datadir=/var/lib/pgsql/15/data \
      --old-bindir=/usr/pgsql-14/bin \
      --new-bindir=/usr/pgsql-15/bin \
      --old-options='-c shared_preload_libraries=citus' \
      --new-options='-c shared_preload_libraries=citus'
    
  6. 启动新版PG服务并验证
    sudo systemctl enable postgresql-15
    sudo systemctl start postgresql-15
    
    登录PG15数据库,执行SQL验证版本:
    SELECT version(); -- 确认PG版本为15
    SELECT citus_version(); -- 确认Citus版本为11.1
    

补充说明

CentOS 7下Citus的RPM包命名规则为citus<主版本号><次版本号>_<PG版本号>,比如citus111_15对应Citus 11.1 + PostgreSQL 15。官方指南未单独提及是因为默认用户了解该命名逻辑,后续升级时需注意匹配PG版本的Citus包。

内容的提问来源于stack exchange,提问作者Nils

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.15 06:00:59