MySQL database business in some data similar to data dictionary, such as configuration file configuration, common business configuration or table with little change in data volume, these tables are often not particularly large, but most of the business scenario will be used, then this table is suitable for mycat global table, do not need to slice the data , just keep a copy of the data on all the shards, mycat in the join operation, the join aggregation of the business table and the global table takes precedence over the global table join within the same shard, avoids cross-Library joins, and when the data is inserted, Mycat will distribute the data to all the shards that correspond to the global table, and it will randomly fetch a node to read the data when the data is read.
The global table is configured as follows:
<table name= "T_area" primarykey= "id" type= "global" datanode= "DN1,DN2"/>
<?xml version= "1.0"?>
<! DOCTYPE mycat:schema SYSTEM "SCHEMA.DTD" >
<mycat:schema xmlns:mycat= "http://io.mycat/" >
<schema name= "TESTDB" checksqlschema= "true" sqlmaxlimit= "datanode=" "DN1" >
<table name= "Temp2" primarykey= "id" type= "global" datanode= "DN1,DN2"/>
</schema>
<schema name= "TESTDB2" checksqlschema= "true" sqlmaxlimit= "datanode=" "DN2" >
</schema>
<datanode name= "dn1" datahost= "Node1" database= "test"/>
<datanode name= "DN2" datahost= "Node1" database= "Test2"/>
<datahost name= "Node1" maxcon= "Ten" mincon= "5" balance= "2" writetype= "0"
Dbtype= "MySQL" dbdriver= "native" switchtype= "-1" >
<writehost host= "Master1" url= "192.168.237.128:3308" user= "root"
password= "MySQL" >
</writeHost>
<writehost host= "salve1" url= "192.168.237.130:3308" user= "root"
password= "MySQL" >
</writeHost>
</dataHost>
</mycat:schema>
Most of the databases used by internet companies are MySQL, want to stand out from the many it workers, need to have advanced technology, learning to add value is essential. The way of learning is your insistence. Old boy Education MySQL DBA course, after several update courses, to eliminate the theory, the whole enterprise real case combined with theoretical teaching, want to deep learning MySQL DBA knowledge, can pay attention to the old boy education.
MySQL Database weekend learning mycat global table MySQL DBA