Adds one or more replicas to an existing global table using the Tablestore Java SDK.
Usage notes
The bind operation is asynchronous. After the call succeeds, the system syncs data to the new replicas in the background. Call DescribeGlobalTable to check progress — the replica is ready when its status returns active.
Prerequisites
Before you begin, ensure that you have:
Method
public BindGlobalTableResponse bindGlobalTable(BindGlobalTableRequest request) throws TableStoreException, ClientException
Example
The following example adds two replicas to an existing global table — one in China (Hangzhou) in active-passive mode and one in China (Shanghai) in multi-active mode.
private static void bindGlobalTableExample(SyncClient client) {
BindGlobalTableRequest request = new BindGlobalTableRequest(
"gt-ee1b54db-f5d9-43f3-ad36-ec44********",
"my-global-table"
);
List<GlobalTableTypes.Placement> placements = new ArrayList<>();
// Active-passive mode: read-only replica, writable = false
GlobalTableTypes.Placement hangzhouReplica = new GlobalTableTypes.Placement(
"cn-hangzhou",
"instance-replica-hz",
false
);
// Multi-active mode: read/write replica, writable = true
GlobalTableTypes.Placement shanghaiReplica = new GlobalTableTypes.Placement(
"cn-shanghai",
"instance-replica-sh",
true
);
placements.add(hangzhouReplica);
placements.add(shanghaiReplica);
request.setPlacements(placements);
BindGlobalTableResponse response = client.bindGlobalTable(request);
System.out.println("Bind succeeded. Request ID: " + response.getRequestId());
}