1. 题目
lab环境是nodea,nodeb,nodec 考试环境是node1,node2,node3
后续部分参数类似
2. 解题
以下操作步骤参见rh436-8.3-student-guide, 15到17页
2.1 集群配置前
3个node节点上运行
yum install -y pcs
firewall-cmd --permanent --add-service=high-availability
firewall-cmd --reload
systemctl enable --now pcsd
echo redhat | passwd --stdin hacluster
2.2 集群配置
pcs host auth -u hacluster -p redhat nodea.private.example.com nodeb.private.example.com nodec.private.example.com
pcs cluster setup cluster1 nodea.private.example.com nodeb.private.example.com nodec.private.example.com
# 如果追求速度,可以先做第三题,在做后面的
pcs cluster start --all
pcs cluster enable --all
3. 确认
pcs status
确认3个红框内容一致,且没报错即可
4. 技巧
技巧只能加快答题速度,对考试得分帮助不大
4.1 当需要在3台服务器上执行的时候
由于ha这门课有大量命令需要在3个节点上同步执行.如果执行history会出现前面数字,复制多行会有些麻烦.
例如本题:
yum install -y pcs
systemctl enable --now pcsd
echo redhat | passwd --stdin hacluster
history -w
cat .bash_history
history
这样就能1次复制3行
再执行一个histrory
记住cat .bash_histroy那行和上一行前的数字,这样下次再有多行需要复制粘贴的时候,直接执行:
!4
!5
就可以快速将历史命令实现可多行复制,当然也可以用awk进行分割,个人喜好随意