Configuring High Availability (HA) Zabbix Server on CentOS 7

February 18, 2016

Step 1: Configure Name Resolution

We need to configure our host to know it’s counterpart quickly without DNS (we don’t want false failures).

Open the following two entries to your /etc/hosts file.

Step 2: Install Zabbix Server

Now we need to install the Zabbix Server, however there are so many ways to deploy this I prefer Puppet (mainly because I contribute a lot to https://github.com/dj-wasabi/puppet-zabbix) We are going to do this the standard way.

On both Zabbix Servers we will need to install Zabbix, I like MySQL, but that’s just because I’ve been using it a long time.

At the time this is written current version is Zabbix 3.0

I don’t really want to go far in depth to showing the entire Zabbix Server configuration, if you still need help setting the rest up please visit:
https://www.zabbix.com/documentation/3.0/manual/installation/install_from_packages#red_hat_enterprise_linuxcentos

However there is one change that is very important. You will need to configure in your  /etc/zabbix/zabbix_server.conf

Step 3: Configure Pacemaker

Lets go back to zabbixserver1 and get these two authenticating to each other.

Now we need to create the cluster and add the zabbix servers

To start the cluster

Make sure that Pacemaker and Corosync are started at boot on both hosts.

Check the status of your cluster after it’s been started by using

Check the status of your nodes in the cluster by using

For Zabbix we don’t need or want stonith especially since we just have 2 servers. Lets run:

Because we have 2 nodes our number of nodes is too low to have a quorum. To have a quorum you must have at least 2 nodes, and that would defeat the purpose of this. We will ignore the low quorum with the following.

Now we are into the fun part! Lets create the VIP which would be used between both of these Zabbix Servers.

To test this you can try to ping the <cluster_ip> now.

You should also see a resource now appear when you test the command

Lets disable systemd from controlling zabbix-server. Once the next step is completed, Pacemaker will actually control the process.

Now we need to setup the Zabbix Server resource which will make sure that the systemd (CentOS 7) has zabbix-server always running in this cluster.

You should also see that resource now appear when you test the command

Now we may have a problem, in its current state the VIP and the zabbix_server can be running on different nodes. Definitely not what we want happening. To resolve this we need to add some constraints that tell pacemaker that they need to be on the same host, and that the cluster_ip needs to be completed before the zabbix_server

Testing the cluster can be done by the following

Bonus Item

If you would like Zabbix Server to prefer a specific server you can use the following command to do so.

Used Resources:

https://www.digitalocean.com/community/tutorials/how-to-set-up-an-apache-active-passive-cluster-using-pacemaker-on-centos-7

13 Responses to Configuring High Availability (HA) Zabbix Server on CentOS 7

  • Hi,
    my configuration: two DB mysql (MASTER-MASTER with VIP), 2 servers application (zabbix server 3.0).
    One question, a must set ip or vip address to connect with my DB?

  • A user connecting to the database is one that each server must be different ? zabbix for two application servers ?

  • While the other node is still down and there is still no quorum, both virtual IP and Zabbix server are running on the remaining node. You can again verify that by looking for zabbix_server process and IP address in the output of

    • There isn’t a quorum… pcs property set no-quorum-policy=ignore provides the following

      A cluster has quorum when more than half of the nodes are online. Pacemaker’s default behavior is to stop all resources if the cluster does not have quorum. However, this does not make sense in a two-node cluster; the cluster will lose quorum if one node fails.

  • hi.ericsysmin。
    I read very carefully your article,I am a bit puzzled,Addresses of the two nodes configuration file must be changed clusterip for sourceip and listenip??After I changed,two nodes zabbix-server in not running?why
    However there is one change that is very important. You will need to configure in your /etc/zabbix/zabbix_server.conf
    SourceIP=
    ListenIP=
    thank you.

    • SourceIP and ListenIP needs to be the ip you specified for the cluster in the ‘cluster_vip’, which is created later in the instructions. Essentially only one server would be running the zabbix-server process at a time when setup correctly. Zabbix cannot have two zabbix-servers running at the same exact time.

  • Hi Eric

    Interesting article and very clear. I just have one question regarding the DB. From what I see above is that each of the Zabbix servers have its own DB locally. How do you keep the two servers in step in terms of configuration ?

  • What you use to create the MySQL cluster? any helpful guides you can link to?

  • In Qa what are the requirements to setup high availability zabbix cluster when every components for this system should be failed over when issues comes up

  • Hi Eric,
    Thank you for your work.
    I have a question not related to this post.
    If I have an infrastructure with two synced mysql server, two zabbix server and I want to implement a distributed high Availability of zabbix proxy servers to divide load for checking a couple of thousands of devices, which will be the best way for doing it?
    What I want is a balanced load between proxies but if a proxy become unreachable I would like to have the hosts monitored by that proxy to be “moved” to another one.
    Thank you in advance

Leave a Reply