[英]Upgrade bitnami postgresql image k8s
I was trying to upgrade from bitnami pg image 11 -> version 14. When trying to do so i was prompted with the following error:我试图从 bitnami pg image 11 -> 版本 14 升级。尝试这样做时,我收到以下错误提示:
The data directory was initialized by PostgreSQL version 11, which is not compatible with this version 14.0
In order to get around this, I created a new postgres deployment with a new PVC, used pgdump to take a backup of the data and imported it within the new postgres deployment which is running version 14.为了解决这个问题,我使用新的 PVC 创建了一个新的 postgres 部署,使用 pgdump 备份数据并将其导入到运行版本 14 的新 postgres 部署中。
However I'm going to need to repeat this process on larger databases which terabytes of data and don't think pgdump is going to be sufficient.但是,我将需要在具有 TB 级数据的大型数据库上重复此过程,并且不认为 pgdump 就足够了。
With the bitnami image is it possible to use the likes of pg_upgrade?使用 bitnami 图像是否可以使用 pg_upgrade 之类的东西?
Yeah, backup and restoring the way you did is always a good option with new PVC and PV .是的,使用新的PVC和PV备份和恢复您所做的方式始终是一个不错的选择。
Pg_dump & Pg_restore is a robust native option i think you can use the -j
to start the multiple threads to migrate the data. Pg_dump & Pg_restore 是一个强大的本机选项,我认为您可以使用
-j
启动多个线程来迁移数据。
To migrate the TB of data you might need good Network bandwidth and a scalable solution.要迁移 TB 的数据,您可能需要良好的网络带宽和可扩展的解决方案。
Not sure how you are running this instances or replicas.不确定您如何运行此实例或副本。
You can do something like :您可以执行以下操作:
Create new helm release of Postgres while the old one running在旧版本运行时创建Postgres的新helm 版本
Migrate the data迁移数据
kubectl exec -it new-helm-db-postgresql-0 -- bash -c 'export PGPASSWORD=${POSTGRES_PASSWORD}; time pg_dump -h old-postgresql -U postgres | psql -U postgres'
As suggested above you can add the -j
also to start multi threads however it will increase the resources of POD and Disk usage if migrating TB of data.如上所述,您也可以添加
-j
来启动多线程,但是如果迁移 TB 数据,它将增加 POD 资源和磁盘使用量。
You can also refer : https://www.citusdata.com/blog/2021/02/20/faster-data-migrations-in-postgres/您也可以参考: https ://www.citusdata.com/blog/2021/02/20/faster-data-migrations-in-postgres/
i would like to suggest using the DMS AWS if you are on the managed cloud.如果您在托管云上,我想建议您使用DMS AWS 。
Or else setting up one VM with Migration Tool and migrating data to old postgres cluster to new.或者使用迁移工具设置一个虚拟机并将数据迁移到旧的 postgres 集群到新的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.