I need to set up the following scheme:
- server1: Generic program connects locally to proxy, which then connects to proxy to server2.
- Everything is ok, until the connection between the servers.
When the connection is down OR some other event occurs (for example packet loss, many retransmits and so on) Things won't work and we need to do the following:
- server1 to "reroute" the current connection to a third server(server3) with the same proxy program
- server3's connection to server2 is OK,
- so as a result a local generic program does not reconnect or even care about the connectivity issues.
- respectively the local generic program on the other side (on server2) also does not know that there is another route.
Probably, this can be simulated with haproxy and openvpn, but the openvpn connect is too slow for fast switches, and the setup is too complicated for just one service (let's say tcp port).
[-It's like the tunneling of a port-] and the local client program on server1 does not need to reconnect (or make a new connection) to the server program on server2, when something happen between server1 and server2
Can anyone advice me for such tcp-proxy-reroute program under linux?
Edit: I did not mean that I need to save the tcp session or so.
I need something like haproxy (working on layer 7),
when client_prog_1_srv_1 connects localhost haproxy_1_srv_1,
haproxy_1_srv_1 connects (Internet) to haproxy_2_srv_2,
- haproxy_2_srv_2 connects to server_prog_2_srv_2 (binds and connects locally, too),
but when there is no connection between haproxy_1_srv_1 and haproxy_2_srv_2,
- haproxy_1_srv_1 to connect to haproxy_3_srv_3,
- which connects to haproxy_2_srv_2 and reuse the opened connection between haproxy_2_srv_2 and server_prog_2_srv_2.
- Connections between haproxes are through internet, connections to the end program (client,server) are always local.