Mycat:1.6.7
mysql:5.1.37
配置成功啟動后,進行資料插入,沒有分表,啥問題呀?
配置如下
1、schema.xml
<?xml version="1.0"?>
<!DOCTYPE mycat:schema SYSTEM "schema.dtd">
<mycat:schema xmlns:mycat="http://io.mycat/">
<!-- name:是mycat的邏輯庫名稱,必須保證和server.xml檔案中配置的schemas一致,鏈接需要用的
checkSQLschema:是否檢測SQL陳述句中的MyCat特殊語意,比如如果采用資料庫方式實作自增ID,則SQL陳述句中ID欄位的值需改成next value for MYCATSEQ_TEST,如果checkSQLschema為false則不會檢測,按欄位串處理,開啟則會檢測為MyCat語意進行ID生成。
-->
<schema name="dsserver_db" checkSQLschema="false" sqlMaxLimit="100" dataNode="dn1">
<!-- name:邏輯表名
primaryKey:真實主鍵
autoIncrement:是否開啟主鍵自增
dataNode:指定資料節點(系結真實資料庫)
subTables:指定所有真實分表,t_user_0$0-2為縮寫,最侄訓被決議成t_user_00,t_user_01,t_user_02
role:指定路由策略
-->
<table name="NDS_Log" dataNode="dn1" rule="rule1" />
</schema>
<!--
dataNode節點中各屬性說明:
name:指定邏輯資料節點名稱;
dataHost:指定邏輯資料節點物理主機節點名稱;
database:指定物理主機節點上。如果一個節點上有多個庫,可使用運算式db$0-99, 表示指定0-99這100個資料庫;-->
<dataNode name="dn1" dataHost="localhost1" database="dsserver_db" />
<dataHost name="localhost1" maxCon="1000" minCon="10" balance="0"
writeType="0" dbType="mysql" dbDriver="jdbc" switchType="1" slaveThreshold="100">
<heartbeat>select user()</heartbeat>
<writeHost host="hostM1" url="jdbc:mysql://127.0.0.1:3306/dsserver_db?autoReconnect=true&useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT" user="root" password=""></writeHost>
</dataHost>
</mycat:schema>
2、server.xml
<?xml version="1.0" encoding="UTF-8"?>
<!-- - - Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License. - You
may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0
- - Unless required by applicable law or agreed to in writing, software -
distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the
License for the specific language governing permissions and - limitations
under the License. -->
<!DOCTYPE mycat:server SYSTEM "server.dtd">
<mycat:server xmlns:mycat="http://io.mycat/">
<system>
<property name="nonePasswordLogin">0</property> <!-- 0為需要密碼登陸、1為不需要密碼登陸 ,默認為0,設定為1則需要指定默認賬戶-->
<property name="useHandshakeV10">1</property>
<property name="useSqlStat">0</property> <!-- 1為開啟實時統計、0為關閉 -->
<property name="useGlobleTableCheck">0</property> <!-- 1為開啟全加班一致性檢測、0為關閉 -->
<!-- 配置MyCat ID自增方式,0 為本地檔案方式,1 為資料庫方式,2 為時間戳序列方式,3 為分布式 ZK ID 生成器,4 為 zk 遞增 id 生成。 從 1.6 增加 兩種 ZK 的全域 ID 生成演算法。詳細請參考:http://www.mycat.io/document/mycat-definitive-guide.pdf -->
<property name="sequnceHandlerType">1</property>
<property name="charset">utf8</property>
<property name="serverPort">8066</property>
<property name="managerPort">9066</property>
</system>
<!-- 全域SQL防火墻設定 -->
<!--白名單可以使用通配符%或著*-->
<!--例如<host host="127.0.0.*" user="root"/>-->
<!--例如<host host="127.0.*" user="root"/>-->
<!--例如<host host="127.*" user="root"/>-->
<!--例如<host host="1*7.*" user="root"/>-->
<!--這些配置情況下對于127.0.0.1都能以root賬戶登錄-->
<!--
<firewall>
<whitehost>
<host host="1*7.0.0.*" user="root"/>
</whitehost>
<blacklist check="false">
</blacklist>
</firewall>
-->
<user name="root" >
<property name="password">1234</property>
<property name="schemas">dsserver_db</property>
</user>
</mycat:server>
3、rule.xml
<?xml version="1.0" encoding="UTF-8"?>
<!-- - - Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License. - You
may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0
- - Unless required by applicable law or agreed to in writing, software -
distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the
License for the specific language governing permissions and - limitations
under the License. -->
<!DOCTYPE mycat:rule SYSTEM "rule.dtd">
<mycat:rule xmlns:mycat="http://io.mycat/">
<tableRule name="rule1">
<rule>
<!-- 真實分表欄位,這里為路由欄位 -->
<columns>Server_Time</columns>
<!-- 指定路由則規則所使用的演算法 -->
<algorithm>partbymonth</algorithm>
</rule>
</tableRule>
<function name="partbymonth"
class="io.mycat.route.function.PartitionByDate">
<property name="dateFormat">yyyy-MM-dd</property>
<property name="sBeginDate">2021-01-25</property>
<property name="sPartionDay">1</property>
</function>
</mycat:rule>
插入資料正常,但是資料沒有分表,為啥呢
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/252845.html
標籤:Java相關
