Pet*_*olf 9 hadoop scala cluster-computing mongodb apache-spark
我有点困惑.
一个简单的rdd.count()在多次运行时给出不同的结果.
这是我运行的代码:
val inputRdd = sc.newAPIHadoopRDD(inputConfig,
classOf[com.mongodb.hadoop.MongoInputFormat],
classOf[Long],
classOf[org.bson.BSONObject])
println(inputRdd.count())
Run Code Online (Sandbox Code Playgroud)
它打开与MondoDb服务器的连接,并简单地计算对象.似乎很直接给我
根据MongoDb,有3,349,495个条目
这是我的火花输出,都运行相同的jar:
spark1 : 3.257.048
spark2 : 3.303.272
spark3 : 3.303.272
spark4 : 3.303.272
spark5 : 3.303.271
spark6 : 3.303.271
spark7 : 3.303.272
spark8 : 3.303.272
spark9 : 3.306.300
spark10: 3.303.272
spark11: 3.303.271
Run Code Online (Sandbox Code Playgroud)
Spark和MongoDb在同一个集群上运行.
我们正在运行:
Spark version 1.5.0-cdh5.6.1
Scala version 2.10.4
MongoDb version 2.6.12
Run Code Online (Sandbox Code Playgroud)
不幸的是我们无法更新这些
Spark不确定吗?
有没有人可以开导我?
提前致谢
编辑/更多信息
我刚刚注意到我们的mongod.log中有错误.这个错误会导致不一致的行为吗?
[rsBackgroundSync] replSet not trying to sync from hadoop04:27017, it is vetoed for 333 more seconds
[rsBackgroundSync] replSet syncing to: hadoop05:27017
[rsBackgroundSync] replSet not trying to sync from hadoop05:27017, it is vetoed for 600 more seconds
[rsBackgroundSync] replSet not trying to sync from hadoop04:27017, it is vetoed for 333 more seconds
[rsBackgroundSync] replSet not trying to sync from hadoop05:27017, it is vetoed for 600 more seconds
[rsBackgroundSync] replSet not trying to sync from hadoop04:27017, it is vetoed for 333 more seconds
[rsBackgroundSync] replSet error RS102 too stale to catch up, at least from hadoop05:27017
[rsBackgroundSync] replSet our last optime : Jul 2 10:19:44 57777920:111
[rsBackgroundSync] replSet oldest at hadoop05:27017 : Jul 5 15:17:58 577bb386:59
[rsBackgroundSync] replSet See http://dochub.mongodb.org/core/resyncingaverystalereplicasetmember
[rsBackgroundSync] replSet error RS102 too stale to catch up
Run Code Online (Sandbox Code Playgroud)
正如您已经发现的,问题似乎不在于 Spark(或 scala),而在于 MongoDB。
这样,关于差异的问题似乎就得到了解决。
您仍然希望解决实际的 MongoDB 错误,提供的链接可以是一个很好的起点: http: //dochub.mongodb.org/core/resyncingaverystalereplicasetmember