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

相关推荐
浊酒南街18 小时前
hive中map_concat函数介绍
数据仓库·hive·hadoop
qq_4465980420 小时前
contos7.9 部署3节点 hadoop3.4 集群 非高可用
大数据·hadoop
雷神乐乐21 小时前
Flume学习
hadoop·学习·flume
遥遥晚风点点1 天前
spark 设置hive.exec.max.dynamic.partition不生效
大数据·hive·spark
huaqianzkh1 天前
了解Hadoop:大数据处理的核心框架
大数据·hadoop·分布式
Kika写代码1 天前
【Hadoop】【hdfs】【大数据技术基础】实验三 HDFS 基础编程实验
大数据·hadoop·hdfs
我的K84091 天前
Flink整合Hive、Mysql、Hbase、Kafka
hive·mysql·flink
heromps1 天前
hadoop报错找不到主类
大数据·hadoop·eclipse
静听山水2 天前
基于ECS实例搭建Hadoop环境
hadoop
三劫散仙2 天前
Hadoop + Hive + Apache Ranger 源码编译记录
hive·hadoop·hbase·ranger