CentOS8-pacemaker+corosync高可用部署

部署pacemaker

yum install pacemaker pcs corosync fence-agents resource-agents

启动pcs服务

systemctl enable pcsd
systemctl start pcsd

修改集群管理员hacluster(默认生成)密码

echo "xmcloud_pass" | passwd --stdin hacluster

xmcmp01节点,认证配置

pcs host auth dns01 dns02 -u hacluster -pxmcloud_pass

创建并命名集群,生成配置文件:/etc/corosync/corosync.conf

pcs cluster setup xmcloud xmcmp01 addr=10.66.7.1 xmcmp02 addr=10.66.7.2 xmcmp03 addr=10.66.7.3

3台controller节点

pcs cluster start --all
pcs cluster enable --all
pcs status

xmcmp01节点, 查看corosync状态

pcs status corosync

查看集群资源

pcs resource

web访问控制台,hacluster/xmcloud_pass

https://10.66.7.1:2224

xmcmp01节点设置属性

# pe-warn-series-max、pe-input-series-max、pe-error-series-max代表日志深度。
# cluster-recheck-interval是节点重新检查的频率
# pacemaker基于时间驱动的方式进行状态处理,” cluster-recheck-interval”默认定义某些#pacemaker操作发生的事件间隔为15min,建议设置为5min或3min
# 设置合适的输入处理历史记录及策略引擎生成的错误与警告,在troulbshoot时有用

pcs property set pe-warn-series-max=1000 pe-input-series-max=1000 pe-error-series-max=1000 cluster-recheck-interval=5

# 由于没有 stonith 设备,注意需要设置禁用stonith设备。
pcs property set stonith-enabled=false

#查询修改后配置
pcs property list --all|grep stonith

xmcmp01节点,创建VIP资源

# 首先创建 VIP 的资源
pcs resource create vip ocf:heartbeat:IPaddr2 ip=10.66.7.250 cidr_netmask=24 op monitor interval=30s

# 然后创建 NFS 的资源
pcs resource create web_file ocf:heartbeat:Filesystem device=10.0.0.101:/var/nfs directory=/var/www/web fstype=nfs

# 最后创建 nginx 的资源
pcs resource create web ocf:heartbeat:nginx op monitor interval=30s
posted @   金笛秀才  阅读(163)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
点击右上角即可分享
微信分享提示