1. 上传并解压安装包
tar -zxvf sqoop-1.4.7.bin__hadoop-2.6.0.tar.gz -C ../server/
重命名:mv sqoop-1.4.7.bin__hadoop-2.6.0 sqoop
2. 配置环境变量
sudo vim /etc/profile
source /etc/profile
3. 修改sqoop的配置文件
cp /$SQOOP_HOME/conf/sqoop-env-template.sh /$SQOOP_HOME/conf/sqoop-env.sh
vim sqoop-env.sh
#Set path to where bin/hadoop is available export HADOOP_COMMON_HOME=/export/server/hadoop #Set path to where hadoop-*-core.jar is available export HADOOP_MAPRED_HOME=/export/server/hadoop #set the path to where bin/hbase is available export HBASE_HOME=/export/server/hbase #Set the path to where bin/hive is available export HIVE_HOME=/export/server/hive #Set the path for where zookeper config dir is export ZOOCFGDIR=/export/server/ zookeeper/conf |
4.上传相关jar包
# 上传
#mysql驱动下载地址:Maven Repository: JDBC Drivers (mvnrepository.com)
mysql-connector-java-8.0.8-dmr-bin.jar
hive/lib目录下
commons-lang-2.6.jar
hive-common-2.3.9.jar
protobuf-java-3.22.2.jar
# 到sqoop/lib目录
5.测试
连接MySQL查看数据库列表
sqoop list-databases --username root --password 1234 --connect jdbc:mysql://node1:3306/
可见安装的sqoop可用。
6.问题解决
(1)报错Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/lang/StringUtils
解决办法:cp /export/server/apache-hive-3.1.3-bin/lib/commons-lang-2.6.jar /export/server/sqoop-1.4.7/lib/ 在hive中把相关包复制到sqoop的lib目录
(2)报错:ERROR sqoop.Sqoop: Got exception running Sqoop: java.lang.RuntimeException: Could not load db driver class: com.mysql.jdbc.Driver
解决办法:上传MySQL驱动到sqoop/lib目录
#mysql驱动下载地址:
Maven Repository: JDBC Drivers (mvnrepository.com)https://mvnrepository.com/open-source/jdbc-drivers
本站资源均来自互联网,仅供研究学习,禁止违法使用和商用,产生法律纠纷本站概不负责!如果侵犯了您的权益请与我们联系!
转载请注明出处: 免费源码网-免费的源码资源网站 » sqoop的安装配置
发表评论 取消回复