企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
Pacemaker是OpenStack官方推荐的资源管理工具,群集基础架构利用Coresync提供的信息和成员管理功能来检测和恢复云端资源级别的故障,达到集群高可用性。Corosync在云端环境中提供集群通讯,主要负责为控制节点提供传递心跳信息的作用。 1)在三个节点上安装以下安装包 ``` yum install -y lvm2 cifs-utils quota psmisc yum install -y pcs pacemaker corosync fence-agents-all resource-agents crmsh ``` 2)在三个节点上设置pcs服务开机启动 ``` systemctl enable pcsd.service systemctl start pcsd.service ``` 3)在三个节点上设置hacluster用户密码 ``` passwd hacluster New password ####设置密码为yjscloud Retry new password ``` 4)配置编写`corosync.conf`文件 ``` vim /etc/corosync/corosync.conf ``` 添加以下内容: ``` totem { version: 2 secauth: off cluster_name: openstack_cluster transport: udpu } nodelist { node { ring0_addr: controller1 nodeid: 1 } node { ring0_addr: controller2 nodeid: 2 } node { ring0_addr: controller3 nodeid: 3 } } quorum { provider: corosync_votequorum } logging { to_logfile: yes logfile: /var/log/cluster/corosync.log to_syslog: yes } ``` 5)在三个节点上设置开机启动服务 ``` systemctl enable corosync systemctl restart corosync ``` 6)设置集群互相验证,在controlle1上操作即可 ``` pcs cluster auth controller1 controller2 controller3 -u hacluster -p yjscloud --force ``` ![8-1-13](http://pded8ke3e.bkt.clouddn.com/8-1-13.jpg) 7)创建并启动名为openstack_cluster的集群,在controlle1上操作即可 ``` pcs cluster setup --force --name openstack-cluster controller1 controller2 controller3 ``` ![8-1-14](http://pded8ke3e.bkt.clouddn.com/8-1-14.png) 8)设置集群开启启动并查看状态,在controlle1上操作即可 ``` pcs cluster enable --all pcs cluster start --all pcs cluster status ``` ![8-1-15](http://pded8ke3e.bkt.clouddn.com/8-1-15.jpg) 9)查看并设置集群属性,在controlle1上操作即可 ``` ps aux |grep pacemaker ``` 10)验证corosync的安装及当前corosync的状态 ``` corosync-cfgtool -s corosync-cmapctl | grep members pcs status corosync ``` ![8-1-16](http://pded8ke3e.bkt.clouddn.com/8-1-16.jpg) 11)验证配置是否正确 ``` controller1# crm_verify -L -V controller1# pcs property set stonith-enabled=false controller1# pcs property set no-quorum-policy=ignore ``` 12)通过crm设置VIP ``` crm(live)configure# primitive vip_piblic ocf:heartbeat:IPaddr2 params ip="192.168.0.168" cidr_netmask="24" nic=eth0 op monitor interval="30s" crm(live)configure# primitive vip_management ocf:heartbeat:IPaddr2 params ip="10.1.1.168" cidr_netmask="24" nic=ens8 op monitor interval="30s" ``` ![8-1-17](http://pded8ke3e.bkt.clouddn.com/8-1-17.jpg)