Preparing shard servers
You must prepare shard servers before you can shard data.
Procedure
To set up shard servers:
-
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. -
Specify trusted hosts information for all shard servers.
On each shard server, run the SQL administration API task() or admin() function with the cdr add trustedhost argument and include the appropriate host values for all the other shard servers. You must be a Database Server Administrator (DBSA) to run these functions.
-
On each shard server, edit the wire listener configuration file:
-
Set the sharding.enable parameter to
true
. -
Set the sharding.query.parallel.enable parameter to
true
. -
Set the update.client.strategy parameter to
deleteInsert
. -
If you want to allow shard key field values to be updated, set the
update.mode parameter to
client
. If you do not want to allow the updating of shard key field values, you can leave the setting of the update.mode parameter as the default value ofmixed
. - Set the USER attribute in the url parameter to a user who has the REPLICATION privilege. If you created a database server instance during installation, the ifxjson user, who has the REPLICATION privilege, is automatically set as the value of the USER attribute. Otherwise, see Configuring the wire listener for the first time for instructions.
-
Set the sharding.enable parameter to
- On each shard server, restart the wire listener.
What to do next
SET ENVIRONMENT USE_SHARDING ON;