Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    HAProxy service delayed start after switching to Backup server

    Scheduled Pinned Locked Moved Cache/Proxy
    2 Posts 2 Posters 341 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D
      dr1m
      last edited by dr1m

      Hello,
      I have 2 high-availability PFsense servers with HAproxy setup. (2.5.0-RELEASE)
      The issue is when the master server is going offline, then the backup server is becoming Master within a second, but the HAproxy service is not starting that fast, so I have a maximum of 59 seconds downtime, because the HAproxy service starts every minute.
      If I stopped the first server on 00:00:01 , the HAproxy service will start on second server on 00:01:00, but the CARP switches to backup server within the first second.
      And vice-versa: if the first server just came back online, CARP switches to from backup to master and we have downtime, because HAproxy service is not started yet.

      If I enable Persistent CARP Maintenance Mode on the first server, then anyway I see the same behavior - downtime up to 59s.

      The CARP Monitor option in HAproxy settings is set to CARP Virtual IP -> Monitor carp interface and only run HAproxy on the firewall which is MASTER.

      So in order to make a seamless transition once the master is offline, I had to disable CARP monitor option, then HAProxy service is running on both servers all the time.

      May I know, what is the downside of disabling CARP monitor option and leaving HAproxy running on both firewalls?
      And why there is such a big delay between CARP switching and HAproxy service start?
      Thank you.

      P 1 Reply Last reply Reply Quote 0
      • P
        PiBa @dr1m
        last edited by

        @dr1m
        Running on memory here.. afaik haproxy is 'subscribed' to carp events, and as such should be able to start soon after becoming master..
        https://github.com/pfsense/FreeBSD-ports/blob/084b4ad9f65198720720f84d04eeed7c441ed49c/net/pfSense-pkg-haproxy/files/usr/local/pkg/haproxy.xml#L52

        dont have time to check why that might fail now.. way past bedtime already here..

        As for having haproxy run on both nodes, there isn't much of a downside besides that 'healthchecks' will be fired from both haproxy instances and might increase the load of the webserver a little bit..

        1 Reply Last reply Reply Quote 0
        • First post
          Last post
        Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.