Redhat7 PCS建立无共享存储浮动地址集群

环境及开局准备

环境概述

由于环境限制,实验环境如下:

  1. 时间有限使用VMware6.7环境
  2. 使用Centos7.8最小化安装方式(不用配置本地yum仓库)
  3. 注意查看主机名(主机双机操作,部分单机操作)
主机名地址备注
PCS0110.10.10.216
PCS0210.10.10.217
Virtual IP10.10.10.215

防火墙配置

关闭防火墙(建议先进行关闭,后期查询端口后开启)

[root@pcs01 ~]# systemctl stop firewalld
[root@pcs01 ~]# systemctl disable firewalld
 
[root@pcs02 ~]# systemctl stop firewalld
[root@pcs02 ~]# systemctl disable firewalld

Redhat/Centos7 建立无共享存储浮动地址集群

配置防火墙允许集群组件通过(可选)

[root@pcs01 ~]# firewall-cmd --permanent --add-service=high-availability
[root@pcs01 ~]# firewall-cmd --permanent --add-service=ntp
[root@pcs01 ~]# firewall-cmd --reload
 
[root@pcs02 ~]# firewall-cmd --permanent --add-service=high-availability
[root@pcs02 ~]# firewall-cmd --permanent --add-service=ntp
[root@pcs02 ~]# firewall-cmd --reload

PCS集群构建

安装pacemaker配置工具

[root@pcs01 ~]# yum install -y pacemaker corosync pcs psmisc policycoreutils-python fence-agents-all nano
[root@pcs01 ~]# rpm -qi fence-agents-all
 
[root@pcs02 ~]# yum install -y pacemaker corosync pcs psmisc policycoreutils-python fence-agents-all nano
[root@pcs02 ~]# rpm -qi fence-agents-all

配置时钟和主机名解析

[root@pcs01 ~]# yum install -y ntp
[root@pcs01 ~]# ntpdate time.windows.com
 
[root@pcs02 ~]# yum install -y ntp
[root@pcs02 ~]# ntpdate time.windows.com

PCS01-与微软时间进行同步

[root@pcs01 ~]# crontab -e
*/30 * * * * /sbin/ntpdate time.windows.com &> /dev/null

Redhat/Centos7 建立无共享存储浮动地址集群

[root@pcs01 ~] nano /etc/ntp.conf

Redhat/Centos7 建立无共享存储浮动地址集群

PCS02-与PCS01进行同步

[root@pcs02 ~]# crontab -e
*/30 * * * * /sbin/ntpdate pcs01

Redhat/Centos7 建立无共享存储浮动地址集群

[root@pcs02 ~] nano /etc/ntp.conf

Redhat/Centos7 建立无共享存储浮动地址集群

主机名解析

[root@pcs01 ~] /etc/hosts
10.10.10.216    pcs01.chndi.com pcs01
10.10.10.217    pcs01.chndi.com pcs02
 
[root@pcs02 ~] /etc/hosts
10.10.10.216    pcs01.chndi.com pcs01
10.10.10.217    pcs01.chndi.com pcs02

Redhat/Centos7 建立无共享存储浮动地址集群

完善时间及验证配置

[root@pcs01 ~] systemctl restart ntpd
[root@pcs02 ~] systemctl restart ntpd
 
[root@pcs02 ~] ntpq -p
 
[root@pcs01 ~] ssh pcs02 'date';date

Redhat/Centos7 建立无共享存储浮动地址集群

配置pcs集群组件

访问:https://10.10.10.216:2224(PCS01地址)

Redhat/Centos7 建立无共享存储浮动地址集群

Redhat/Centos7 建立无共享存储浮动地址集群

Redhat/Centos7 建立无共享存储浮动地址集群

Redhat/Centos7 建立无共享存储浮动地址集群

Redhat/Centos7 建立无共享存储浮动地址集群

PCS集群配置(无共享存储 浮动地址配置)

查询集群状态

[root@pcs01 ~]# pcs status

Redhat/Centos7 建立无共享存储浮动地址集群

检查配置有无错误


[root@pcs01 ~]# crm_verify -L -V

Redhat/Centos7 建立无共享存储浮动地址集群

禁用stonish


[root@pcs01 ~]# pcs property set stonith-enabled=false

验证配置


[root@pcs01 ~]# crm_verify -L -V

创建VIP资源浮动地址

[root@pcs01 ~]pcs resource create VirtualIP ocf:heartbeat:IPaddr2 ip=10.10.10.215 cidr_netmask=24 op monitor interval=30s

Redhat/Centos7 建立无共享存储浮动地址集群

验证配置

[root@pcs01 ~]# pcs status
[root@pcs01 ~]# ip a
[root@pcs02 ~]# ip a

Redhat/Centos7 建立无共享存储浮动地址集群

Redhat/Centos7 建立无共享存储浮动地址集群

Redhat/Centos7 建立无共享存储浮动地址集群

VIP资源浮动地址切换

切换至pcs01
pcspcs resource move VirtualIP pcs01
切换至pcs02
pcspcs resource move VirtualIP pcs02
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

知名“矿工”

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值