Use Docker
Using Docker to start ShardingSphere-Proxy does not require additional package supoort.
- Acquire Docker Image
- Method 1 (Recommended): Pull from DockerHub
Method 2: Acquire latest master branch image master:
mvn clean install
cd shardingsphere-distribution/shardingsphere-proxy-distribution
mvn clean package -Prelease,docker
If the following problems emerge, please make sure Docker daemon Process is running.
- Configure
conf/server.yaml
andconf/config-*.yaml
docker cp tmp:/opt/shardingsphere-proxy/conf /host/path/to/conf
Since the network conditions inside the container may differ from those of the host, if errors such as “cannot connect to the database” occurs, please make sure that the IP of the database specified in the conf/config-*.yaml
configuration file can be accessed from inside the Docker container.
For details, please refer to ShardingSphere-Proxy quick start manual - binary distribution packages.
- (Optional) Introduce third-party dependencies or customized algorithms
If you have any of the following requirements:
- ShardingSphere-Proxy Backend use MySQL Database;
- Implement customized algorithms;
- Use Etcd as Registry Center in cluster mode.
Please create ext-lib
directory anywhere inside the host and refer to the steps in .
- Start ShardingSphere-Proxy container
ext-lib
is not necessary during the process. Users can mount it at will. ShardingSphere-Proxy default portal 3307
can be designated according to environment variable -e PORT
Customized JVM related parameters can be set according to environment variable JVM_OPTS
Note:
Support setting environment variable CGROUP_ MEM_ OPTS: used to set related memory parameters in the container environment. The default values in the script are:
-XX:InitialRAMPercentage=80.0 -XX:MaxRAMPercentage=80.0 -XX:MinRAMPercentage=80.0
- Use Client to connect to ShardingSphere-Proxy
Please refer to ShardingSphere-Proxy quick start manual - binary distribution packages.