Creating a configuration file for the built-in balancer

Only applicable when integrating with multiple servers of КАТА 5.0 or a later version.

To create a configuration file for the built-in balancer:

  1. Create a text file in the Unix format (LF for newline) and name it haproxy.cfg.
  2. Add the following lines to the file:

    global

        log 127.0.0.1 local6

        chroot /var/lib/haproxy

        pidfile /var/run/haproxy.pid

        stats socket /var/lib/haproxy/stats user root group adm mode 660 level user

        maxconn 1000

        user haproxy

        group haproxy

        daemon

     

    defaults

        mode tcp

        log global

        retries 3

        timeout queue 1m

        timeout connect 10s

        timeout client 1m

        timeout server 1m

        timeout check 10s

        maxconn 1000

     

    frontend kata_balancer

        bind 127.0.0.1:8000

        default_backend kata_servers

  3. Choose the appropriate method of specifying KATA server addresses and add the corresponding line to the file.
    • If you want to specify IP addresses of all KATA servers in the configuration file, add the following lines to the file:

      backend kata_servers

          balance roundrobin

          default-server check

          server kata_node1 <IP-address1:port1>

          server kata_node2 <IP-address2:port2>

          server kata_node3 <IP-address3:port3>

          server kata_node4 <IP-address4:port4>

    • If you want to obtain an up-to-date list of addresses using a domain name (DNS record), add the following lines to the file:

      resolvers dns_servers

          parse-resolv-conf

          accepted_payload_size 8192

          timeout resolve 10s

          timeout retry 10s

          hold valid 60s

       

      backend kata_servers

          balance roundrobin

          default-server check resolvers dns_servers init-addr none

          server-template kata_node 8 <domain_name>:<port>

      To obtain the list of addresses using a domain name, on the DNS server, create a domain name (for example, kata.example.com) with multiple A records indicating the IP addresses of KATA servers.

  4. Save the configuration file.

The configuration file for the built-in balancer is created.

Page top