[JAVA-3568] The server is not the primary and did not execute the operation; nested exception is com.mongodb.MongoNotPrimaryException: The server is not the primary and did not execute the operation Created: 22/Dec/19  Updated: 22/Sep/21  Resolved: 26/Dec/19

Status: Closed
Project: Java Driver
Component/s: Cluster Management
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Ashok R Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Production



 Description   

The server is not the primary and did not execute the operation; nested exception is com.mongodb.MongoNotPrimaryException:The server is not the primary and did not execute the operation.
 
All the cluster IP's are mentioned in property files and replicaSet is also mentioned. So no new IP's also not added in the cluster.
 
 
Take this issue as high priority and provide the solution to resolve this issue.



 Comments   
Comment by Ashok R [ 27/Dec/19 ]

Thanks Jeffrey Yemin

Comment by Jeffrey Yemin [ 26/Dec/19 ]

From the exception, it looks like either a read or a write operation failed, most likely because it occurred during a replica set failover. To minimize application-visible exceptions, I suggest enabling both retryable reads and retryable writes in your MongoClient configuration.

Just to let you know for future reference the best place for questions regarding MongoDB usage or the Java driver specifics is the mongodb-user mailinglist or stackoverflow as you will reach a broader audience there. If your business requires an answer from MongoDB within a time frame then we do offer production support.

Comment by Ashok R [ 22/Dec/19 ]

This issue is from Spring Boot application and currently we are using <version>2.0.1.RELEASE</version>

Generated at Thu Feb 08 08:59:55 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.