两个主机 相同的配置
安装  corosync.x86_64
pssh-2.3.1-2.1.x86_64.rpm  
crmsh-1.2.6-0.rc2.2.1.x86_64.rpm

/etc/corosync/corosync.conf
 
  4 totem {
  5         version: 2
  6         secauth: off
  7         threads: 0
  8         interface {
  9                 ringnumber: 0
 10                 bindnetaddr: 172.25.28.0
 11                 mcastaddr: 226.94.1.1     #多播地址
 12                 mcastport: 54070          #多播端口
 13                 ttl: 1
 14         }
 15 }
 
 34 service{
 35         name: pacemaker   #启动 pacemaker
 36         ver: 0
 37 }


crm_verify -LV  检测配置信息
crm_mon  监控主机状态
 

error: unpack_resources:     Resource start-up disabled since no STONITH resources have been defined
error: unpack_resources:     Either configure some or disable STONITH with the stonith-enabled option
error: unpack_resources:     NOTE: Clusters with shared data need STONITH to ensure data integrity
Errors found during check: config not valid

crm configure property stonith-enabled=false    #设置为 false 来关闭STONITH

crm configure primitive vip ocf:heartbeat:IPaddr2 params ip=172.25.28.70 cidr_netmask=32 op monitor interval=10s    #添加VIP信息

crm configure primitive apache ocf:heartbeat:apache params configfile=/etc/httpd/conf/httpd.conf op monitor interval=20s    #添加Apache

配置Apache
/etc/httpd/conf/httpd.conf

 921 <Location /server-status>
 922     SetHandler server-status
 923     Order deny,allow
 924     Deny from all
 925     Allow from 127.0.0.1
 926 </Location>

cleanup apache server27.example.com  
 
以上可能造成 vip 和 Apache 不再一个服务器上
解决方法:
crm configure colocation apache-with-vip inf:mysite vip



双方服务器有一方挂掉 ,整个业务就停止。改进当一方挂掉,另一方接替工作

crm configure property no-quorum-policy=ignore


增加fence 功能
crm configure property stonish-enable=true

主机生成 fence_xvm.key 发给 corosync 两台主机  /etc/cluster
dd if=/dev/urandom of=/etc/cluster/fence_xvm.key bs=128 count=1

开启主机fence
systemctl start fence_virtd

vm2 对应 server26.example.com  vm1 对应 server27.example.com
crm configure  primitive vmfence stonith:fence_xvm params pcmk_host_map=server26.example.com:vm2;server27.example.com:vm1 op monitor interval=1min

增加 ISCSI  共享磁盘

iscsiadm  -m discovery -t st -p 172.25.28.28
iscsiadm -m node -l
fdisk /dev/sda
mkfs.ext4 /dev/sda1

crm configure  primitive webdata ocf:heartbeat:Filesystem params device=/dev/sda1 directory=/var/www/html fstype=ext4 op monitor  interval=1min

crm configure  group webgroup vip webdata mysite   设置组和 服务顺序