rhel6下组建两台主机的HA集群







[kiosk@foundation15 Desktop]$ ssh root@172.25.15.10#配置初始化环境
Last login: Thu Jul  2 16:02:25 2015 from 172.25.0.250
[root@rhel6 ~]# vim /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=node1-f15.example.com
~                                      
[root@rhel6 ~]# vim /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
172.25.15.10 node1-f15.example.com node1-f15
172.25.15.11 node2-f15.example.com node2-f15
172.25.15.12 node3-f15.example.com node3-f15
172.25.15.13 node4-f15.example.com node4-f15


[root@rhel6 ~]# service NetworkManager stop
Stopping NetworkManager daemon:                            [  OK  ]
[root@rhel6 ~]# chkconfig NetworkManager off
[root@rhel6 ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0 


DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth0"


IPADDR=172.25.15.10
NETMASK=255.255.255.0
GATEWAY=172.25.15.254


vim /etc/sysconfig/network-scripts/ifcfg-eth1


DEVICE=eth1
TYPE=Ethernet
ONBOOT=no
NM_CONTROLLED=yes
BOOTPROTO=none
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth1"
[root@rhel6 ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth2
DEVICE=eth2
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth2"


IPADDR=192.168.122.40
NETMASK=255.255.255.0
[root@rhel6 ~]# iptables -F
[root@rhel6 ~]# service iptables save
iptables: Saving firewall rules to /etc/sysconfig/iptables:                                                          [  OK  ]
[root@rhel6 ~]# vi /etc/selinux/config 
SELINUX=disabled


[root@rhel6 ~]wget http://classroom.example.com/content/ula/cluster/cluster.repo -O /etc/yum.repos.d/cluster.repo
[root@rhel6 ~]# yum makecache
wget http://classroom.example.com/content/ula/cluster/cluster.repo -O /etc/yum.repos.d/cluster.repo
node2:
[root@rhel6 ~]#  wget http://classroom.example.com/content/ula/cluster/clusterinit.sh
[root@rhel6 ~]# bash clusterinit.sh node2-f15.example.com
Stopping NetworkManager daemon:                            [  OK  ]
iptables: Saving firewall rules to /etc/sysconfig/iptables:[  OK  ]


node1:


[root@node1-f15 ~]# yum install luci ricci -y #luci是提供web,ricci
[root@node1-f15 ~]# service luci start
[root@node1-f15 ~]# service ricci start
[root@node1-f15 ~]# echo uplooking | passwd ricci --stdin#更改密码
[root@rhel6 ~]# mkdir /etc/cluster/
[root@node1-f15 ~]# echo node1-f15 > /var/www/html/index.html#新建网站的测试页


node2:
[root@node2-f15 ~]# yum install ricci -y #安装客户端
[root@node2-f15 ~]# service ricci start
[root@node2-f15 ~]# passwd ricci #更改密码
[root@rhel6 ~]# mkdir /etc/cluster/
[root@node2-f15 ~]# echo node2-f15 > /var/www/html/index.html#新建网站的测试页






[kiosk@foundation15 Desktop]$ su - #切换到root才能拷贝etc下的配置文件
Password: 
Last login: Tue Sep 27 20:19:30 CST 2016 on pts/9
[root@foundation15 ~]# scp /etc/cluster/fence_xvm.key root@172.25.15.10:/etc/cluster/


[root@foundation15 ~]# scp /etc/cluster/fence_xvm.key root@172.25.15.11:/etc/cluster/
key文件是通过dd指令生成的大小为512b的文件,只要每台机器该文件的大小一致,fence就能生效
主机要线安装fence
yum -y install fence*
service fence_virtd restart
chkconfig fence_virtd on
______________________________
firefox
https://node1-f15.example.com:8084
user:root password:uplooking




[root@node1-f15 ~]# clustat
Cluster Status for cluster-f15 @ Tue Sep 27 19:50:05 2016
Member Status: Quorate


 Member Name                              ID   Status
 ------ ----                              ---- ------
 node1-f15.example.com                        1 Online, Local
 node2-f15.example.com                        2 Online













posted @ 2016-10-06 16:30  希曼博客  阅读(338)  评论(0编辑  收藏  举报