Command failed with error 10107: ‘not master‘ on server 10.2.2.139:27017. Closed connection

springboot 连接mogodb,报错Command failed with error 10107: 'not master' on server 

Closed connection [connectionId{localValue:2, serverValue:389122}] to 10.2.2.139:27017 because there was a socket exception raised on another connection from this pool.

原因: mongodb集群的主从节点换了,主节点由139换成了138,连接时的配置,只配了139,因此报错。

解决:将主从节点都写在配置中

猜你喜欢

转载自blog.csdn.net/qq_36838406/article/details/108053991