您好,登錄后才能下訂單哦!
下載安裝包
http://archive.apache.org/dist/sqoop/1.4.6/sqoop-1.4.6.bin__hadoop-2.0.4-alpha.tar.gz
我裝在hadoop 用戶下面
hadoop目錄是 /home/hadoop/hadoop
hive 目錄是 /home/hadoop/hive
sqoop 目錄是 /home/hadoop/sqoop
當(dāng)前目錄是 /home/hadoop
tar -zxvf sqoop-1.4.6.bin__hadoop-2.0.4-alpha.tar.gz
mv sqoop-1.4.6.bin__hadoop-2.0.4-alpha sqoop
在 /etc/profile 增加 sqoop 環(huán)境變量
export SQOOP_HOME=/home/hadoop/sqoop
export PATH=$PATH:$SQOOP_HOME/bin
創(chuàng)建sqoop-env.conf文件
export HADOOP_COMMON_HOME=/home/hadoop/hadoop
export HADOOP_MAPRED_HOME=/home/hadoop/hadoop
export HIVE_HOME=/home/hadoop/hive
修改$SQOOP_HOME/bin/configure-sqoop
#if [ -z "${HCAT_HOME}" ]; then
# if [ -d "/usr/lib/hive-hcatalog" ]; then
# HCAT_HOME=/usr/lib/hive-hcatalog
# elif [ -d "/usr/lib/hcatalog" ]; then
# HCAT_HOME=/usr/lib/hcatalog
# else
# HCAT_HOME=${SQOOP_HOME}/../hive-hcatalog
# if [ ! -d ${HCAT_HOME} ]; then
# HCAT_HOME=${SQOOP_HOME}/../hcatalog
# fi
# fi
#fi
#if [ -z "${ACCUMULO_HOME}" ]; then
# if [ -d "/usr/lib/accumulo" ]; then
# ACCUMULO_HOME=/usr/lib/accumulo
# else
# ACCUMULO_HOME=${SQOOP_HOME}/../accumulo
# fi
#fi
## Moved to be a runtime check in sqoop.
#if [ ! -d "${HCAT_HOME}" ]; then
# echo "Warning: $HCAT_HOME does not exist! HCatalog jobs will fail."
# echo 'Please set $HCAT_HOME to the root of your HCatalog installation.'
#fi
#
#if [ ! -d "${ACCUMULO_HOME}" ]; then
# echo "Warning: $ACCUMULO_HOME does not exist! Accumulo imports will fail."
# echo 'Please set $ACCUMULO_HOME to the root of your Accumulo installation.'
#fi
注釋掉HCatalog,Accumulo檢查(除非你準(zhǔn)備使用HCatalog,Accumulo等HADOOP上的組件)
我的sqoop 要把oracle 數(shù)據(jù)庫(kù) 導(dǎo)入到hive 里面
所以要用到oracle jdbc 驅(qū)動(dòng) ojdbc6.jar
從oracle官網(wǎng)上下載此驅(qū)動(dòng) 放在
/home/hadoop/sqoop/lib 目錄下。
查看sqoop 版本
[hadoop@bi-hadoop01 sqoop]$ sqoop version
Warning: /home/hadoop/sqoop/../hbase does not exist! HBase imports will fail.
Please set $HBASE_HOME to the root of your HBase installation.
Warning: /home/hadoop/sqoop/../zookeeper does not exist! Accumulo imports will fail.
Please set $ZOOKEEPER_HOME to the root of your Zookeeper installation.
16/10/13 14:33:44 INFO sqoop.Sqoop: Running Sqoop version: 1.4.6
Sqoop 1.4.6
git commit id c0c5a81723759fa575844a0a1eae8f510fa32c25
Compiled by root on Mon Apr 27 14:38:36 CST 2015
查看 sqoop-import 幫助
執(zhí)行 sqoop-import --help
測(cè)試oracle導(dǎo)入hive數(shù)據(jù)
sqoop import --hive-import --conect jdbc:oracle:thin:@192.168.106.35:1521:cyporcl --username CYP --password cyp --verbose -m 1 --table CYP_ETL_PROC_CONFIG
注意 用戶名 和表名必須大寫。
導(dǎo)入成功
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。