pacemaker haproxy实现nginx的高可用(未完成)

yum install pacemaker corosync -y
 cd /etc/cluster/
 ls
cman-notify.d  fence_xvm.key
cd /etc/corosync/
ls
 cp corosync.conf.example corosync.conf
 vim corosync.conf
配置文件
# Please read the corosync.conf.5 manual page
compatibility: whitetank

totem {
    version: 2
    secauth: off
    threads: 0
    interface {
        ringnumber: 0
        bindnetaddr: 172.25.88.0   ##域
        mcastaddr: 226.94.1.1
        mcastport: 5405
        ttl: 1
    }
}

logging {
    fileline: off
    to_stderr: no
    to_logfile: yes
    to_syslog: yes
    logfile: /var/log/cluster/corosync.log
    debug: off
    timestamp: on
    logger_subsys {
        subsys: AMF
        debug: off
    }
}

amf {
    mode: disabled
}

service{            ##添加pacemaker服务
    name:pacemaker
    ver:0           ##0表示pacemaker跟随软件自启
在server1中安装pacemaker和corosync服务。并拷贝server4的配置文件到1中


 scp corosync.conf server1:/etc/corosync//e
 /etc/init.d/corosync start
 /etc/init.d/corosync start
 crm_verify -LV   ##有报错,因为默认引导fence,而fence还未配置
   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
}

这里写图片描述
这里写图片描述

crmsh 和 pcs

crm(live)# configure 
crm(live)configure# show
node server1
node server4
property $id="cib-bootstrap-options" \
    dc-version="1.1.10-14.el6-368c726" \
    cluster-infrastructure="classic openais (with plugin)" \
    expected-quorum-votes="2"
crm(live)configure# property stonith-enabled=false  ##先关掉fence
crm(live)configure# commit

 crm_verify -LV   ##关掉fence后不报错
# crm
crm(live)# configure 
shoecrm(live)configure# show
node server1
node server4
property $id="cib-bootstrap-options" \
    dc-version="1.1.10-14.el6-368c726" \
    cluster-infrastructure="classic openais (with plugin)" \
    expected-quorum-votes="2" \
    stonith-enabled="false"
crm(live)configure# primitive vip ocf:heartbeat:IPaddr2 params ip=172.25.18.100 cidr_netmask=24 op monitor interval=1min
##配置vip heartbeat工具 vip netmask     健康监测时间
crm(live)configure# commit 
crm(live)configure# bye
 vim /etc/haproxy/haproxy.cfg
frontend public
        bind            *:80    ##监听所有的80端口(为了监听vip)

猜你喜欢

转载自blog.csdn.net/ningyuxuan123/article/details/81395726