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