Re: Is it possible to configure a failover backend?
Hi I would try Jarno's method with the "frontend" rules: simple, effective, great. Similar results may achieved with the "backup"s inside each "backend" section. Because of the "use_backend" map and a ton of other reasons, this approach should not fit your case, but... who knows? backend loggingdc1-elasticsearch-acc mode http balance roundrobin option httplog option httpchk GET / option allbackups server loggingdc1-elasticsearch-01a:9200 10.1.20.22:9200 check server loggingdc1-elasticsearch-03a:9200 10.1.20.23:9200 check server loggingdc1-elasticsearch-05a:9200 10.1.20.25:9200 check server loggingdc2-elasticsearch-02a:9200 10.1.36.23:9200 check backup server loggingdc2-elasticsearch-04a:9200 10.1.36.25:9200 check backup server loggingdc2-elasticsearch-06a:9200 10.1.36.26:9200 check backup Ciao! .marcoc
Re: Is it possible to configure a failover backend?
Hi, On Mon, Jan 29, Pieter Vogelaar wrote: > I have two Elasticsearch clusters. One is the active cluster and the other is > the failover cluster. > > Is it possible to configure a failover backend if the default backend health > check failes? Does "if the default backend health check failes" mean that all servers in default backend are down ? nbsrv + acl + use_backend (https://cbonte.github.io/haproxy-dconv/1.8/configuration.html#7.3.1-nbsrv) frontend acl primary_down nbsrv(loggingdc1-elasticsearch-acc) lt 1 use_backend loggingdc2-elasticsearch-acc if primary_down use_backend loggingdc1-elasticsearch-acc if !primary_down (or default_backend loggingdc1-elasticsearch-acc) -Jarno > So if loggingdc1-elasticsearch-acc is not healthy, I would like to route to > the loggingdc2-elasticsearch-acc backend. > > > The configuration: > > frontend default-http > bind :80 > bind :8091 > bind :9200 > mode http > option httplog > use_backend > %[base,regsub(^www\.,,i),map_beg(/etc/haproxy/http-bases-to-backends.map,default)] > > backend loggingdc1-elasticsearch-acc > mode http > balance roundrobin > option httplog > option httpchk GET / > server loggingdc1-elasticsearch-01a:9200 10.1.20.22:9200 check > server loggingdc1-elasticsearch-03a:9200 10.1.20.23:9200 check > server loggingdc1-elasticsearch-05a:9200 10.1.20.25:9200 check > > backend loggingdc2-elasticsearch-acc > mode http > balance roundrobin > option httplog > option httpchk GET / > server loggingdc2-elasticsearch-02a:9200 10.1.36.23:9200 check > server loggingdc2-elasticsearch-04a:9200 10.1.36.25:9200 check > server loggingdc2-elasticsearch-06a:9200 10.1.36.26:9200 check > > > Best regards, > Pieter Vogelaar -- Jarno Huuskonen
Re: Is it possible to configure a failover backend?
Yes. Whichever backend server you do not want to route requests to except when the primary server is offline, append the keyword "backup" to that server's configuration (after the word "check"). E.g.: server loggingdc1-elasticsearch-05a:9200 10.1.20.25:9200 check backup -Paul > On Jan 29, 2018, at 4:58 AM, Pieter Vogelaarwrote: > > Hi, > > I have two Elasticsearch clusters. One is the active cluster and the other is > the failover cluster. > > Is it possible to configure a failover backend if the default backend health > check failes? > So if loggingdc1-elasticsearch-acc is not healthy, I would like to route to > the loggingdc2-elasticsearch-acc backend. > > > The configuration: > > frontend default-http > bind :80 > bind :8091 > bind :9200 > mode http > option httplog > use_backend > %[base,regsub(^www\.,,i),map_beg(/etc/haproxy/http-bases-to-backends.map,default)] > > backend loggingdc1-elasticsearch-acc > mode http > balance roundrobin > option httplog > option httpchk GET / > server loggingdc1-elasticsearch-01a:9200 10.1.20.22:9200 check > server loggingdc1-elasticsearch-03a:9200 10.1.20.23:9200 check > server loggingdc1-elasticsearch-05a:9200 10.1.20.25:9200 check > > backend loggingdc2-elasticsearch-acc > mode http > balance roundrobin > option httplog > option httpchk GET / > server loggingdc2-elasticsearch-02a:9200 10.1.36.23:9200 check > server loggingdc2-elasticsearch-04a:9200 10.1.36.25:9200 check > server loggingdc2-elasticsearch-06a:9200 10.1.36.26:9200 check > > > Best regards, > Pieter Vogelaar