码迷,mamicode.com
首页 > 其他好文 > 详细

centos6 安装 keepalived

时间:2017-05-20 01:04:24      阅读:271      评论:0      收藏:0      [点我收藏+]

标签:conf   .com   mail   linux   dir   lvs   vim   tar.gz   rc.d   

安装keepalived

yum -y install kernel-devel

ln -s /usr/src/kernels/2.6.32-642.15.1.el6.x86_64/ /usr/src/linux

cd /usr/local/src/
wget http://www.keepalived.org/software/keepalived-1.2.20.tar.gz
tar -zxvf keepalived-1.2.20.tar.gz
cd keepalived-1.2.20

./configure
make && make install

生成keepalived 的启动命令
cp /usr/local/etc/rc.d/init.d/keepalived /etc/init.d/

配置启动脚本的参数:
cp /usr/local/etc/sysconfig/keepalived /etc/sysconfig/

配置文件默认路径:
mkdir /etc/keepalived

拷贝配置文件到默认路径:
cp /usr/local/etc/keepalived/keepalived.conf /etc/keepalived/


cp /usr/local/sbin/keepalived /usr/sbin/


/etc/init.d/keepalived start

ps -ef |grep keepalived



cd /etc/keepalived/
cp keepalived.conf keepalived.conf.default
vim keepalived.conf

: notification_email {
  test@qq.com
}

router_id LVS_01

vrrp_instance VI_1 {
 state MASTER
 interface eth0
 virtual_router_id 51
 priority 150
 advert_int 1
 authentication {
 auth_type PASS
 auth_pass 1111
 }
 virtual_ipaddress {
 192.168.1.190/24 (2台机都一样,是ip addr 添加的虚拟IP)
 }
 }


/etc/init.d/keepalived start
ip addr add 192.168.1.190/24 dev eth0
ip addr


ip add|grep 192.168.1.190(只能在一台机有结果输出,不然就是裂脑了)


可以ping 同主,backup 有VIP(虚拟IP) 就认为是裂脑了

centos6 安装 keepalived

标签:conf   .com   mail   linux   dir   lvs   vim   tar.gz   rc.d   

原文地址:http://www.cnblogs.com/shijiu520/p/6880688.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!