Hive

1. ps -ef | grep hive
2. hive --service hiveserver
3.CREATE external TABLE  IF NOT EXISTS person1

  id INT,
  name STRING
)
STORED BY 'com.mongodb.hadoop.hive.MongoStorageHandler'
WITH SERDEPROPERTIES('mongo.columns.mapping'='{"id":"_id","name":"name"}')
TBLPROPERTIES('mongo.uri'='mongodb://10.42.185.55:27017/testHive.persons');


insert into table persons select * from test; (test table is already exist in hive)


hive export to mongo
a. firstly you should copy mongo-hadoop-hive_x.jar to hive/lib






The fking important point is that you need to change conf/hive-env.sh
specify
export HIVE_CONF_DIR=$HIVE_HOME/conf
export HIVE_AUX_JARS_PATH=$HIVE_HOME/lib




and additional steps I don't know if they are necessary are copying jackson-*.jar under hive/lib to hadoop/lib




------------------------------------------------------------------------------------
hive


hive --service hiveserver


problems
1. Failed with exception Unable to rename: hdfs://vm-9ac7-806d.apac.nsroot.net:8020/tmp/hive-007/hive_2014-03-27_17-18-57_060_5683127430773874167-1/-ext-10000 to: DataSet/m
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.MoveTask
or if you insert results to a table, you see no error, but nothing imported to table, then below change will do the trick


solution:


in hive-default.xml, change false to true
<property>  
  <name>hive.insert.into.multilevel.dirs</name>  
  <value>true</value>  
</property>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值