sqoop的安装配置

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

|-----------------------------------------------------------------------------------------|
| # 配置sqoop的环境变量 export SQOOP_HOME=/export/server/sqoop export PATH=PATH:SQOOP_HOME/bin |

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

相关推荐
8***a8151 天前
从0到1部署Tomcat和添加servlet(IDEA2024最新版详细教程)
hive·servlet·tomcat
5***79002 天前
JavaScript生成器函数
hive·tidb·consul
顧棟3 天前
HDFS元数据与auditlog结合Hive元数据统计分析
hive·hadoop·hdfs
z***89713 天前
【分布式】Hadoop完全分布式的搭建(零基础)
大数据·hadoop·分布式
Kevinyu_3 天前
责任链模式
java·hadoop·责任链模式
yumgpkpm3 天前
腾讯云TBDS与CDH迁移常见问题有哪些?建议由CDH迁移到CMP 7.13 平台(类Cloudera CDP,如华为鲲鹏 ARM 版)
hive·hadoop·zookeeper·flink·spark·kafka·hbase
yumgpkpm4 天前
数据可视化AI、BI工具,开源适配 Cloudera CMP 7.3(或类 CDP 的 CMP 7.13 平台,如华为鲲鹏 ARM 版)值得推荐?
人工智能·hive·hadoop·信息可视化·kafka·开源·hbase
二进制_博客4 天前
使用datax将mysql数据抽取到hive分区表无数据
数据库·hive·mysql
干就完事了4 天前
Hive视图
数据仓库·hive·hadoop
Linux Huang4 天前
【Dinky】IDEA运行出现HistoryServer异常
java·hadoop·flink·intellij idea