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>
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>