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.

Scaling is an experimental feature, if scaling job fail, you could try nightly version, click here to download nightly build.

  1. Unzip the proxy distribution package, modify the configuration file conf/config-sharding.yaml. Please refer to proxy startup manual for more details.

  2. Modify the configuration file conf/server.yaml. Please refer to Mode Configuration for more details. Type of mode must be Cluster for now, please start the registry center before running proxy.

Configuration Example:

  1. mode:
  2. type: Cluster
  3. repository:
  4. type: ZooKeeper
  5. props:
  6. namespace: governance_ds
  7. server-lists: localhost:2181
  8. retryIntervalMilliseconds: 500
  9. timeToLiveSeconds: 60
  10. maxRetries: 3
  11. operationTimeoutMilliseconds: 500
  12. overwrite: false
  1. Modify scalingName and scaling configuration in conf/config-sharding.yaml.

Configuration Items Explanation:

  1. rules:
  2. - !SHARDING
  3. # ignored configuration
  4. scalingName: # Enabled scaling action config name
  5. scaling:
  6. <scaling-action-config-name> (+):
  7. blockQueueSize: # Data channel blocking queue size
  8. workerThread: # Worker thread pool size for inventory data ingestion and data importing
  9. readBatchSize: # Maximum records count of a query operation returning
  10. rateLimiter: # Rate limit algorithm
  11. type: # Algorithm type. Options: SOURCE
  12. props: # Algorithm properties
  13. qps: # QPS property. Available for types: SOURCE
  14. completionDetector: # Completion detect algorithm. If it's not configured, then system won't continue to do next steps automatically.
  15. type: # Algorithm type. Options: IDLE
  16. props: # Algorithm properties
  17. incremental-task-idle-minute-threshold: # If incremental tasks is idle more than so much minutes, then it could be considered as almost completed. Available for types: IDLE
  18. sourceWritingStopper: # Lock algorithm for stopping source writing. If it's not configured, then system will skip this step.
  19. type: # Algorithm type. Options: DEFAULT
  20. dataConsistencyChecker: # Data consistency check algorithm. If it's not configured, then system will skip this step.
  21. type: # Algorithm type. Options: DATA_MATCH, CRC32_MATCH
  22. props: # Algorithm properties
  23. chunk-size: # Maximum records count of a query operation for check
  24. checkoutLocker: # Lock algorithm for metadata checkout. If it's not configured, then system will skip this step.
  25. type: # Algorithm type. Options: DEFAULT

Configuration Example:

  1. rules:
  2. - !SHARDING
  3. # ignored configuration
  4. scalingName: default_scaling
  5. scaling:
  6. default_scaling:
  7. blockQueueSize: 10000
  8. workerThread: 40
  9. readBatchSize: 1000
  10. rateLimiter:
  11. type: SOURCE
  12. props:
  13. qps: 50
  14. completionDetector:
  15. type: IDLE
  16. props:
  17. incremental-task-idle-minute-threshold: 30
  18. sourceWritingStopper:
  19. type: DEFAULT
  20. dataConsistencyChecker:
  21. type: DATA_MATCH
  22. props:
  23. chunk-size: 1000
  24. checkoutLocker:
  25. type: DEFAULT

You could customize rateLimiter, completionDetector, sourceWritingStopper, dataConsistencyChecker and checkoutLocker algorithm by implementing SPI. Current implementation could be referenced, please refer to Dev Manual#Scaling for more details.

  1. Start up ShardingSphere-Proxy:
  1. sh bin/start.sh
  1. Check proxy log logs/stdout.log:
  1. [INFO ] [main] o.a.s.p.frontend.ShardingSphereProxy - ShardingSphere-Proxy start success

It means proxy start up successfully.

Shutdown

  1. sh bin/stop.sh