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

pg_upgradecluster taking too much time(around 8 hours for 165GB database) any workarounds?

我正在尝试将 postgres-9.3 升级到 postgres-10,数据库大小约为 165GB。我正在使用 "sudo pg_upgradecluster 9.3 main" 这样做,但它需要大约 8 小时,这对于我的实时网络应用程序来说停机时间太多了。有什么建议可以减少停机时间并提高速度。

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

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.