HAProxy configuration

When using a Layer 4 load balancer, you can configure a health monitor to perform checks on the back-end servers.

Only a single host runs all health monitor instances at a given time. If that host goes down for any reason, a different host will be elected and spawn the HAProxy instances. These instances are managed by the MidoNet Agent and do not require any special setup. However, hosts that can potentially hold the HAProxy instances have to be chosen.

To enable a MidoNet Agent host for health monitoring, its health_monitor_enable property has to be set to true.

Run the following command to check if a host is enabled for health monitoring:

$ mn-conf get agent.haproxy_health_monitor.health_monitor_enable

To toggle health monitoring for a certain host, use the following commands on that host:

$ echo "agent.haproxy_health_monitor.health_monitor_enable : true" | mn-conf set -h local
$ echo "agent.haproxy_health_monitor.health_monitor_enable : false" | mn-conf set -h local

Additionally, the hosts running the HAProxy instances must have a group called "nogroup" and a user called "nobody", otherwise HAProxy will not be able to start. While this is a default configuration on Ubuntu, on Red Hat you must create this user and group.

How the Health Monitor works in the MidoNet Agent

  • The MidoNet Agent does not implement its own health monitor. Instead, it leverages the health checker that is a part of HAProxy.

    • Whenever a user attaches a health monitor to a pool, the MidoNet Agent starts up an HAProxy instance associated with that pool.
    • The HAProxy process then receives information about all of the pool members it must watch.
    • The MidoNet Agent periodically polls HAProxy about the status of its nodes. If it detects a change in status, the MidoNet Agent will update its own database with the status information.
  • The following configuration settings (inside mn-conf(1)) tell the MidoNet Agent how to act with respect to health monitoring:

    • health_monitor_enable: true indicates the MidoNet Agent host is eligible to set up HAProxy for health monitoring.
    • namespace_cleanup: true indicates the MidoNet Agent host needs to clean up any left over HAProxy namespaces on the host that are still present after the MidoNet Agent has gone down and is no longer the designated HAProxy host. By default, this is set to false.
    • namespace_suffix: String appended to the end of the namespace names that hold the HAProxy instances. This is to allow you to easily identify the namespaces being created for HAProxy. _MN is the default value.
    • haproxy_file_loc: identifies the location in the file system where the config files for HAProxy will be created. The default value is: /etc/midolman/l4lb/.
  • At any given time, there is only one host containing all of the HAProxy instances. This host will be one of the MidoNet Agent hosts that has health_monitor_enable=true defined in its configuration. If this host goes down for any reason, one of the other hosts with the health_monitor_enable=true setting will take over and spawn any required HAProxy instances.
Questions? Discuss on Mailing Lists or Chat.
Found an error? Report a bug.


loading table of contents...