#vim /etc/sysconfig/network HOSTNAME=web1.example.com #hostname web1.example.com |
#vim /etc/sysconfig/network HOSTNAME=web2.example.com #hostname web2.example.com |
#vim /etc/hosts 192.168.0.101 web1.example.com web1 192.168.0.102web2.example.com web2 |
#ssh-keygen -t rsa -f "~/.ssh/id_rsa -P "" #ssh-copy-id i .ssh/id_rsa.pub root@192.168.0.102 |
#ssh-keygen -t rsa -f "~/.ssh/id_rsa -P "" #ssh-copy-id i .ssh/id_rsa.pub root@192.168.0.101 |
#yum -y install httpd #chkconfig httpd off #echo 'web1' > /var/www/html/index.html (测试) #service httpd restart |
#yum -y install httpd #chkconfig httpd off #echo 'web2' > /var/www/html/index.html (测试) |
#mkdir /webfile #cd /webfile;echo "nfs" >index.html #vim /etc/exports /webfile192.168.0.0/24(ro,sync) #service nfs start #showmount -e 192.168.0.100 |
heartbeat-2.1.4-11.el5.i386.rpm heartbeat-pils-2.1.4-11.el5.i386.rpm heartbeat-stonith-2.1.4-11.el5.i386.rpm heartbeat-gui-2.1.4-11.el5.i386.rpm 额外依赖包:libnet-1.1.4-3.el5.i386.rpm perl-MailTools-1.77-1.el5.noarch.rpm #wget http://dl.fedoraproject.org/pub/ ... 1.4-11.el5.i386.rpm #wget http://dl.fedoraproject.org/pub/ ... 1.4-11.el5.i386.rpm #wget http://dl.fedoraproject.org/pub/ ... 1.4-11.el5.i386.rpm #wget http://dl.fedoraproject.org/pub/ ... 1.4-11.el5.i386.rpm #wget http://dl.fedoraproject.org/pub/ ... .1.6-7.el5.i386.rpm #wget http://dl.fedoraproject.org/pub/ ... 77-1.el5.noarch.rpm # yum -y localinstall --nogpgcheck *.rpm |
#cp /usr/share/doc/heartbeat-2.1.4/{haresources,ha.cf authkeys} /etc/had.d/ #cd /etc/had.d/ #chmod 600 authkeys (权限必须为600,否则会出现问题) |
bcast eth0 node web1.example.com node web2.example.com |
#dd if=/dev/random count=1 bs=512 |md5sum #vim authkeys auth 3 3 md5 ec92b27792a008b420ec5adfe0a34ea0 //为刚才借助dd产生的随机md5加密值 |
#vim haresources web1.example.com 192.168.0.254/24/eth0 httpd |
scp /etc/ha.d/{haresources,authkeys,ha.cf} root@web2:/etc/ha.d |
#service heartbeat start #ssh web2 ‘service heartbeat start’ |
#/usr/share/heartbeat/hb_standby 2012/12/28_19:43:49 Going standby [all]. #elinks -dump http://192.168.0.254 |
#vim /etc/ha.d/haresources web1.example.com 192.168.0.254/24/eth0 Filesystems::192.168.0.100:/webfile::/var/www/html httpd #scp /etc/ha.d/haresources root@web2:/etc/ha.d/ #service heartbeat restart #ssh web2 'service heartbeat restart' |
#elinks -dump http://192.168.0.254 nfs |
#/usr/share/heartbeat/hb_standby 2012/12/28_19:43:49 Going standby [all]. #elinks -dump http://192.168.0.254 nfs |
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) | Powered by Discuz! X3.2 |