# server listen addr
addr : 0.0.0.0:9696
# prometheus server listen addr
prometheus_addr : 0.0.0.0:7080
# server user and password
user_list:
-
user : kingshard
password : kingshard
# the web api server
web_addr : 0.0.0.0:9797
#HTTP Basic Auth
web_user : admin
web_password : admin
# if set log_path, the sql log will write into log_path/sql.log,the system log
# will write into log_path/sys.log
#log_path : /Users/flike/log
# log level[debug|info|warn|error],default error
log_level : debug
# if set log_sql(on|off) off,the sql log will not output
log_sql: on
# only log the query that take more than slow_log_time ms
#slow_log_time : 100
# the path of blacklist sql file
# all these sqls in the file will been forbidden by kingshard
#blacklist_sql_file: /Users/flike/blacklist
# only allow this ip list ip to connect kingshard
# support ip and ip segment
#allow_ips : 127.0.0.1,192.168.15.0/24
# the charset of kingshard, if you don't set this item
# the default charset of kingshard is utf8.
#proxy_charset: gbk
# node is an agenda for real remote mysql server.
nodes :
-
name : node1
# default max conns for mysql server
max_conns_limit : 32
# all mysql in a node must have the same user and password
user : root
password : 123456
# master0 represents a real mysql master0 server
master : 127.0.0.1:3306
# slave0 represents a real mysql salve server,and the number after '@' is
# read load weight of this slave0.
slave : 127.0.0.1:3307
down_after_noalive : 32
-
name : node2
# default max conns for mysql server
max_conns_limit : 32
# all mysql in a node must have the same user and password
user : root
password : 123456
# master0 represents a real mysql master0 server
master : 127.0.0.1:3316
# slave0 represents a real mysql salve server
slave : 127.0.0.1:3317
# down mysql after N seconds noalive
# 0 will no down
down_after_noalive: 32
# schema defines sharding rules, the db is the sharding table database.
schema_list :
-
user: kingshard
nodes: [node1,node2]
default: node1
shard:
-
# 数据库
db : test
# 虚拟表
table: userinfo
# 用来分片的字段
key: id
# 两个主从复制集群
nodes: [node1, node2]
# hash 分片
type: hash
# 每个分片的表个数,通过 表名+ _ + 4位数字组成,userinfo_0000
locations: [4,4]