Stay organized with collections Save and categorize content based on your preferences.
Replication is the ability to create copies of a Cloud SQL instance and offload work to the copies.
Important: Before using this feature, review the limitations. Additionally, note that this feature only applies to the following versions of Cloud SQL for SQL Server: SQL Server 2017 Enterprise, SQL Server 2019 Enterprise, and SQL Server 2022 Enterprise. IntroductionThe primary reason for using replication is to scale the use of data in a database without degrading performance.
Note: Although this page is primarily concerned with specific read replica scenarios, you can set up replication from external databases (external to Cloud SQL) to Cloud SQL. For example, see Migrating data from SQL Server 2017 to Cloud SQL for SQL Server using snapshot replication.Other reasons for replication include migrating data between regions.
Additionally, if an original instance is corrupted, a replica could be promoted to a standalone instance (in which case, existing replicas wouldn't consider that instance as primary).
Note: This page applies to replicas of a Cloud SQL instance. To set up a Cloud SQL instance to act as a publisher to an external subscriber, see Configure external replicas.When referring to a Cloud SQL instance, the instance that is replicated is called the primary instance and the copies are called read replicas. The primary instance and read replicas all reside in Cloud SQL.
Note: SQL Server replication is implemented using SQL Server Read Scale Availability Groups.When the first replica is created:
A temporary disk is created, and a full backup is taken and stored on the temporary disk. The temporary disk is deleted after the replica creation process is complete.
Note: Normal storage billing rates apply to the temporary disk.If, in the time period of the first replica creation, the user switches to the simple recovery model, then the replica creation fails.
The following apply to databases added to the primary instance after the replicas are created:
Cloud SQL supports the following types of replicas:
By using connector enforcement, you can enforce using only the Cloud SQL Auth Proxy or Cloud SQL Language Connectors to connect to Cloud SQL instances. With connector enforcement, Cloud SQL rejects direct connections to the database. You can't create read replicas for an instance that has connector enforcement enabled. Similarly, if an instance has read replicas, then you can't enable connector enforcement for the instance.
This limitation doesn't apply to the instances that have private service access configured.Cloud SQL doesn't support replication between two external servers.
Read replicasYou use a read replica to offload work from a Cloud SQL instance. The read replica is an exact copy of the primary instance. Data and other changes on the primary instance are updated in almost real time on the read replica.
Read replicas are read-only; you cannot write to them. The read replica processes queries, read requests, and analytics traffic, thus reducing the load on the primary instance. You can have up to 8 read replicas per primary instance.
You connect to a replica directly using its connection name and IP address. If you're connecting to a replica using a private IP address, you don't need to create an additional VPC private connection for the replica because the connection is inherited from the primary instance.
For information about how to create a read replica, see Creating read replicas. For information about managing a read replica, see Managing read replicas.
Note: Read replicas don't provide failover capability. To provide failover capability for an instance, see Configuring an instance for high availability.As a best practice, put read replicas in a different zone than the primary instance when you use HA on your primary instance. This practice ensures that read replicas continue to operate when the zone that contains the primary instance has an outage. See the Overview of high availability for more information.
Selecting an appropriate machine typeRead replicas can have a different number of vCPUs and memory from that of the primary. You should monitor metrics on your instance such as CPU and memory usage to ensure that the replica instance is sized correctly for its workload, especially if it is smaller than the primary instance. A replica instance that is undersized is more prone to poor performance, such as frequent out-of-memory (OOM) events.
Storage capacity on read replicasWhen a primary instance is resized, all of its read replicas are resized, if needed, so that they have at least as much storage capacity as the updated primary instance.
Cross-region read replicasCross-region replication lets you create a read replica in a different region from the primary instance. You create a cross-region read replica the same way as you create an in-region replica.
In the case of SQL Server read replicas, it is assumed that the replica is in the same virtual network as the primary replica, or that they communicate using Public IP.
Cross-region replicas:
See Promoting replicas for regional migration or disaster recovery for more information about cross-region replicas.
Cascading read replicas Note: This feature is available with Cloud SQL Enterprise Plus edition only. For more information about Cloud SQL editions, see Introduction to Cloud SQL editions.Cascading replication lets you create a read replica under another read replica in the same or a different region. Cascading replicas are implemented using distributed availability groups. Some use cases for cascading replicas are as follows:
Cascading replicas let you add read replicas to any existing replicas. You can add up to four levels of replicas, including the primary instance. When you promote the replica at the top of a cascading replica hierarchy, it becomes a primary instance and its cascading replicas continue to replicate.
For more information on configuring distributed availability groups, see Configure an Always On distributed availability group.
RestrictionsThe following use cases apply for each type of replication.
Billinggcloud
command, and the deletion automatically propagates to the replicas. You cannot delete a replicated SQL Server database using T-SQL commands. Failover A primary instance can failover to a replica only if the replica is a DR replica. Read replicas are unable to failover in any way during an outage. Load balancing Cloud SQL does not provide load balancing between replicas. Maintenance windows Read replicas share maintenance windows with the primary instance. The replicas follow the maintenance settings for the primary instance, including the maintenance window, rescheduling, and the deny maintenance period. During maintenance, Cloud SQL updates all read replicas first before updating the primary instance. Multiple read replicas You can create up to 8 read replicas for a single primary instance. Private IP If you're connecting to a replica using a private IP address, you don't need to create an additional VPC private connection for the replica, as it is inherited from the primary instance. Restoring the primary instance You cannot restore the primary instance of a replica while the replica exists. Before restoring an instance from a backup, or performing a point-in-time recovery on it, you must promote or delete all of its replicas. Settings The settings of the primary instance are propagated to the replica, including changes to the data about users who can access the instance. Stopping a replica You cannot stop
a replica. You can restart
or delete
it, but you cannot stop it as you can a primary instance. Upgrading a replica Read replicas can experience a disruptive upgrade at any time. User tables You cannot make changes on the replica. All user changes must be done on the primary instance. Limitations
This feature only applies to the following versions of Cloud SQL for SQL Server:
Logins aren't propagated to a replica.
You must monitor your replica using T-SQL and/or SQL Server Management Studio.
Before deleting a database, you must close your database connections.
When you create a replica, the primary instance can contain no databases in single-user mode. Otherwise, replica creation fails.
Replication can't be configured on an instance configured with external replication.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-13 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-13 UTC."],[],[]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4