How to configure Load Balancer For 3 Nodes HA

Hi Morpheus Community,
I have deployed Morpheus 3 Nodes HA.
I have installed HAproxy on a separate machine. When I am trying to load balancing the 3 Nodes via HAProcy it gives me the following error.

" 404 Not Found

nginx "

My haproxy config file is Below:

global
    log         127.0.0.1:514 local2
    chroot      /var/lib/haproxy
    pidfile     /var/run/haproxy.pid
    maxconn     4000
    user        haproxy
    group       haproxy
    daemon

    # turn on stats unix socket
    stats socket /var/lib/haproxy/stats

    # utilize system-wide crypto-policies
#    ssl-default-bind-ciphers PROFILE=SYSTEM
 #   ssl-default-server-ciphers PROFILE=SYSTEM

defaults
    mode                    http
    log                     global
    option                  httplog
    option                  dontlognull
    option http-server-close
    option forwardfor       except 127.0.0.0/8
    option                  redispatch
    retries                 3
    timeout http-request    10s
    timeout queue           1m
    timeout connect         10s
    timeout client          1m
    timeout server          1m
    timeout http-keep-alive 10s
    timeout check           10s
    maxconn                 3000

frontend main
    mode http
    bind *:443
    default_backend             mybackend

backend mybackend
    mode http
    option      httpchk
    option httpchk GET /ping
    http-check expect string PING
    balance     leastconn
    server      morpheus-server1 192.168.72.101:443 check ssl verify none
    server      morpheus-server2 192.168.72.102:443 check ssl verify none
    server      morpheus-server3 192.168.72.103:443 check ssl verify none

In the /etc/hosts file of haproxy I added all the 3 Node’s name and IPs. And in the /etc/hosts file of all the three server I added the HAproxy’s name and Ip. And also in the /etc/morpheus/morpheus.rb file of all the three nodes I replaced the appliance url with load balancer ip address(HAproxy ip).
Any here to Guide me Please.

Thank You
Basharat.

journalctl should give you an idea of what is going on. If you have the dashboard configured you may be able to navigate to: /haproxy?stats and see if there are any online servers.

Hi @cbunge.
There is no error in my config file. The error is when I trying to access my load balancer ip it redirect me to nginx page. What’s the problem I didn’t get.

I expect you have done this, but always worth stating:

  • Ensure the haproxy.cfg is correct. I think this will spit out any issues.
haproxy -c -f /etc/haproxy/haproxy.cfg
  • Reload the config.
systemctl reload haproxy

If that does not help please reply, and we’ll try compare your example against known working configuration.

I believe I only see the 404 when the backend servers are not live in the HAProxy. I would check your health checks.

1 Like

When I execute this command

haproxy -c -f /etc/haproxy/haproxy.cfg

It gives me “Configuration file is valid”.

And the Reload and restart couldn’t make any affect.

If you navigate to one of the nodes directly do you get the log-in page?

Yeah! Thank you,
I resolved the issue, actually my port 443 was Listening at some other addresses. That’s why it is creating issue.

Thank you all.

1 Like