时间:2021-07-01 10:21:17 帮助过:43人阅读
<property name="password">123456</property>
<property name="defaultPool">master</property>
<property name="writePool">master</property>
<property name="readPool">slaves</property>
[root@localhost amoeba]# cp conf/dbServers.xml conf/dbServers.xml{.bak}
[root@localhost amoeba]# vim conf/dbServers.xml
找到下面的内容并修改。
<property name="user">test</property>
<property name="password">123.com</property>
<dbServer name="master" parent="abstractServer">
<factoryConfig>
<!-- mysql ip -->
<property name="ipAddress">192.168.253.6</property>
</factoryConfig>
</dbServer>
<dbServer name="slave1" parent="abstractServer">
<factoryConfig>
<!-- mysql ip -->
<property name="ipAddress">192.168.253.7</property>
</factoryConfig>
</dbServer>
<dbServer name="slave2" parent="abstractServer">
<factoryConfig>
<!-- mysql ip -->
<property name="ipAddress">192.168.253.8</property>
</factoryConfig>
</dbServer>
<dbServer name="slaves" virtual="true"> 注 “slaves”是一个组,刚才在上面定义的。
<poolConfig class="com.meidusa.amoeba.server.MultipleServerPool">
<!-- Load balancing strategy: 1=ROUNDROBIN , 2=WEIGHTBASED , 3=HA-->
<property name="loadbalance">1</property>
<!-- Separated by commas,such as: server1,server2,server1 -->
<property name="poolNames">slave1,slave2</property>
</poolConfig>
</dbServer>
组内成员
[root@localhost amoeba]# bin/amoeba start& 放到后台运行。
[root@localhost amoeba]# netstat -anpt |grep java
[root@localhost amoeba]# netstat -anpt |grep 8066
通过上面两条命令可以查看8066、3306端口是否已经开启.
最后就是找一台client用于测试。
mysql主从复制和读写分离
标签:end 这一 ble rop nec file http profile 中继日志