我是 Play/Scala/ReactiveMongo 堆栈的新手,正在努力理解我在日志中看到的 [警告],看看我是否能弄清楚如何解决它或让它消失。问题在于在 replset 上使用 ReactiveMongo。出于某种原因,在应用程序启动时,驱动程序会记录以下令人不安的 [警告]...
[debug] play - Plugin [play.api.cache.EhCachePlugin] is disabled
[info] application - ReactiveMongoPlugin starting...
[info] application - ReactiveMongoPlugin successfully started with db 'reactivemongo_app'! Servers:
[cheetah1.local:27017]
[cheetah2.local:27018]
[info] play - Application started (Dev)
[warn] r.api.Failover - Got an error, retrying... (try #1 is scheduled in 500 ms)
reactivemongo.core.actors.Exceptions$PrimaryUnavailableException$: MongoError['No primary node is available!']
at reactivemongo.core.actors.Exceptions$PrimaryUnavailableException$.<clinit>(actors.scala) ~[reactivemongo_2.10-0.9.jar:0.9]
at reactivemongo.core.actors.MongoDBSystem$$anonfun$pickChannel$5.apply(actors.scala:385) ~[reactivemongo_2.10-0.9.jar:0.9]
at reactivemongo.core.actors.MongoDBSystem$$anonfun$pickChannel$5.apply(actors.scala:385) ~[reactivemongo_2.10-0.9.jar:0.9]
at scala.Option.toRight(Option.scala:280) ~[scala-library.jar:na]
at reactivemongo.core.actors.MongoDBSystem.pickChannel(actors.scala:385) ~[reactivemongo_2.10-0.9.jar:0.9]
at reactivemongo.core.actors.MongoDBSystem$$anonfun$receive$1.applyOrElse(actors.scala:154) ~[reactivemongo_2.10-0.9.jar:0.9]
[info] a.e.s.Slf4jEventHandler - Slf4jEventHandler started
[debug] play - java.nio.channels.ClosedChannelException
[info] application - Checked index, result is Success(true)
使用 Mongo shell 检查 replSet 本身并没有发现问题,并且应用程序运行良好。我相当肯定这些例外是“误报”。
我的 conf/application.conf 就像
# Simple configuration (by URI)
# The URI syntax supports the following format: mongodb://[username:password@]host1[:port1][,hostN[:portN]]/dbName
mongodb.uri = "mongodb://cheetah1.local:27017,cheetah2.local:27018/reactivemongo_app"
appDependency 是
val appDependencies = Seq("org.reactivemongo" %% "play2-reactivemongo" % "0.9")
有一个 conf/play.plugins 文件
400:play.modules.reactivemongo.ReactiveMongoPlugin
该应用程序本身从启动开始运行良好,读取和写入 Mongo 文档没有问题。这就是为什么我断言早期 [警告] 是“误报”。这个警告正常吗?我能做些什么让它消失吗?