9.2 修改dble配置
说明: 此配置仅为示例配置,并非调优配置,请根据运行环境自行调优,调优步骤参考:2.18 性能观测以及调试概览
1. bootstrap.cnf
调整如下参数 -DNIOFrontRW=10 -DNIOBackendRW=10 -DfrontWorker=8 -DbackendWorker=6 -DsqlExecuteTimeout=3000000
2.user.xml
<?xml version="1.0" encoding="UTF-8"?>
<dble:user xmlns:dble="http://dble.cloud/" version="4.0">
<managerUser name="root" password="111111" />
<shardingUser name="test" password="111111" schemas="sbtest" maxCon="1000000">
</shardingUser>
</dble:user>
3.db.xml
<?xml version="1.0"?>
<dble:db xmlns:dble="http://dble.cloud/" version="4.0">
<dbGroup name="host_1" rwSplitMode="0" delayThreshold="-1">
<heartbeat >select USER()</heartbeat>
<dbInstance name="hostM1" url="172.20.134.3:3306" user="test1" password="test1" maxCon="1000" minCon="100" primary="true"/>
</dbGroup>
<dbGroup name="host_2" rwSplitMode="0" delayThreshold="-1">
<heartbeat >select USER()</heartbeat>
<dbInstance name="hostM1" url="172.20.134.4:3306" user="test1" password="test1" maxCon="1000" minCon="100" primary="true"/>
</dbGroup>
<dbGroup name="host_3" rwSplitMode="0" delayThreshold="-1">
<heartbeat >select USER()</heartbeat>
<dbInstance name="hostM1" url="172.20.134.5:3306" user="test1" password="test1" maxCon="1000" minCon="100" primary="true"/>
</dbGroup>
</dble:db>
4.sharding.xml
<?xml version="1.0"?>
<dble:sharding xmlns:dble="http://dble.cloud/" version="4.0">
<schema name="sbtest">
<shardingTable name="sbtest1" shardingNode="dn$1-9" function="hash-sysbench" shardingColumn="id" />
</schema>
<shardingNode name="dn$1-3" dbGroup="host_1" database="dbledb$1-3" />
<shardingNode name="dn$4-6" dbGroup="host_2" database="dbledb$4-6" />
<shardingNode name="dn$7-9" dbGroup="host_3" database="dbledb$7-9" />
<function name="hash-sysbench" class="Hash">
<property name="partitionCount">9</property>
<property name="partitionLength">1</property>
</function>
</dble:sharding>
5.在后端mysql节点创建相应物理库
- 172.20.134.3:3306 创建库:dbledb1, dbledb2, dbledb3
- 172.20.134.4:3306 创建库:dbledb4, dbledb5, dbledb6
- 172.20.134.5:33066 创建库:dbledb7, dbledb8, dbledb9