Preparing shard servers

You must prepare shard servers before you can shard data.

Procedure

To set up shard servers:

  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. Specify trusted hosts information for all shard servers. On each shard server, use one of the following method to add trusted host information about all the other shard servers:
    • 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.
  3. On each shard server, edit the wire listener configuration file:
    1. Set the sharding.enable parameter to true.
    2. Set the sharding.query.parallel.enable parameter to true.
    3. Set the update.client.strategy parameter to deleteInsert.
    4. 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 of mixed.
    5. 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.
  4. On each shard server, restart the wire listener.

What to do next

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;

Copyright© 2019 HCL Technologies Limited