0

I have two Servers, Server A,ServerB. running as TCP socket server.

I want to a active/standby or /active/passive failover.

that means:

1:Server A and Server B Running, route ALL connection to Server A.

2:Server A down, route ALL connection to Server B.

3:Server A back, still route ALL connection to Server B.

4:Server B down, then route ALL connection to Server A.

ONLY will be one server handle all the connections at a time.

I have search a lot.

it seems that HAProxy have a trick to do like this. Prevent HAProxy from toggling back from fallback to master

but it have a problem, in the case 4, when Server B down, Server A is running, the HAPRoxy still do not route connection to Server A.

is there a way to reolve it?

I also have try Nginx, did not work at all.

listen sql-cluster 0.0.0.0:1433 balance roundrobin server sql01 192.168.100.109:1433 check backup server sql02 192.168.100.180:1433 check inter 5s fall 3 rise 99999999

imhazige
  • 1
  • 3

1 Answers1

0

Try with Keepalived.

 vrrp_instance v_http {
  smtp_alert
  state MASTER
  nopreempt
  interface eth0
  virtual_router_id 51
  advert_int 1
  priority 101
  unicast_src_ip 1.2.3.4

  unicast_peer {
   1.2.3.5
  }
  authentication {
   auth_type AH
   auth_pass myPassword
  }
  virtual_ipaddress {
   x.x.x.x # virtual ip address
  }
 track_script {
  chk_http_port
 }
} 
rcsrao
  • 1