Ad Widget

Collapse

Zabbix HA with InnoDB Cluster & VIP for Agent access?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • zabbiXzer
    Junior Member
    • Aug 2022
    • 1

    #1

    Zabbix HA with InnoDB Cluster & VIP for Agent access?

    Hi Guys,

    I've setup a working Zabbix Server-HA-Cluster, with
    - 3 VMs/Nodes
    - MySQL InnoDB Cluster over all nodes
    - MySQL Router on every node
    - Zabbix Server on every node with HA configured
    - Zabbix UI/Frontend on every node

    Zabbix Servers & Frontends are communication with the DB over the local MySQL Routers... so far all works well.

    Now I am thinking how to improve the agent connection... it is mainly about active agents contacting the server cluster.

    I find it too difficult to give each agent multiple IP addresses or hostnames, especially if their requests come from the public internet (forwarded to an internal LAN IP of the server cluster), I really don't want to sacrifice multiple public IPs.

    Therefore, I would like to set up a VIP - possibly via keepalived - that should become active on the respective 'active' (via Zabbix HA) Zabbix server.

    Now I wonder:
    How could I get keepalived to activate the VIP on the server that is currently 'active' via Zabbix HA, which according to my understanding happens via the database.

    Is there perhaps another method (built in by Zabbix) to set the VIP?

    Or does it not matter to which Zabbix server the packets are sent from the agent(s), no matter if the server is active or standby?

    I also wonder:
    What happens if an agent has multiple servers configured at ServerActive?
    Does the agent send to all three servers and the standby servers drop the packets or does the agent send to any of the configured servers or do they discuss which server is active?

    Do you know a suitable solution for setting the VIP via Zabbix HA?

    Best Regards,
    zabbiXzer
  • Markku
    Senior Member
    Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
    • Sep 2018
    • 1781

    #2
    You have lot of questions and there is space for various angles of discussion, I'll now just comment this:

    Originally posted by zabbiXzer
    What happens if an agent has multiple servers configured at ServerActive?
    Does the agent send to all three servers and the standby servers drop the packets or does the agent send to any of the configured servers or do they discuss which server is active?
    The documentation (https://www.zabbix.com/documentation...tation-details) says:

    A standby node runs only one process - the HA manager. A standby node does no data collection, processing or other regular server activities; they do not listen on ports; they have minimum database connections.
    Therefore, the active agents cannot connect to that node, they get a TCP reset when attempting, so my assumption is that they just select another node from the ServerActive list and try that.

    Markku

    Comment

    • Markku
      Senior Member
      Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
      • Sep 2018
      • 1781

      #3
      Originally posted by zabbiXzer
      How could I get keepalived to activate the VIP on the server that is currently 'active' via Zabbix HA, which according to my understanding happens via the database.
      Keepalived can use a script to check if the application process is in specific state or not, and it will then adjust the VRRP priority according to that. You can use "sudo zabbix_server -R ha_status" command to see the Zabbix server status in the HA cluster, so parsing that output you can build detection in keepalived.

      (Update: Or, you can just use a TCP check for port 10051, as mentioned in my previous post)

      Markku
      Last edited by Markku; 11-08-2022, 10:02.

      Comment


      • zabbiXzer
        zabbiXzer commented
        Editing a comment
        Hi Markku,

        This seems to be the right way to go.

        I also read a few minutes ago that the check should happen from the keepalived side and not from the Zabbix server side.

        Many Thanks!

        Best Regards,
        zabbiXzer
    • karam
      Junior Member
      • Jul 2023
      • 1

      #4
      [QUOTE=Markku;n449629]

      Keepalived can use a script to check if the application process is in specific state or not, and it will then adjust the VRRP priority according to that. You can use "sudo zabbix_server -R ha_status" command to see the Zabbix server status in the HA cluster, so parsing that output you can build detection in keepalived.

      (Update: Or, you can just use a TCP check for port 10051, as mentioned in my previous post)

      Hello Can you please help me with the script and how to implement with keepalived

      Comment

      • Rah9742
        Junior Member
        • Jan 2025
        • 2

        #5

        I got the following to work as the Keeoalived tracked script, by trying to access the Zabbix-server port via TCP. I could not get Keepalived to correctly execute a script involving "zabbix_server -R ha_status", even though when I ran it through the CLI it all worked.

        Code:
        #!/bin/bash
        
        # Use /dev/tcp to test TCP connection
        timeout 5 bash -c "echo > /dev/tcp/<HOST IP>/10051" 2>/dev/null
        
        # Check the exit code
        if [ $? -eq 0 ]; then
            echo "Port $PORT on $HOSTNAME is reachable (connection successful)."
            exit 0  # Healthy, Keepalived will not trigger failover
        else
            echo "Port $PORT on $HOSTNAME is NOT reachable (connection failed or timed out)."
            exit 1  # Unhealthy, Keepalived will trigger failover
        fi

        Comment

        Working...