README.md 8.6 KB
Newer Older
T
terrymanu 已提交
1
# [ShardingSphere - Distributed Database Middleware Ecosphere](https://shardingsphere.apache.org/)
T
terrymanu 已提交
2

T
terrymanu 已提交
3
**Official website: https://shardingsphere.apache.org/**
T
terrymanu 已提交
4

T
terrymanu 已提交
5
[![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg)](https://www.apache.org/licenses/LICENSE-2.0.html)
T
terrymanu 已提交
6
[![Gitter](https://badges.gitter.im/shardingsphere/shardingsphere.svg)](https://gitter.im/shardingsphere/Lobby)
7
[![GitHub release](https://img.shields.io/github/release/apache/incubator-shardingsphere.svg)](https://github.com/apache/incubator-shardingsphere/releases)
wu-sheng's avatar
wu-sheng 已提交
8
[![Stargazers over time](https://starchart.cc/apache/incubator-shardingsphere.svg)](https://starchart.cc/apache/incubator-shardingsphere)
T
terrymanu 已提交
9

10
[![Total Lines](https://tokei.rs/b1/github/apache/incubator-shardingsphere?category=lines)](https://github.com/apache/incubator-shardingsphere)
T
terrymanu 已提交
11 12
[![Build Status](https://travis-ci.org/apache/incubator-shardingsphere.svg?branch=dev)](https://travis-ci.org/apache/incubator-shardingsphere)
[![Coverage Status](https://coveralls.io/repos/github/apache/incubator-shardingsphere/badge.svg?branch=dev)](https://coveralls.io/github/apache/incubator-shardingsphere?branch=dev)
T
terrymanu 已提交
13
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/278600ed40ad48e988ab485b439abbcd)](https://www.codacy.com/app/terrymanu/sharding-sphere?utm_source=github.com&utm_medium=referral&utm_content=sharding-sphere/sharding-sphere&utm_campaign=Badge_Grade)
14
[![snyk](https://snyk.io/test/github/apache/incubator-shardingsphere/badge.svg?targetFile=pom.xml)](https://snyk.io/test/github/apache/incubator-shardingsphere?targetFile=pom.xml)
T
terrymanu 已提交
15
[![OpenTracing-1.0 Badge](https://img.shields.io/badge/OpenTracing--1.0-enabled-blue.svg)](http://opentracing.io)
kzd666's avatar
kzd666 已提交
16
[![Skywalking Tracing](https://img.shields.io/badge/Skywalking%20Tracing-enable-brightgreen.svg)](https://github.com/apache/skywalking)
T
terrymanu 已提交
17

T
terrymanu 已提交
18
## Document
T
terrymanu 已提交
19

P
panjuan 已提交
20 21
[![EN doc](https://img.shields.io/badge/document-English-blue.svg)](https://shardingsphere.apache.org/document/current/en/overview/)
[![CN doc](https://img.shields.io/badge/文档-中文版-blue.svg)](https://shardingsphere.apache.org/document/current/cn/overview/)
T
terrymanu 已提交
22

T
terrymanu 已提交
23
## Overview
T
terrymanu 已提交
24

T
terrymanu 已提交
25
ShardingSphere is an open-source ecosystem consisted of a set of distributed database middleware solutions, including 2 independent products, Sharding-JDBC & Sharding-Proxy & Sharding-Sidecar (todo). 
T
terrymanu 已提交
26
They all provide functions of data sharding, distributed transaction and database orchestration, applicable in a variety of situations such as Java isomorphism, heterogeneous language and cloud native. 
T
terrymanu 已提交
27

T
terrymanu 已提交
28
Aiming at reasonably making full use of the computation and storage capacity of database in distributed system, ShardingSphere defines itself as a middleware, rather than a totally new type of database. 
T
terrymanu 已提交
29 30
As the cornerstone of many enterprises, relational database still takes a huge market share. 
Therefore, at current stage, we prefer to focus on its increment instead of a total overturn.
T
terrymanu 已提交
31

T
terrymanu 已提交
32
__Apache releases is beginning from version 4.0.0__
T
terrymanu 已提交
33

34
![ShardingSphere Scope](https://shardingsphere.apache.org//document/current/img/shardingsphere-scope_en.png)
T
terrymanu 已提交
35

T
terrymanu 已提交
36
### Sharding-JDBC
T
terrymanu 已提交
37

38
[![Maven Status](https://maven-badges.herokuapp.com/maven-central/org.apache.shardingsphere/sharding-jdbc/badge.svg)](https://mvnrepository.com/artifact/org.apache.shardingsphere/sharding-jdbc)
T
terrymanu 已提交
39

T
terrymanu 已提交
40 41 42
Sharding-JDBC defines itself as a lightweight Java framework that provides extra service at Java JDBC layer. 
With client end connecting directly to the database, it provides service in the form of jar and requires no extra deployment and dependence. 
It can be considered as an enhanced JDBC driver, which is fully compatible with JDBC and all kinds of ORM frameworks.
T
terrymanu 已提交
43

T
terrymanu 已提交
44 45
* Applicable in any ORM framework based on Java, such as JPA, Hibernate, Mybatis, Spring JDBC Template or direct use of JDBC.
* Based on any third-party database connection pool, such as DBCP, C3P0, BoneCP, Druid, HikariCP.
46
* Support any kind of database that conforms to JDBC standard: MySQL, Oracle, SQLServer and PostgreSQL for now.
T
terrymanu 已提交
47

48
![Sharding-JDBC Architecture](https://shardingsphere.apache.org//document/current/img/sharding-jdbc-brief.png)
T
terrymanu 已提交
49 50

### Sharding-Proxy
T
terrymanu 已提交
51

T
tuohai666 已提交
52
[![Download](https://img.shields.io/badge/release-download-orange.svg)](https://www.apache.org/dyn/closer.cgi?path=incubator/shardingsphere/4.0.0-RC2/apache-shardingsphere-incubating-4.0.0-RC2-sharding-proxy-bin.tar.gz)
C
Chris Cao 已提交
53
[![Docker Pulls](https://img.shields.io/docker/pulls/shardingsphere/sharding-proxy.svg)](https://store.docker.com/community/images/shardingsphere/sharding-proxy)
T
terrymanu 已提交
54

T
terrymanu 已提交
55
Sharding-Proxy defines itself as a transparent database proxy, providing a database server that encapsulates database binary protocol to support heterogeneous languages. 
T
terrymanu 已提交
56
Friendlier to DBA, the MySQL/PostgreSQL version provided now can use any kind of client access (such as MySQL Command Client, MySQL Workbench, Navicat etc.) that is compatible of MySQL/PostgreSQL protocol to operate data.
T
terrymanu 已提交
57

T
terrymanu 已提交
58 59
* Totally transparent to applications, it can be used directly as MySQL and PostgreSQL.
* Applicable to any kind of compatible of client end that is compatible of MySQL and PostgreSQL protocol.
T
terrymanu 已提交
60

61
![Sharding-Proxy Architecture](https://shardingsphere.apache.org//document/current/img/sharding-proxy-brief_v2.png)
T
terrymanu 已提交
62

T
terrymanu 已提交
63
### Sharding-Sidecar(TODO)
T
terrymanu 已提交
64

T
terrymanu 已提交
65 66
Sharding-Sidecar (TODO) defines itself as a cloud native database agent of Kubernetes environment, in charge of all the access to database in the form of sidecar. 
It provides a mesh layer interacting with database, we call this as `Database Mesh`.
T
terrymanu 已提交
67

T
terrymanu 已提交
68 69 70 71
Database Mesh emphasizes on how to connect distributed database access application with the database. 
Focusing on interaction, it effectively organizes the interaction between messy applications and database. 
The application and database that use Database Mesh to visit database will form a large grid system, where they just need to be put into the right position accordingly. 
They are all governed by mesh layer.
T
terrymanu 已提交
72

73
![Sharding-Sidecar Architecture](https://shardingsphere.apache.org//document/current/img/sharding-sidecar-brief_v2.png)
T
terrymanu 已提交
74

T
terrymanu 已提交
75 76
|                         | *Sharding-JDBC* | *Sharding-Proxy*     | *Sharding-Sidecar* |
| ----------------------- | --------------- | -------------------- | ------------------ |
T
terrymanu 已提交
77
| Database                | Any             | MySQL/PostgreSQL     | MySQL/PostgreSQL   |
T
terrymanu 已提交
78 79
| Connections Count Cost  | High            | Low                  | High               |
| Supported Languages     | Java Only       | Any                  | Any                |
T
terrymanu 已提交
80 81 82 83
| Performance             | Low loss        | Relatively High loss | Low loss           |
| Decentralization        | Yes             | No                   | No                 |
| Static Entry            | No              | Yes                  | No                 |

T
terrymanu 已提交
84 85 86
### Hybrid Architecture

Sharding-JDBC adopts decentralized architecture, applicable to high-performance light-weight OLTP application developed with Java; 
T
terrymanu 已提交
87
Sharding-Proxy provides static entry and all languages support, applicable for OLAP application and the sharding databases management and operation situation.
T
terrymanu 已提交
88 89

ShardingSphere is an ecosphere consists of multiple endpoints together.
T
terrymanu 已提交
90
Through mixed use of Sharding-JDBC and Sharding-Proxy and unified sharding strategy by same registry center, ShardingSphere can build application system applicable to all kinds of scenarios. 
T
terrymanu 已提交
91 92
Architects can adjust the system architecture to the most applicable one to current business more freely.

93
![ShardingSphere Hybrid Architecture](https://shardingsphere.apache.org//document/current/img/shardingsphere-hybrid.png)
T
terrymanu 已提交
94

T
terrymanu 已提交
95
## Features
T
terrymanu 已提交
96

T
terrymanu 已提交
97
### Data Sharding
T
terrymanu 已提交
98

T
terrymanu 已提交
99
* Database sharding & Table sharding
T
terrymanu 已提交
100
* Read-write splitting
T
terrymanu 已提交
101 102
* Sharding strategy customization
* Centre-less Distributed primary key
T
terrymanu 已提交
103

T
terrymanu 已提交
104
### Distributed Transaction
T
terrymanu 已提交
105

T
terrymanu 已提交
106
* Unified Transaction API
T
terrymanu 已提交
107 108
* XA transaction
* BASE transaction
T
terrymanu 已提交
109

T
terrymanu 已提交
110
### Database Orchestration
T
terrymanu 已提交
111

T
terrymanu 已提交
112 113 114 115
* Dynamic Configuration
* Orchestration & Governance
* Data Encryption
* Tracing & Observability
Z
zdrjson 已提交
116
* Elastic scaling out (Planning)
T
terrymanu 已提交
117

T
terrymanu 已提交
118
## Project Status
T
terrymanu 已提交
119

T
terrymanu 已提交
120
![Status](https://shardingsphere.apache.org/document/current/img/shardingsphere-status_en.png)
T
terrymanu 已提交
121

122
## How to Build
T
terrymanu 已提交
123

T
terrymanu 已提交
124
Install `maven` and run command:
T
terrymanu 已提交
125 126

```shell
T
terrymanu 已提交
127
mvn clean install -Prelease
T
terrymanu 已提交
128
``` 
T
tuohai666 已提交
129

T
tuohai666 已提交
130
Artifact:
T
tuohai666 已提交
131

T
tuohai666 已提交
132
```
T
tuohai666 已提交
133 134 135
sharding-distribution/sharding-jdbc-distribution/target/apache-shardingsphere-incubating-${latest.release.version}-sharding-jdbc-bin.tar.gz: Binary package of Sharding-JDBC
sharding-distribution/sharding-proxy-distribution/target/apache-shardingsphere-incubating-${latest.release.version}-sharding-proxy-bin.tar.gz: Binary package of Sharding-Proxy
sharding-distribution/shardingsphere-src-distribution/target/apache-shardingsphere-incubating-${latest.release.version}-src.zip: Source code package of ShardingSphere
T
tuohai666 已提交
136
```