为MySQL安装配置代理工具Kingshard的基本教程

2019-01-04 17:16:47王冬梅

 
通过kingshard的日志可以看到数据插入时根据不同的hash值,插入到不同的子表里面去了。


查看数据

[root@testnode kingshard]# mysql -h 127.0.0.1 -P 9696 -u kingshard -pkingshard -e "select * from test_shard_hash where id in (2, 3, 4, 5)"
+----+------+------+-------+------+------+------+ | id | str | f | e | u | i | ni | +----+------+------+-------+------+------+------+ | 2 | abc2 | 3.14 | test2 | 255 | -127 | NULL | | 3 | abc3 | 3.14 | | 255 | -127 | NULL | | 4 | abc4 | 3.14 | | 255 | -127 | NULL | | 5 | abc5 | 3.14 | | 255 | -127 | NULL | +----+------+------+-------+------+------+------+

 
注意kingshard不支持 select * from test_hard_hash查询, 只支持带条件的查询。