- Newest
- Most votes
- Most comments
When migrating from a Patroni-managed PostgreSQL cluster to AWS, there are some specific considerations to keep in mind. While the general guidelines for PostgreSQL migration to AWS are still applicable, the Patroni setup introduces some unique challenges.
Patroni is an open-source tool that manages high availability for PostgreSQL clusters, which means it controls certain aspects of your database configuration. This can indeed make it challenging to directly apply some of the recommended parameter changes for AWS Database Migration Service (DMS).
Here are some recommendations for your migration:
-
Assessment: Before starting the migration, thoroughly assess your current Patroni-managed PostgreSQL environment. This includes analyzing the database size, workload characteristics, and performance metrics.
-
Patroni Configuration: Review your Patroni configuration carefully. You may need to temporarily adjust some Patroni settings to allow for the necessary changes required by AWS DMS.
-
Replication Slots: Ensure that Patroni's configuration allows for the creation of replication slots, which are crucial for AWS DMS change data capture (CDC).
-
Parameter Modifications: While you may not be able to directly modify all parameters as recommended in the AWS documentation, work with your database administrators to find equivalent settings that can be applied within the Patroni framework.
-
Patroni API: Utilize Patroni's REST API to make necessary changes to the cluster configuration if direct modifications to postgresql.conf are not possible.
-
Testing: Perform thorough testing of the migration process in a non-production environment that mimics your Patroni setup as closely as possible.
-
Failover Considerations: Plan for how to handle potential failovers during the migration process, as Patroni manages this automatically in your current setup.
-
Migration Project Setup: When setting up your migration project in AWS DMS, ensure you're connecting to the current primary node of your Patroni cluster.
-
Monitoring: Implement robust monitoring during the migration process, paying special attention to replication lag and any Patroni-specific metrics.
-
Cutover Planning: Develop a detailed cutover plan that accounts for the Patroni cluster's behavior during the final stages of migration.
Remember that migrating from a Patroni-managed cluster may require more manual intervention and careful planning compared to a standalone PostgreSQL instance. It's advisable to engage with AWS support or consider consulting services if you encounter specific challenges related to your Patroni setup during the migration process.
Sources
Assessing your database environment before migration - AWS Prescriptive Guidance
Patroni and etcd - AWS Prescriptive Guidance
Recommendations for migrating PostgreSQL databases are generally consistent across different platforms.
My recommendations is to use DMS.
https://docs.aws.amazon.com/dms/latest/sbs/dm-postgresql-step-by-step-migration.html
As long as the source database user has sufficient permissions to access tables (AWS DMS specifically migrates tables), the migration will proceed with a full load without additional configuration.
To optimize DMS, you might use DMS configurations such as parallel loading to speed up migration:
If you require ongoing replication (CDC - Change Data Capture), the PostgreSQL database must have either the test_decoding or pglogical extension installed and wal_level set to logical. These extensions enable AWS DMS to capture WAL (Write-Ahead Logging) statements. Without CDC, these configurations and parameters are not necessary.
Adjusting parameters is optional and typically recommended only if there is a need to manage database load during migration or to minimize replication lag for highly transactional databases.
Cutover should be performed once the replication lag approaches zero. Utilizing Route 53 for DNS cutover can significantly reduce downtime. Additionally, ensure the Time To Live (TTL) for DNS entries related to your applications is set to a low value to facilitate a swift and smooth transition.
Lastly, I recommend you use the data validation feature of DMS:
https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Validating.html
For more information: https://repost.aws/knowledge-center/dms-migrate-postgresql-to-postgresql
answered 2 years ago
Relevant content
asked 3 years ago
