cdr list shardCollection
The cdr list shardCollection command displays the sharding definition for all database servers in a shard cluster.
Syntax
Element | Description | Restrictions |
---|---|---|
definition_name | The name of the sharding definition that is used for distributing data across multiple database servers. | Must be the name of an existing definition. |
Usage
The cdr list shardCollection command displays the sharding definition for database servers in a shard cluster.
Return codes
A return code of 0 indicates that the command was successful.
If the command is not successful, one of the following error codes is returned: 99, 196, 229.
For information on these error codes, see Return Codes for the cdr Utility.
Example: Output for a sharding definition that uses consistent hash-based sharding
For this example, you have a sharding definition that is created by the following command:
cdr define shardCollection collection_1 db_1:john.customers
--type=delete --key=b --strategy=chash --partitions=3 --versionCol=column_3
g_shard_server_1 g_shard_server_2 g_shard_server_3
The following example shows output when the cdr list shardCollection command is run on a database server in the shard cluster. Each shard server has three hashing partitions.
Example: Output for a sharding definition that uses hash-based sharding
cdr define shardCollection collection_1 database_1:john.customers_1
--type=delete --key=col2 --strategy=hash --versionCol=column_3
g_shard_server_A
g_shard_server_B
g_shard_server_C
g_shard_server_D
The following example shows output when the cdr list shardCollection command is run on a database server in the shard cluster.
Example: Output for a sharding definition that uses an expression
cdr define shardCollection collection_2 database_2:joe.customers_2
-t delete -k state -s expression -v column_3
g_shard_server_F "IN ('AL','MS','GA')"
g_shard_server_G "IN ('TX','OK','NM')"
g_shard_server_H "IN ('NY','NJ')"
g_shard_server_I remainder
The following example shows output when the cdr list shardCollection command is run on a database server in the shard cluster.
Example: Output for a sharding definition that was modified
cdr define shardCollection collection_3 database_3:tony.customers_3
-t keep -k bson_value_lvarchar(data,'year') -s expression -v column_3
g_shard_server_J "BETWEEN 1970 and 1979"
g_shard_server_K "BETWEEN 1980 and 1989"
g_shard_server_L "BETWEEN 1990 and 1999"
g_shard_server_M remainder
cdr change shardCollection collection_3 -a
g_shard_server_N "BETWEEN 2000 and 2009"
cdr change shardCollection collection_3 -d g_shard_server_J
The
following example shows output when the cdr list shardCollection command
is run on a database server in the shard cluster. The Version
value
increments with each cdr change shardCollection command
that successfully runs on collection_3.