Creating a shard cluster

To create a shard cluster, prepare the shard servers and specify the sharding definition.

All shard servers must belong to the same Enterprise Replication domain.

To create a shard cluster:

  1. On each shard server, set the SHARD_ID configuration parameter to a positive integer value that is unique in the shard cluster by running the following command:
    onmode -wf SHARD_ID=unique_positive_integer
    If the SHARD_ID configuration parameter is already set to a positive integer, you can change the value by editing the onconfig file and then restarting the database server. You can also set the SHARD_MEM configuration parameter to customize the number of memory pools that are used during shard queries.
  2. On the shard server that contains the table to shard, run the cdr define shardCollection command.
When applications connect to shard servers, enable sharded queries to run against data across all shard servers by setting the USE_SHARDING session environment variable:
SET ENVIRONMENT USE_SHARDING ON;