Skip to content

Commit

Permalink
update KingDoc
Browse files Browse the repository at this point in the history
  • Loading branch information
cppmajor committed Apr 28, 2018
1 parent 55cd278 commit 9d6b711
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 24 deletions.
17 changes: 9 additions & 8 deletions doc/KingDoc/admin_command_introduce.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ mysql> admin server(opt,k,v) values('show','proxy','config');
| Key | Value |
+--------------+----------------+
| Addr | 127.0.0.1:9696 |
| User | kingshard |
| User_List | root,kingshard |
| LogPath | ./ |
| LogLevel | debug |
| LogSql | on |
Expand Down Expand Up @@ -66,13 +66,14 @@ mysql> admin server(opt,k,v) values('show','node','config');
#查看schema配置
mysql> admin server(opt,k,v) values('show','schema','config');
+-----------+------------------+---------+------+--------------+-----------+---------------+
| DB | Table | Type | Key | Nodes_List | Locations | TableRowLimit |
+-----------+------------------+---------+------+--------------+-----------+---------------+
| kingshard | | default | | node1 | | 0 |
| kingshard | test_shard_hash | hash | id | node1, node2 | 4, 4 | 0 |
| kingshard | test_shard_range | range | id | node1, node2 | 4, 4 | 10000 |
+-----------+------------------+---------+------+--------------+-----------+---------------+
+-----------+-----------+------------------+---------+------+--------------+-----------+---------------+
| User | DB | Table | Type | Key | Nodes_List | Locations | TableRowLimit |
+-----------+-----------+------------------+---------+------+--------------+-----------+---------------+
| kingshard | kingshard | | default | | node1 | | 0 |
| kingshard | kingshard | test_shard_hash | hash | id | node1, node2 | 4, 4 | 0 |
| kingshard | kingshard | test_shard_range | range | id | node1, node2 | 4, 4 | 10000 |
| root | kingshard | | default | | node1 | | 0 |
+-----------+-----------+------------------+---------+------+--------------+-----------+---------------+
3 rows in set (0.00 sec)
Expand Down
15 changes: 10 additions & 5 deletions doc/KingDoc/how_to_use_kingshard.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@
# kingshard的地址和端口
addr : 0.0.0.0:9696
# 连接kingshard的用户名和密码
user : kingshard
password : kingshard
# 连接kingshard的用户名和密码的用户列表
-user_list:
-
user : kingshard
password : kingshard
#kingshard的web API 端口
web_addr : 0.0.0.0:9797
#调用API的用户名和密码
Expand Down Expand Up @@ -79,8 +81,11 @@ nodes :
slave :
down_after_noalive: 100
# 分表规则
schema :
# 各用户的分表规则
schema_list :
-
#schema的所属用户名
user: kingshard
#分表分布的node名字
nodes: [node1,node2]
#所有未分表的SQL,都会发往默认node。
Expand Down
9 changes: 7 additions & 2 deletions doc/KingDoc/how_to_use_kingshard_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ web_addr : 0.0.0.0:9797
web_user : admin
web_password : admin
# server user and password
# user list with user name and password
user_list:
-
user : kingshard
password : kingshard
Expand Down Expand Up @@ -87,8 +89,11 @@ nodes :
# 0 will no down
down_after_noalive: 32
# schema list include all user's schema
# schema defines which db can be used by client and this db's sql will be executed in which nodes
schema :
schema_list :
-
user: kingshard
nodes: [node1,node2]
default: node1
shard:
Expand Down
20 changes: 20 additions & 0 deletions doc/KingDoc/kingshard_admin_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ curl -X GET \
返回结果:
[
{
"user": "kingshard",
"db": "kingshard",
"Table": "",
"Key": "",
Expand All @@ -212,6 +213,7 @@ curl -X GET \
"DateRange": null
},
{
"user": "kingshard",
"db": "kingshard",
"Table": "test_shard_hash",
"Key": "id",
Expand All @@ -228,6 +230,7 @@ curl -X GET \
"DateRange": null
},
{
"user": "kingshard",
"db": "kingshard",
"Table": "test_shard_range",
"Key": "id",
Expand All @@ -244,6 +247,7 @@ curl -X GET \
"DateRange": null
},
{
"user": "kingshard",
"db": "kingshard",
"Table": "test_shard_time",
"Key": "id",
Expand All @@ -260,6 +264,7 @@ curl -X GET \
"DateRange": null
},
{
"user": "kingshard",
"db": "kingshard",
"Table": "test_shard_month",
"Key": "dtime",
Expand All @@ -276,6 +281,7 @@ curl -X GET \
]
},
{
"user": "kingshard",
"db": "kingshard",
"Table": "test_shard_day",
"Key": "mtime",
Expand All @@ -290,6 +296,20 @@ curl -X GET \
"20160306-20160307",
"20160308-20160309"
]
},
{
"user": "root",
"db": "kingshard",
"Table": "",
"Key": "",
"Nodes": [
"node1",
"node2"
],
"Locations": null,
"Type": "default",
"TableRowLimit": 0,
"DateRange": null
}
]
```
Expand Down
12 changes: 9 additions & 3 deletions doc/KingDoc/kingshard_date_sharding.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,12 @@ kingshard的配置文件如下所示:
# server listen addr
addr : 0.0.0.0:9696
# server user and password
# user list with user name and password
user_list:
-
user : kingshard
password : kingshard
# the web api server
web_addr : 0.0.0.0:9797
#HTTP Basic Auth
Expand Down Expand Up @@ -98,8 +101,11 @@ nodes :
# 0 will no down
down_after_noalive: 32
# schema defines sharding rules, the db is the sharding table database.
schema :
# schema list include all user's schema
# schema defines which db can be used by client and this db's sql will be executed in which nodes
schema_list :
-
user: kingshard
nodes: [node1,node2]
default: node1
shard:
Expand Down
16 changes: 11 additions & 5 deletions doc/KingDoc/kingshard_install_document.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@
# kingshard的地址和端口
addr : 0.0.0.0:9696
# 连接kingshard的用户名和密码
user : kingshard
password : kingshard
# 连接kingshard的用户名和密码的用户列表
user_list:
-
user : kingshard
password : kingshard
#kingshard的web API 端口
web_addr : 0.0.0.0:9797
#调用API的用户名和密码
Expand Down Expand Up @@ -70,8 +72,12 @@ nodes :
slave :
down_after_noalive: 100
# 分表规则
schema :
# 各用户的分表规则
schema_list :
-
#schema的所属用户名
user: kingshard
nodes: [node1,node2]
#分表分布的node名字
nodes: [node1,node2]
#所有未分表的SQL,都会发往默认node。
Expand Down
2 changes: 1 addition & 1 deletion proxy/server/conn_admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,6 @@ func (c *ClientConn) handleShowNodeConfig() (*mysql.Resultset, error) {
}

func (c *ClientConn) handleShowSchemaConfig() (*mysql.Resultset, error) {
var Column = 7
var rows [][]string
var names []string = []string{
"User",
Expand All @@ -513,6 +512,7 @@ func (c *ClientConn) handleShowSchemaConfig() (*mysql.Resultset, error) {
"Locations",
"TableRowLimit",
}
var Column = len(names)

for _, schemaConfig := range c.proxy.cfg.SchemaList {
//default Rule
Expand Down

0 comments on commit 9d6b711

Please sign in to comment.