Apache Sqoop安装

1.切换到/export/server

2.上传并解压

tar zxvf sqoop-1.4.7.bin__hadoop-2.6.0

3.设置软连接

ln -s sqoop-1.4.7.bin__hadoop-2.6.0 sqoop

4.切换到/sqoop/conf

将sqoop-env-template.sh改名为sqoop-env.sh

mv sqoop-env-template.sh sqoop-env.sh

5.编辑配置文件(sqoop-env.sh)

vim sqoop-env.sh

插入

export HIVE_HOME=/export/server/hive
export HADOOP_MAPRED_HOME=/export/server/hadoop
export HADOOP_COMMON_HOME=/export/server/hadoop
export ZOOKEEPER_HOME=/export/server/zookeeper
export ZOOCFGDIR=/export/server/zookeeper

注意:配置的版本号和路径根据自身情况更改

6.添加JDBC驱动

切换到/hive/lib

cd /export/server/hive/lib

复制mysql驱动文件

cp mysql-connector-java-5.1.34.jar /export/server/sqoop/lib/

7.验证

bin/sqoop list-databases \
--connect jdbc:mysql://localhost:3306/ \
--username root \
--password 123456

注:若验证时出现java.lang.NoClassDefFoundError错误:请看Sqoop 连接mysql 错误 java.lang.NoClassDefFoundError

出现mysql中的数据库,配置成功。

posted @ 2023-08-08 17:01  万事胜意k  阅读(44)  评论(0编辑  收藏  举报