In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly shows you "how to configure schmea.xml in Mycat", the content is easy to understand, clear, hope to help you solve your doubts, let the editor lead you to study and learn "how to configure schmea.xml in Mycat" this article.
1. Basic environment dn1localhost1192.168.6.121:3306---writehost
192.168.6.121:3307---readhost
192.168.6.121:3308dn2locahost2192.168.6.120:3306---writehost
192.168.6.120:3307---readhost
192.168.6.121:3308dn3localhost3192.168.6.119:3306---writehost
192.168.6.119:3307---readhost
192.168.6.119:3308
2.schemal configuration
-default data node. If a new table company2 is not configured in the configuration file, it will be established on the dn1 data node by default (private table)
-sharding table, which is sliced to each physical node according to the corresponding sharding rules
-Global tables, tables on every node
-equivalent to company
-equivalent to company2
-the localhost corresponding to the data node and the real database
Select user ()
Select user ()
Select user ()
. to be continued
The query of the global table has the function of load balancing.
Mysql > select * from company;-the same data should be changed to different data to show the effect of load balancing
+-+ +
| | id | name |
+-+ +
| | 1 | this is 119 |
+-+ +
1 row in set (0.01 sec)
Mysql > select * from company
+-+ +
| | id | name |
+-+ +
| | 1 | this is 120 |
+-+ +
1 row in set (0.01 sec)
Mysql > select * from company
+-+ +
| | id | name |
+-+ +
| | 1 | this is 121 |
+-+ +
1 row in set (0.00 sec)
Fragmented table and private table can not be found jointly if they are not on the first elder brother node!
Uc sharding table, 4101 on the second node
Act is a private table, 4101 on the first node
Select * from uc_coupon where COUPON_ID=4101;-- checked separately, yes.
Select * from act_vote_info where id=4101;-check alone, yes
Select a. * from uc_coupon a dagger voice info b where a.COUPON_ID=b.id and b.id=4101 limit 1;-- joint search, can not find, because cross-node!
For example:
Mysql > select * from order2;-sharding table
+-- +
| | ID | PROVINCE | SN | CREATE_TIME | |
+-- +
| | 2 | shanghai | 2BJ0001 | 2017-05-09 15:01:33 |-Node 2 |
| | 1 | beijing | 2BJ0001 | 2017-04-23 21:48:08 |-Node 1 |
| | 3 | tianjin | 2BJ0001 | 2017-05-09 15:01:45 |
+-- +
3 rows in set (0.00 sec)
Mysql > select * from tt;-on private table node 1
+-+ +
| | id | name |
+-+ +
| | 2 | zhangsanli |
| | 1 | 12314 |
+-+ +
2 rows in set (0.00 sec)
Mysql > select a.recording b. * from tt a where a.id=b.ID and b. IDC 2;-2 is not on the same node as the private table and cannot be found.
Empty set (0.00 sec)
Mysql > select a.recording b. * from tt a where a.id=b.ID and b. ID table 1;-1 is on the same node as the private table, so you can find it.
+-- +
| | id | name | ID | PROVINCE | SN | CREATE_TIME | |
+-- +
| | 1 | 12314 | 1 | beijing | 2BJ0001 | 2017-04-23 21:48:08 |
+-- +
1 row in set (0.00 sec)
By the same token:
Sharding table and sharding table condition data cannot be found jointly if they are not on the same node!
Mysql > select a. *, b. * from order2 a _ r order3 b where a.id=b.id and a. IDC 2;-- all have data alone, but the id is equally divided on different nodes, but it still cannot cross nodes.
Empty set (0.00 sec)
Mysql > select * from order2
+-- +
| | ID | PROVINCE | SN | CREATE_TIME | |
+-- +
| | 2 | shanghai | 2BJ0001 | 2017-05-09 15:01:33 |
| | 1 | beijing | 2BJ0001 | 2017-04-23 21:48:08 |
| | 3 | tianjing | 2BJ0001 | 2017-05-15 14:52:17 |
+-- +
3 rows in set (0.00 sec)
Mysql > select * from order3
+-- +
| | ID | PROVINCE | SN | CREATE_TIME | |
+-- +
| | 2 | beijing | 2BJ0001 | 2017-05-15 14:56:27 |
| | 1 | tianjing | 2BJ0001 | 2017-05-15 14:56:35 |
| | 3 | shanghai | 2BJ0001 | 2017-05-15 14:56:17 |
+-- +
3 rows in set (0.00 sec)
Solution: note, see the document for detailed usage
Mysql > / *! mycat:catlet=demo.catlets.ShareJoin * / select b.snrec b.CreateTime from order2 a.CreateTIME aauthor order3b where a.id=b.id
+-+
| | CREATE_TIME | id | sn | CREATE_TIME | |
+-+
| | 2017-04-23 21:48:08 | 1 | 2BJ0001 | 2017-05-15 14:56:35 |
| | 2017-05-09 15:01:33 | 2 | 2BJ0001 | 2017-05-15 14:56:27 |
| | 2017-05-15 14:52:17 | 3 | 2BJ0001 | 2017-05-15 14:56:17 |
+-+
These are all the contents of the article "how to configure schmea.xml in Mycat". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.