Mongodb data sync between primary and secondary node even when port is closed

awsmongodb

I have configured mongodb replicaset in aws using 3 ec2's with one primary and 2 secondary nodes. When I insert data on primary node it is getting synced to the secondary nodes which it should. But when I close the port via security group still the data is syncing to the secondary node whose port is closed even though the state in rs.status() in the primary node is stateStr" : "(not reachable/healthy)" -> for the secondary node(whose port is closed).

I tried this with my secondary node in different subnet public as well as private but its still getting synced.I am new to mongodb and might be doing something wrong. Could someone please suggest something.

Best Answer

Have you closed that path both ways...

If primary cannot "ping" secondary, it's not reachable/healthy, but if secondary can connect primary, it can replicate opLog...