Sharding

  1. ShardingRuleConfiguration ruleConfiguration = new ShardingRuleConfiguration();
  2. // algorithmName is specified by users and should be consistent with the sharding algorithm in the sharding strategy.
  3. // type and props, please refer to the built-in sharding algorithm: https://shardingsphere.apache.org/document/current/en/user-manual/common-config/builtin-algorithm/sharding/
  4. ruleConfiguration.getShardingAlgorithms().put("algorithmName", new AlgorithmConfiguration("xxx", new Properties()));

Encryption

  1. // encryptorName is specified by users, and its property should be consistent with that of encryptorName in encryption rules.
  2. // type and props, please refer to the built-in encryption algorithm: https://shardingsphere.apache.org/document/current/en/user-manual/common-config/builtin-algorithm/encrypt/
  3. Map<String, AlgorithmConfiguration> algorithmConfigs = new LinkedHashMap<>(1, 1);
  4. algorithmConfigs.put("encryptorName", new AlgorithmConfiguration("xxx", new Properties()));

Read/Write Splitting Load Balancer

  1. // loadBalancerName is specified by users, and its property has to be consistent with that of loadBalancerName in read/write splitting rules.
  2. // type and props, please refer to the built-in read/write splitting algorithm load balancer: https://shardingsphere.apache.org/document/current/en/user-manual/common-config/builtin-algorithm/load-balance/
  3. Map<String, AlgorithmConfiguration> algorithmConfigs = new HashMap<>(1, 1);
  4. algorithmConfigs.put("loadBalancerName", new AlgorithmConfiguration("xxx", new Properties()));

Shadow DB

  1. // shadowAlgorithmName is specified by users, and its property has to be consistent with that of shadowAlgorithmNames in shadow DB rules.
  2. // type and props, please refer to the built-in shadow DB algorithm: https://shardingsphere.apache.org/document/current/en/user-manual/common-config/builtin-algorithm/shadow/
  3. Map<String, AlgorithmConfiguration> algorithmConfigs = new HashMap<>(1, 1);
  4. algorithmConfigs.put("shadowAlgorithmName", new AlgorithmConfiguration("xxx", new Properties()));

High Availability

  1. // discoveryTypeName is specified by users, and its property has to be consistent with that of discoveryTypeName in database discovery rules.
  2. Map<String, AlgorithmConfiguration> algorithmConfigs = new HashMap<>(1, 1);
  3. algorithmConfigs.put("discoveryTypeName", new AlgorithmConfiguration("xxx", new Properties()));