A high-performance MySQL proxy
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Fei Chen f17b393947
Merge pull request #580 from maskwang/hotfix/prometheus
2 years ago
backend 1.修复普罗米修斯对连接池的统计错误问题 2 years ago
cmd/kingshard #382,subtable index is sequential 4 years ago
config 增加prometheus监控 4 years ago
core #382,subtable index is sequential 4 years ago
doc typo 3 years ago
etc remove tmp config 2 years ago
monitor fix: 1. 修复监控节点数据被覆盖问题 2. 新增节点没有动态监控问题 2 years ago
mysql bugfix #310 5 years ago
proxy Merge pull request #565 from yuanqinguo/master 2 years ago
sqlparser support go mod 3 years ago
sqltypes modify doc 7 years ago
vendor support go mod 3 years ago
web support go mod 3 years ago
.gitignore git ignore vs code directory 6 years ago
.travis.yml update travis 3 years ago
Dockerfile delete: unnecessary run cmd 2 years ago
Makefile support go mod 3 years ago
README.md 将代码的clone路径改为$GOPATH 3 years ago
README_ZH.md Fix typo in README_ZH.md 3 years ago
dev.sh change travis.yml 7 years ago
go.mod support go mod 3 years ago
go.sum support go mod 3 years ago


kingshard 中文主页

Build Status


kingshard is a high-performance proxy for MySQL powered by Go. Just like other mysql proxies, you can use it to split the read/write sqls. Now it supports basic SQL statements (select, insert, update, replace, delete). The most important feature is the sharding function. Kingshard aims to simplify the sharding solution of MySQL. The Performance of kingshard is about 80% compared to connecting to MySQL directly.


1. Basic Function

  • Splits reads and writes
  • Client's ip ACL control.
  • Transaction in single node.
  • Support limiting the max count of connections to MySQL database.
  • Support setting the backend database online or offline dynamically.
  • Supports prepared statement: COM_STMT_PREPARE, COM_STMT_EXECUTE, etc.
  • Support multi slaves, and load balancing between slaves.
  • Support reading master database forcely.
  • Support last_insert_id().
  • Support MySQL backends HA.
  • Support set the charset of proxy.
  • Support SQL blacklist.
  • Support dynamically changing the config value of kingshard.

2. Sharding Function

  • Support hash,range and date sharding across multiple nodes.
  • Support sending sql to the specified node.
  • Support most commonly used functions, such as max, min, count, sum, and also support join, limit, order by,group by.


  1. Install Go
  2. git clone https://github.com/flike/kingshard.git $GOPATH/src/github.com/flike/kingshard
  3. cd $GOPATH/src/github.com/flike/kingshard
  4. source ./dev.sh
  5. make
  6. set the config file (etc/ks.yaml)
  7. run kingshard (./bin/kingshard -config=etc/ks.yaml)

Details of kingshard

1.How to use kingshard building a MySQL cluster


kingshard is under the Apache 2.0 license. See the LICENSE directory for details.