您好,登錄后才能下訂單哦!
Mysql mycat讀寫分離:
下載網址:http://dl.mycat.io
Mycat官方網址:http://mycat.org.cn
說明:
10.0.1.2為mycat服務器,10.0.1.3、10.0.1.4為mysql服務器
配置讀寫分離:
<?xml version="1.0"?>
<!DOCTYPE mycat:schema SYSTEM "schema.dtd">
<mycat:schema xmlns:mycat="http://io.mycat/">
<schema name="TESTDB" checkSQLschema="true" sqlMaxLimit="100" randomDataNode="dn1">
<table name="travelrecord,address" dataNode="dn1" rule="auto-sharding-long" splitTableNames ="true"/>
</schema>
<dataNode name="dn1" dataHost="10.0.1.3" database="ming" />
<dataHost name="10.0.1.3" maxCon="1000" minCon="10" balance="3"
writeType="0" dbType="mysql" dbDriver="native" switchType="1" slaveThreshold="100">
<heartbeat>select user()</heartbeat>
<writeHost host="hostM1" url="10.0.1.3:3306" user="ming"
password="123@abAB">
<readHost host="hostS1" url="10.0.1.4:3306" user="ming"
password="xxxxxx"/>
</writeHost>
</dataHost>
</mycat:schema>
:wq
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mycat:server SYSTEM "server.dtd">
<mycat:server xmlns:mycat="http://io.mycat/">
<system>
<property name="nonePasswordLogin">0</property>
<property name="ignoreUnknownCommand">0</property>
<property name="useHandshakeV10">1</property>
<property name="removeGraveAccent">1</property>
<property name="useSqlStat">0</property>
<property name="useGlobleTableCheck">0</property>
<property name="sqlExecuteTimeout">300</property>
<property name="sequnceHandlerType">1</property>
<property name="sequnceHandlerPattern">(?:(\snext\s+value\s+for\sMYCATSEQ_(\w+))(,|)|\s)*)+</property>
<property name="subqueryRelationshipCheck">false</property>
<property name="sequenceHanlderClass">io.mycat.route.sequence.handler.HttpIncrSequenceHandler</property>
<property name="processorBufferPoolType">0</property>
<property name="handleDistributedTransactions">0</property>
<property name="useOffHeapForMerge">0</property>
<property name="memoryPageSize">64k</property>
<property name="spillsFileBufferSize">1k</property>
<property name="useStreamOutput">0</property>
<property name="systemReserveMemorySize">384m</property>
<property name="useZKSwitch">false</property>
<property name="strictTxIsolation">false</property>
<property name="useZKSwitch">true</property>
<property name="parallExecute">0</property>
</system>
<user name="ming" defaultAccount="true">
<property name="password">xxxxxx</property>
<property name="schemas">ming</property>
<property name="defaultSchema">ming</property>
</user>
</mycat:server>
:wq
<!-- how many data nodes -->
<property name="count">1</property>
:wq
0-500M=0
#500M-1000M=1
#1000M-1500M=2
:wq
啟動服務:
查看log是否有報錯(有的話根據報錯提示處理):
查看端口:
管理命令:
show @@help;
show @@version;
show @@datanode;
show @@heartbeat;
show @@datasource;
通過show @@datasource里不同mysql服務器的READ_LOAD和WRITE_LOAD次數可以看出是否有讀寫分離
讀寫:
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。