436企业级集群架构
集群436
作者:libin
*-------------------------下面为RHCA-红帽集群安装及配置管理(建议先看理论在实操)*
实验环境说明:实验测试
*2台centos7的虚拟机 4C4G 100G*
*192.168.124.134 libin3.com master*
*192.168.124.133 libin2.com node1*
192.168.124.132 libin.com node2 (我在后面添加的加入了一次集群测试)
1、设置selinux(在每个节点)
#setenforce 0
[root@libin3 ~]# vim /etc/selinux/config
SELINUX=disabled
2、关闭防火墙(在每个节点)
# firewall-cmd --list-all-zones
# systemctl stop firewalld.service
# firewallcmd --set-default-zone=trustec #将防火墙添加到信任区域,这样开启防火墙也没有事
3、设置域名解析(在每个节点)
#vim /etc/hosts
==>192.168.124.134 libin3.com master
==>192.168.124.133 libin2.com node1
4、安装集群测试(在每个节点)
#yum install -y pcs*
5、添加并安装crm的yum源(在每个节点)供额外学习用
#cd /etc/yum.repos.d/;vim cr.repo
[network_ha-clustering_Stable]
name=Stable High Availability/Clustering packages (CentOS_CentOS-7)
type=rpm-md
baseurl=http://download.opensuse.org/repositories/network:/ha-clustering:/Stable/CentOS_CentOS-7/
gpgcheck=1
gpgkey=http://download.opensuse.org/repositories/network:/ha-clustering:/Stable/CentOS_CentOS-7/repodata/repomd.xml.key
enabled=1
#yum install -y crmsh
下载一个集群包
6、给集群用户设置设置密码(在每个节点)
# cp corosync.conf.example corosync.conf
# cat /etc/passwd | grep hacluster #安装pcs会多出一个集群用户
# echo helloword | passwd --stdin hacluster
# systemctl start pcsd.service #开启集群服务
# netstat -tlpn grep ruby #决定了能不能图形化访问
# pcs cluster auth master #授权,写主机名
Username: hacluster Password:
master: Authorized
# cd .mozilla/;rm-fr #清空浏览器缓存
# curl https://libin3.com:2224/ #访问,登陆就进入图形界面了
7、添加节点到集群中
可以看到双节点都正常
8、创建新的集群 点击“more nodes”就能添加更多节点。点击“create CLuster”完成
9、添加仲裁
*(双节该操作点可以忽略,3节点或更多时需要,Quorum=3/2+1=2,相当于可以掉一台)*
# pcs cluster standby master 手动将master指定为备用节点
# pcs cluster unstandby master 取消备用节点
# pcs resource move vip master 指定移动VIP到master节点,前提节点必须是online状态
#corosync-quorumtool -l 查看节点数量和节点名
10、查看集群状态(集群管理命令)
# pcs cluster status
#pcs cluster stop --all #如果不带“--all”,那就是停止集群中的哪个节点。如果带了--all就是所有节点
#pcs cluster start --all #开启所有节点
#pcs cluster enable --all #开机启动所有节点集群服务
# corosync-cmapctl |grep members #检查当前集群的成员信息
# crm_mon -1 #监测集群状态
# pcs cluster node remove master #移除集群节点master
# crm_verify -L -V #检查集群配置是否有误
# pcs property set stonith-enabled=false #检查有stonith报错就执行该命令
# pcs property list #检查已经更改过的集群属性
# pcs property --all #检查已经更改过的集群属性,全局使用该命令
集群是基于这三个服务
# systemctl start corosync.service;systemctl enable corosync
# systemctl start pacemaker.service ;systemctl enable pacemaker.service
# systemctl start pcsd;systemctl enable pcsd
11、创建VIP(命令和图形)master节点,随意哪个节点都行
(1)、添加一个集群的虚拟VIP资源(命令)创建VIP的前提是有双节点才会有效192.168.124.200
# pcs resource create vip ocf
标签:架构,fence,pcs,企业级,master,集群,root,节点 From: https://www.cnblogs.com/libin-linux/p/16839261.html