设为首页 收藏本站
查看: 1214|回复: 0

[经验分享] RedHat6 集群Fence【8】

[复制链接]

尚未签到

发表于 2018-5-10 07:35:03 | 显示全部楼层 |阅读模式
  RedHat6 集群Fence
  实验目的:
  掌握集群Fence理论和配置
  Fence概念:
  在HA集群坏境中,备份服务器B通过心跳线来发送数据包来看服务器A是否还活着,主服务器A接收了大量的客户端访问请求,服务器A的CPU负载达到100%响应不过来了,资源已经耗尽,没有办法回复服务器B数据包(回复数据包会延迟),这时服务器B认为服务器A已经挂了,于是备份服务器B把资源夺过来,自己做主服务器,过了一段时间服务器A响应过来了,服务器A觉得自己是老大,服务器B觉得自己也是老大,他们两个就挣着抢夺资源,集群资源被多个节点占有,两个服务器同时向资源写数据,破坏了资源的安全性和一致性,这种情况的发生叫做“脑裂”。服务器A负载过重,响应不过来了,有了Fence机制,Fence会自动的把服务器A给Fence掉,阻止了“脑裂"的发生
  Fence分类:
  硬件Fence:电源Fence,通过关掉电源来踢掉坏的服务器
  软件Fence:Fence卡(智能卡),通过线缆、软件来踢掉坏的服务器
  实际坏境中,Fence卡连接的都是专线,使用专用的Fence网卡,不会占用数据传输线路,这样,更能保证稳定及可靠性。
  Fence卡的IP网络和集群网络是相互依存的
  实验步骤:
  由于实际情况的限制,没有真实的Fence卡,所用我们用fence服务来虚拟出Fence卡
  在iscsi服务器上安装fence服务,把iscsi服务器当成fence卡
  安装fence卡,你只需要安装fence-virtd-libvirt.x86_64和fence-virtd-multicast.x86_64这两个软件就可以了
[root@node1 ~]# yum list  |  grep fence

  Repository ResilientStorage is listed morethan once in the configuration
  Repository ScalableFileSystem is listedmore than once in the configuration
  fence-agents.x86_64                        3.1.5-10.el6                @Cluster
  fence-virt.x86_64                          0.2.3-5.el6                 @Cluster
  fence-virtd.x86_64                         0.2.3-5.el6                 base
  fence-virtd-checkpoint.x86_64              0.2.3-5.el6                 Cluster
  fence-virtd-libvirt.x86_64                 0.2.3-5.el6                 base
  fence-virtd-libvirt-qpid.x86_64            0.2.3-5.el6                 optional
  fence-virtd-multicast.x86_64               0.2.3-5.el6                 base
  fence-virtd-serial.x86_64                  0.2.3-5.el6                 base
[root@node1 ~]# yum  -y  install fence-virtd-libvirt.x86_64 fence-virtd-multicast.x86_64

[root@desktop24 ~]# mkdir /etc/cluster

[root@desktop24 ~]# cd /etc/cluster

[root@desktop24 cluster]# dd   if=/dev/random   of=/etc/cluster/fence_xvm.key  bs=4k  count=1   创建fence卡的key文件,让节点服务器和Fence卡相互认识

  0+1 records in
  0+1 records out
  73 bytes (73 B) copied, 0.000315063 s, 232kB/s
  random:为随机数字生成器,生成的东西是唯一的
  fence_xvm.key:Fence卡的key文件,名字别改,fence_xvm是fence卡的一种类型
  把fence的key文件分发给各个节点服务器
[root@desktop24cluster]#scp/etc/cluster/fence_xvm.key  172.17.0.1:/etc/cluster/fence_xvm.key

  root@172.17.0.1's password:
  fence_xvm.key                                                             100%   73     0.1KB/s  00:00
[root@desktop24 cluster]# scp  /etc/cluster/fence_xvm.key   172.17.0.2:/etc/cluster/fence_xvm.key

  root@172.17.0.2's password:
  fence_xvm.key                                                             100%   73     0.1KB/s  00:00
  对fence服务的配置文件/etc/fence_virt.conf做配置策略:
