MySQL 20th article ~mycat A preliminary explanation of shard rules

Source: Internet
Author: User

A brief introduction: Today let's talk about the preliminary understanding of sharding rules

Second Frontier: Mycat's Shard rules are very rich and can also be extended according to Java

Three documents: Rule.xml

Four specific Shard rules:

<tablerule name= "Rule1" >
<tablerule name= "Rule2" >
<tablerule name= "Sharding-by-intfile" >
<tablerule name= "Auto-sharding-long" >
<tablerule name= "Mod-long" >
<tablerule name= "Sharding-by-murmur" >
<tablerule name= "Crc32slot" >
<tablerule name= "Sharding-by-month" >
<tablerule name= "Latest-month-calldate" >
<tablerule name= "Auto-sharding-rang-mod" >
<tablerule name= "Jch" >

Five what we need to know:

1 I consulted a lot of senior mycat on the line, Mycat's own shard rules have been fully satisfied with various business requirements

2 Understand all of the above Shard rules, and research and development to explore the application of fragmentation is very necessary

3 Some shard rules need to be related to the text setting rules, especially note

4 Shard Rule and Table type (Shard table +er model Shard) to meet business requirements

Six-Shard Rule composition

1 Table rule name schema to be set as here
2 Columns This is a shard field and must have this field for the Shard table
3 Algorithm Shard function name
4 Function name shard function names corresponding to the above
5 MapFile Many shard functions require a file-making rule here is the file name
6 Type the default value is 0,0 for Integer, non-zero means String
7 Defaultnode less than 0 means that the default node is not set, greater than or equal to 0 means setting the default node
Default node function: When enumerating shards, if you encounter an unrecognized enumeration value, let it be routed to the default node if you do not configure the default node (the Defaultnode value is less than 0 means that the default node is not configured), an unrecognized enumeration value will be an error, like This:can ' t find Datanode

8 <property name= "Count" >2</property> similar this will set the default node, if the actual number of configuration nodes is less than here, will load the configuration file fails, pay particular attention to

9 Special properties of some shard functions

I'll test every shard rule in the back.

MySQL 20th article ~mycat A preliminary explanation of shard rules

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.