我试图从Hbase读取数据并写入MongoDB,我的代码如下scala所示:
raw: ([wmiclass]"Win32_Process").Create("myprocess.exe /option1 /option2")
但它有以下编译错误:
mongoConfig.set("mongo.output.uri", "mongodb://node1:57017/sampledb.sample")
mongoConfig.set("mongo.output.format","com.mongodb.hadoop.MongoOutputFormat")
val documents:RDD[Map[Object, BasicBSONObject]] = newRDD1.map(f => convert2BSON(f))
documents.saveAsNewAPIHadoopFile("file:///test",classOf[Object],classOf[BSONObject],
classOf[BSONFileOutputFormat[Object, BSONObject]],sparkConf)
我使用的是Spark1.5.2,mongo-hadoop-core 1.5.2和mongo-java-driver 3.2.0 我的mongoDB版本是3.2.5