Thanks for the suggestion. What we are trying to achieve is that we already have HAproxy and Gerrit server setup in place. So, we want to make the changes in the HAproxy in such a way it should perform round-robin. If the Production Gerrit server goes down then we can redirect the traffic from HAproxy to the Slave server automatically. Please suggest how can we achieve that we have made the below changes:
global
log 127.0.0.1 local2 debug
#daemon
pidfile /var/run/haproxy.pid
maxconn 16000
#group gerrit
defaults
#mode tcp
retries 3
timeout connect 5000ms
timeout client 500000ms
timeout server 500000ms
frontend ssh-in
log 127.0.0.1 local2 debug
bind *:29418 transparent
mode tcp
default_backend gerrit-ssh-servers
option tcplog
option redispatch
balance roundrobin
log-format "%ci:%cp [%t] %ft %b/%s %Tw/%Tc/%Tt %B %ts %ac/%fc/%bc/%sc/%rc %sq/%bq %bi:%bp"
email-alert mailers mymailers
frontend https
log 127.0.0.1 local2 debug
bind *:443 transparent
option tcplog
log-format "%ci:%cp [%t] %ft %b/%s %Tw/%Tc/%Tt %B %ts %ac/%fc/%bc/%sc/%rc %sq/%bq %bi:%bp"
#mode http
option forwardfor except 127.0.0.1
balance roundrobin
#maxconn 5000
# NOTE: users should connect over ssh to
# <ip>:<ssh_port>, which should be the same as the
# sshd.advertisedAddress parameter in the
# 'gerrit.config' files
default_backend gerrit-https-servers
email-alert mailers mymailers
backend gerrit-ssh-servers
log 127.0.0.1 local2 debug
option redispatch
balance roundrobin
server gerritM1 XX.XXX.XX.XXX:29418 check 60s
server gerritM2 XX.XXX.XX.XXX:29418 check
email-alert mailers mymailers
source 0.0.0.0 usesrc clientip
backend gerrit-https-servers
log 127.0.0.1 local2 debug
option redispatch
balance roundrobin
server gerritM1 XX.XXX.XX.XXX:443 check 60s
server gerritM2 9XX.XXX.XX.XXX:443 check
source 0.0.0.0 usesrc clientip
email-alert mailers mymailers
# http-request cache-use mycache if { path_beg /gerrit/plugins/events-log/ }
# http-response cache-store mycache