運(yùn)行環(huán)境,hadoop2.6.0-cdh5.5.2
讓客戶滿意是我們工作的目標(biāo),不斷超越客戶的期望值來自于我們對(duì)這個(gè)行業(yè)的熱愛。我們立志把好的技術(shù)通過有效、簡單的方式提供給客戶,將通過不懈努力成為客戶在信息化領(lǐng)域值得信任、有價(jià)值的長期合作伙伴,公司提供的服務(wù)項(xiàng)目有:域名注冊(cè)、虛擬空間、營銷軟件、網(wǎng)站建設(shè)、隆化網(wǎng)站維護(hù)、網(wǎng)站推廣。
所以,下載的sqoop1.4.6也是5.5.2的版本,與之相對(duì)。
文件安裝在了/usr/local/中
[root@fa01 hadoop]# tar -zxvf /home/hadoop/sqoop-1.4.6-cdh6.5.2.tar.gz -C /usr/local/
[root@fa01 hadoop]# mv ./sqoop-1.4.6-cdh6.5.2 ./sqoop-1.4.6
[root@fa01 hadoop]# chown -Rhadoop:hadoop ./sqoop-1.4.6
下載JDBC,放到sqoop-1.4.6/lib目錄下
[hadoop@fa01 lib]$ mv MySQL-connector-java-5.1.43-bin.jar /usr/local/sqoop-1.4.6/lib
修改配置文件,拷貝一份
[hadoop@fa01 conf]$ cp sqoop-env-template.sh sqoop-env.sh
[hadoop@fa01 conf]$ vi sqoop-env.sh
#Set path to where bin/hadoop is available
export HADOOP_COMMON_HOME=/home/hadoop/hadoop-2.6.0-cdh6.5.2
#Set path to where hadoop-*-core.jar is available
export HADOOP_MAPRED_HOME=/home/hadoop/hadoop-2.6.0-cdh6.5.2
配置環(huán)境變量,添加
[hadoop@fa01 bin]$ vi /home/hadoop/.bash_profile
export SQOOP_HOME=/usr/local/sqoop-1.4.6
出現(xiàn)警告:
[hadoop@fa01 bin]$ ./sqoop
Warning: /home/hadoop/sqoopsqoop-1.99.7/../hbase does not exist! HBase imports will fail.
Please set $HBASE_HOME to the root of your HBase installation.
Warning: /home/hadoop/sqoopsqoop-1.99.7/../hcatalog does not exist! HCatalog jobs will fail.
Please set $HCAT_HOME to the root of your HCatalog installation.
Warning: /home/hadoop/sqoopsqoop-1.99.7/../accumulo does not exist! Accumulo imports will fail.
Please set $ACCUMULO_HOME to the root of your Accumulo installation.
Warning: /home/hadoop/sqoopsqoop-1.99.7/../zookeeper does not exist! Accumulo imports will fail.
Please set $ZOOKEEPER_HOME to the root of your Zookeeper installation.
Error:Could not find or load main class org.apache.sqoop.Sqoop
解決方式:
[hadoop@fa01 bin]$ vi configure-sqoop
把上面的四個(gè)內(nèi)容都給#注釋掉了,就只剩下最后的報(bào)錯(cuò)了。
第一步,拷貝jar包
[hadoop@fa01 sqoop-1.4.6]$ cp sqoop-1.4.6-cdh6.5.2.jar ./lib/
會(huì)依舊報(bào)錯(cuò)。
第二步,修改啟動(dòng)的配置文件
[hadoop@fa01 bin]$ cd /usr/local/sqoop-1.4.6/bin
先給sqoop做個(gè)備份。
[hadoop@fa01 bin]$ cp sqoop sqoop.bak
修改
[hadoop@fa01 bin]$ vi sqoop
添加了一段的內(nèi)容
exec ${HADOOP_COMMON_HOME}/bin/hadoop jar $SQOOP_HOME/sqoop-1.4.6-cdh6.5.2.jarorg.apache.sqoop.Sqoop "$@"
我到這里已經(jīng)好用。
如果還報(bào)錯(cuò),就把$SQOOP_HOME/下的sqoop-1.4.6-cdh6.5.2.jar放到$SQOOP_HOME/lib目錄下。
連接測試:
[hadoop@fa01 bin]$ ./sqoop list-tables --connect jdbc:mysql://192.111.111.111:3306/dasename --username mysqlname --password mysqlmima