mongodb_hive建表
Posted 何国秀_xue
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mongodb_hive建表相关的知识,希望对你有一定的参考价值。
create database hive_to_mongodb;
add jar /hgx/mongo-hadoop-core-1.5.1.jar /hgx/mongo-hadoop-hive-1.5.1.jar /hgx/mongo-java-driver-3.2.1.jar;
add jar /jar_tools/mongodb/mongo-hadoop-core-1.5.1.jar /jar_tools/mongodb/mongo-hadoop-hive-1.5.1.jar /jar_tools/mongodb/mongo-java-driver-3.2.1.jar;
CREATE EXTERNAL TABLE rec_o2o_app
(
id string,
uid string,
message string,
time timestamp,
inTime string,
outTime string
)
STORED BY ‘com.mongodb.hadoop.hive.MongoStorageHandler‘
WITH SERDEPROPERTIES(‘mongo.columns.mapping‘=‘{"id":"_id","uid":"uid","message":"message","time":"time","inTime":"inTime","outTime":"outTime"}‘)
TBLPROPERTIES(‘mongo.uri‘=‘mongodb://10.10.10.33:27017/log.REC_O2O-app‘);
以上是关于mongodb_hive建表的主要内容,如果未能解决你的问题,请参考以下文章