In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the relevant knowledge of "how to realize mycat range library and hash library". In the operation process of actual cases, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to deal with these situations! I hope you can read carefully and learn something!
2.1, scope sub-library
The so-called scope sub-database refers to the storage of different databases according to the scope of your id, or
Is based on the size of your database data to save a processing mechanism.
1.[mycat-server-01] Define a new fragmentation rule: vim/usr/local/mycat/conf/rule.xml;
Set the algorithm used for this fragmentation process:
At this point, you need to set up a rule file for fragmentation: orders-partition-long.txt.
2.[mycat-server-01] Write specific fragmentation rules: vim/usr/local/mycat/conf/orders-partition-long.txt
3.[mycat-server-01] Replace fragmentation rules: vim/usr/local/mycat/conf/schema.xml;
Then start mycat service: /usr/local/mycat/bin/mycat console; append data: INSERT INTOorders (oid,title,pubdate)VALUES(11,@@hostname,'2020-01- 01'); at this time, different shards will be selected according to the order number for data storage.
2.2 Hash library
Hash sub-library can realize the operation of saving to different databases according to different numbers. For example, suppose that it is required to save sub-libraries according to the region, which is called hash sub-library processing.
1.[mycat-server-01] Set a new fragmentation rule: vim/usr/local/mycat/conf/rule.xml;
·Add a new fragment item: the optional content of title must be fixed at this time;
·Add the corresponding algorithm configuration:
For hash shards, you need to set the data type of a shard:
·type=0: indicates digital fragmentation;
·type=1: describes string fragmentation.
·Establish hash fragmentation principle configuration file:
vim/usr/local/mycat/conf/myorders-partition-hash-int.txt
Then the title can be set at this time only a few points above.
2.[mycat-server-01] Configure mycat fragmentation rules: vim/usr/local/mycat/conf/schema.xml;
3.[mycat-server-01] Start mycat service: /usr/local/mycat/bin/mycatconsole;
The number of titles you can add is limited.
INSERTINTOorders(oid,title,pubdate)VALUES(13,'sh','2020-01-01');
In general, if you want to implement Hash fragmentation processing, you often need to have some fixed data information, such as: fragmentation by province, fragmentation by city.
"How to realize mycat range library and hash library" is introduced here. Thank you for reading. If you want to know more about industry-related knowledge, you can pay attention to the website. Xiaobian will output more high-quality practical articles for everyone!
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.