1. 安装所需的软件源
yum config-manager --set-enabled ol9_addons
2. 安装所需的软件
yum install -y pacemaker corosync pcs
3. 编写corosync配置文件
文件路径:/etc/corosync/corosync.conf
totem {
version: 2
cluster_name: mycluster
transport: udpu
}
nodelist {
node {
name: glusterfs-01
ring0_addr: 10.0.0.120
nodeid: 1
}
node {
name: glusterfs-02
ring0_addr: 10.0.0.173
nodeid: 2
}
}
quorum {
provider: corosync_votequorum
}
logging {
to_syslog: yes
}
4. 配置服务
设置服务启动(每个节点都执行)
sudo systemctl start pcsd
sudo systemctl enable pcsd
sudo systemctl start corosync
sudo systemctl enable corosync
sudo systemctl start pacemaker
sudo systemctl enable pacemaker
需要移除
http_proxy
和https_proxy
设置集群管理员密码(每个节点都执行)
passwd hacluster
其中一个节点上认证集群管理员
pcs host auth node1 node2 -u hacluster -p <管理员密码>
验证corosync配置
pcs cluster authkey corosync
启动集群
pcs cluster start --all
创建NFS-Ganasha资源
pcs resource create nfs-ganesha systemd:nfs-ganesha op monitor interval=30s
创建虚拟ip
pcs resource create virtual_ip ocf:heartbeat:IPaddr2 ip=10.0.0.10 cidr_netmask=24 op monitor interval=30s
需要将虚拟ip更换为你自己的,我的网段是10.0.0.0
设置资源组
pcs resource group add nfs_group virtual_ip nfs-ganesha
psc resource enable nfs_group
禁用 STONITH(如果不需要)
pcs property set stonith-enabled=false
验证配置
pcs status
标签:可用,pcs,sudo,systemctl,NFS,ip,Ganasha,nfs,corosync
From: https://www.cnblogs.com/RHbyCIwRMQ0T/p/18345754