将 AWS RDS Postgresql 复制到本地 Postgresql
Replication of AWS RDS Postgresql into On-Premise Postgresql
我需要将数据从 AWS RDS Postgres(9.6) 数据库复制到本地 Postgres(9.5) 数据库。我发现了有关从内部部署到内部部署的复制的内容。但是我们如何将 AWS RDS 实施到本地?
Beginning with PostgreSQL version 9.4, PostgreSQL supports the
streaming of WAL changes using logical replication slots. Amazon RDS
supports logical replication for a PostgreSQL DB instance version
9.4.9 and higher and 9.5.4 and higher. Using logical replication, you can set up logical replication slots on your instance and stream
database changes through these slots to a client like pg_recvlogical.
Logical slots are created at the database level and support
replication connections to a single database.
注意可能出现的问题 例如https://dba.stackexchange.com/questions/173267/aws-rds-postgres-logical-replication
我用 Bucardo 做这个。
看看这个:https://bucardo.org/Bucardo/
使用 Bucardo,您可以将 RDS postgres 实例复制到某处存在的从属 postgres,仅配置从属,因此无需配置 RDS 内容。
您也可以在零停机时间的情况下完成此操作。
无论如何,我不确定这是否适用于不同版本的 Postgresql。如果可能,您应该使用相同的版本。我用 9.4.x 测试了它,它正在工作。
更新
我可以确认这也适用于使用不同版本的 Postgres,例如我能够使用这些版本进行复制:
- AWS RDS postgresql 9.4.x
- 本地 postgresql 9.6.x
我需要将数据从 AWS RDS Postgres(9.6) 数据库复制到本地 Postgres(9.5) 数据库。我发现了有关从内部部署到内部部署的复制的内容。但是我们如何将 AWS RDS 实施到本地?
Beginning with PostgreSQL version 9.4, PostgreSQL supports the streaming of WAL changes using logical replication slots. Amazon RDS supports logical replication for a PostgreSQL DB instance version 9.4.9 and higher and 9.5.4 and higher. Using logical replication, you can set up logical replication slots on your instance and stream database changes through these slots to a client like pg_recvlogical. Logical slots are created at the database level and support replication connections to a single database.
注意可能出现的问题 例如https://dba.stackexchange.com/questions/173267/aws-rds-postgres-logical-replication
我用 Bucardo 做这个。 看看这个:https://bucardo.org/Bucardo/
使用 Bucardo,您可以将 RDS postgres 实例复制到某处存在的从属 postgres,仅配置从属,因此无需配置 RDS 内容。 您也可以在零停机时间的情况下完成此操作。
无论如何,我不确定这是否适用于不同版本的 Postgresql。如果可能,您应该使用相同的版本。我用 9.4.x 测试了它,它正在工作。
更新
我可以确认这也适用于使用不同版本的 Postgres,例如我能够使用这些版本进行复制:
- AWS RDS postgresql 9.4.x
- 本地 postgresql 9.6.x