2014-10-30 45 views
0

將數據從配置單元轉儲到MongoDB時,我面臨以下問題。我正在運行的命令是:將數據從配置單元轉儲到MongoDB時出現錯誤

1)

創建的「組織存儲外部表mongo_users(MEMBERID字符串,電子郵件串,sentdate串,操作類型串,actiondate串,CAMPAIGNID串,CAMPAIGNNAME字符串)。 (「mongo.column.mapping」=「memberid,email,sentdate,actiontype,actiondate,campaignid,campaignname」)tblproperties(「mongo.host」=「serverip」,「mongo。 port「=」port「,」mongo.db「=」admin「,」mongo.collection「=」dummy「);

2)
insert into table mongo_users select * from testmail;

的表格的說明:

Mongo_Users 

memberid  string from deserializer 
email   string from deserializer 
sentdate  string from deserializer 
actiontype  string from deserializer 
actiondate  string from deserializer 
campaignid  string from deserializer 
campaignname string from deserializer 

TestMail表:

memberid  string 
email string 
sentdate  string 
actiontype  string 
actiondate  string 
campaignid  string 
campaignname string 

錯誤蜂巢是投擲:

Diagnostic Messages for this Task: 
java.lang.RuntimeException: org.apache.hadoop.hive.ql.metadata.HiveException: Hive Runtime Error while processing row {"memberid":"1","email":"[email protected]","sentdate":"1st June 2012","actiontype":"Bounced","actiondate":"4-Jun","campaignid":"51674","campaignname":"Brand Awareness"} 
    at org.apache.hadoop.hive.ql.exec.ExecMapper.map(ExecMapper.java:159) 
    at org.apache.hadoop.mapred.MapRunner.run(MapRunner.java:50) 
    at org.apache.hadoop.mapred.MapTask.runOldMapper(MapTask.java:417) 
    at org.apache.hadoop.mapred.MapTask.run(MapTask.java:332) 
    at org.apache.hadoop.mapred.Child$4.run(Child.java:268) 
    at java.security.AccessController.doPrivileged(Native Method) 
    at javax.security.auth.Subject.doAs(Subject.java:396) 
    at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1438) 
    at org.apache.hadoop.mapred.Child.main(Child.java:262) 
Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: Hive Runtime Error while processing row {"memberid":"1","email":"[email protected]","sentdate": 

FAILED: Execution Error, return code 2 from org.apache.hadoop.hive.ql.exec.MapRedTask 
MapReduce Jobs Launched: 
Job 0: Map: 1 HDFS Read: 0 HDFS Write: 0 FAIL 
Total MapReduce CPU Time Spent: 0 msec 

回答

0

首先你必須設置HIVE輔助通道

命令如下。

蜂房--auxpath /home/hadoop/mongo-java-driver-2.12.4.jar,/home/hadoop/hive-mongo-0.0.1-SNAPSHOT.jar

隨着上述罐您還需要添加執行配置單元腳本所需的jar。

創建蒙戈表

創建由 「org.yong3.hive.mongo.MongoStorageHandler」 與serdeproperties存儲的外部表mongo_users(student_id數據INT,EMAIL_ID STRING,delivery_status STRING)( 「mongo.column.mapping」=「 ,「mongo.user」,「student_id,email_id,delivery_status」)tblproperties(「mongo.host」=「ServerName」,「mongo.port」=「port」,「mongo.db」=「admin」 mongo.passwd「=」admin「,」mongo.collection「=」testing「);

插入數據從蜂巢到MONGO:

插入重寫表mongo_users選擇student_id數據,EMAIL_ID,delivery_status從avro_table;

相關問題