Fence 设备
RHCS中必须有Fence设备,在设备为知故障发生时,Fence负责让占有浮动资源的设备与集群断开。
REDHAT的fence device有两种,
内部fence设备:
IBM RSAII卡,HP的iLO卡,Dell的DRAC,还有IPMI的设备;
外部fence 设备:
UPS,SAN SWITCH,NETWORK SWITCH等。
对于外部fence 设备,可以做拔电源的测试,因为备机可以接受到fence device返回的信号,备机可以正常接管服务,
对于内部fence 设备,不能做拔电源的测试,因为主机断电后,备机接受不到主板芯片做为fence device返备的信号,就不能接管服务,clustat会看到资源的属主是unknow,查看日志会看到持续报fence failed的信息。
软fence配置
CentOS与Redhat使用KVM虚拟机做RHCS时可以通过做软fence来实现fence功能。
配置如下:
1、在真机上运行fence服务
yum list | grep --color fence
yum -y install fence-virtd fence-virtd-libvirt fence-virtd-mult
2 、创建密码文件,并密码文件scp给 web1 web2 台服务器,
宿主计算机上做:
1 2 3 4 5 6 7 8 9 10 | [root@localhost ~] # mkdir /etc/cluster [root@localhost ~] # dd if=/dev/urandom of=/etc/cluster/fence_xvm.key bs=4K count=1 1+0 records in 1+0 records out 4096 bytes (4.1 kB) copied, 0.000848692 s, 4.8 MB /s [root@localhost ~] # ll /etc/cluster/ total 4 -rw-r--r-- 1 root root 4096 Mar 24 16:58 fence_xvm.key [root@localhost ~] # [root@localhost ~] # scp /etc/cluster/fence_xvm.key root@10.37.129.5:/etc/cluster/ |
/etc/cluster/
3、宿主机配置fencefence_virtd -c
红色为手动,其他为enter
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | [root@localhost ~] # fence_virtd -c###### Module search path [ /usr/lib64/fence-virt ]: Available backends: libvirt 0.1 Listener modules are responsible for accepting requests from fencing clients. Listener module [multicast]: No listener module named multicast found! Use this value anyway [y /N ]? y ##### The multicast listener module is designed for use environments where the guests and hosts may communicate over a network using multicast. The multicast address is the address that a client will use to send fencing requests to fence_virtd. Multicast IP Address [225.0.0.12]: Using ipv4 as family. Multicast IP Port [1229]: Setting a preferred interface causes fence_virtd to listen only on that interface. Normally, it listens on the default network interface. In environments where the virtual machines are using the host machine as a gateway, this *must* be set (typically to virbr0). Set to 'none' for no interface. Interface [none]: private ##### The key file is the shared key information which is used to authenticate fencing requests. The contents of this file must be distributed to each physical host and virtual machine within a cluster. Key File [ /etc/cluster/fence_xvm .key]: Backend modules are responsible for routing requests to the appropriate hypervisor or management layer. Backend module [checkpoint]: libvirt ##### The libvirt backend module is designed for single 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 = "private" ; 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 .conf with the above [y /N ]? y [root@localhost ~] # |
4、启动fence服务并开机运行
1 2 | /etc/init .d /fence_virtd start chkconfig fence_virtd on |
#
公众号请关注:侠之大者
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· .NET 9 new features-C#13新的锁类型和语义
· Linux系统下SQL Server数据库镜像配置全流程详解
· 现代计算机视觉入门之:什么是视频
· 你所不知道的 C/C++ 宏知识
· 聊一聊 操作系统蓝屏 c0000102 的故障分析
· DeepSeek V3 两周使用总结
· 回顾我的软件开发经历(1)
· C#使用yield关键字提升迭代性能与效率
· 低成本高可用方案!Linux系统下SQL Server数据库镜像配置全流程详解
· 4. 使用sql查询excel内容