安装ha组件: yum install pcs fence-agents-all 创建集群 pcs cluster setup --start --name my_cluster z1.example.com z2.example.com 启动集群服务 pcs cluster enable --all 查看集群状态 pcs cluster status 创建stonith设备 pcs stonith create myapc fence_apc_snmp params ipaddr="zapc.example.com" pcmk_host_map="z1.example.com:1;z2.example.com:2" pcmk_host_check= "static-list" pcmk_host_list="z1.example.com,z2.example.com" login="apc" passwd="apc" pcs stonith show myapc 创建资源 pcs resource create my_lvm LVM volgrpname=my_vg exclusive=true --group apachegroup pcs resource show pcs resource enable pcs resource create my_fs Filesystem device="/dev/my_vg/my_lv" directory="/var/www" fstype="ext4" --group apachegroup pcs resource create VirtualIP IPaddr2 ip=198.51.100.3 cidr_netmask=24 --group apachegroup pcs resource create Website apache configfile="/etc/httpd/conf/httpd.conf" statusurl="http://127.0.0.1/server-status" --group apachegrouppcs resource create VirtualIP ocf:heartbeat:IPaddr2 ip=192.16 8.0.120 cidr_netmask=24 opmonitorinterval= 30s
查看集群状态:
pcs status
倒换节点:pcs cluster standby z1.example.compcs cluster unstandby z1.example.com
查看帮助pcs resource -h
导出和备份配置文件pcs cluster cib testfilepcs config backuppcs config restorepcs cluster setup --name new_cluster nodeA nodeB --token 10000 --join 100pcs cluster stoppcs cluster enablepcs cluster disablepcs cluster node add nodepcs cluster node remove nodepcs cluster standby nodepcs cluster unstandby nodepcs stonith listpcs stonith describepcs stonith show --fullpcs stonith create myapc-west-13 fence_apc pcmk_host_list="west-13" ipaddr="west-apc" login="apc" passwd="apc" port="15"
fence对应节点:pcs stonith fence nodepcs resource delete VirtualIPpcs resource describe LVMpcs resource show --fullpcs resource enable resource_idpcs resource disable resource_id
设置资源先后关系pcs constraint VirtualIP then dummy_resource kind=Optional
进入维护模式:pcs resource unmanage resource1
解除维护模式
pcs resource manage resource1
pcs常用命令
最新推荐文章于 2024-04-27 14:53:46 发布