Mycat zookeeper norm zookeeper sharding-by-month
Sharding-by-month has been used when calling Dynamic Route
1. rule. xml
Please wait until (then again) until then again before again until then
- <TableRule name = "sharding-by-month">
- <Rule>
- <Columns> createtime </columns>
- <Algorithm> partbymonth </algorithm>
- </Rule>
- </TableRule>
- <Function name = "partbymonth"
- Class = "io. mycat. route. function. PartitionByMonth">
- <Property name = "dateFormat"> yyyy-MM-dd HH: mm: ss </property>
- <Property name = "sBeginDate"> 00:00:00 </property>
- </Function>
DateFormat: How many threads are there? SBeginDate? Br/>
2. schema. xml
Please wait until (then again) until then again before again until then
- <? Xml version = "1.0"?>
- <! DOCTYPE mycat: schema SYSTEM "schema. dtd">
- <Mycat: schema xmlns: mycat = "http://io.mycat/">
- <Schema name = "logdb" checkSQLschema = "false" sqlMaxLimit = "100">
- <Table name = "tb_log_t" primaryKey = "ID" autoIncrement = "true" dataNode = "dn1, dn2, dn3, dn4, dn5, dn6 "rule =" mod-long "/>
- <Table name = "tb_user_t" dataNode = "dn1, dn2, dn3, dn4, dn5, dn6" rule = "sharding-by-intfile-provcode"/>
- <Table name = "tb_user_detail_t" dataNode = "dn1, dn2, dn3, dn4, dn5, dn6" rule = "auto-sharding-long-userid"/>
- <Table name = "tb_user_murmur_t" dataNode = "dn1, dn2, dn3, dn4, dn5, dn6" rule = "sharding-by-murmur"/>
- <Table name = "tb_user_murmur_string_t" dataNode = "dn1, dn2, dn3, dn4, dn5, dn6" rule = "sharding-by-murmur-userid"/>
- <Table name = "tb_user_crc32slot_t" dataNode = "dn1, dn2, dn3, dn4, dn5, dn6" rule = "crc32slot"/>
- <Table name = "tb_user_partbymonth_t" dataNode = "dn $1-13" rule = "sharding-by-month"/>
- </Schema>
- <Schema name = "coss03" checkSQLschema = "false" sqlMaxLimit = "100" dataNode = "dnoss03"/>
- <DataNode name = "dn1" dataHost = "localhost1" database = "log01"/>
- <DataNode name = "dn2" dataHost = "localhost1" database = "log02"/>
- <DataNode name = "dn3" dataHost = "localhost1" database = "log03"/>
- <DataNode name = "dn4" dataHost = "localhost1" database = "log04"/>
- <DataNode name = "dn5" dataHost = "localhost1" database = "log05"/>
- <DataNode name = "dn6" dataHost = "localhost1" database = "log06"/>
- <DataNode name = "dn7" dataHost = "localhost1" database = "log01"/>
- <DataNode name = "dn8" dataHost = "localhost1" database = "log02"/>
- <DataNode name = "dn9" dataHost = "localhost1" database = "log03"/>
- <DataNode name = "dn10" dataHost = "localhost1" database = "log04"/>
- <DataNode name = "dn11" dataHost = "localhost1" database = "log05"/>
- <DataNode name = "dn12" dataHost = "localhost1" database = "log06"/>
- <DataNode name = "dn13" dataHost = "localhost1" database = "log01"/>
- <DataNode name = "dnoss03" dataHost = "localhost1" database = "oss03"/>
- <DataHost name = "localhost1" maxCon = "1000" minCon = "10" balance = "0"
- WriteType = "0" dbType = "mysql" dbDriver = "native" switchType = "1" slaveThreshold = "100">
- <Heartbeat> select user ()
- <! -- Can have multi write hosts -->
- <WriteHost host = "hostM1" url = "192.168.56.141: 3306" user = "root"
- Password = "mysql">
- <! -- Can have multi read hosts -->
- <ReadHost host = "hostS2" url = "192.168.56.142: 3306" user = "root" password = "mysql"/>
- </WriteHost>
- </DataHost>
- </Mycat: schema>
Name = "tb_user_partbymonth_t? Dn $1-13 "13 atatanode, datanode ogogog( log01 og06 ), 13 atatanode, 13? What do you call this? 015-01 success? 016-01, there are two major reasons for this problem. chema. xml cute.
3. Why? Br/> create table 'tb _ user_partbymonth_t '(
'Id' varchar (32) not null,
'Name' varchar (64) default null,
'Createtime' datetime DEFAULT CURRENT_TIMESTAMP
) ENGINE = InnoDB default charset = utf8;
Zookeeper editions)
Insert into tb_user_partbymonth_t (id, name, createtime) values ('a0001 ', 'name1', '2017-01-01 10:00:00 ');
Insert into tb_user_partbymonth_t (id, name, createtime) values ('a0002', 'name1', '2017-02-02 10:00:00 ');
Insert into tb_user_partbymonth_t (id, name, createtime) values ('a0003', 'name1', '2017-03-01 00:00:00 ');
Insert into tb_user_partbymonth_t (id, name, createtime) values ('a0004', 'name1', '2017-04-01 00:00:00 ');
Insert into tb_user_partbymonth_t (id, name, createtime) values ('a0005 ', 'name1', '2017-05-01 10:00:00 ');
Insert into tb_user_partbymonth_t (id, name, createtime) values ('a0006', 'name1', '2017-06-02 10:00:00 ');
Insert into tb_user_partbymonth_t (id, name, createtime) values ('a0007', 'name1', '2017-07-01 00:00:00 ');
Insert into tb_user_partbymonth_t (id, name, createtime) values ('a0008', 'name1', '2017-08-01 00:00:00 ');
Insert into tb_user_partbymonth_t (id, name, createtime) values ('a0009', 'name1', '2017-09-01 10:00:00 ');
Insert into tb_user_partbymonth_t (id, name, createtime) values ('a0010', 'name1', '2017-10-02 10:00:00 ');
Insert into tb_user_partbymonth_t (id, name, createtime) values ('a0011', 'name1', '2017-11-01 00:00:00 ');
Insert into tb_user_partbymonth_t (id, name, createtime) values ('a0012', 'name1', '2017-12-01 00:00:00 ');
Insert into tb_user_partbymonth_t (id, name, createtime) values ('a0013 ', 'name1', '2017-01-01 00:00:00 ');
-- The End --