0

I have 2 servers, They have at least 2 interfaces, When one of the interface is down, I want to grpc to try next interface in same RPC call, for example

N1 ip-eth0 <-- Path1 ---> N2 ip-eth0
N1 ip-eth1 <-- Path2 ---> N2 ip-eth1

In this case, while connecting from N1, I want to bind(2) client to ip-eth0 when trying path1 and connect to N2 ip-eth0. Similarly if this connection fails, Connect from N1 ip-eth1 to N2 ip-eth1. WithContextDialer I can bind the IP's but how to retry with second path if first path is not working. and give up if path2 is also not working. Please note I am not trying to load-balance the server, The server is only one process, but path to that server are via two interfaces.

tushars
  • 53
  • 6
  • Do you already have take a look at [Load Balacing client side](https://grpc.io/blog/grpc-load-balancing/#proxy-or-client-side)? Seems the [ServiceConfig](https://github.com/grpc/grpc/blob/master/doc/service_config.md) options could be useful for your use case – Matteo Apr 01 '21 at 06:56
  • IIUC, server is listening on both interfaces and on the client-side you want to prefer Path1 when it is available, and fallback to Path2 only when Path1 is not available. How does the client dial the server? If it uses a DNS name to dial, and the name resolves to two addresses {A1, A2} which use {Path1, Path2} respectively, and if you end up using the pick-first load balancing policy on the client-side, you should be able to achieve what you are looking for. – Easwar Swaminathan Apr 07 '21 at 18:10

0 Answers0