
MMMM需要5个IP,两个节点使用固定IP,两个程式读IP(只读),1个 程式写IP(用来更新)
后面这三个虚拟IP是根据节点的可用性在节点之间实现跳转的
一。IP分配
IP分配如下:
A :mysql master 246
固定IP:211.100.97.246
程式读IP:211.100.97.244 (虚拟)
B:mysql master 250
固定IP:211.100.97.250
程式读IP:211.100.97.243 (虚拟)
monitor 245
程式写IP:211.100.97.248 (虚拟)
给246添加虚拟IP 211.100.97.244
ifconfig eth1:1 211.100.97.244 netmask 255.255.255.224 up
[root@XKWB5510 software]# ifconfig -a|grep "inet addr"|head -3|tail -2|awk -F "[ :]+" '{print $4"/"$NF}'
211.100.97.246/255.255.255.224
211.100.97.244/255.255.255.224
给250添加虚拟IP 211.100.97.243
ifconfig eth0:1 211.100.97.243 netmask 255.255.255.224 up
[root@XKWB5705 software]# ifconfig -a|grep "inet addr"|head -2|awk -F "[ :]+" '{print $4"/"$NF}'
211.100.97.250/255.255.255.224
211.100.97.243/255.255.255.224
二 授权
在AB机器添加代理账号 useradd rep_agent
在monitor机器上添加监控账号 useradd rep_monitor
A上授权
mysql> grant all privileges on *.* to 'rep_monitor'@'%' identified by '123456';
mysql> grant all privileges on *.* to 'rep_agent'@'%' identified by '123456';
查看授权情况
mysql> select host,user from mysql.user where user like 'rep%';
+----------------+-------------+
| host | user |
+----------------+-------------+
| % | rep_agent |
| % | rep_monitor |
| 211.100.97.250 | replication |
| localhost | replication |
+----------------+-------------+
4 rows in set (0.01 sec)
B上授权
mysql> grant all privileges on *.* to 'rep_monitor'@'%' identified by '123456';
mysql> grant all privileges on *.* to 'rep_agent'@'%' identified by '123456';
mysql> select host,user from mysql.user where user like 'rep%';
+----------------+-------------+
| host | user |
+----------------+-------------+
| % | rep_agent |
| % | rep_monitor |
| 211.100.97.246 | replication |
| localhost | replication |
+----------------+-------------+
4 rows in set (0.00 sec)
源码包安装mysql-mmm
wget http://mysql-master-master.googlecode.com/files/mysql-master-master-1.2.3.tar.gz
tar zxf mysql-master-master-1.2.3.tar.gz
cd mysql-master-master-1.2.3
./install.pl