[root@desktop24 cluster]# fence_virtd   -c

  Module search path[/usr/lib64/fence-virt]:
  //模块搜索路径,回车使用默认的
  Available backends:
  libvirt 0.1
  Available listeners:
  multicast 1.1
  Listener modules are responsible foraccepting requests
  from fencing clients.
  Listener module [multicast]:
  //监听组播模块,回车选择默认
  The multicast listener module is designedfor use environments
  where the guests and hosts may communicateover a network using
  multicast.
  The multicast address is the address that aclient will use to
  send fencing requests to fence_virtd.
  Multicast IP Address[225.0.0.12]:
  组播IP地址选择,回车选择默认的225.0.0.12
  Using ipv4 as family.
  Multicast IP Port [1229]:
  //组播IP端口选择,回车选择默认的1229
  Setting a preferred interface causes fence_virtdto listen only
  on that interface.  Normally, it listens on all interfaces.
  In environments where the virtual machinesare using the host
  machine as a gateway, this *must* be set(typically to virbr0).
  Set to 'none' for no interface.
  Interface [none]: private
  //Fence卡使用那个接口来和集群网络来通讯(fence卡的专用接口和集群网络在同一网段)
  The key file is the shared key informationwhich is used to
  authenticate fencing requests.  The contents of this file must
  be distributed to each physical host andvirtual machine within
  a cluster.
  Key File[/etc/cluster/fence_xvm.key]:
  //是否是对/etc/cluster/fence_xvm.key这个文件做策略,回车选择默认的
  Backend modules are responsible for routingrequests to
  the appropriate hypervisor or managementlayer.
  Backend module [checkpoint]:libvirt
  //模块基于那个协议,填写libvirt
  The libvirt backend module is designed forsingle desktops or
  servers. Do not use in environments where virtual machines
  may be migrated between hosts.
  Libvirt URI [qemu:///system]:
  Configuration complete.
  === Begin Configuration ===
  backends {
  libvirt{
  uri= "qemu:///system";
  }
  }
  listeners {
  multicast{
  interface= "eth0";
  port= "1229";
  family= "ipv4";
  address= "225.0.0.12";
  key_file= "/etc/cluster/fence_xvm.key";
  }
  }
  fence_virtd {
  module_path= "/usr/lib64/fence-virt";
  backend= "libvirt";
  listener= "multicast";
  }
  === End Configuration ===
  Replace /etc/fence_virt.confwith the above [y/N]? y
  //输入y保存配置
  启动fence服务:
[root@desktop24 cluster]# /etc/init.d/fence_virtd  restart

  Stopping fence_virtd:                                      [FAILED]
  Starting fence_virtd:                                      [  OK  ]
[root@desktop24 cluster]# chkconfig  fence_virtd on

  把fence卡加入到集群:
  Fence Dervices中点击add来添加fence卡(虚拟的)
DSC0000.jpg

  打开【Select  a  fence device】选择【Fence virt(Multicast  Mode)】,名字写这个Fence卡名字
DSC0001.jpg

  虚拟的Fence设备添加完成后,界面如下:
DSC0002.jpg

  把Fence卡添加到各个节点中去
  添加fence卡到Node1中:
DSC0003.jpg

  选择【Node】,然后点击Node1节点的界面,找到下图位置添加Fence
DSC0004.jpg

  取名根据自己需要,只要能识别即可
DSC0005.jpg

  然后点击【Add Fence Instance】,添加Fence实咧
DSC0006.jpg

  选择Fence1这个Fence卡,这里的domain指的的是node1.private.cluster0.example.com中的node1
DSC0007.jpg

DSC0008.jpg

  添加Fence卡到Node2中:
  把界面换到节点2中
DSC0009.jpg

  找到下图位置,点击【Add  Fence  Method】
DSC00010.jpg

  给Fence  Method起名字
DSC00011.jpg

  点击【Add Fence Instance】
DSC00012.jpg

  选择Fence1这个Fence卡,这里的domain指的的是node2.private.cluster0.example.com中的node2
DSC00013.jpg

DSC00014.jpg

  手动fence剔除:
[root@node2 ~]#fence_node  node1

  fence node1   success
  实验效果:node1会重启两次

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-457817-1-1.html 上篇帖子: RedHat6 集群多路径【5】 下篇帖子: Redhat6集群存活条件【9】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

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