您好,登錄后才能下訂單哦!
運行環境,hadoop2.6.0-cdh5.5.2
所以,下載的sqoop1.4.6也是5.5.2的版本,與之相對。
文件安裝在了/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 -R hadoop: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
配置環境變量,添加
[hadoop@fa01 bin]$ vi /home/hadoop/.bash_profile
export SQOOP_HOME=/usr/local/sqoop-1.4.6
出現警告:
[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
把上面的四個內容都給#注釋掉了,就只剩下最后的報錯了。
第一步,拷貝jar包
[hadoop@fa01 sqoop-1.4.6]$ cp sqoop-1.4.6-cdh6.5.2.jar ./lib/
會依舊報錯。
第二步,修改啟動的配置文件
[hadoop@fa01 bin]$ cd /usr/local/sqoop-1.4.6/bin
先給sqoop做個備份。
[hadoop@fa01 bin]$ cp sqoop sqoop.bak
修改
[hadoop@fa01 bin]$ vi sqoop
添加了一段的內容
exec ${HADOOP_COMMON_HOME}/bin/hadoop jar $SQOOP_HOME/sqoop-1.4.6-cdh6.5.2.jar org.apache.sqoop.Sqoop "$@"
我到這里已經好用。
如果還報錯,就把$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
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。