Create a read replica cluster
Deploy read replicas → across different products
New UI If your user base is geographically distributed, you can add a read replica cluster to the universe to improve read latency in regions that are far from your primary region.
Read replicas are a read-only extension to the primary cluster. With read replicas, the primary data of the cluster is copied to one or more nodes in a different region. Read replicas do not add to write latencies because writes aren't synchronously replicated to replicas - the data is replicated to the replicas asynchronously. To read data from a read replica, you need to enable follower reads.
For more information on read replicas and follower reads in YugabyteDB, see the following:
You can customize the number of read replicas in the read replica cluster. Multiple replicas ensure the availability of the replica in case of a node outage. Replicas do not participate in the primary cluster Raft consensus, and do not affect the fault tolerance of the primary cluster or contribute to failover. The number of read replicas can't exceed the number of nodes in the read replica cluster.
You can delete, modify, and scale read replica clusters. Adding or removing nodes incurs a load on the read replica cluster. Perform scaling operations when the cluster isn't experiencing heavy traffic. Scaling during times of heavy traffic can temporarily degrade performance and increase the length of time of the scaling operation.
Limitations
- Currently, YugabyteDB Anywhere supports only one read replica cluster per universe.
- You can add up to 15 read replicas to the read replica cluster.
For how read replicas fit with other multi-region topologies, refer to Topology.
Add a read replica
In the New UI, you add a read replica after the primary universe exists. Create the primary universe first (see Create universes), then use the Add Read Replica wizard.
To add a read replica cluster:
-
Navigate to the universe, then open Settings > Placement.
-
Click Advanced Placement options > Add Read Replica.
-
Follow the Add Read Replica wizard.
The wizard has the following pages:
Regions and Availability Zones
Specify the placement of read replica nodes:
-
For each region, select the region and one or more availability zones.
-
For each availability zone, set the following:
- Nodes (or Pods for Kubernetes) — Number of nodes to place in the zone.
- Replication Factor — Number of copies of primary cluster data to maintain in this availability zone. This determines fault tolerance within the read replica; it does not change the primary cluster replication factor.
-
Optionally click Add Availability Zone to place nodes in additional zones in the region, or Add Region to place replicas in additional regions.
The total node count for the read replica is shown below the region cards.
Instance Settings
Configure the instance used for read replica nodes (YB-TServers only):
-
Select Keep read replica instance settings same as primary cluster instance settings to use the same instance type and storage as the primary cluster.
-
To customize, clear that option and set CPU architecture, Linux version, instance type, and volume info as needed. For Kubernetes, you can set cores, memory, and volume info. For AWS, you can also configure EBS volume encryption when that feature is enabled.
For field details that match primary-cluster hardware settings, refer to Hardware in Create universes.
Database Settings
By default, YB-TServer flags from the primary cluster are applied to the read replica. Read replicas do not include YB-Master servers.
To set different flags for the read replica, enable Customize Database Config Flags for Read Replica and add or edit YB-TServer flags. You can also change flags later; refer to Edit configuration flags.
leader_failure_max_missed_heartbeat_periods configuration flag for YB-Master and YB-TServer with a value of 10. As the data is globally replicated, remote procedure call (RPC) latencies are higher. You can use this flag to increase the failure detection interval in high-RPC latency deployments.Summary and Cost
Review the read replica placement, hardware, and cost summary, then click Create.
After the task completes, open Nodes (or Pods for Kubernetes). Nodes are grouped into the primary cluster and read replicas; read replica nodes have a readonly1 identifier appended to their name.
Edit a read replica
You can change placement, instance settings, and flags independently.
Edit placement
- Navigate to the universe, then open Settings > Placement.
- On the Read Replica card, open the menu and choose Edit Placement.
- Update regions, availability zones, node counts, and replication factor as needed.
- Click Apply Changes.
Edit instance settings
- Navigate to the universe, then open Settings > Hardware.
- On the Read Replica Instance card, click Edit.
- Keep settings the same as the primary cluster, or customize the instance and storage.
- Confirm and apply the changes.
Edit configuration flags
- Navigate to the universe, then open Settings > Database.
- Under Advanced Config Flags, select Read Replica, then click Edit to update YB-TServer flags.
You can also edit flags as described in Edit configuration flags.
Delete a read replica
- Navigate to the universe, then open Settings > Placement.
- On the Read Replica card, open the menu and choose Delete Read Replica.
- Confirm by entering the universe name, then click Yes.