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.
Get ShardingSphere-Proxy. Please refer to for details.
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:
- 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.
- Start ShardingSphere-Proxy:
sh bin/start.sh
- View the proxy log
logs/stdout.log
. If you see the following statements:
[INFO ] [main] o.a.s.p.frontend.ShardingSphereProxy - ShardingSphere-Proxy start success
The startup will have been successful.
- Configure and migrate on demand.
6.1. Query configuration.
The default configuration is as follows.
+--------------------------------------------------------------+--------------------------------------+------------------------------------------------------+
| read | write | stream_channel |
+--------------------------------------------------------------+--------------------------------------+------------------------------------------------------+
+--------------------------------------------------------------+--------------------------------------+------------------------------------------------------+
6.2. Alter configuration (Optional).
A completely configured DistSQL is as follows.
ALTER MIGRATION RULE (
READ(
WORKER_THREAD=40,
SHARDING_SIZE=10000000,
RATE_LIMITER (TYPE(NAME='QPS',PROPERTIES('qps'='500')))
),
WRITE(
WORKER_THREAD=40,
BATCH_SIZE=1000,
RATE_LIMITER (TYPE(NAME='TPS',PROPERTIES('tps'='2000')))
),
STREAM_CHANNEL (TYPE(NAME='MEMORY',PROPERTIES('block-queue-size'='10000')))
);
Configuration item description:
DistSQL sample: configure READ
for traffic limit.
ALTER MIGRATION RULE (
RATE_LIMITER (TYPE(NAME='QPS',PROPERTIES('qps'='500')))
)
Configure data reading for traffic limit. Other configurations use default values.
6.3. Restore configuration.
ALTER MIGRATION RULE (
READ(
WORKER_THREAD=40,
BATCH_SIZE=1000,
SHARDING_SIZE=10000000,
RATE_LIMITER (TYPE(NAME='QPS',PROPERTIES('qps'='500')))
),
WRITE(
WORKER_THREAD=40,
BATCH_SIZE=1000,
RATE_LIMITER (TYPE(NAME='TPS',PROPERTIES('tps'='2000')))
),
STREAM_CHANNEL (TYPE(NAME='MEMORY',PROPERTIES('block-queue-size'='10000')))