??????????????????????????????ü??????????node1??IP?192.168.122.168 ????????node2??IP?192.168.122.169 ??
????????????????
???????????pcs??pacemaker??corosync??fence-agents-all???????????????????????????????
???????????÷????
????1????????????selinux
????# systemctl disable firewalld
????# systemctl stop firewalld
???????/etc/sysconfig/selinux???SELINUX=disabled????????setenforce 0????reboot??????????Ч

????2?????÷????????
????# firewall-cmd --permanent --add-service=high-availability
????# firewall-cmd --add-service=high-availability
?????????????????????????????
??????????2???????????node1??node2????centos 7????????/etc/hostname????????????????????????????????????ɡ?
????#vi /etc/hostname
????node1
????#systemctl restart network.service
????#hostname
????node1
????????2????????????????/etc/hosts?м???
????192.168.122.168 node1
????192.168.122.169 node2
?????????????????????
??????node1??node2?????????????????????ntp????
????[root@node1 ~]# ntpdate 172.16.0.1 //172.16.0.1 ?????????
?????塢????????????ssh????????????????
??????????????????????????????
????# ssh-keygen -t rsa -P ‘’   #??????????????????????????????????????????????????
????# ssh-copy-id -i /root/.ssh/id_rsa.pub root@node2 #??????????????????
????????????????????????????????????????????????????????????????????hosts???????????????????????? 192.168.122.168 node1 192.168.122.169 node2
????# ssh node2 ‘date’;date #?????????????????
???????????pacemaker?????????ü??
????1????????????
???????????????????????????ü????????????????????hacluster????????????????????????????????
????# passwd hacluster
????Changing password for user hacluster.
????New password:
????Retype new password:
????passwd: all authentication tokens updated successfully.
????2??????pcsd?????????
????# systemctl start pcsd.service
????# systemctl enable pcsd.service
????3???????????????????
????# pcs cluster auth node1 node2Username: hacluster Password: node1: Authorized node2: Authorized
????4??????????????
????[root@z1 ~]# pcs cluster setup --start --name my_cluster node1 node2
????node1: Succeeded
????node1: Starting Cluster...
????node2: Succeeded
????node2: Starting Cluster...
????5?????ü???????
????# pcs cluster enable –all
????6????????????
????[root@z1 ~]# pcs cluster status
????7??????fence?豸
???????????ο?<Red Hat Enterprise Linux 7 High Availability Add-On Reference>
????corosync?????????stonith????????????????????stonith?豸??????? ?????????в???????????????????????????
????#crm_verify -L -V
????????????????????????stonith??
????#pcs property set stonith-enabled=false???????true??
????8??????洢
????????ü????????????????????????????????????????????????????????????????????????????????????????????????????????
????????????????iscsi??DBRD????????????ù???????
????9?????????IP
?????????????????????У???????????????????????????????????192.168.122.101???????IP???????????ü?????? ClusterIP ????????? ?30????????Ρ?
????# pcs resource create VIP ocf:heartbeat:IPaddr2 ip=192.168.122.170 cidr_netmask=24 op monitor interval=30s
????# pcs update VIP op monitor interval=15s
????10??????apache????
??????node1??node2????httpd ?????httpd??????????
????# systemctl status httpd.service??
????????httpd?????棨ò???????????????systemd???????????node1??node2?????
????# cat > /etc/httpd/conf.d/status.conf << EOF
????SetHandler server-status
????Order deny??allow
????Deny from all
????Allow from localhost
????EOF
?????????????Apache??????????????centos????????Apache docroot??/var/www/html????????????????????潨??????????
????node1?????????£?
????[root@node1 ~]# cat <<-END >/var/www/html/index.html
????<html>
????<body>Hello node1</body>
????</html>
????END
????node2?????????£?
????[root@node2 ~]# cat <<-END >/var/www/html/index.html
????<html>
????<body>Hello node2</body>
????</html>
????END
??????????????httpd??????????????У?
????#pcs resource create WEB apache configfile="/etc/httpd/conf/httpd.conf" statusurl="http://127.0.0.1/server-status"