集群学习笔记1-创建一个简单的集群

准备工作: 准备5台虚拟机  

classroom   用来做yum源  NTP   

nodea    172.24.1.6      172.24.16.6

nodeb    172.24.1.7       172.24.16.7

nodec    172.24.1.8        172.24.16.8

storage   172.24.1.5        172.24.16.5

安装好系统,配好yum源,NTP,写好hosts

 172.25.254.254 classroom

172.25.254.250 provision.example.com
172.25.0.10 nodea
172.25.0.11 nodeb
172.25.0.12 nodec
192.168.0.10 nodea.private.example.com
192.168.0.11 nodeb.private.example.com
192.168.0.12 nodec.private.example.com

开始搭建集群

1. 在nodea nodeb nodec 执行以下命令:

# yum list all

# firewall-cmd --permanent --add-service=high-availability

# firewall-cmd --reload
# yum install -y pcs fence-agents-all.x86_64 fence-agents-rht.x86_64
# systemctl start pcsd && systemctl enable pcsd

以下命令在nodea nodeb nodec 任意一个节点执行即可:
# id hacluster
# echo flectrag |passwd --stdin hacluster
# exit
# pcs cluster auth nodea.private.example.com nodeb.private.example.com nodec.private.example.com
# pcs cluster setup --name cluster0 nodea.private.example.com nodeb.private.example.com nodec.private.example.com
# pcs cluster start --all
#pcs cluster enable --all
# pcs status

若看到如下信息,则集群创建成功

[root@nodeb ~]# pcs status
Cluster name: cluster0
WARNING: no stonith devices and stonith-enabled is not false
Last updated: Wed Jun 2 17:16:42 2021
Last change: Wed Jun 2 17:16:26 2021
Stack: corosync
Current DC: nodeb.private.example.com (2) - partition with quorum
Version: 1.1.12-a14efad
3 Nodes configured
0 Resources configured


Online: [ nodea.private.example.com nodeb.private.example.com nodec.private.example.com ]

Full list of resources:


PCSD Status:
nodea.private.example.com: Online
nodeb.private.example.com: Online
nodec.private.example.com: Online

Daemon Status:
corosync: active/enabled
pacemaker: active/enabled
pcsd: active/enabled

========================================================================

原文地址:https://www.cnblogs.com/cloud-yongqing/p/14842140.html