MongoDB Community Operator Replicaset Read Write Operations

Hello Team,

I am using Kubernetes Mongodb Community Operator to create a Replicaset to scale my mongodb setup. However, i am not sure how read and write operations are directed towards the primary and secondary replicas. Please help me with the following questions:

  1. Is it the responsibility of Kubernetes Community Operator to forward the read operations to the secondary replicas and write operations to the primary one and if true, how can we verify it?
  2. If the above questions answers to false, then is there a way to separate the read and write calls to secondary and primary replicas respectively?

Thanks in advance

Hi @Abhishek_Chauhan2
Welcome to the Community!!

No, the Kubernetes Community Operator will not forward the read to the secondary, rather, the read and write operations are done through the drivers.

We can verify this, with the logs captured for the replica set.
Please refer to the documentation : Read Preference.

Let us know if you need any further information.

Thanks
Aasawari

2 Likes