Build

Build&Deployment

  1. Execute the following command to compile and generate the ShardingSphere-Proxy binary package:
  1. git clone --depth 1 https://github.com/apache/shardingsphere.git
  2. cd shardingsphere
  3. mvn clean install -Dmaven.javadoc.skip=true -Dcheckstyle.skip=true -Drat.skip=true -Djacoco.skip=true -DskipITs -DskipTests -Prelease

The binary packages:

  • /shardingsphere-distribution/shardingsphere-proxy-distribution/target/apache-shardingsphere-${latest.release.version}-shardingsphere-proxy-bin.tar.gz

Or get binary package from download page.

  1. Unzip the proxy distribution package, modify the configuration file conf/server.yaml, enable scaling and mode:
  1. scaling:
  2. blockQueueSize: 10000
  3. workerThread: 40
  4. clusterAutoSwitchAlgorithm:
  5. type: IDLE
  6. props:
  7. incremental-task-idle-minute-threshold: 30
  8. dataConsistencyCheckAlgorithm:
  9. type: DEFAULT
  10. mode:
  11. type: Cluster
  12. repository:
  13. type: ZooKeeper
  14. props:
  15. namespace: governance_ds
  16. server-lists: localhost:2181
  17. retryIntervalMilliseconds: 500
  18. timeToLiveSeconds: 60
  19. maxRetries: 3
  20. operationTimeoutMilliseconds: 500
  21. overwrite: false

Enable clusterAutoSwitchAlgorithm indicate system will detect when scaling job is finished and switch cluster configuration automatically. Currently, system supply IDLE type implementation.

Enable dataConsistencyCheckAlgorithm indicate system will use this defined algorithm to do data consistency check when it’s emitted, if it’s disabled, then data consistency check will be ignored. Currently, system supply DEFAULT type implementation, it supports following database types: MySQL, you could not enable it if you’re running other database types for now, support of other database types is under development.

You could customize an auto switch algorithm by implementing ScalingClusterAutoSwitchAlgorithm SPI interface, and customize a check algorithm by implementing ScalingDataConsistencyCheckAlgorithm SPI interface. Please refer to Dev Manual#Scaling for more details.

  1. Start up ShardingSphere-Proxy:
  1. sh bin/start.sh
  1. See the proxy log file logs/stdout.log,ensure startup successfully.

Shutdown

  1. sh bin/stop.sh

Configuration

The existing configuration items are as follows, we can modify them in conf/server.yaml:

NameDescriptionDefault value
blockQueueSizeQueue size of data transmission channel10000
workerThreadWorker thread pool size, the number of migration task threads allowed to run concurrently40