运行环境,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进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。