Commit e49d41cd authored by terrymanu's avatar terrymanu
Browse files

update readme

parent e3002738
Loading
Loading
Loading
Loading
+42 −32
Original line number Diff line number Diff line
@@ -5,42 +5,50 @@ Example for 1.x please see tags in `https://github.com/apache/incubator-sharding
Example for 2.x or 3.x or 4.x please see tags in `https://github.com/apache/incubator-shardingsphere-example/tree/${tag}`

**Need attention**

- *Please do not use `dev` branch to run your example, example of `dev` branch is not released yet.*

- *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.
## Before start the example if you want use `dev` branch

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
## checkout a specific version, example is 4.0.0-RC1
cd incubator-shardingsphere && git checkout 4.0.0-RC1

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

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
## checkout a specific version, example is 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
## shardingsphere-example module design

### project structure

### project module
```
sharding-sphere-example
shardingsphere-example
  ├── example-common
  │   ├── config-utility
  │   ├── repository-api
@@ -60,7 +68,6 @@ sharding-sphere-example
  │   │   └── orchestration-spring-namespace-example
  │   ├── transaction-example
  │   │   ├── transaction-2pc-xa-example
  │   │   ├── transaction-base-saga-example
  │   │   └──transaction-base-seata-example
  │   ├── other-feature-example
  │   │   ├── hint-example
@@ -73,44 +80,47 @@ sharding-sphere-example
```

### Best practice for sharding data

* sharding databases
* sharding tables
* sharding databases and tables
* master-slave
* sharding & master-slave

you can get more detail from **[sharding-example](./sharding-jdbc-example/sharding-example)**
You can get more detail from **[sharding-example](./sharding-jdbc-example/sharding-example)**

### Best practice for sharding + orchestration
* local zookeeper/etcd & sharding

    local sharding configuration can override the configuration of zookeeper/etcd.

* cloud zookeeper/etcd & sharding

    shardingsphere will load the sharding configuration form zookeeper/etcd directly.
* using local configuration file for zookeeper/etcd & sharding
* using register center(zookeeper/etcd)'s configuration for sharding

you can get more detail from **[orchestration-example](./sharding-jdbc-example/orchestration-example)**
You can get more detail from **[orchestration-example](./sharding-jdbc-example/orchestration-example)**

### Best Practice for sharding + distribution-transaction

* 2pc-xa transaction
* base-saga transaction
* base-seata transaction

You can get more detail from **[transaction-example](./sharding-jdbc-example/transaction-example)**

### Best Practice for hint routing

You can get more detail from **[hint-example](./sharding-jdbc-example/other-feature-example/hint-example)**

### Best Practice for broadcast table

You can get more detail from **[broadcast-table-example](./sharding-jdbc-example/other-feature-example/broadcast-table-example)**

you can get more detail from **[transaction-example](./sharding-jdbc-example/transaction-example)**
### Best Practice for data encrypt

### how to use hint routing
you can get more detail from **[hint-example](./sharding-jdbc-example/other-feature-example/hint-example)**
You can get more detail from **[encrypt-example](./sharding-jdbc-example/other-feature-example/encrypt-example)**

### how to config broadcast-table
you can get more detail from **[broadcast-table-example](./sharding-jdbc-example/other-feature-example/broadcast-table-example)**
### Best Practice for APM

### how to encrypt & decrypt data in shardingsphere
you can get more detail from **[encrypt-example](./sharding-jdbc-example/other-feature-example/encrypt-example)**
We will add APM example recently.

### how to use APM with shardingsphere
we will add APM example recently.
### Best Practice for sharding-proxy.

### how to use sharding-proxy with jdbc.
we prefer to add a docker base example recently.
We prefer to add a docker base example recently.

### [how to use docker to config sharding-jdbc & sharding-proxy](./docker/docker-compose.md) (Optional)