postgresql - pg_upgradecluster 花费太多时间(165GB 数据库大约需要 8 小时)有什么解决方法吗?

标签 postgresql postgresql-9.3 postgresql-10 pg-upgrade

我正在尝试将 postgres-9.3 升级到 postgres-10,数据库大小约为 165GB。我正在使用“sudo pg_upgradecluster 9.3 main”来执行此操作,但它需要大约 8 小时,这对于我的实时 Web 应用程序来说停机时间太多了。有什么建议可以通过减少停机时间和加快速度使其变得更好。

最佳答案

你可以告诉pg_upgradecluster将 Postgres 的 pg_upgrade 工具与 --link 选项一起使用,然后应该在几分钟而不是几小时内完成:

pg_upgradecluster --method=upgrade --link ......

请注意 --link 不会复制您的数据,因此恢复升级的唯一方法是将上次备份恢复到 9.3 安装。

Quote from the Postgres manual

If you use link mode, the upgrade will be much faster (no file copying) and use less disk space, but you will not be able to access your old cluster once you start the new cluster after the upgrade.

...

If you want to use link mode and you do not want your old cluster to be modified when the new cluster is started, make a copy of the old cluster and upgrade that in link mode. To make a valid copy of the old cluster, use rsync to create a dirty copy of the old cluster while the server is running, then shut down the old server and run rsync --checksum again to update the copy with any changes to make it consistent.

关于postgresql - pg_upgradecluster 花费太多时间(165GB 数据库大约需要 8 小时)有什么解决方法吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56801383/

相关文章:

function - 如何在 PostgreSQL 中使用函数插入多行

sql - 带有忽略条件的 case 语句 postgres 9.3

sql - 慢计数postgresql

postgresql - PostgreSQL 中的时区转换不一致

postgresql - 选择带有别名表的不同列在 postgres 中不起作用

postgresql - 如何知道 Postgresql 服务器在什么操作系统/平台上运行?

postgresql - 液基数据库/PostgreSQL : how to preserve table case correctly?

postgresql - 计算大表中的未读新闻

node.js - SequelizeConnectionError : FATAL: remaining connection slots are reserved for non-replication superuser connections

sql - PostgreSQL 选择通过多对多数据透视连接的表的多个列