Coder Social home page Coder Social logo

dikang123 / saashard Goto Github PK

View Code? Open in Web Editor NEW

This project forked from berkaroad/saashard

0.0 1.0 0.0 2.86 MB

根据具体业务数据的划分,实现db级别的数据分片拆分。思路来源mycat和kingshard。

License: MIT License

Makefile 0.21% Go 92.44% Batchfile 0.19% Shell 0.04% Yacc 7.12%

saashard's Introduction

SaaShard

中文版

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

https://github.com/berkaroad/docker-images/tree/master/saashard

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

logical architecture

logical schema

Contact Info

  1. QQ Group: SaaShard 487761803

saashard's People

Contributors

berkaroad avatar

Watchers

dikang123 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.