Install and Configure HaProxy LBR

hi Team,
Assignment was to configure HA proxy on the LBR server with all the appservers. Please see below configuration. however, I was failed. I even tailed the acess logs to check. Please help check for me

LBR CONFIGURATION

Hi @ASAAC, the question indicated that haproxy must server the http port, so you needed to change the default port of haproxy to 80 and not the 5000

Hi Informixids,
Thank you for your reply. However, the question was to use the default port of haproxy.
It did not state to use http port(80). After installing the default port was 5000. That is what i used.

1 Like

Hi @ASAAC

Question says HAproxy must serve on default http port. which is 80. Its not saying HAproxy must serve on its default port or haproxy's default port.

1 Like

yes you are right. Went through the question again. Thank you for the clarification. You are the best.

1 Like

Hi @Inderpreet this is 2nd time it happened to me. please reply and let me know my mistake.

Attached latest screenshot which got failed twice.

NOTE: this is second time assignment of same task which got failed again.

Hi Folks,

I did not take a screenshot but I too like Narendra096 did the curl command and the display port on host tab and got the welcome to xfussioncorp industries so my Haproxy was working. The only thing that I can imagine, but it was not clear in the question I believe, was that I did not change the apache port from 8087 and instead used that in the backend of haproxy. My guess is that that was only set on the port of stapp01 and not the others, so I should have gone and check. Nevertheless I wanted to see if I am correct with my mistake.

cheers

My default haproxy bind port was 80. When I checked with curl there was no error. But the task was failed. Where is the mistake?

@GB1972

Seems like you bind the Haproxy port to LBR server IP (local IP) itself so your application stopped working on LBR public URL. That’s the reason your task failed.

1 Like

Ah!!! Ok. thanks Inderpreet. I appreciate the assistance.

cheers

@ijazbro

Seems like you used incorrect port for apps. Did you try to check if web page was accessible on LBR link ?

1 Like

Yes I tried and it was working immaculately.

@Inderpreet
I checked in each app server with netstat command to check the httpd port and it was 5000 on all app servers.

I also faced the same error. i had configured the haporxy and it worked for me. but not sure how the task shows failed.

Please let me know where i went wrong.

HAPROXY

Hi Same here my solution was working when I tested but the task was marked as failed.
Attached screenshot.

Kind Regards
Urbansumo
(Richard A. Forth)

This is my second task failing like this.

@ijazbro Marked this as Success for you, thank you for your patience.

@jesty.sam5 unfortunately you configured Haproxy on Jump host itself but you were supposed to do that on LBR host.

@urbansumo although you were able to configure it and run the web page but you changed Apache port on all app servers to port 80 however as per question you were supposed not to do that, you just had to configure Haproxy to use default http port i.e 80.

Hi.
That’s not true the nodes were listening on port 6000 all i did was point haproxy to the port 6000 on each node. Then the page came up OK.

[root@stlb01 ~]# cat /etc/haproxy/haproxy.cfg 
global 
    log 127.0.0.1 local0 notice 
    maxconn 2000 
    user haproxy 
    group haproxy 
defaults 
    log     global 
    mode    http 
    option  httplog 
    option  dontlognull 
    retries 3 
    option redispatch 
    timeout connect  5000 
    timeout client  10000 
    timeout server  10000 
listen appname 0.0.0.0:80 
    mode http 
    stats enable 
    stats uri /haproxy?stats 
    stats realm Strictly\ Private 
    stats auth A_Username:YourPassword 
    stats auth Another_User:passwd 
    balance roundrobin 
    option httpclose 
    option forwardfor 
    server stapp01 172.16.238.10:6000 check 
    server stapp02 172.16.238.11:6000 check 
    server stapp02 172.16.238.12:6000 check

@urbansumo

Seems like you changed ports in config multiple times so I got confused earlier :slight_smile: . But your final config seems good. Anyways I marked it Success for you.

Many thanks, yes I used some documentation online to help me build ha proxy as I have never done it before, and realised on the first test - the ports werent standard so had to check the app servers with netstat and saw it was 6000 so I went back and changed it but only on the haproxy server made sure it was all working before I submitted the work, I really appreciate you marking it successful, I will take more care next time to avoid any confusion.