postgres9.5.3升级postgres11.6

 

附上postgres下载地址:

https://yum.postgresql.org/11/redhat/rhel-7-x86_64/repoview/postgresqldbserver11.group.html

 分别下载rpm包,并安装

https://yum.postgresql.org/11/redhat/rhel-7-x86_64/postgresql11-11.6-1PGDG.rhel7.x86_64.rpm
https://yum.postgresql.org/11/redhat/rhel-7-x86_64/postgresql11-contrib-11.6-1PGDG.rhel7.x86_64.rpm
https://yum.postgresql.org/11/redhat/rhel-7-x86_64/postgresql11-libs-11.6-1PGDG.rhel7.x86_64.rpm
https://yum.postgresql.org/11/redhat/rhel-7-x86_64/postgresql11-server-11.6-1PGDG.rhel7.x86_64.rpm
https://yum.postgresql.org/11/redhat/rhel-7-x86_64/postgresql11-devel-11.6-1PGDG.rhel7.x86_64.rpm
yum localinstall postgresql11-*

  

检查升级条件是否具备
/usr/pgsql-11/bin/pg_upgrade -b /usr/local/pgsql/9.5/bin -B /usr/pgsql-11/bin/ -d /data/pgsql/data_159/ -D /data/pgsql/11/data/ -p 5432 -P 5433 -U postgres -j 8 --link --check

通过硬连接进行升级(切记注意升级前进行数据完整备份,防止出现不可预料的问题)
/usr/pgsql-11/bin/pg_upgrade --link -b /usr/local/pgsql/9.5/bin -B /usr/pgsql-11/bin/ -d /data/pgsql/data_159 -D /data/pgsql/11/data/ -p 5432 -P 5433

启动新版的postgres数据库
/usr/pgsql-11/bin/pg_ctl -D /data/pgsql/11/data start

 

  

参考:https://cloud.tencent.com/developer/article/1506934

posted @ 2019-12-06 19:52  也曾少年  阅读(893)  评论(0编辑  收藏  举报