美文网首页
Spark Mongo 笔记

Spark Mongo 笔记

作者: shaun_x | 来源:发表于2018-09-27 17:21 被阅读0次

    spark mongo pipeline partitioning failed

    ClassNotFoundException: ...MongoDefaultPartition

    Partitioning using the 'DefaultMongoPartitioner$' failed.
    java.lang.NoSuchMethodError: com.mongodb.client.MongoCollection.countDocuments(Lorg/bson/conversions/Bson;)
    

    目前将partitioner设置为MongoSplitVectorPartitioner可解决

    SparkConf().set("spark.mongodb.input.partitioner", "MongoSplitVectorPartitioner")
    

    参考
    https://docs.mongodb.com/spark-connector/current/configuration/index.html#input-configuration

    no permission on database config

    new SparkConf().set("spark.mongodb.input.uri", "mongodb://user:pwd@host:port/db.collection")
    

    需要同时设置mongodb user的 config db read 权限

    db.updateUser("readonly",{"roles":[{"role":"read","db":"yourdb"},{"role":"read","db":"config"}]});
    

    相关文章

      网友评论

          本文标题:Spark Mongo 笔记

          本文链接:https://www.haomeiwen.com/subject/ldtyoftx.html