tree: a042a36b2580f046f60ef8e917f10374e7774696 [path history] [tgz]
  1. docker/
  2. example-core/
  3. shardingsphere-example-generator/
  4. shardingsphere-parser-example/
  5. shardingsphere-proxy-example/
  6. src/
  7. pom.xml
  8. README.md
  9. README_ZH.md
examples/README.md

ShardingSphere-example

Example for 1.x please see tags in https://github.com/apache/shardingsphere/tree/${tag}/shardingsphere-jdbc-example

Example for 2.x or 3.x or 4.x please see tags in https://github.com/apache/shardingsphere-example/tree/${tag}

Notices

  • *The shardingsphere-sample module is a brand new sample experience module. *

  • Please execute initial script before you first run the example if using manual mode.

  • Please make sure primary replica data replication sync on MySQL is running correctly. Otherwise, primary-replica example will query empty data from the replica.

Using master branch

Please make sure some dependencies from Apache ShardingSphere has been installed since examples depend on that. if you are a newbie for Apache ShardingSphere, you could prepare the dependencies as following:

  1. download and install Apache ShardingSphere:
## download source code
git clone https://github.com/apache/shardingsphere.git

## compile source code
cd shardingsphere
mvn clean install -Prelease

Module design

project structure

shardingsphere-example
  ├── example-core
  │   ├── config-utility
  │   ├── example-api
  │   ├── example-raw-jdbc
  │   ├── example-spring-jpa
  │   └── example-spring-mybatis
  ├── shardingsphere-example-generator
  ├── shardingsphere-parser-example
  ├── shardingsphere-proxy-example
  │   ├── shardingsphere-proxy-boot-mybatis-example
  │   ├── shardingsphere-proxy-distsql-example
  │   └── shardingsphere-proxy-hint-example
  └── src/resources
        └── manual_schema.sql

Available Examples

ExampleDescription
ShardingSphere-JDBC ExamplesGenerate the examples by configuration and show how to use ShardingSphere-JDBC
DistSQLshow how to use DistSQL in ShardingSphere-Proxy
APM(Pending)show how to use APM in ShardingSphere
proxy(Pending)show how to use ShardingSphere-Proxy
dockershow how to use docker to setup the environment for ShardingSphere