RHSC+fence配置服务级别的高可用

参考文档
https://blog.csdn.net/tjiyu/article/details/52736285
https://www.cnblogs.com/forsaken627/articles/6514987.html

注意事项
1.RHCS套件最多支持的集群节点数为 16。
2.RHCS套件主要用在rhel6的系统版本上,在rh el7上面有其他的套件。
3.RHCS套件可以搭配很多东西可以使用,也可以管理很多软件,本文章只能使用了很少的一部分内容。
4.确保集群所使用的资源在交付给集群时,他是关闭的,否则会出错。‘
5.确保集群之间的时间同步,防火墙和SELINUX为关闭状态。

实验环境
主机 server1:192.168.122.1
KVM2 server2:192.168.122.2
KVM3 server3:192.168.122.3
KVM4 server4:192.168.122.4
首先配置三个 KVM虚拟机的yum源,红帽官方景象文件内包含有所需要的安装包,不过不在基础包内,所以还需要配置yum源


//基础包
[rhel6.5]
name=rhel6.5
baseurl=http://192.168.122.1/rhel6.5
gpgcheck=0

//HA组建包
[HighAvailability]
name=HighAvailability
baseurl=http://192.168.122.1/rhel6.5/HighAvailability
gpgcheck=0

//LB组建包
[LoadBalancer]
name=LoadBalancer
baseurl=http://192.168.122.1/rhel6.5/LoadBalancer
gpgcheck=0

//存储扩展包
[ResilientStorage]
name=ResilientStorage
baseurl=http://192.168.122.1/rhel6.5/ResilientStorage
gpgcheck=0

//大文件系统扩展包
[ScalableFileSystem]
name=ScalableFileSystem
baseurl=http://192.168.122.1/rhel6.5/ScalableFileSystem
gpgcheck=0

完成后开始安装,启动软件。
KVM3/4安装ricci,KVM2安装luci

//安装luci,设为开启启动
[root@server2 ~]# yum install luci
[root@server2 ~]# /etc/init.d/luci start
[root@server2 ~]# chkconfig luci on
//安装ricci,设为开启启动
[root@server3 ~]# yum install -y ricci
[root@server3 ~]# passwd ricci
[root@server3 ~]# /etc/init.d/ricci start
[root@server3 ~]# chkconfig ricci on
//安装ricci,设为开启启动
[root@server4 ~]# yum install -y ricci
[root@server4 ~]# passwd ricci
[root@server4 ~]# /etc/init.d/ricci start
[root@server4 ~]# chkconfig ricci on

进如GUI管理页面

//由于我在我的主机上做了本地解析,所以可以直接用server2
//luci使用8084端口
https://server2:8084

登陆页面
用户名为server的用户名,密码为root用户密码

创建集群
ricci使用tcp/11111端口

这里写图片描述

提交
这里创建的集群,实际上是在server2上面创建的集群,所以他的所以验证之类的都在server2上面去做
这里写图片描述

创建完成

这里写图片描述

使用fence_vird模拟物理机
在真机上安装软件,模拟fence设备

[root@server ~]# yum install -y fence-virtd fence-virtd-libvirt fence-virtd-libvirt fence-virtd-serial  fence-virtd-multicast

[root@server ~]# fence_virtd -c  
//fence_vird使用的组建的各种信息
Module search path [/usr/lib64/fence-virt]: 

Available backends:
    libvirt 0.1
Available listeners:
    multicast 1.2
    serial 0.4

Listener modules are responsible for accepting requests
from fencing clients.
//多拨
Listener module [multicast]: 

The multicast listener module is designed for use environments
where the guests and hosts may communicate over a network using
multicast.

The multicast address is the address that a client will use to
send fencing requests to fence_virtd.
//多播地址
Multicast IP Address [225.1.1.12]: 

Using ipv4 as family.
//多播地址
Multicast IP Port [1229]: 

Setting a preferred interface causes fence_virtd to listen only
on that interface.  Normally, it listens on all interfaces.
In environments where the virtual machines are using the host
machine as a gateway, this *must* be set (typically to virbr0).
Set to 'none' for no interface.
//虚拟机与物理机通信的接口
Interface [virbr0]: 

The key file is the shared key information which is used to
authenticate fencing requests.  The contents of this file must
be distributed to each physical host and virtual machine within
a cluster.
//key的位置
Key File [/etc/cluster/fence_xvm.key]: 

Backend modules are responsible for routing requests to
the appropriate hypervisor or management layer.

Backend module [libvirt]: 

Configuration complete.
//生成的信息
=== Begin Configuration ===
backends {
    libvirt {
        uri = "qemu:///system";
    }

}

listeners {
    multicast {
        port = "1229";
        family = "ipv4";
        interface = "virbr0";
        address = "225.1.1.12";
        key_file = "/etc/cluster/fence_xvm.key";
    }

}

fence_virtd {
    module_path = "/usr/lib64/fence-virt";
    backend = "libvirt";
    listener = "multicast";
}

=== End Configuration ===
Replace /etc/fence_virt.conf with the above [y/N]? y

由于没有cluster文件夹,所以需要自己新建,并且需要把生成的key放入该文件下面,并且发送给server3/4,

[root@server ~]# mkdir /etc/cluster
[root@server ~]# dd if=/dev/urandom of=/etc/cluster/fence_xvm.key bs=128 count=1
[root@server ~]# scp /etc/cluster/fence_xvm.key server3:/etc/cluster/

查看key
这里写图片描述

回到GUI,创建fence,
这里写图片描述

这里写图片描述

回到server3里面,添加刚刚创建的webfence
这里写图片描述
server4也一样

此时fence虚拟设备添加完毕设备

查看节点信息

[root@server3 cluster]# clustat
Cluster Status for webserver @ Sat May  5 17:47:02 2018
Member Status: Quorate

 Member Name                                                    ID   Status
 ------ ----                                                    ---- ------
 server3                                                            1 Online, Local
 server4                                                            2 Online

在server3/4安装httpd服务,
设置不同的主页便于检查

回到GUI,添加一个服务
这里写图片描述

添加一个vip
这里写图片描述

添加一个脚本
http的启动脚本
这里写图片描述

完成后是这样
这里写图片描述

配置一个资源组
这里写图片描述
加入vip和刚刚定义的脚本
这里写图片描述

此时vip和httpd服务都加入了集群,就可以简单的进行使用了

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值