Unverified Commit 91b0e6e5 authored by Liang Zhang's avatar Liang Zhang Committed by GitHub
Browse files

Merge pull request #158 from taojintianxia/documentation-update

Rephase: update the document for docker
parents e37ea5a7 bee597aa
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
@@ -9,6 +9,33 @@ Example for 2.x or 3.x or 4.x please see tags in `https://github.com/apache/incu
- *The manual schema initial script is in `https://github.com/apache/incubator-shardingsphere-example/blob/dev/src/resources/manual_schema.sql`, please execute it before you first run the example.*
- *Please make sure master-slave data sync on MySQL is running correctly. Otherwise this example will query empty data from slave.*

## Before start the example
please make sure some dependencies from [shardingsphere](https://github.com/apache/incubator-shardingsphere) and [shardingsphere-spi-impl](https://github.com/OpenSharding/shardingsphere-spi-impl) have been installed since some examples depend on that.
if you are a newbie for shardingsphere, you could prepare the dependencies as following : 
1.download and install [shardingsphere](https://github.com/apache/incubator-shardingsphere) :  
```bash
## download the code of shardingsphere
git clone https://github.com/apache/incubator-shardingsphere.git

## checkout a specific version, say 4.0.0-RC1
cd incubator-shardingsphere && git checkout 4.0.0-RC1

## install the dependencies
mvn clean install -Prelease
```

2.download and install [shardingsphere-spi-impl](https://github.com/OpenSharding/shardingsphere-spi-impl) :  
```bash
## download the code of shardingsphere-spi-impl
git clone https://github.com/OpenSharding/shardingsphere-spi-impl.git

## checkout a specific version, say 4.0.0-RC1
cd shardingsphere-spi-impl && git checkout 4.0.0-RC1

## install the dependencies
mvn clean install
```

## sharding-sphere-example module design

### project module
+3 −3
Original line number Diff line number Diff line
## Using docker-compose to config startup environment
before we use docker compose, please install docker first : https://docs.docker.com/compose/install/
before we use docker compose, please install docker and docker-compose first : https://docs.docker.com/compose/install/

#### sharding-jdbc
1. access the docker folder (cd docker/sharding-jdbc/sharding)
2. launch the environment by docker compose (docker-compose up -d)
3. access mysql / etcd / zookeeper as you want
4. if there is conflict on port, just modify the mapper port in docker-compose.yml and then launch docker compose again(docker-compose up -d)
4. if there is conflict on port, just modify the corresponding port defined in docker-compose.yml and then launch docker compose again(docker-compose up -d)
5. if you want to stop these environment, use command docker-compose down

#### sharding-proxy
1. access the docker folder (cd docker/sharding-proxy/sharding)
2. launch the environment by docker compose (docker-compose up -d)
3. access proxy by `mysql -h127.0.0.1 -P13308 -proot -uroot`
4. if there is conflict on port, just modify the mapper port in docker-compose.yml and then launch docker compose again(docker-compose up -d)
4. if there is conflict on port, just modify the corresponding port defined in docker-compose.yml and then launch docker compose again(docker-compose up -d)
5. if you want to stop these environment, use command docker-compose down

to clean the docker container , you could use docker rm `docker ps -a -q` (be careful)