h0x91b / redis-fast-driver

78 stars 13 forks source link

double port NIC: bind to different IPs locally #57

Closed Dmitry-N-Medvedev closed 1 year ago

Dmitry-N-Medvedev commented 1 year ago

hi,

the context:

  1. a machine has double port 40GbE NIC ( 192.168.1.100, 192.168.1.101 );
  2. there's a microservice that needs to establish two connections to the same Redis instance residing on 192.169.1.10;
  3. one connection should read from a Redis stream;
  4. one connection should write to a Redis stream;

the question: Is it possible to do reading from 192.168.1.100, and do writing from 192.168.1.101?

PS: I believe if the above is not possible I would need to expose the same Redis instance on two separate networks, change IP addresses of the NIC to connect to both of these instances. Thus I could ensure that different physical connections are used for reading and writing. This is my uneducated guess only of course.

best regards, Dmitry

h0x91b commented 1 year ago

Hi Dmitry,

I see no problem to do it, you can bind Redis on 2 different interfaces in the same time

Binding to multiple IPs is indeed possible since Redis 2.8. Just separate each IP by whitespace (not commas). (Stackoverflow https://stackoverflow.com/a/22267803/1242684)

bind 127.0.0.1 123.33.xx.xx