|
|
## 参考文档进行配置学习
|
|
|
|
|
|
## 1. 具体概述
|
|
|
|
|
|
Example for 2.x or 3.x or 4.x please see tags in `https://github.com/apache/shardingsphere-example/tree/${tag}`
|
|
|
|
|
|
[Apache ShardingSphere](https://github.com/apache/shardingsphere):
|
|
|
|
|
|
## download source code
|
|
|
|
|
|
git clone https://github.com/apache/shardingsphere.git
|
|
|
|
|
|
## compile source code
|
|
|
|
|
|
下载源码
|
|
|
|
|
|
git clone https://github.com/apache/shardingsphere.git
|
|
|
|
|
|
编译源码
|
|
|
|
|
|
cd shardingsphere
|
|
|
mvn clean install -Prelease
|
|
|
|
|
|
## 2. 项目结构
|
|
|
|
|
|
shardingsphere-example
|
|
|
├── example-core 示例核心,主要是讲如何整合
|
|
|
│ ├── config-utility 配置工具
|
|
|
│ ├── example-api
|
|
|
│ ├── example-raw-jdbc
|
|
|
│ ├── example-spring-jpa
|
|
|
│ └── example-spring-mybatis
|
|
|
├── other-example 其他示例
|
|
|
│ └── shardingsphere-parser-example
|
|
|
├── shardingsphere-jdbc-example
|
|
|
│ ├── mixed-feature-example
|
|
|
│ │ └── sharding-readwrite-splitting-example
|
|
|
│ │ │ ├── sharding-readwrite-splitting-raw-jdbc-example
|
|
|
│ │ │ ├── sharding-readwrite-splitting-spring-boot-jpa-example
|
|
|
│ │ │ ├── sharding-readwrite-splitting-spring-boot-mybatis-example
|
|
|
│ │ │ ├── sharding-readwrite-splitting-spring-namespace-jpa-example
|
|
|
│ │ │ └── sharding-readwrite-splitting-spring-namespace-mybatis-example
|
|
|
│ └── single-feature-example
|
|
|
│ │ ├── cluster-mode-example 集群模式示例
|
|
|
│ │ │ ├── cluster-mode-raw-jdbc-example
|
|
|
│ │ │ ├── cluster-mode-spring-boot-mybatis-example
|
|
|
│ │ │ └── cluster-mode-spring-namespace-mybatis-example
|
|
|
│ │ ├── encrypt-example 加解密示例
|
|
|
│ │ │ ├── encrypt-raw-jdbc-example
|
|
|
│ │ │ ├── encrypt-spring-boot-mybatis-example
|
|
|
│ │ │ └── encrypt-spring-namespace-mybatis-example
|
|
|
│ │ ├── extension-example 扩展示例
|
|
|
│ │ │ └── custom-sharding-algortihm-example
|
|
|
│ │ │ │ ├── class-based-sharding-algorithm-example
|
|
|
│ │ │ │ └── spi-based-sharding-algorithm-example
|
|
|
│ │ ├── readwrite-splitting-example 读写分离示例
|
|
|
│ │ │ ├── readwrite-splitting-raw-jdbc-example
|
|
|
│ │ │ ├── readwrite-splitting-spring-boot-jpa-example
|
|
|
│ │ │ ├── readwrite-splitting-spring-boot-mybatis-example
|
|
|
│ │ │ ├── readwrite-splitting-spring-namespace-jpa-example
|
|
|
│ │ │ └── readwrite-splitting-spring-namespace-mybatis-example
|
|
|
│ │ ├── shadow-example
|
|
|
│ │ │ ├── shadow-raw-jdbc-example
|
|
|
│ │ │ ├── shadow-spring-boot-mybatis-example
|
|
|
│ │ │ └── shadow-spring-namespace-mybatis-example
|
|
|
│ │ ├── sharding-example 分片示例
|
|
|
│ │ │ ├── sharding-raw-jdbc-example
|
|
|
│ │ │ ├── sharding-spring-boot-jpa-example
|
|
|
│ │ │ ├── sharding-spring-boot-mybatis-example
|
|
|
│ │ │ ├── sharding-spring-namespace-jpa-example
|
|
|
│ │ │ └── sharding-spring-namespace-mybatis-example
|
|
|
│ │ └── transaction-example 事物示例
|
|
|
│ │ │ ├── transaction-2pc-xa-atomikos-raw-jdbc-example
|
|
|
│ │ │ ├── transaction-2pc-xa-bitronix-raw-jdbc-example
|
|
|
│ │ │ ├── transaction-2pc-xa-narayana-raw-jdbc-example
|
|
|
│ │ │ ├── transaction-2pc-xa-spring-boot-example
|
|
|
│ │ │ ├── transaction-2pc-xa-spring-namespace-example
|
|
|
│ │ │ ├── transaction-base-seata-raw-jdbc-example
|
|
|
│ │ │ └── transaction-base-seata-spring-boot-example
|
|
|
├── shardingsphere-proxy-example
|
|
|
│ ├── shardingsphere-proxy-boot-mybatis-example
|
|
|
│ ├── shardingsphere-proxy-distsql-example
|
|
|
│ └── shardingsphere-proxy-hint-example
|
|
|
├── shardingsphere-sample
|
|
|
│ ├── shardingsphere-example-generator
|
|
|
└── src/resources
|
|
|
└── manual_schema.sql
|
|
|
|
|
|
## 3. 可用示例
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| **例子** | **描述** |
|
|
|
| -------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------- |
|
|
|
| [分片](shardingsphere-jdbc-example/single-feature-example/sharding-example) | **演示通过 ShardingSphere-JDBC 进行分库、分表等** |
|
|
|
| [读写分离](shardingsphere-jdbc-example/mixed-feature-example/sharding-readwrite-splitting-example) | **演示在 ShardingSphere-JDBC 中使用读写分离** |
|
|
|
| [springboot jpa](shardingsphere-jdbc-example/single-feature-example/sharding-example/sharding-spring-boot-jpa-example) | **演示通过 SpringBoot JPA 对接 ShardingSphere-JDBC** |
|
|
|
| [springboot mybatis](shardingsphere-jdbc-example/single-feature-example/sharding-example/sharding-spring-boot-mybatis-example) | **演示通过 SpringBoot Mybatis 对接 ShardingSphere-JDBC** |
|
|
|
| [治理](shardingsphere-jdbc-example/single-feature-example/cluster-mode-example) | **演示在 ShardingSphere-JDBC 中使用治理** |
|
|
|
| [事务](shardingsphere-jdbc-example/single-feature-example/transaction-example) | **演示在 ShardingSphere-JDBC 中使用事务** |
|
|
|
| [hint](shardingsphere-jdbc-example/single-feature-example/sharding-example/sharding-raw-jdbc-example) | **演示在 ShardingSphere-JDBC 中使用 hint** |
|
|
|
| [加密](shardingsphere-jdbc-example/single-feature-example/encrypt-example) | **演示在 ShardingSphere-JDBC 中使用加密** |
|
|
|
| [DistSQL](shardingsphere-proxy-example/shardingsphere-proxy-distsql-example) | **演示在 ShardingSphere-Proxy 中使用 DistSQL** |
|
|
|
| **APM 监控(Pending)** | **演示在 ShardingSphere 中使用 APM 监控** |
|
|
|
| **proxy(Pending)** | **演示使用 ShardingSphere-Proxy** |
|
|
|
| [docker](./docker/docker-compose.md) | **演示通过 docker 创建 ShardingSphere 所依赖的环境** |
|