HA 高可用集群

  1. hostname 设置好,分别为master 和 slave

  2. 关闭防火墙 iptables -F;
    关闭selinux: setenforce 0

  3. vi /etc/hosts // 增加内容如下:
    192.168.100.5 master
    192.168.100.13 slave

  4. 主上(master)配置
    cp authkeys ha.cf haresources /etc/ha.d/
    cd /etc/ha.d
    vi authkeys //加入
    3 md5 Hello!

    chmod 600 authkeys

    vi haresources //加入
    master 192.168.100.110/24/eth0:0 nginx //VIP
    vi ha.cf //改为如下内容:
    debugfile /var/log/ha-debug
    logfile /var/log/ha-log
    logfacility local0
    keepalive 2
    deadtime 30
    warntime 10
    initdead 60
    udpport 694
    ucast eth0 192.168.100.13 //这里写对方ip
    auto_failback on
    node master //两个主机名
    node slave
    ping 192.168.100.1 //仲裁
    respawn hacluster /usr/lib64/heartbeat/ipfail //64位要写lib64

5.把主上的三个配置拷贝到从上:
cd /etc/ha.d/
scp authkeys ha.cf haresources aming1:/etc/ha.d/

6.到从上(slave) 编辑ha.cf
vi /etc/ha.d/ha.cf //只需要更改一个地方
ucast eth1 192.168.100.13 改为 ucast eth1 192.168.100.5

7.启动heartbeat :
先主,后从
service heartbeat start

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值