Build

    • Proxy is developed in JAVA, and JDK version 1.8 or later is recommended.
    • Data migration adopts the cluster mode, and ZooKeeper is currently supported as the registry.
    1. Get ShardingSphere-Proxy. Please refer to for details.

    2. Modify the configuration file . Please refer to mode configuration for details.

    Currently, mode must be Cluster, and the corresponding registry must be started in advance.

    Configuration sample:

    1. Introduce JDBC driver.

    Proxy has included JDBC driver of PostgreSQL.

    If you are migrating to a heterogeneous database, then you could use more types of database. Introduce JDBC driver as above too.

    1. Start ShardingSphere-Proxy:
    1. sh bin/start.sh
    1. View the proxy log logs/stdout.log. If you see the following statements:
    1. [INFO ] [main] o.a.s.p.frontend.ShardingSphereProxy - ShardingSphere-Proxy start success

    The startup will have been successful.

    1. Configure and migrate on demand.

    6.1. Query configuration.

    The default configuration is as follows.

    1. +--------------------------------------------------------------+--------------------------------------+------------------------------------------------------+
    2. | read | write | stream_channel |
    3. +--------------------------------------------------------------+--------------------------------------+------------------------------------------------------+
    4. +--------------------------------------------------------------+--------------------------------------+------------------------------------------------------+

    6.2. Alter configuration (Optional).

    A completely configured DistSQL is as follows.

    1. ALTER MIGRATION RULE (
    2. READ(
    3. WORKER_THREAD=40,
    4. SHARDING_SIZE=10000000,
    5. RATE_LIMITER (TYPE(NAME='QPS',PROPERTIES('qps'='500')))
    6. ),
    7. WRITE(
    8. WORKER_THREAD=40,
    9. BATCH_SIZE=1000,
    10. RATE_LIMITER (TYPE(NAME='TPS',PROPERTIES('tps'='2000')))
    11. ),
    12. STREAM_CHANNEL (TYPE(NAME='MEMORY',PROPERTIES('block-queue-size'='10000')))
    13. );

    Configuration item description:

    DistSQL sample: configure READ for traffic limit.

    1. ALTER MIGRATION RULE (
    2. RATE_LIMITER (TYPE(NAME='QPS',PROPERTIES('qps'='500')))
    3. )

    Configure data reading for traffic limit. Other configurations use default values.

    6.3. Restore configuration.

    1. ALTER MIGRATION RULE (
    2. READ(
    3. WORKER_THREAD=40,
    4. BATCH_SIZE=1000,
    5. SHARDING_SIZE=10000000,
    6. RATE_LIMITER (TYPE(NAME='QPS',PROPERTIES('qps'='500')))
    7. ),
    8. WRITE(
    9. WORKER_THREAD=40,
    10. BATCH_SIZE=1000,
    11. RATE_LIMITER (TYPE(NAME='TPS',PROPERTIES('tps'='2000')))
    12. ),
    13. STREAM_CHANNEL (TYPE(NAME='MEMORY',PROPERTIES('block-queue-size'='10000')))