[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-09-03 (世界標準時間)。"],[],[],null,["# About replicating from an external server\n\n\u003cbr /\u003e\n\n[MySQL](/sql/docs/mysql/replication/external-server \"View this page for the MySQL database engine\") \\| PostgreSQL \\| SQL Server\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nThis page describes a configuration that replicates\ndata from a source database server to PostgreSQL replicas. This\nconfiguration is sometimes referred to as an *external server* configuration.\n\nThe source database server can be any PostgreSQL server,\nincluding servers running on other Google Cloud services (such as Cloud SQL or\nCompute Engine) or on other cloud providers (such as Amazon RDS), if\nthey meet the requirements. For step-by-step instructions for setting up this\nconfiguration, see [Replicating from an external server](/sql/docs/postgres/replication/configure-replication-from-external).\n\nUse cases for external server configuration\n-------------------------------------------\n\nExternal server configuration helps you achieve the following goals:\n\n1. Migrate your data from your self-managed PostgreSQL server to Google Cloud\n with a minimum of downtime.\n\n2. Retain colocation and control of your server while off-loading the\n administration of the replicas to Cloud SQL.\n\n This use case is sometimes called a *hybrid cloud*. Replication between your\n self-managed server and the Cloud SQL replica continues\n indefinitely.\n\nExternal replication configuration\n----------------------------------\n\nExternal replication configuration includes the following instances:\n\n- The PostgreSQL server that you manage, also called the *source database server*.\n- The Cloud SQL replica.\n\n There can be multiple replicas for a single source database server.\n- The *source representation instance*.\n\n The source representation instance is a Cloud SQL instance that\n represents the source database server to the Cloud SQL replica. It is\n visible in the Google Cloud console and appears the same as a regular\n Cloud SQL instance, but it contains no data, requires no configuration\n or maintenance, and does not affect billing.\n\nThe following diagram shows these instances:\n\nSSL/TLS configuration\n---------------------\n\nReplicating from an external server requires that all changes to the data be\nsent between the source database server and the Cloud SQL replicas.\n\nIf the connection is made over a public network (by using IP allowlists),\nGoogle recommend using SSL/TLS encryption for the connection between the source\nand destination databases.\n\nCloud SQL offers the following options for SSL/TLS configuration:\n\n- None: the Cloud SQL destination instance connects to the source database without encryption.\n- [Server-only authentication](#server-only-authentication)\n\n\u003cbr /\u003e\n\n| **Note:** For information about creating certificates and keys for your external server, see [Secure TCP/IP Connections with SSL](https://www.postgresql.org/docs/current/static/ssl-tcp.html).\n\n### Server-only authentication\n\nWhen the replica connects to the primary instance, the replica authenticates the\nprimary instance. This helps make sure the replica connects to the correct host\nand helps prevent on-path attacks. The primary instance doesn't authenticate\nthe replica.\n\nTo use server-only authentication, at replica creation time, provide the\nx509 PEM-encoded certificate of the certificate authority (CA) that signed the\nexternal server's certificate. The CA must contain only a single certificate,\nand it must be self signed. In other words, the Certificate Authority that\nsigned the server's certificate must be a root CA.\n\n### External server SSL expiration notification\n\nIf the external server's server CA certificate is expiring, then\n[rotate the SSL certificates](/sql/docs/postgres/manage-ssl-instance),\nincluding the server CA certificate on the on-premises instance.\n\nFor more information, see\n[Manage SSL/TLS certificates](/sql/docs/postgres/manage-ssl-instance).\n\nMultiple replicas from the same database server\n-----------------------------------------------\n\nYou can create multiple replicas from the same source database server. You might\nwant to provide more bandwidth or create replicas in different regions.\n\nIf you're creating multiple replicas in the same region, they can all use\nthe same source representation instance or different ones. If you use the\nGoogle Cloud console to create multiple replicas, they will have different\nsource representation instances.\n\nIf you're creating multiple replicas in different regions, they must have\ndifferent source representation instances.\n\nYou cannot create more than one replica in the same operation. As soon as you\nfinish creating the replica configuration for the first replica,\nyou can start [creating the replica configuration](/sql/docs/postgres/replication/configure-replication-from-external#setup-replica-instance) for the other\nreplicas. You don't need to wait until the first replica is completely\nfunctional before starting to create other replicas.\n\nCascading replicas for an external server\n-----------------------------------------\n\n[Cascading read replicas](/sql/docs/postgres/replication#cascading-replicas)\nlet you create a read replica under another read replica\nin the same or different region. You can add up to four levels of cascading replicas, including\nthe primary instance. When you promote the replica at the top of a cascading replica\nhierarchy, it becomes the primary instance and its cascading replicas continue to replicate.\n\nWith external servers, you can create read replicas under an external server replica\nafter migrating your data, but before promoting the external server replica to\nprimary. This lets you test read replica topologies before the external server\nreplica is promoted.\n| **Note:** You can't directly promote a cascading read replica that's a replica of an external server replica. First, promote the external server replica. Then, you can promote the replica of the promoted external server replica."]]