配置集群文件系統(tǒng):
?
安裝軟件包: yum -y install ??lvm2* gfs2* dlm*
?
1.安裝rpm包
?yum -y install ??lvm2* gfs2* dlm* fence-agents*
?
?
?
?
?
2.修改LVM配置文件改為集群模式-----暫時(shí)不做
/etc/lvm/lvm.conf
?
?locking_type = 1 改為 locking_type = 3
?
?
?
?
?
[root@qhdb2 lvm]# lvmconf -h
Usage: /usr/sbin/lvmconf <command>
?
Commands:
Enable clvm: ?--enable-cluster [--lockinglibdir <dir>] [--lockinglib <lib>]
Disable clvm: --disable-cluster
Enable halvm: --enable-halvm
Disable halvm: --disable-halvm
Set locking library: --lockinglibdir <dir> [--lockinglib <lib>]
?
Global options:
Config file location: --file <configfile>
Set services: --services [--mirrorservice] [--startstopservices]
?
Use the separate command 'lvmconfig' to display configuration information
?
?
?
?
重啟主機(jī)生效
?
------------ ?創(chuàng)建cluster CLVM必須得創(chuàng)建fence機(jī)制
?
?
禁止集群投票,防止腦裂(由于我們集群是2個(gè)節(jié)點(diǎn))
pcs ??property ??set no-quorum-policy=freeze
?
在生產(chǎn)環(huán)境中,可以用
[root@qhdb1 ~]# pcs ???stonith list
?
fence_aliyun - Fence agent for Aliyun (Aliyun Web Services)
fence_amt_ws - Fence agent for AMT (WS)
fence_apc - Fence agent for APC over telnet/ssh
fence_apc_snmp - Fence agent for APC, Tripplite PDU over SNMP
fence_aws - Fence agent for AWS (Amazon Web Services)
fence_azure_arm - Fence agent for Azure Resource Manager
fence_bladecenter - Fence agent for IBM BladeCenter
fence_brocade - Fence agent for HP Brocade over telnet/ssh
fence_cisco_mds - Fence agent for Cisco MDS
fence_cisco_ucs - Fence agent for Cisco UCS
fence_compute - Fence agent for the automatic resurrection of OpenStack compute instances
fence_drac5 - Fence agent for Dell DRAC CMC/5
fence_eaton_snmp - Fence agent for Eaton over SNMP
fence_emerson - Fence agent for Emerson over SNMP
fence_eps - Fence agent for ePowerSwitch
fence_evacuate - Fence agent for the automatic resurrection of OpenStack compute instances
fence_gce - Fence agent for GCE (Google Cloud Engine)
fence_heuristics_ping - Fence agent for ping-heuristic based fencing
fence_hpblade - Fence agent for HP BladeSystem
fence_ibmblade - Fence agent for IBM BladeCenter over SNMP
fence_idrac - Fence agent for IPMI
fence_ifmib - Fence agent for IF MIB
fence_ilo - Fence agent for HP iLO
fence_ilo2 - Fence agent for HP iLO
fence_ilo3 - Fence agent for IPMI
fence_ilo3_ssh - Fence agent for HP iLO over SSH
fence_ilo4 - Fence agent for IPMI
fence_ilo4_ssh - Fence agent for HP iLO over SSH
fence_ilo5 - Fence agent for IPMI
fence_ilo5_ssh - Fence agent for HP iLO over SSH
fence_ilo_moonshot - Fence agent for HP Moonshot iLO
fence_ilo_mp - Fence agent for HP iLO MP
fence_ilo_ssh - Fence agent for HP iLO over SSH
fence_imm - Fence agent for IPMI
fence_intelmodular - Fence agent for Intel Modular
fence_ipdu - Fence agent for iPDU over SNMP
fence_ipmilan - Fence agent for IPMI
fence_kdump - fencing agent for use with kdump crash recovery service
fence_lpar - Fence agent for IBM LPAR
fence_mpath - Fence agent for multipath persistent reservation
fence_redfish - I/O Fencing agent for Redfish
fence_rhevm - Fence agent for RHEV-M REST API
fence_rsa - Fence agent for IBM RSA
fence_rsb - I/O Fencing agent for Fujitsu-Siemens RSB
fence_sanlock - Fence agent for watchdog and shared storage
fence_sbd - Fence agent for sbd
fence_scsi - Fence agent for SCSI persistent reservation
fence_virsh - Fence agent for virsh
fence_virt - Fence agent for virtual machines
fence_vmware_rest - Fence agent for VMware REST API
fence_vmware_soap - Fence agent for VMWare over SOAP API
fence_wti - Fence agent for WTI
fence_xvm - Fence agent for virtual machines
?
在我的生產(chǎn)環(huán)境中、我則會(huì)優(yōu)先選擇使用fence_mpath作為stonith資源限制
配置:我的存儲(chǔ)使用的日立的盤(pán)
?
?
修改/etc/multipath.conf 配置文件
?
defaults {
????????user_friendly_names yes
????????find_multipaths yes
????????reservation_key ???????0x2????依次命名節(jié)點(diǎn)1 2 3
}
?
?
?
?
?
?
2節(jié)點(diǎn):
?
?
?
?
?
?
?
重啟multipath
systemctl restart multipathd
multipath
?
?
配置stonith設(shè)備:
?
pcs stonith create qhdb1_pcmk fence_mpath key=1 pcmk_host_list="qhdb1" pcmk_reboot_action="off" ??devices="/dev/mapper/mpathe,/dev/mapper/mpathf" meta provides=unfencing
pcs stonith create qhdb2_pcmk fence_mpath key=2 pcmk_host_list="qhdb2" pcmk_reboot_action="off" ??devices="/dev/mapper/mpathe,/dev/mapper/mpathf" meta provides=unfencing
或者
pcs ?stonith create ?pg_cluster_st ?fence_mpath devices="/dev/mapper/mpathe,/dev/mapper/mpathf" ??pcmk_host_map="qhdb1:1;qhdb2:2" ?pcmk_monitor_action="metadata" pcmk_reboot_action="off" pcmk_host_argument="key" meta provides=unfencing
?
?
?
?
禁止集群投票,防止腦裂(由于我們集群是2個(gè)節(jié)點(diǎn))
pcs ??property ??set no-quorum-policy=freeze
?
?
?
添加dlm資源
pcs resource create dlm ocf:pacemaker:controld op monitor interval=30s on-fail=fence clone interleave=true ordered=true
?
啟用集群鎖模式的clvm
lvmconf ?--enable-cluster ???---
?
添加clvm資源
pcs resource create clvmd ocf:heartbeat:clvm op monitor interval=30s on-fail=fence clone interleave=true ordered=true
?
?
?
?
?
創(chuàng)建dlm資源和clvm資源的依賴(lài)關(guān)系和啟動(dòng)順序:
?
pcs constraint order start dlm-clone then clvmd-clone
pcs constraint colocation add clvmd-clone with dlm-clone
?
?
創(chuàng)建文件系統(tǒng)gfs2
pvcreate ?/dev/mapper/mpathe ??/dev/mapper/mpathf ?
vgcreate -Ay -cy ?vg01 /dev/mapper/mpathe ?/dev/mapper/mpathf
lvcreate ?-L +200G -n lv_01 ??vg01
?
mkfs.gfs2 ?-p lock_dlm ?-j 2 -t pg_cluster:file1 ?/dev/vg01/lv_01
?
?
?
?
?
添加clusterfs資源:
pcs ?resource ?create pg01_file1 ??ocf:heartbeat:Filesystem ?device="/dev/vg01/lv_01" directory="/pg01" fstype="gfs2" ??"options=noatime" op monitor interval=10s on-fail=fence clone interleave=true
或者????
pcs ?resource ?create pg01_file1 ??Filesystem ?device="/dev/vg01/lv_01" directory="/pg01" fstype="gfs2" ??"options=noatime" op monitor interval=10s on-fail=fence clone interleave=true
?
創(chuàng)建 gfs2和clvmd的啟動(dòng)順序和依賴(lài)關(guān)系:
pcs ?constraint order ?start ?clvmd-clone then ?pg01_file1-clone
pcs ?constraint colocation add pg01_file1-clone with clvmd-clone
?
?
?
?
?
?
?
查看文件系統(tǒng):
?
?
?
本文摘自 :https://www.cnblogs.com/