背景:
服务器列表:
机器IP | 机器名 | 安装组件 |
192.168.239.144 | douzi9 | Mysql Master1|Mycat1 |
192.168.239.145 | douzi10 | Mysql Slave1|HAProxy Keepalived Master|zk |
192.168.239.146 | douzi11 | Mysql Master2|Mycat2 |
192.168.239.147 | douzi12 | Mysql Slave2|HAProxy Keepalived Savle|mycat-web |
zookeeper安装:
1.官网下载tar包 zookeeper-3.4.12.tar.gz
2.上传虚拟机douzi11, 解压,命令:tar -zxvf zookeeper-3.4.12.tar.gz -C /usr/local
3.进入conf目录,创建一个zookeeper的配置文件zoo.cfg,可复制conf/zoo_sample.cfg作为配置文件
4.配置文件说明:
# The number of milliseconds of each tick # The number of ticks that the initial # The number of ticks that can pass between # the directory where the snapshot is stored.
# the port at which the clients will connect # the maximum number of client connections.
# server.N=YYY:A:B # 其中N表示服务器编号,YYY表示服务器的IP地址,A为LF通信端口,表示该服务器与集群中的leader交换的信息的端口。B为选举端口,表示选举新leader时服务器间相互通信的端口(当leader挂掉时,其余服务器会相互通信,选择出新的leader)。一般来说,集群中每个服务器的A端口都是一样,每个服务器的B端口也是一样。但是当所采用的为伪集群时,IP地址都一样,只能时A端口和B端口不一样。 |
启动命令:./bin/zkServer.sh start
停止命令:./bin/zkServer.sh stop
重启命令:./bin/zkServer.sh restart
状态查看命令:./bin/zkServer.sh status
Mycat-web安装
1.下载 Mycat-web-1.0-SNAPSHOT-20170102153329-linux.tar.gz,地址:
http://dl.mycat.io/mycat-web-1.0/
2.上传douzi12服务器,解压:
tar -zxvf Mycat-web-1.0-SNAPSHOT-20170102153329-linux.tar.gz -C /usr/local
3.启动mycat web
cd /usr/local/mycat-web
./start.sh &
浏览器上访问:http://douzi12:8082/mycat
添加zookeeper配置
添加mycat配置
添加mycat-vm配置