Asynchronous Cross-Region Raft Replication
Asynchronous cross-region Raft replication enables Oracle Globally Distributed AI Database to replicate data from a read-write Raft cluster to read-only Raft clusters in other regions. In this Multi-Raft Cluster deployment, the database uses built-in Raft replication between clusters. Cross-region replication is unidirectional and requires no separate replication software. This deployment supports disaster recovery and lets applications serve read-only workloads closer to their users.
Within each Raft cluster, native Raft replication provides local high availability. Transactions commit in the read-write cluster when the local Raft quorum requirement is met, without waiting for acknowledgment from remote read-only clusters. Replicated changes become available for queries after they are applied in the read-only clusters, so query results can lag behind committed changes in the read-write cluster.
This chapter explains the replication model, deployment planning, configuration, and ongoing management. The configuration example uses automated data distribution with Raft replication and includes one read-write Raft cluster and one read-only Raft cluster. In this GDSCTL example, the Raft clusters are configured as shardgroups using system-managed sharding. For background on local Raft replication, see Using Raft Replication in Oracle Globally Distributed AI Database .
Benefits and use cases
By placing copies of the data in different regions, cross-region Raft replication supports the following uses:
- Disaster recovery:If the region hosting the read-write Raft cluster becomes unavailable, an administrator must initiate failover to another region. Within a Raft cluster, RU leader failover is automatic when a quorum remains. Because cross-region replication is asynchronous, transactions that have not reached the recovery region can be lost.
- Local read access:Read-only applications can query a read-only Raft cluster in a nearby region instead of sending every request to the writer region. Queries against a read-only Raft cluster can return data that does not yet include recent commits in the writer region.
- Planned workload relocation. When both regions are available, you can move the write workload to another region for planned maintenance or regional capacity changes.
How Cross-Region Raft Replication Works
A Multi-Raft Cluster topology contains a read-write Raft cluster and one or more read-only Raft clusters. Each Raft cluster contains nodes (databases). Data is organized into replication units (RUs), each containing a set of chunks with the same replication topology. A Raft group consists of the leader and followers for one RU.
In this configuration:
- Within the read-write Raft cluster: Each read-write RU leader replicates changes to its followers. Transactions commit when the local Raft quorum requirement is met.
- Between Raft clusters: Changes are sent asynchronously to the corresponding RU leaders in the read-only clusters. Transactions in the read-write cluster commit without waiting for acknowledgment from a remote cluster.
- Within the read-only Raft clusters: Replicated changes are applied and made available to queries. Query results can lag behind recent commits in the read-write cluster.

