佘小宝的爹 发表于 2017-6-24 13:33:03

KVM环境搭建RHCS

一、环境

Hypervisor:RHEL 6.3               
             IP:10.10.60.10    login:root    passwd:root

Guest OS:CentOS 6.3   两台
             node1   IP:10.10.60.16   login:root   passwd:root
             node2   IP:10.10.60.55   login:root   passwd:root

二、配置

1、修改hosts文件

# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
10.10.60.16 node1
10.10.60.55 node2

2、同步ssh key
# scp -r /root/.ssh/ node2:/root/

3、安装RHCS套件
# for i in cman ricci ;do rpm -qa | grep $i;done
cman-3.0.12.1-32.el6.x86_64
ricci-0.16.2-55.el6.x86_64

4、测试Hypervisor的libvirt连接情况

# virsh -c qemu+ssh://10.10.60.10/system
root@10.10.60.10's password:
Welcome to virsh, the virtualization interactive terminal.
Type:'help' for help with commands
       'quit' to quit
virsh # list
Id    Name                           State
----------------------------------------------------
2   cLient_App                     running
14    node1                        running
18    node2                        running
virsh #
出现虚机信息,说明libvirt连接成功,可用于fence

5、编辑cluster.conf文件(记得同步到node2)

# cat /etc/cluster/cluster.conf
<?xml version="1.0"?>
<cluster config_version="12" name="kvm_fence">
   <clusternodes>
          <clusternode name="node1" nodeid="1">
               <fence>
                  <method name="virsh">
                         <device action="reboot" name="virsh" port="node1"/>
                  </method>
               </fence>
          </clusternode>
          <clusternode name="node2" nodeid="2">
               <fence>
                  <method name="virsh">
                         <device action="reboot" name="virsh" port="node2"/>
                  </method>
               </fence>
          </clusternode>
   </clusternodes>
   <cman expected_votes="1" two_node="1"/>
   <fencedevices>
          <fencedevice agent="fence_virsh" ipaddr="10.10.60.10" login="root" name="virsh" passwd="root"/>
   </fencedevices>
</cluster>

验证cluster.conf语句
# ccs_config_validate
Configuration validates

备注:cluster.conf文件中fencedevice agent部分参数由man fence_virsh可知


6、测试节点手动fence

# fence_virsh --ip=10.10.60.10 --username=root --password=root-x -n node2
Success: Rebooted
或者
# fence_node node2
fence node2 success
fence_node命令会自动取fence_virsh中相关参数


7、服务开机启动
# chkconfig cman on
# chkconfig ricci on
页: [1]
查看完整版本: KVM环境搭建RHCS