zoukankan      html  css  js  c++  java
  • 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
    [root@node1 ~]# 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连接情况

    [root@node1 ~]# 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)
     
    [root@node1 ~]# 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语句
    [root@node1 ~]# ccs_config_validate
    Configuration validates
     
    备注:cluster.conf文件中fencedevice agent部分参数由man fence_virsh可知
     
     
    6、测试节点手动fence
     
    [root@node1 ~]# fence_virsh --ip=10.10.60.10 --username=root --password=root  -x -n node2
    Success: Rebooted

    或者

    [root@node1 ~]# fence_node node2
    fence node2 success

    fence_node命令会自动取fence_virsh中相关参数
     
     
    7、服务开机启动
    # chkconfig cman on
    # chkconfig ricci on
  • 相关阅读:
    (转)获取枚举属性的值
    C#调用C++类(以COM组件的形式)
    托管DirectX,从MDX到SlimDX的转换(转)
    数字地球影像服务后台数据读取粗糙问题
    DevExpress控件EditValue_Changed事件(延迟问题)
    Visual Studio 2008经常性卡死的其中一种解决办法
    It's not too late to start!
    Gcc编译器 linux
    UNIX系统中的进程 linux
    图算法套汇问题 linux
  • 原文地址:https://www.cnblogs.com/tonychiu/p/5766537.html
Copyright © 2011-2022 走看看