双心跳线

双心跳线

心跳线就是两台服务器之间再搭一个内网进行通信,保障主线断了,两台服务器还能通过内网线路通信。双心条线就在内网内某一个节点出现问题而其他节点不知道的时候就会通过另一条心跳线发出警告并将该节点提掉。

现在搭建怎么创建2个心跳线,这里准备多台PC:[root@foundation0 ~] 为真机
[root@nodea ~]、[root@nodeb ~]、[root@nodec ~]为3个节点
首先我们安装一个集群pcs包。
[root@nodea ~]# yum -y install pcs ;systemctl stop firewalld.service ;systemctl disable firewalld.service ;systemctl restart pcsd ;systemctl enable pcsd ; echo redhat |passwd --stdin hacluster *****nodea、nodeb、nodec都需要这样装

将nodea、nodeb、nodec授权给pcs并指定在hacluster用户下
[root@nodea ~]# pcs cluster auth nodea.cluster0.example.com nodeb.cluster0.example.com nodec.cluster0.example.com
Username: hacluster
Password:
nodea.cluster0.example.com: Authorized
nodeb.cluster0.example.com: Authorized
nodec.cluster0.example.com: Authorized

在真实机输入下面网站访问集群
[root@foundation0 ~]# firefox https://nodea.cluster0.example.com:2224

 

enter description here

1.png

1、添加
2、集群名:cluster-1
3-5、将nodea、nodeb、noddec主机名加入其中

 

点击进入集群cluster-1

 

enter description here

2.png

 

用下面命令查看当前心跳线的个数及IP地址
[root@nodea corosync]# corosync-cfgtool -s
Printing ring status.
Local node ID 1
RING ID 0
id = 172.25.0.10
status = ring 0 active with no faults

进入到/etc/corosync/会发现当前有几个配置文件
[root@nodea ~]# cd /etc/corosync/
[root@nodea corosync]# ls
corosync.conf corosync.conf.example.udpu uidgid.d
corosync.conf.example corosync.xml.example

首先我们需要将corosync.conf.example内的内容当模版
[root@nodea corosync]# vim corosync.conf.example

 

enter description here

3.png

 

1、将多余的文字去掉留下当前黑色范围内的内容复制

[root@nodea corosync]# vim corosync.conf

 

enter description here

4.png

 

1、增加一个active模式
2、心跳模版指定的IP地址为172.25.0.0网段
3、心跳模版指定的IP地址为192.168.0.0网段
*****由于真机和节点内的网卡IP都属于这2个网段

上面的配置文件做完后
[root@nodea corosync]# pcs cluster stop --all
nodea.cluster0.example.com: Stopping Cluster (pacemaker)...
nodeb.cluster0.example.com: Stopping Cluster (pacemaker)...
nodec.cluster0.example.com: Stopping Cluster (pacemaker)...
nodeb.cluster0.example.com: Stopping Cluster (corosync)...
nodec.cluster0.example.com: Stopping Cluster (corosync)...
nodea.cluster0.example.com: Stopping Cluster (corosync)...
[root@nodea corosync]# pcs cluster sync
nodea.cluster0.example.com: Succeeded
nodeb.cluster0.example.com: Succeeded
nodec.cluster0.example.com: Succeeded
[root@nodea corosync]# pcs cluster start --all
nodeb.cluster0.example.com: Starting Cluster...
nodec.cluster0.example.com: Starting Cluster...
nodea.cluster0.example.com: Starting Cluster...

先关掉集群使集群同步,后开启集群就可以看到有2个心跳线了
[root@nodea corosync]# corosync-cfgtool -s
Printing ring status.
Local node ID 1
RING ID 0
id = 172.25.0.10
status = ring 0 active with no faults
RING ID 1
id = 192.168.0.10
status = ring 1 active with no faults

转载于:https://www.cnblogs.com/ZhengLiming/p/5899200.html

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值