HA-高可用性集群实验(防单点故障)
RedHat 高可用性集群实验(防单点故障)
实验环境:
192.168.0.53 ---->网络共享存储主机
192.168.0.11 ---->节点1 (要求时间同步)
192.168.0.12---->节点2 (要求时间同步)
192.168.0.13---->管理机 (要求时间同步)
备注:
管理机: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 $tid -T iqn.2009-11-19.com.example.starton53:disk$tid
hda=$2
ip1=$3
ip2=$4
tgtadm --lld iscsi --op new --mode logicalunit --tid $tid --lun 1 -b /dev/$hda
tgtadm --lld iscsi --op bind --mode target --tid $tid -I $ip1
tgtadm --lld iscsi --op bind --mode target --tid $tid -I $ip2
tgtadm --lld iscsi --op show --mode target
------------------------------------------------
# ./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 (查看时间是否与时间服务器同步)
BC:yum -y install ricci httpd
BC:service ricci start
BC:chkconfig ricci on
A:yum -y install luci
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
--------------------------
yum clean all
yum install iscsi-initiator-utils
service iscsi start
chkconfig iscsi on
alias=$1
echo "InitiatorAlias=station$alias" >> /etc/iscsi/initiatorname.iscsi
service iscsi start
service iscsi start
service iscsi start
chkconfig iscsi on
iscsiadm -m discovery -t sendtargets -p 192.168.0.53:3260
iscsiadm -m node -T iqn iqn.2009-11-19.com.example.starton53:disk$tid -p 192.168.0.53:3260
iscsiadm -m node -T iqn iqn.2009-11-19.com.example.starton53:disk$tid -p 192.168.0.53:3260 -l
partprobe
fdisk -l
service iscsi servie
--------------------------
B:service syslog restart
《over》