The following section explains application access, availability, and recovery for this configuration.
Replication in a Multi-Raft Cluster Deployment
In this configuration, one read-write Raft cluster accepts application writes for the replicated data. It contains the read-write copies of all replication units (RUs), while read-only Raft clusters in other regions maintain corresponding copies of the data.
This configuration uses a Multi-Raft Cluster topology. Replication from the read-write Raft cluster to a read-only Raft cluster is asynchronous and unidirectional. The read-only Raft clusters continue to receive and apply changes and can serve read-only workloads. A read-only RU leader manages replication for that RU but does not accept application writes. Use this configuration when applications can direct updates to one region while distributing read workloads across other regions.
Consider the following when planning this deployment:
- Application writes: One read-write Raft cluster accepts DML for all replication units (RUs). The read-write service routes requests to eligible read-write RU leaders.
- Replication and read access: Use read-only services for workloads that tolerate replication delay, such as reporting. Direct requests that must reflect recent commits to the read-write service.
- Conflict handling: During normal operation, one writer per RU prevents conflicts from concurrent application updates to the same data in different regions.
- Local availability: Raft replication protects against supported failures while the RU’s Raft group retains a quorum. Choose each cluster’s replication factor for its local availability requirements. Local recovery is separate from transferring write ownership between regions.
- Regional recovery: A planned switchover transfers write ownership while both regions are available. If the read-write cluster becomes unavailable, an administrator initiates failover; transactions that have not reached the recovery destination can be lost. After either transition, verify service routing and application connections before resuming writes. See Switch a Shardgroup Between Read-Write and Read-Only Modes and Failover to Another Region.
- Resource requirements: Size each read-only Raft cluster to store replicated data, apply changes, and serve queries. Provide sufficient network bandwidth and retain enough Raft logs for expected interruptions and catch-up periods.
Automated data distribution uses consistent hashing to distribute data across the nodes in each Raft cluster.
Plan a Cross-Region Deployment
Before configuring cross-region replication, decide where applications will write data, where read-only Raft clusters are needed, and how those copies will support read access and recovery. These decisions guide the placement of shardgroups, their resource requirements, and the services applications use to connect.
The following planning and configuration procedures use automated data distribution with one read-write Raft cluster and remote read-only Raft clusters. The read-write cluster contains the writable copies of all replication units (RUs).
Topology Requirements
Start by identifying the writer region and the regions that will contain read-only copies. Then determine the shardgroups, shard counts, and replication factors needed to support the workloads in those locations.
Plan the topology around the following requirements:
- Use system-managed sharding with native Raft replication.
- Maintain the same chunks and chunk-to-RU mapping in the replicated shardgroups.
- Configure one read-write Raft cluster and the remote read-only Raft clusters.
- Size each shardgroup for its application workload, data storage, and replication processing.
- Ensure that the shard directors can reach the primary shard catalog and its standby databases.
Shardgroups can have different shard counts and replication factors. Choose these settings according to the workload and local availability requirements of each shardgroup. A read-only shardgroup can use replication factor 1 when those requirements permit a single replica of each RU within that shardgroup.
Plan shard catalog availability separately. Raft replication protects the replicated shard data but does not provide high availability for the catalog database. See Creating a Shard Catalog Standby.
For host, software, and general connectivity requirements, see Planning Your Deployment.
See Raft Replication Restrictions for restrictions that apply to Raft replication generally.
Network and Log-Retention Planning
After identifying the shardgroup locations and workloads, plan the network connections that will carry replicated changes between regions. Provide enough bandwidth for the expected volume of changes, and account for periods of increased activity, network latency, and reduced bandwidth.
Network capacity and Raft log retention must be planned together. A read-only Raft cluster that falls behind needs access to retained log records to receive the missing changes. Retain enough logs to accommodate the interruptions and catch-up periods expected for the deployment.
If the required log records are no longer available, the affected shardgroup requires synchronization from an available copy. Include the time and resources needed for this operation in the recovery plan. For background on replication unit synchronization, see Raft Replication Operations and Settings.
Application and Recovery Planning
Replication delay affects which workloads can use the read-only Raft clusters. Identify the application requests that must use the read-write service and the read-only workloads that can tolerate a delay before recent changes become visible.
Plan application access during both normal operation and recovery. In particular, determine how applications reconnect and how services route requests when write ownership moves to another shardgroup.
Use these requirements to define the recovery objectives and procedures:
- Recovery destination: Identify the candidate regions and the criteria for selecting a new writer.
- Recovery time objective (RTO): Determine the maximum acceptable time to restore application access after a failure. Account for the time needed to designate a new writer and restore application connections.
- Recovery point objective (RPO): Determine the maximum acceptable period of data loss after a failure. Account for transactions committed in the failed region that had not reached the selected recovery destination.
- Return to service: Define how to reconcile the failed region with the current writer and verify replication before returning it to application use.
Record these decisions before configuring the shard catalog. They establish the topology, capacity, and application access requirements used in the following configuration procedure.
Configure asynchronous cross-region Raft replication
After selecting the topology and defining your recovery objectives, configure the Raft clusters that will provide cross-region replication. In this deployment, applications write to one read-write Raft cluster while a remote read-only Raft cluster receives and applies changes asynchronously. The read-only Raft cluster provides read-only access and a recovery destination if the region hosting the read-write cluster becomes unavailable.
The following example establishes this configuration between the east and west regions. Using GDSCTL, you create the topology metadata in the shard catalog, add the shard directors and shardgroups, register the shard databases, and deploy replication. You then configure application services and verify the intended read-write and read-only access.
Example topology
The example uses the following components. These names are referenced throughout the configuration commands.
| Component | Read-write region | Read-only region |
|---|---|---|
| Component | Read-write region | Read-only region |
| Region | east |
west |
| Shardgroup | dbs1 |
dbs2 |
| Shard director | gsm_east |
gsm_west |
| Shard CDBs | rw_cdb1, rw_cdb2, rw_cdb3 |
ro_cdb1, ro_cdb2, ro_cdb3 |
| Application access | Read-write | Read-only |
Before you begin
Before registering this topology, complete the host and database preparations:
- Provision the shard catalog, shard director hosts, and shard database hosts.
- Install the Oracle Database and shard director software.
- Create and configure the catalog and shard databases.Follow Create the Shard Catalog Database and Create the Shard Databases for the required settings.
- Configure the required accounts, privileges, listeners, and Oracle Net connect identifiers.Prepare
gsm_adminas the catalog administrator withGSMADMIN_ROLE, unlockGSMCATUSERin the catalog PDB, and prepareGSMROOTUSERin each shard CDB root andGSMUSERin each shard PDB with the required privileges. - Verify host name resolution and network connectivity between regions.
- Prepare the catalog high-availability configuration.Include the primary and standby catalog addresses in the catalog connect descriptor so that the shard directors can reach the catalog after a catalog role change. See Creating a Shard Catalog Standby.
- Select system-managed sharding and native Raft replication for the catalog configuration.
- Validate each shard PDB and resolve reported errors before registration. See Validate the Shard Database.
See Oracle Globally Distributed AI Database Deployment for the preparation procedures.
Run GDSCTL from a shard director host. When continuing on another host, connect to the catalog as gsm_admin before running administrative commands. After the catalog has been created, use the following command; enter the password when prompted. See CONNECT.
GDSCTL> connect gsm_admin@catalog_connect_string
Create the Shard Catalog
Begin by creating the topology metadata in the prepared shard catalog PDB. This metadata identifies the data distribution method, replication technology, and regions used by the distributed database. The shard directors use the catalog to manage the configuration.
The following example creates a system-managed configuration with native Raft replication and two regions, east and west. Set catalog_connect_string to the service for the catalog PDB, and use the gsm_admin account prepared in the prerequisites. GDSCTL prompts for the account password.
GDSCTL> create shardcatalog -database catalog_connect_string \
-user gsm_admin -sharding system -repl native \
-region east,west
After the catalog is created, register the shard directors that will manage the configuration in each region.
See CREATE SHARDCATALOG and Enabling Raft Replication.
Add and Start the Shard Directors
With the catalog and regions defined, add a shard director in each region. Shard directors monitor the distributed database, coordinate management operations, and provide connection routing for global services.
Run each ADD GSM and START GSM pair on the host where that director will run. When starting a GDSCTL session on another host, connect to the shard catalog before continuing with administrative commands.
On the east-region shard director host, register and start gsm_east:
GDSCTL> add gsm -gsm gsm_east -catalog catalog_connect_string -region east
GDSCTL> start gsm -gsm gsm_east
On the west-region shard director host, register and start gsm_west:
GDSCTL> add gsm -gsm gsm_west -catalog catalog_connect_string -region west
GDSCTL> start gsm -gsm gsm_west
Each ADD GSM command prompts for the catalog PDB’s GSMCATUSER password. The director uses this account to access the catalog.
These examples use the default listener and Oracle Notification Service (ONS) ports. If your deployment uses different ports, specify them when adding the director and ensure that the required network connections are available.
See ADD GSM.
Add the Shardgroups
The shard directors are now registered with the catalog. Next, define the shardgroups that will contain the shard databases and assign each group to its region.
The following commands create dbs1 in east for application writes and dbs2 in west for read-only access to replicated data:
GDSCTL> add shardgroup -shardgroup dbs1 -region east -ru_mode readwrite
GDSCTL> add shardgroup -shardgroup dbs2 -region west -ru_mode readonly
A read-only RU still has a leader that receives and applies replicated changes. Its read-only mode controls application write access.
Use CONFIG and CONFIG SHARDGROUP to review the registered regions and shardgroups before adding the databases. Confirm that dbs1 belongs to east and dbs2 belongs to west.
The shardgroups define the logical organization of the deployment. The next step assigns the prepared databases to these groups.
Register the CDBs and Shards
Register the databases in two stages. First, register the container databases (CDBs) that host the shard PDBs. Then register each PDB as a shard and assign it to the appropriate shardgroup.
This example uses three shard CDBs in each region. Replace the connect identifiers and database names with those prepared for your deployment.
Register the CDBs
Use ADD CDB to register each CDB with the catalog. The rw_root_* and ro_root_* connect identifiers must resolve to the corresponding CDB roots.
GDSCTL> add cdb -connect rw_root_1
GDSCTL> add cdb -connect rw_root_2
GDSCTL> add cdb -connect rw_root_3
GDSCTL> add cdb -connect ro_root_1
GDSCTL> add cdb -connect ro_root_2
GDSCTL> add cdb -connect ro_root_3
For each command, GDSCTL prompts for the GSMROOTUSER password. It retrieves the CDB’s DB_UNIQUE_NAME, which becomes the registered CDB name used by subsequent ADD SHARD commands.
Run the following command to review the registered CDBs:
GDSCTL> config cdb
Confirm that the registered names match those used in the following examples, or substitute their actual values.
See ADD CDB.
Register the Shard PDBs
With the CDBs registered, add the PDBs that will store the distributed data. The rw_pdb_* and ro_pdb_* connect identifiers must resolve directly to the corresponding shard PDBs.
The following commands assign the three east-region shard PDBs to the read-write shardgroup, dbs1, and the three west-region shard PDBs to the read-only shardgroup, dbs2:
GDSCTL> add shard -cdb rw_cdb1 -connect rw_pdb_1 -shardgroup dbs1
GDSCTL> add shard -cdb rw_cdb2 -connect rw_pdb_2 -shardgroup dbs1
GDSCTL> add shard -cdb rw_cdb3 -connect rw_pdb_3 -shardgroup dbs1
GDSCTL> add shard -cdb ro_cdb1 -connect ro_pdb_1 -shardgroup dbs2
GDSCTL> add shard -cdb ro_cdb2 -connect ro_pdb_2 -shardgroup dbs2
GDSCTL> add shard -cdb ro_cdb3 -connect ro_pdb_3 -shardgroup dbs2
GDSCTL prompts for the GSMUSER password when registering each shard.
Use CONFIG CDB and CONFIG SHARD to confirm that all six shard PDBs are registered under the correct CDBs and shardgroups.
See ADD SHARD.
With database registration complete, check host registration and data file capacity before deploying the configuration.
Check the Configuration Before Deployment
Before deploying the registered databases, verify that the shard directors can accept their registration requests and that the databases have sufficient data file capacity. These checks help identify configuration issues before replication is deployed.
Check Host Registration
Shard databases register with the shard director listeners during deployment. Valid node checking for registration (VNCR) controls which hosts can register.
Review the trusted host information in the catalog:
GDSCTL> config vncr
Confirm that the list includes the host names and IP addresses used by the shard databases to register with the directors. Pay particular attention to hosts with multiple network interfaces, because registration can use an address different from the one discovered during database registration.
Verify that the required host names resolve from the participating hosts. Add any required missing host names or IP addresses with ADD INVITEDNODE.
Follow the host metadata checks in Configure the Distributed Database Topology.
Check Data File and Storage Capacity
After checking host registration, verify the data file count, file growth settings, and available storage on each shard before running DEPLOY.
Check the data file count
Connect to each shard PDB in SQL*Plus with an account that can read the data dictionary views and initialization parameters. Run the following commands to check the current file count and the configured limit.
SELECT COUNT(*) AS current_data_files
FROM v$datafile;
SHOW PARAMETER db_files
Verify that DB_FILES can accommodate the existing data files and the additional files required by the deployment. Use the sizing calculation in Create the Shard Databases.
Check data file sizes and growth settings
In each shard PDB, run the following query to review the size and growth settings for each data file.
SELECT tablespace_name, file_name, bytes, autoextensible, maxbytes
FROM dba_data_files
ORDER BY tablespace_name, file_name;
BYTES shows the current file size. AUTOEXTENSIBLE indicates whether the file can grow automatically. For files with autoextend enabled, MAXBYTES shows the maximum size. See DBA_DATA_FILES.
Check available storage
In each shard PDB, use SHOW PARAMETER db_create_file_dest to identify where Oracle Managed Files creates data files. Check the available space at that destination.
- Oracle ASM. Connect to the ASM instance and run the following query. Review
USABLE_FILE_MBfor the destination disk group.
SELECT name, type, free_mb, usable_file_mb FROM v$asm_diskgroup_stat WHERE state = 'MOUNTED';
For FLEX and EXTEND disk groups, follow the capacity guidance for the disk group type. See Managing Capacity in Disk Groups.
- File system. On the shard host, check the available space on the volume that contains the destination directory. On Linux, run
df -h /path/to/datafiles, substituting the actual directory.
Compare the available space with the space required for new data files and expected file growth. Resolve any file-count or storage shortfall before running DEPLOY.
Deploy the Configuration
With the topology registered and the configuration checks complete, deploy the distributed database. Deployment applies the registered configuration to the shard databases and establishes the replication configuration.
Run the following commands:
GDSCTL> deploy
GDSCTL> config task
Review the DEPLOY result and any management tasks reported by CONFIG TASK. Background work can continue after a command returns, so check the reported tasks and resolve deployment errors before configuring application access.
When deployment completes successfully, verify that the registered shards are deployed in their intended shardgroups. You can then create the services that applications will use to connect to the read-write and read-only RUs.
See Deploy the Configuration and CONFIG TASK.
Create and Start Application Services
The deployed topology provides the replicated data. Global services determine which eligible destinations applications use to access that data.
The following examples create rwsrv for read-write requests and rosrv for read-only requests. Run the commands while connected to the catalog with pool administrator privileges. The examples assume that the session has access to one database pool.
Create the Read-Write Service
Create and start the service applications will use for writes:
GDSCTL> add service -service rwsrv -preferred_all -ru_mode readwrite
GDSCTL> start service -service rwsrv
In this configuration, applications use rwsrv to access the writable data in dbs1. For requests that include a sharding key, routing selects an eligible read-write RU leader for that key.
Create the Read-Only Service
Next, create and start the service for workloads that can use the read-only Raft clusters:
GDSCTL> add service -service rosrv -preferred_all -ru_mode readonly -failover_readwrite no
GDSCTL> start service -service rosrv
For sharding-key requests, routing selects an eligible read-only RU leader for the key.
The read-only service in this example does not fall back to a read-write RU if a matching read-only RU is unavailable. This keeps the example’s read-only workload directed to read-only RUs.
Applications using rosrv must tolerate asynchronous replication delay. A query through this service can return data that does not yet include a recent commit in the writer region.
See ADD SERVICE and START SERVICE for service administration options.
Verify the Configuration
After starting the services, verify both the replication configuration and application access. The first set of commands checks the distributed database, shardgroup assignments, deployed shards, and RU state:
GDSCTL> config sdb
GDSCTL> config shardgroup
GDSCTL> config shard
GDSCTL> status ru
Review the results before proceeding:
CONFIG SDBidentifies the replication type asNative.CONFIG SHARDGROUPidentifies the intended region and shardspace for each shardgroup.CONFIG SHARDshows all six shard PDBs deployed in their intended shardgroups, without unresolved management errors.STATUS RUshows the corresponding RUs in both shardgroups. Confirm the intended read-write and read-only states. A read-only RU leader reportsRead-only; this is its expected state.
Next, verify the service definitions and their running instances:
GDSCTL> config service -service rwsrv
GDSCTL> config service -service rosrv
GDSCTL> status service -gsm gsm_east
GDSCTL> status service -gsm gsm_west
Confirm that rwsrv is available on the intended read-write shards and rosrv on the intended read-only shards, with the required service instances reported as ready. Use the service network names returned by CONFIG SERVICE in application connection settings.
Before opening the deployment to application traffic, test connections through both services and verify that requests reach the intended shardgroups. If an application schema and data are already available, confirm that a change committed through the read-write service becomes visible through the read-only service after replication applies it.
These checks establish that the topology is deployed and the services provide the intended access. The following section explains which workloads can use the read-only Raft clusters.
See CONFIG SERVICE and STATUS SERVICE.
Use read-only Raft clusters
After verifying the deployment and services, assign application workloads to the appropriate service. Use a read-only service for queries that can tolerate replication delay. Use the read-write service when a read following a write requires the latest committed value.
Send application DML through the read-write service. After a switchover or failover, verify the application connection settings and service routing so that writes reach the new read-write Raft cluster.
A read-only Raft cluster is different from follower replicas within a Raft cluster. Configure each type of access by using its supported service and routing attributes.
Monitor cross-region replication
Use GDSCTL to identify the leader for a replication unit (RU) in each shardgroup and check the status of management operations. The following example uses RU 1. Replace 1 with the RU ID for the stream you want to monitor.
STATUS RU -ru 1
CONFIG TASK
In STATUS RU output, Read-only is the expected status for the RU leader in the read-only shardgroup. Use CONFIG TASK to check the progress of operations such as synchronization or mode changes.
Check sender progress
Connect to the shard PDB that hosts the RU leader in the read-write cluster. Review the sender row for the remote peer. Track the last log index sent and check for increases in connection errors. See V$SHARD_NETWORK_SENDER.
SELECT ru_id, shardgroup_id, remote_peer_id, state,
last_sent_lcr_log_index, connect_error_count
FROM v$shard_network_sender
WHERE ru_id = 1;
Check receive and apply progress
Connect to the shard PDB that hosts the corresponding RU leader in the read-only cluster. Use REMOTE_PEER_ID to identify the incoming cross-region stream and APPLY_NAME to find its apply coordinator. See V$SHARD_NETWORK_RECEIVER and V$SHARD_APPLY_COORDINATOR.
SELECT ru_id, shardgroup_id, remote_peer_id, apply_name, state,
last_received_log_index, last_received_lcr_time
FROM v$shard_network_receiver
WHERE ru_id = 1;
SELECT ru_id, shardgroup_id, apply_name, state,
lwm_lcr_log_index, total_applied, total_errors
FROM v$shard_apply_coordinator
WHERE ru_id = 1;
Run the queries at intervals while the source processes writes. If the receive position stops advancing, check the sender state and connection errors. If the receive position advances but the apply low watermark stays unchanged across samples, check the apply coordinator state and look for new apply errors.
Switch a shardgroup between read-write and read-only modes
Use the monitoring checks to prepare for a planned change in write ownership, such as before maintenance or workload relocation. A planned switch requires both the current writer and the target shardgroup to be available.
Before requesting the switch:
- Confirm that source and target RU leaders are available.
- Review
STATUS RUand resolve replication errors. - Prepare applications for the service transition.
- Confirm the intended target shardgroup and its current RU modes.
The SWITCHMODE command changes the current mode of the selected RUs. Switching a read-only RU to read-write first changes the current writer for that data to read-only, then changes the target to read-write. If -ru is omitted, the command switches all RUs in the target shardgroup, which must have a consistent current mode.
Choose one of the following scopes. These examples are alternatives, not consecutive steps.
To switch all RUs in dbs2:
GDSCTL> switchmode -shardgroup dbs2
Alternatively, to switch only RU 1 in dbs2:
GDSCTL> switchmode -ru 1 -shardgroup dbs2
After requesting the switch, monitor the generated tasks:
GDSCTL> config task
The planned transition drains the current workload and replication stream before the target accepts writes. After the tasks complete, verify the RU modes and application service routing. Check the current modes before retrying SWITCHMODE, because the command changes the existing mode.
A cross-region mode switch changes write ownership. A leader change within a local RU is a separate operation.
Failover to another region
If the current writer is unavailable and cannot participate in a planned switch, use regional failover to designate a new writer. If the current writer is unavailable and cannot participate in a planned switch, an administrator can use regional failover to designate a new writer.
Because cross-region replication is asynchronous, transactions committed in the failed region might not have reached the selected region. Different read-only regions can contain different portions of the tail of the replication stream, and a region can be ahead for one RU and behind for another.
Plan the transition and recovery in the following order:
- Prevent the failed region from accepting writes.
- Select the most up-to-date available shardgroup for each affected RU, as directed by the supported recovery procedure.
- Designate the new writer and verify its RU and service state.
- Allow the new writer to converge the other shardgroups.
- Reconcile the former writer before returning it to application service.
- Verify application connection settings and read-write and read-only service routing.
The convergence process can roll back transactions that are present in another region but absent from the new writer. Plan for this outcome when defining recovery objectives.
If a recovered shardgroup requires a data copy before returning to service, use the synchronization procedure in the following topic.
Synchronize a shardgroup
Use SYNC RU to reinitialize a replication unit (RU) in a recovered or newly added read-only shardgroup.
Use MOVE RU and COPY RU for operations within a shardgroup. To recover a replication unit from another shardgroup, use SYNC RU.
Specify the shardgroup that contains the RU data to retain with -source. Specify the read-only shardgroup to rebuild with -target. In the read-write to read-only recovery flow shown here, synchronization copies the RU data from a follower in the source shardgroup.
Synchronization replaces the target RU’s data, erases its Raft logs, and resets its log index and term. The target RU is unavailable during synchronization. Before starting, redirect application traffic that depends on the target RU and confirm that the target has enough space for the data copy and Raft logs.
The following example synchronizes RU 1 in the read-only shardgroup dbs2 using the read-write shardgroup dbs1 as the source.
SYNC RU -ru 1 -target dbs2 -source dbs1
Before resuming application traffic to the target shardgroup, verify the following.
- Run
CONFIG TASKand confirm that synchronization completed successfully. - Run
STATUS RU -ru 1and verify that the target RU leader reportsRead-onlyand that any followers report the expected state. - Verify that the target RU is receiving and applying changes. See Monitor cross-region replication.
- Test a connection through the read-only service and verify that it reaches the intended shardgroup.
Back up and recover a cross-region deployment
Synchronization brings a replica to the state of an existing source. Recovery to an earlier point in time also requires backups. Include the shard catalog and participating shardgroups in the backup and recovery plan.
After restoring a shardgroup, synchronize the corresponding RUs in the other shardgroups from the restored copy before resuming normal application access. Follow the supported backup and restore sequence for the release, then verify catalog connectivity, RU state, and application services.
For the backup configuration and restore prerequisites, see Backing Up and Recovering a Distributed Database.