pg_upgrade 版本升级

本文详细介绍了如何使用pg_upgrade工具进行PostgreSQL的大版本升级,强调了小版本可以直接替换二进制文件而大版本需要通过导出与导入。pg_upgrade允许在不进行数据dump/reload的情况下升级数据,但要求内部存储格式不变。升级过程包括检查集群兼容性、初始化新数据库、修改配置、停用老库、执行pg_upgrade以及后续处理。在升级中需要注意数据完整性、兼容性检查以及符号链接的处理。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

--对于小版本的升级,内部存储格式是兼容的,大版本不一定兼容
--小版本可以直接替换二进制文件,大版本需要导出与导入升级
Minor releases never change the internal storage format and are always compatible with earlier and later minor releases of the same major version number, e.g., 8.4.2 is compatible with 8.4,8.4.1 and 8.4.6. 
To update between compatible versions, you simply replace the executables while the server is down and restart the server. The data directory remains unchanged — minor upgrades are that simple.
For major releases of PostgreSQL, the internal data storage format is subject to change, thus complicating upgrades. The traditional method for moving data to a new major version is to dump and reload the
database, though this can be slow. A faster method is pg_upgrade. Replication methods are also available, as discussed below.

--在使用pg_dumpall进行长级时,注意要保持数据的完整性
If making a backup, make sure that your database is not being updated. This does not affect the integrity of the backup, but the changed data would of course not be included. 
If necessary, edit the permissions in the file pg_hba.conf (or equivalent) to disallow access from everyone except you



--pg_upgrade用于大版本的升级,但对于小版本的升级不起作用
pg_upgrade allows data stored in PostgreSQL data files to be upgraded to a later PostgreSQL major version without the data dump/reload typically req
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值