All Products
Search
Document Center

Tablestore:Add replicas to a global table

Last Updated:Mar 12, 2026

Add one or more replicas (distribution locations) to an existing global table using the Tablestore Java SDK.

Notes

After the bind operation succeeds, the system asynchronously binds new replicas and synchronizes data. You can call `DescribeGlobalTable` to view the current status of the global table. When the returned status is `active`, the new global table replica is successfully bound.

Prerequisites

Initialize the client.

Method

public BindGlobalTableResponse bindGlobalTable(BindGlobalTableRequest request) throws TableStoreException, ClientException

BindGlobalTableRequest Parameters

  • globalTableId (Required)String: The global table ID.

    Note

    If you do not have the global table ID, call the `DescribeTable` operation to query the replica details. If the table replica belongs to a global table, the `DescribeTable` operation response includes the corresponding global table ID.

  • globalTableName (Required)String: The global table name. It must match the base table name.

  • placements (Required)List<Placement>: A list of new distribution location configurations. Each configuration contains the following parameters:

    Name

    Type

    Description

    regionId (Required)

    String

    The region ID.

    instanceName (Required)

    String

    The instance name.

    writable (Required)

    boolean

    Is writable. The default value is `false`. When using active-passive mode, keep the default configuration. When using multi-active mode, set this parameter to `true` as needed.

Example

private static void bindGlobalTableExample(SyncClient client) {
    // Construct the request
    BindGlobalTableRequest request = new BindGlobalTableRequest(
                // Global table ID
                "gt-ee1b54db-f5d9-43f3-ad36-ec44********",
                // Global table name
                "my-global-table"
    ); 

    // Construct the Placement list (at least one replica configuration)
    List<GlobalTableTypes.Placement> placements = new ArrayList<>();

    // Example: Add a replica in the China (Hangzhou) region
    GlobalTableTypes.Placement hangzhouReplica = new GlobalTableTypes.Placement(
                // Region ID of the replica
                "cn-hangzhou", 
                // Instance name of the replica
                "instance-replica-hz",
                // In active-passive mode, the replica table is not writable (default value is false)
                // In multi-active mode, the replica table can be set to read/write (true) or read-only (false) 
                false
    );

    // Example: Add a replica in the China (Shanghai) region
    GlobalTableTypes.Placement shanghaiReplica = new GlobalTableTypes.Placement(
                // Region ID of the replica
                "cn-shanghai",  
                // Instance name of the replica
                "instance-replica-sh", 
                // In active-passive mode, the replica table is not writable (default value is false)
                // In multi-active mode, the replica table can be set to read/write (true) or read-only (false)
                true
    );

    placements.add(hangzhouReplica);
    placements.add(shanghaiReplica);
    request.setPlacements(placements);

    // Send the request
    BindGlobalTableResponse response = client.bindGlobalTable(request);
    System.out.println("Bind succeeded. Request ID: " + response.getRequestId());
}