MySQL testdb /*proxy*/show status ;
+-----------------------------+-------------------------------------------------------------------+
| status_name | value |
+-----------------------------+-------------------------------------------------------------------+
| cluster | group_1605181791_302290 |
| **set_1605181898_1:ip | 10.53.179.14:4322;s1@10.53.178.227:4322@1@IDC_GZ_YDSS0301_79263@0 |
| set_1605181898_1:hash_range | 0---31 |
| **set_1605181972_3:ip | 10.53.179.14:4323;s1@10.53.178.227:4323@1@IDC_GZ_YDSS0301_79263@0 |
| set_1605181972_3:hash_range | 32---63 |
| set | set_1605181898_1,set_1605181972_3 |
+-----------------------------+-------------------------------------------------------------------+
6 rows in set (0.00 sec)
b、演示数据插入
我们针对之前创建的fbs分布式表进行数据的插入
MySQL testdb insert into fbs(a,b,c) values(10,1,'AAA'),(20,2,'bbb'),(30,3,'ccc'),(40,4,'dddd'),(50,5,'eee'),(60,6,'fff'),(70,7,'ggg'),(80,8,'hhhh');
MySQL testdb select * from fbs order by 1;
+----+------+------+
| a | b | c |
+----+------+------+
| 10 | 1 | AAA |
| 20 | 2 | bbb |
| 30 | 3 | ccc |
| 40 | 4 | dddd |
| 50 | 5 | eee |
| 60 | 6 | fff |
| 70 | 7 | ggg |
【php分布式数据库 php 分布式】| 80 | 8 | hhhh |
+----+------+------+
8 rows in set (0.00 sec)
c、透传查看数据在各个节点的分布情况
MySQL testdb /*proxy*/show status;
+-----------------------------+-------------------------------------------------------------------+
| status_name | value |
+-----------------------------+-------------------------------------------------------------------+
| cluster | group_1605181791_302290 |
| **set_1605181898_1:ip | 10.53.179.14:4322;s1@10.53.178.227:4322@1@IDC_GZ_YDSS0301_79263@0 |
| set_1605181898_1:hash_range | 0---31 |
| set_1605181972_3:ip | 10.53.179.14:4323;s1@10.53.178.227:4323@1@IDC_GZ_YDSS0301_79263@0 |
| set_1605181972_3:hash_range | 32---63 |
| set | set_1605181898_1,set_1605181972_3 |
+-----------------------------+-------------------------------------------------------------------+
6 rows in set (0.00 sec)
查看数据在set_1605181898_1 节点上的分布
MySQL testdb /*sets:set_1605181898_1*/select * from fbs order by 1;
+----+------+------+------------------+
| a | b | c | info |
+----+------+------+------------------+
| 10 | 1 | AAA | set_1605181898_1 |
| 30 | 3 | ccc | set_1605181898_1 |
| 40 | 4 | dddd | set_1605181898_1 |
| 50 | 5 | eee | set_1605181898_1 |
| 80 | 8 | hhhh | set_1605181898_1 |
+----+------+------+------------------+
5 rows in set (0.00 sec)
查看数据在set_1605181972_3节点上的分布
MySQL testdb /*sets:set_1605181972_3*/select * from fbs order by 1;
+----+------+------+------------------+
| a | b | c | info |
+----+------+------+------------------+
| 20 | 2 | bbb | set_1605181972_3 |
| 60 | 6 | fff | set_1605181972_3 |
| 70 | 7 | ggg | set_1605181972_3 |
+----+------+------+------------------+
3 rows in set (0.00 sec)
d、通过shardkey分片号查看数据
MySQL testdb /*shardkey:2*/select * from fbs order by 1;
+----+------+------+
| a | b | c |
+----+------+------+
| 20 | 2 | bbb |
| 60 | 6 | fff |
| 70 | 7 | ggg |
+----+------+------+
3 rows in set (0.00 sec)
支持透传种类和格式:
1、set名字可以通过/*proxy*/show status查询
2、/*sets:set_1名称*/ 透传指定节点
3、/*sets:allsets*/ 透传所有节点
4、/*shardkey:10*/ 透传到shardkey分片对应的set
5、支持透传sql到对应的一个或者多个set
分布式表的DDL部分的语句限制:
推荐阅读
- 发微信视频号怎么删除,怎么删除微信视频号发的视频
- 财富精算师小程序怎么注册的简单介绍
- 如何做新媒体布局创意案例,新媒体创新案例
- 网站制作视频教程下载,网站制作视频教程下载免费
- java中文写代码 java在哪儿写代码
- 华为手机商城质量怎么杨,华为商城的商品怎么样
- js字符串substr,js字符串substring
- 象棋直播走棋教程,象棋走棋步骤
- python递归函数分解 python递归函数基例