安装lvs
下载:wget http://www.linuxvirtualserver.org/software/kernel-2.6/ipvsadm-1.24.tar.gz
tar -zxvf ipvsadm-1.24.tar.gz
cd tar -zxvf ipvsadm-1.24
make
make install
yum install ipv* 安装
验证
ipvsadm –v
ipvsadm v1.24 2003/06/07 (compiled with getopt_long and IPVS v1.2.0)说明安装成功
安装keepalived
tar –zxvf keepalived-1.2.12.tar.gz
cd keepalived-1.2.12
./configure --prefix=/usr/local/keepalived/
make
make install
ln -s /usr/local/keepalived/etc/keepalived /etc/
ln -s /usr/local/keepalived/etc/rc.d/init.d/keepalived /etc/rc.d/init.d/
ln -s /usr/local/keepalived/etc/sysconfig/keepalived /etc/sysconfig/
ln -s /usr/local/keepalived/bin/genhash /bin/
ln -s /usr/local/keepalived/sbin/keepalived /sbin/
configure时注意Use IPVS Framework、IPVS sync daemon support 、Use VRRP Framework要返回yes,否则无法关联ipvs功能
4、配置mysql的主从
Master(210.171)的配置
vi /etc/my.cnf
添加如下内容:
server-id = 1 ##master ID
binlog-do-db = ppl ##允许同步的库
binlog-ignore-db = mysql ##忽略同步的库,也就是不能同步的库
##配置文件中还需开启log-bin,例如log-bin = mysql-bin
mysql –uroot –p
以下内容在mysql中执行
mysql> grant replication slave on *.* to ‘repdb01’@’%’ identified by ‘123456‘;
mysql>create database db01;
mysql>flush logs;
mysql>show master status;
mysql>use db01
mysql> create table test(name char);