/***
* 先根據擷取欄位的日期分組,再根據字段值資料按天入錶
* @author fx_demon**/
public class partitionbysubstringrangedateday extends abstractpartitionalgorithm
implements rulealgorithm
}@override
public integer calculate(string columnvalue) else
}return null;
}// 在columnvalue擷取日期的起始記錄
public void setstartindex(string startindex)
// 資料庫節點的數量
public void setpartitioncount(string partitioncount)
}/** 日期分組,逗號分隔如 ,【 20170101@20170331 , 20170401@20170630】 或 【 20170101@20170331 , 2017-04-01@2017-06-30】*/
public void setrangedate(string rangedatestr)
}public void setdateformat(final string dateformat)
this.dateformat = dateformat;
}@override
public int getpartitionnum() }
Mycat分庫分表
schema.xml 配置 name dn1 datahost localhost1 database db1 name dn2 datahost localhost1 database db2 name dn3 datahost localhost1 database db3 把localhost...
mycat分庫分表
一 修改schema.xml select user 二 修改server.xml 0 0 10 011m 1k0 384m true 123456 testdb user testdb true 三 啟動關閉1 進入bin目錄,2 啟動輸入.mycat start。關閉命令 mycat stop ...
mycat分庫分表
mycat是資料庫分庫分表的中介軟體,mycat使用最多的兩個功能是 讀寫分離和分庫分表功能,支援全域性表和e r關係 這兩個比較實用 mycat相當於是乙個 可以將多個實際資料庫組合成乙個完整的虛擬資料庫 我們可以直接訪問mycat的埠,其使用的是mysql原生的協議連線資料庫進行通訊 mycat...