0

我想使用 corosync+pacemaker+zabbix 来实现高可用。跟随是我的配置

crm(live)configure# show
node zabbix1 \
attributes standby="off" timeout="60"
node zabbix2 \
attributes standby="off"
primitive httpd lsb:httpd \
op monitor interval="10s"
primitive vip ocf:heartbeat:IPaddr \
params ip="192.168.56.110" nic="eth0" cidr_netmask="24" \
op monitor interval="10s"
primitive zabbix-ha lsb:zabbix_server \
op monitor interval="30s" timeout="20s" \
op start interval="0s" timeout="40s" \
op stop interval="0s" timeout="60s" 
group webservice vip httpd zabbix-ha
property $id="cib-bootstrap-options" \
dc-version="1.1.8-7.el6-394e906" \
cluster-infrastructure="classic openais (with plugin)" \
expected-quorum-votes="2" \
stonith-enabled="false" \
last-lrm-refresh="1377489711" \
no-quorum-policy="ignore"
rsc_defaults $id="rsc-options" \
resource-stickiness="100"

我的 crm_mon 状态是:

Last updated: Mon Aug 26 18:52:48 2013
Last change: Mon Aug 26 18:52:33 2013 via cibadmin on zabbix1
Stack: classic openais (with plugin)
Current DC: zabbix1 - partition with quorum
Version: 1.1.8-7.el6-394e906
2 Nodes configured, 2 expected votes
3 Resources configured.


Node zabbix1: online
    httpd   (lsb:httpd):    Started
    vip     (ocf::heartbeat:IPaddr):        Started
    zabbix-ha   (lsb:zabbix_server):    Started
Node zabbix2: online

现在我停止zabbix1上的zabbix-ha服务,等待300s,pacemaker无法启动我的zabbix-ha服务:

[root@zabbix1 tmp]# ps -ef|grep zabbix
root     13287 31252  0 18:59 pts/2    00:00:00 grep zabbix

我的 zabbix-ha 脚本可以crm resource stop/start zabbix-ha用来停止/启动我的 zabbix-ha。

4

1 回答 1

0

我没有使用zabbix默认脚本(地址是zabbix-2.0.6/misc/init.d/fedora/core/zabbix_serve),我自己创建了lsb脚本。下面是我的zabbix_server脚本(我把它放在/等/init.d)

    #!/bin/bash
    #
    # zabbix: 控制zabbix Daemon
    #
    #作者:邓磊
    #
    # 博客:      http ://dl528888.blog.51cto.com/
    # 描述:这是一个 zabbix 的 init.d 脚本。在 CentOS6 上测试。\
    # 如有必要,更改 DAEMON 和 PIDFILE。
    #

#Location of zabbix binary. Change path as neccessary DAEMON=/usr/local/zabbix/sbin/zabbix_server NAME=`basename $DAEMON` #Pid file of zabbix, should be matched with pid directive in nginx config file. PIDFILE=/tmp/$NAME.pid #this file location SCRIPTNAME=/etc/init.d/$NAME #only run if binary can be found test -x $DAEMON || exit 0 RETVAL=0 start() { echo $"Starting $NAME" $DAEMON RETVAL=0 } stop() { echo $"Graceful stopping $NAME" [ -s "$PIDFILE" ] && kill -QUIT `cat $PIDFILE` RETVAL=0 } forcestop() { echo $"Quick stopping $NAME" [ -s "$PIDFILE" ] && kill -TERM `cat $PIDFILE` RETVAL=$? } reload() { echo $"Graceful reloading $NAME configuration" [ -s "$PIDFILE" ] && kill -HUP `cat $PIDFILE` RETVAL=$? } status() { if [ -s $PIDFILE ]; then echo $"$NAME is running." RETVAL=0 else echo $"$NAME stopped." RETVAL=3 fi } # See how we were called. case "$1" in start) start ;; stop) stop ;; force-stop) forcestop ;; restart) stop start ;; reload) reload ;; status) status ;; *) echo $"Usage: $0 {start|stop|force-stop|restart|reload|status}" exit 1 esac exit $RETVAL </pre>
于 2013-08-27T02:57:30.343 回答