sqoop导数据到hive报错
ERROR hive.HiveConfig: Could not load org.apache.hadoop.hive.conf.HiveConf. Make sure HIVE_CONF_DIR is set correctly.
[root@hadoop1 conf]# sqoop import --connect jdbc:mysql://192.168.122.15:3306/company --username sqoop --password 123456 --table erp_card --warehouse-dir=/test02 --hive-import --create-hive-table
ERROR hive.HiveConfig: Could not load org.apache.hadoop.hive.conf.HiveConf. Make sure HIVE_CONF_DIR is set correctly.
解决:
在hdfs用户下添加环境变量HADOOP_CLASSPATH
# vi ~/.bash_profile
export HADOOP_CLASSPATH=$HADOOP_CLASSPATH:/opt/cloudera/parcels/CDH/lib/hive/lib/*
# source ~/.bash_profile
hive环境配置缺少 hcatalog,报错如下图
解决方法:配置hive环境变量
vim /etc/profile
#hive
export HIVE_HOME=/home/hadoop/hive
export HIVE_CONF=$HIVE_HOME/conf
export PATH=$PATH:$HIVE_HOME/bin
export HCAT_HOME=$HIVE_HOME/hcatalog
export hive_dependency=$HIVE_HOME/conf:$HIVE_HOME/lib/*
export HIVE_LIB=/home/hadoop/hive/lib
export PATH=$PATH:$HIVE_LIB