https://github.com/berkaroad/saashard
根据具体业务数据的划分,实现db级别的数据分片拆分。思路来源mycat和kingshard。
https://github.com/berkaroad/saashard
Last synced: 10 months ago
JSON representation
根据具体业务数据的划分,实现db级别的数据分片拆分。思路来源mycat和kingshard。
- Host: GitHub
- URL: https://github.com/berkaroad/saashard
- Owner: berkaroad
- License: mit
- Created: 2016-03-25T22:35:44.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2018-09-06T09:09:36.000Z (over 7 years ago)
- Last Synced: 2024-06-20T10:13:32.747Z (almost 2 years ago)
- Language: Go
- Homepage:
- Size: 2.8 MB
- Stars: 31
- Watchers: 6
- Forks: 12
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SaaShard
[中文版](README.zh-CN.md "中文版")
SaaShard is a MySQL sharding solution, that based on SaaS application.
SaaS application, use multi-tenancy technologyis.
Each tenancy's data is isolated from db logically.For this feature, we can horizontal split data by the field 'tenant_id'.
Each sql statement that related with special tenancy, is only located at single db. So, we can remain the query capability as soon as possible.
## Compile and Run
### Source
```
go get github.com/berkaroad/saashard
cd $GOPATH/src/github.com/berkaroad/saashard
```
### Binary Release
[http://github.com/berkaroad/saashard-binary](http://github.com/berkaroad/saashard-binary "SaaShard Binary")
[https://github.com/berkaroad/docker-images/tree/master/saashard](https://github.com/berkaroad/docker-images/tree/master/saashard "SaaShard Dockerfile")
### Compile
```
make # compile in current platform
make build-all # compile in windows, linux and darwin platform.
```
### Run
```
make test # just for test
make dev # Run immediately, use dev.yaml config file.
make run # Run immediately, use ss.yaml config file.
```
## Features
- Support multi-query and multi-result.
- Support transaction.
- Support hint /*!saashard master */ to force execute on master.
- Support hint /*!saashard nodes=node1,node2 */ to force specify node list in DDL statement.
- Support split read and write. (Read balance use polling algorithm.)
- Support database sharding, supported algorithm is 'hash', 'mod'.
- Support backend connection pool.
- Support Stmt related command.(developing)
## SQL Client Support
- MySQL Workbench (tested version:6.3)
- SQLyog (tested version:10.2)
- ado.net
- entity framework (EF6)
## SQL Support
- simple query, join query, sub query is supported.
- DML statement
- DDL that only support table struct and index.
- VIEW is not supported, because it couldn't get shard key's value from those.
- maintain FUNCTION, PROCEDURE or TRIGGER is not supported.
```
/* Not supported, but you can replace it to above */
select (case t1.f1 when '0' then 'hello' else 'world' end) f1 from t1;
/* This is supported */
select (case when t1.f1='0' then 'hello' else 'world' end) f1 from t1;
```
```
/* Not supported, because this is dml statement, and couldn't get shard key's value. */
select f1,f2,f3 into t2 from t1
```
## Logical Architecture


## Contact Info
1. QQ Group: SaaShard 487761803