我在牧场主中添加了 mongodb 副本集作为堆栈。
我已将服务的链接配置为 mongodb。但是每当我在 spring boot 应用程序中连接到数据库时,我都会遇到这个异常:
7/5/2016 6:57:24 AMcom.mongodb.MongoException: not talking to master and retries used up
7/5/2016 6:57:24 AM at com.mongodb.DBTCPConnector.innerCall(DBTCPConnector.java:323) ~[mongo-java-driver-2.14.2.jar!/:na]
7/5/2016 6:57:24 AM at com.mongodb.DBTCPConnector.innerCall(DBTCPConnector.java:325) ~[mongo-java-driver-2.14.2.jar!/:na]
7/5/2016 6:57:24 AM at com.mongodb.DBTCPConnector.innerCall(DBTCPConnector.java:325) ~[mongo-java-driver-2.14.2.jar!/:na]
7/5/2016 6:57:24 AM at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:273) ~[mongo-java-driver-2.14.2.jar!/:na]
7/5/2016 6:57:24 AM at com.mongodb.DBCollectionImpl.find(DBCollectionImpl.java:86) ~[mongo-java-driver-2.14.2.jar!/:na]
7/5/2016 6:57:24 AM at com.mongodb.DBCollectionImpl.find(DBCollectionImpl.java:68) ~[mongo-java-driver-2.14.2.jar!/:na]
7/5/2016 6:57:24 AM at com.mongodb.DBCursor._check(DBCursor.java:498) ~[mongo-java-driver-2.14.2.jar!/:na]
7/5/2016 6:57:24 AM at com.mongodb.DBCursor._hasNext(DBCursor.java:621) ~[mongo-java-driver-2.14.2.jar!/:na]
7/5/2016 6:57:24 AM at com.mongodb.DBCursor.hasNext(DBCursor.java:657) ~[mongo-java-driver-2.14.2.jar!/:na]
7/5/2016 6:57:24 AM at org.springframework.data.mongodb.core.MongoTemplate.executeFindMultiInternal(MongoTemplate.java:1943) ~[spring-data-mongodb-1.9.1.RELEASE.jar!/:na]
我是否需要在我的 Spring Boot 应用程序中添加任何其他配置才能使其工作。非常感谢。