Currently running into a situation where this fails after a while.
Container M1, N1 are running on Server S1 Container M2, N2 are running on Server S2 Personal Laptop L
N's has published port 5432 (postgres)
I can always communicate using S1:5432 from Laptop L. S2, M2, can also always communicate using S1:5432
However, M1 when initially setup can communicate using S1:5432, but after some times (sometimes hours, sometimes days), this will always timeout. It is however always able to communicate using N1:5432 (they are on the same bridge network)
We must use this setup because the postgres on S1 S2 are in High-Availability setup, so there is a shared virtual ip that points at the primary database. Since both M1 and M2 needs to be able to access "primary database", this must be the external IP of S1 rather than container IP N1.
Any idea why this happens? Any solutions?
TCPdump shows this. Left side is curl request from M1 to S1:5432. Right side is from S2 to S1:5432. The curl will hang/timeout
source | dest | content | source | dest | content | |
---|---|---|---|---|---|---|
M1 | N1 | SYN | S2 | N1 | SYN | |
N1 | M1 | SYN ACK | N1 | S2 | SYN ACK | |
M1 | N1 | ACK | S2 | N1 | ACK | |
M1 | N1 | PUSH | S2 | N1 | PUSH | |
N1 | M1 | ... data | N1 | S2 | ... data | |
missing | S2 | N1 | FIN | |||
missing | N1 | S2 | FIN ACK | |||
missing | S2 | N1 | ACK |