当前位置: 代码迷 >> 综合 >> sqoop 1.4.7 安装
  详细解决方案

sqoop 1.4.7 安装

热度:51   发布时间:2023-12-29 14:44:34.0

下载

下载链接:http://mirror.bit.edu.cn/apache/sqoop/1.4.7/

解压

tar -zxvf sqoop-1.4.7.bin__hadoop-2.6.0.tar.gz -C /opt/app/

配置环境变量

vi /etc/profileexport SQOOP_HOME=/opt/app/sqoop-1.4.7.bin__hadoop-2.6.0
export PATH=$PATH:$SQOOP_HOME/binsource /etc/profile

导入mysql驱动

https://dev.mysql.com/downloads/connector/j/

将mysql-connector-java-8.0.17.jar  放到  sqoop根目录下的lib文件夹里

修改配置文件

进入 sqoop 根目录下的conf文件夹

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

修改sqoop-env.sh

#Set path to where bin/hadoop is available
export HADOOP_COMMON_HOME=/opt/app/hadoop-2.7.7/#Set path to where hadoop-*-core.jar is available
export HADOOP_MAPRED_HOME=/opt/app/hadoop-2.7.7/#set the path to where bin/hbase is available
#export HBASE_HOME=#Set the path to where bin/hive is available
export HIVE_HOME=/opt/app/apache-hive-2.3.6-bin/#Set the path for where zookeper config dir is
export ZOOCFGDIR=/opt/app/apache-zookeeper-3.5.5-bin/

测试

sqoop version

sqoop help

查看mysql数据库

sqoop list-databases --username root  --password '123456' --connect jdbc:mysql://hadoop01:3306

查看mysql库里的表

sqoop list-tables --username root  --password '123456' --connect jdbc:mysql://hadoop01:3306/mytest1

从mysql导个数据到hdfs上试试看

sqoop import --connect jdbc:mysql://hadoop01:3306/mytest1 --username root --password 123456 --table user

 

 

  相关解决方案