简体   繁体   English

Postgresql 的 GCP CloudSQL 只读副本使用的复制方法是什么

[英]What is the replication method used for the GCP CloudSQL Read Replica for Postgresql

Based on the descriptions it seems that for the Read Replicas for Postgresql, the Write-Ahead Log Shipping is used.根据描述,Postgresql 的只读副本似乎使用了预写日志传送 Is it logical?合乎逻辑吗? I have tables without primary keys, however when I spin up a read replica I have no problems so wonder what is being used behind the scenes.我有没有主键的表,但是当我启动一个只读副本时我没有任何问题所以想知道在幕后使用了什么。

Cloud SQL "native" Postgres replicas (eg, those you create via Cloud Console/gcloud/API ) uses Postgres' built-in streaming physical replication which involves WAL segment shipping from primary to replica(s). Cloud SQL “原生”Postgres 副本(例如,您通过Cloud Console/gcloud/API创建的副本)使用 Postgres 的内置流式物理复制,这涉及从主副本到副本的 WAL 段传送。

The needing primary keys is a constraint that exists in logical replication using an extension like pg_logical .需要主键是一个约束,它存在于使用pg_logical等扩展的逻辑复制中。 You can configure your own replication relationships using pg_logical (as well as postgres' own built in logical decoding on versions that support it) in Cloud SQL but this isn't the same as native replication offering which is fully managed by Google.您可以在 Cloud SQL 中使用pg_logical (以及支持它的 postgres 自己的内置逻辑解码版本)配置自己的复制关系,但这与完全由 Google 管理的本机复制产品不同。

But to answer your question directly: Cloud SQL's native read replicas, like the one you referred, uses WAL shipping (physical/streaming replication) as you suspect.但直接回答您的问题:正如您所怀疑的那样,Cloud SQL 的本机只读副本,就像您提到的那样,使用 WAL 运输(物理/流式复制)。 Which is why your tables replicate just fine without primary keys.这就是为什么您的表在没有主键的情况下复制得很好。

SELECT * FROM pg_replication_slots;

will show you the type of replication.将向您显示复制类型。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM