浮三社区

 找回密码
 立即注册
搜索
查看: 46|回复: 0

[linux学习] Keepalived配置文档doc

[复制链接]

18

主题

21

帖子

91

积分

正式会员

Rank: 2

积分
91
发表于 2017-12-9 22:11:58 | 显示全部楼层 |阅读模式
Keepalived配置文档
环境: Centos 6.6 x86_64
Server1:192.168.116.171;nginx171;Master;nginx/1.6.2; keepalived-1.2.13-5.el6_6.x86_64
Server2:192.168.116.173;nginx173;Slave;nginx/1.6.2; keepalived-1.2.13-5.el6_6.x86_64
配置过程:
删除rc.local中除nginx其他的启动项;
Server1&2 eth1网卡激活并修改BOOTPROTO=none
Server1&2: #yum install -ykeepalived;
Server1&2:#vi/etc/keepalived/nginx.sh
#------------------------------------------------------------------------------------
#!/bin/bash
A=`ps -C nginx -no-header |wc -l`
if [ $A -eq 1 ];then
    killall keepalived
Fi
#------------------------------------------------------------------------------------
#vi /etc/keepalived/route.sh
#------------------------------------------------------------------------------------
#!/bin/bash
route add default gateway 211.155.81.193 dev eth1
#------------------------------------------------------------------------------------
Server1:# vi/etc/keepalived/keepalived.conf
#------------------------------------------------------------------------------------
global_defs
{
notification_email    #通知email,根据实际情况配置
{
admin@example.com
}
notification_email_fromadmin@example.com
smtp_server 127.0.0.1
stmp_connect_timeout 30
router_id node1         #节点名标识,主要用于通知中
}
vrrp_script chk_http_port {
  script "/etc/keepalived/nginx.sh"  #在这里添加脚本链接
  interval 1      #脚本执行间隔
  weight 2         #脚本结果导致的优先级变更
}
vrrp_script route {
  script "/etc/keepalived/route.sh"



链接:https://pan.baidu.com/s/1slBNW3V 密码:jol0
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|浮三网 ( 粤ICP备13073689号

GMT+8, 2018-1-18 10:02 , Processed in 0.051558 second(s), 22 queries .

Powered by Discuz!

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表