【问题标题】:how to use mongo-hadoop to access mongodb collection whose name is "my.study.stable"如何使用 mongo-hadoop 访问名为“my.study.stable”的 mongodb 集合
【发布时间】:2020-01-30 02:51:54
【问题描述】:

在 mongodb 中有一个名为 'my.study.stable' 的集合。 现在我使用 MongoDB Connector for Hadoop(hive) 来连接集合。 我的创建语句是

CREATE EXTERNAL TABLE mytable(
	song_id BIGINT,
	ctime BIGINT
)
STORED BY 'com.mongodb.hadoop.hive.MongoStorageHandler' 
WITH SERDEPROPERTIES('mongo.columns.mapping'=
'{"song_id":"_id",
"ctime":"ctime"}') 
TBLPROPERTIES('mongo.uri'='mongodb://username:password@host:port/mzk_spiders.my.study.stable');

create语句执行成功。但是当我查询数据时,出现如下错误:

java.io.IOException: java.io.IOException: Failed to aggregate sample documents. Note that this Splitter implementation is incompatible with MongoDB versions prior to 3.2.

【问题讨论】:

  • 合集大小约4.3G
  • 您找到解决方案了吗?我遇到了同样的错误
  • 搞定了,看看下面的答案

标签: mongodb hive connector


【解决方案1】:

该错误是由于SampleSplitter 无法处理来自 MongoDB 的大量数据而产生的,因此要解决此问题,请在您用于调用 hadoop 的行中指定不同的拆分器,例如在mongo.splitter.class=com.mongodb.hadoop.splitter.StandaloneMongoSplitter

【讨论】:

    猜你喜欢
    • 2015-10-08
    • 2014-12-19
    • 1970-01-01
    • 2016-04-12
    • 1970-01-01
    • 2017-10-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多