RedHat 高可用性集群实验(防单点故障)
实验环境:
192.168.0.13---->管理机 (要求时间同步)
192.168.0.11 ---->节点1 (要求时间同步)
192.168.0.12---->节点2 (要求时间同步)
192.168.0.53 ---->网络共享存储主机
备注:
管理机:A
节 点1:B
节 点2:C
存储机:D
实验前的准备工作: # iptables -F (清空防火墙)
# vim /etc/selinux/config (关闭selinux)
SELINUX=disabled
# setenforce 0
1。搭建存储存储服务器:
# yum -y install scsi-target-utils-utils
# service tgtd start
# chkconfig tgtd on
# fdisk /dev/hda
分了一个hda4 为共享存储
# vim cunchu_run
-----------------------------------------------
tid=$1
tgtadm --lld iscsi --op new --mode target --tid $1 -T iqn.2009-11-19.com.example.starton53:disk$tid
dev_hda=$2
clinet_ip1=$3
clinet_ip2=$4
tgtadm --lld iscsi --op new --mode logicalunit --tid $1 --lun 1 -b /dev/$2
tgtadm --lld iscsi --op bind --mode target --tid $1 -I $ip1
tgtadm --lld iscsi --op bind --mode target --tid $1 -I $ip2
tgtadm --lld iscsi --op show --mode target
------------------------------------------------
# chmod 777 cunchu_run
# ./cunchu_run 1 hda4 192.168.0.11 192.168.0.12
2。搭建节点客户端:
vim /etc/hosts (解析主机名)
-----------------------------------------------------------
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
192.168.0.11 station11.example.com station11
192.168.0.12 station12.example.com station12
192.168.0.53 station53.example.com station53
-----------------------------------------------------------
vim /etc/ntp.conf 把时间与 0.254时间服务器同步
----------------------------------------------
restrict default ignore
restrict 127.0.0.1
restrict 192.168.0.254
server 127.127.1.0 # local clock
fudge 127.127.1.0 stratum 10
server 192.168.0.254
driftfile /var/lib/ntp/drift
broadcastdelay 0.008
----------------------------------------------
ABC:# service ntpd restart (重启ntpd服务,使时间与服务器同步)
ABC:# watch -n.1 date (查看时间是否与时间服务器同步)
2-1。访问网络存储:
集群存储
--------------------------
BC:# yum clean all
BC:# yum install iscsi-initiator-utils
BC:# service iscsi start
BC:# chkconfig iscsi on
BC:# vim chu_run
------------------------------
stationX=$1
echo "InitiatorAlias=$1" >> /etc/iscsi/initiatorname.iscsi
service iscsi start
chkconfig iscsi on
iqn_disk_id=$2
iscsiadm -m discovery -t sendtargets -p 192.168.0.53:3260
iscsiadm -m node -T iqn.2009-11-19.com.example.starton53:disk$2 -p 192.168.0.53:3260
iscsiadm -m node -T iqn.2009-11-19.com.example.starton53:disk$2 -p 192.168.0.53:3260 -l
partprobe
fdisk -l
service iscsi status
--------------------------
BC:# chmod 777 chu_run
BC:# ./chu_run 11 1
3。HA--高可用性(时间要保持高度的一致性):
A:yum -y install luci
BC:yum -y install ricci httpd
ABC:# service ntpd restart (重启ntpd服务,使时间与服务器同步)
ABC:# watch -n.1 date (查看时间是否与时间服务器同步)
BC:service ricci start
BC:chkconfig ricci on
A:luci_admin init
redhat ---- redhat (初始化创建密码)
A:chkconfig luci on
A:service luci restart (如果有失败就多重启几次就好了)
Point your web browser to https://station32.example.com:8084 to access luci
在浏览器中打开: https://station32.example.com:8084
1. 登录名:admin 密码:redhat
2. 选择top导航中的"cluster"菜单--"Create a New Cluster"。在右边的Cluster Name-->cluster13(填写一个集群分配号),下边的“Node Hostname”分别填写节点主机名-->"station11.example.com" "station12.example.com",“Root Password“中填写对应主机的登录密码 "redhat",其他所有参数都可以保留其默认,然后点击"Submit"提交。(然后管理机开始试图分别访问节点,并对每个节点安装相应的软件包,并重启各个节点机--正常完成该步为正确,否则错误)。
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
刷新信息群集列表中选择从左侧菜单
================
浏览器中配置到第14步后:
ABC:# yum -y install cman
ABC:# service cman status
A:# scp 192.168.0.11:/etc/cluster/fence_xvm.key /etc/cluster
A:# scp 192.168.0.12:/etc/cluster/fence_xvm.key /etc/cluster
先开存储机,再开客户端(节点机),最后开管理机。
B:service syslog restart
如果
1、IP 设置没有问题
2、网关设置没有问题
3、网关本身没有问题
4、DNS 设置没有问题
5、防火墙设置没有问题
6、网线没有问题
那么可能就是
7、SELinux 的问题
如果也不是,那也许
8、也许是网线有问题
如果还不是,那就是
9、传说中的人品问题
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/21021875/viewspace-620068/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/21021875/viewspace-620068/