如何克服[警告] ... Play 2.1 App启动时的PrimaryUnavailableException?

时间:2013-06-20 00:22:52

标签: playframework playframework-2.1 reactivemongo

我是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本身显示没有问题,应用程序正常工作。我相当肯定这些例外是假阳性&#34;。

我的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文档。这就是为什么我断言早期[警告]是&#34;误报&#34;。这个警告是否正常,是否有我可以做的事情让它消失?

1 个答案:

答案 0 :(得分:1)

它似乎“只是这里的正常噪音”:https://groups.google.com/d/msg/reactivemongo/orwHB09OW58/IUhODHcmmI8J

它只是[警告]而不是[错误],基础设施立即恢复。 “街上的话”不要担心,所以我不会。