本节用到的安装介质:
sqoop-1.4.7.bin__hadoop-2.6.0.tar.gz 提取码:aubk
mysql-connector-java-5.1.46.tar.gz 提取码:zaqf
1.下载sqoop安装包
[root@bigdata ~]# ls /root/tools/sqoop-*
/root/tools/sqoop-1.4.7.bin__hadoop-2.6.0.tar.gz
2.解压到安装目录
[root@bigdata ~]# tar zxvf /root/tools/sqoop-1.4.7.bin__hadoop-2.6.0.tar.gz -C /root/trainings
3.配置环境变量
[root@bigdata ~]# vim /root/.bash_profile
SQOOP_HOME=/root/trainings/sqoop-1.4.7.bin__hadoop-2.6.0
export SQOOP_HOME
PATH=$SQOOP_HOME/bin:$PATH
export $PATH[root@bigdata ~]# source /root/.bash_profile
4.修改Sqoop配置文件
(1)下载需要的MySQL的JDBC驱动包mysql-connector-java-5.1.46-bin.jar放到$SQOOP_HOME/lib目录下:
[root@bigdata ~]# cd /root/tools/
[root@bigdata tools]# tar -zxvf mysql-connector-java-5.1.46.tar.gz
[root@bigdata tools]# cp mysql-connector-java-5.1.46/mysql-connector-java-5.1.46-bin.jar \
/root/trainings/sqoop-1.4.7.bin__hadoop-2.6.0/lib/
(2)修改sqoop配置文件(如果你的Hadoop,Hive,HBase等配置了环境变量,则这里可以不用配置)
[root@bigdata ~]# cd /root/trainings/sqoop-1.4.7.bin__hadoop-2.6.0/conf/
[root@bigdata conf]# cp sqoop-env-template.sh sqoop-env.sh
[root@bigdata conf]# vim sqoop-env.sh
# 指定各环境变量的实际配置
# Set Hadoop-specific environment variables here.#Set path to where bin/hadoop is available
export HADOOP_COMMON_HOME=/root/trainings/hadoop-2.7.3#Set path to where hadoop-*-core.jar is available
export HADOOP_MAPRED_HOME=/root/trainings/hadoop-2.7.3/lib#set the path to where bin/hbase is available
export HBASE_HOME=/root/trainings/hbase-2.0.1#Set the path to where bin/hive is available
export HIVE_HOME=/root/trainings/hive-3.1.0-bin
5.验证是否成功
(1)查看Sqoop版本
[root@bigdata ~]# sqoop version
Warning: /root/trainings/sqoop-1.4.7.bin__hadoop-2.6.0/../hcatalog does not exist! HCatalog jobs will fail.
Please set $HCAT_HOME to the root of your HCatalog installation.
Warning: /root/trainings/sqoop-1.4.7.bin__hadoop-2.6.0/../accumulo does not exist! Accumulo imports will fail.
Please set $ACCUMULO_HOME to the root of your Accumulo installation.
18/09/27 23:51:26 INFO sqoop.Sqoop: Running Sqoop version: 1.4.7
Sqoop 1.4.7
git commit id 2328971411f57f0cb683dfb79d19d4d19d185dd8
Compiled by maugli on Thu Dec 21 15:59:58 STD 2017
注意:这里两处警告的意思是说,hcatalog和accumulo没有安装,如果需要的话,你可以安装它们,并在配置文件中指定其家目录。
(2)查看Sqoop帮助信息
[root@bigdata ~]# sqoop help
Warning: /root/trainings/sqoop-1.4.7.bin__hadoop-2.6.0/../hcatalog does not exist! HCatalog jobs will fail.
Please set $HCAT_HOME to the root of your HCatalog installation.
Warning: /root/trainings/sqoop-1.4.7.bin__hadoop-2.6.0/../accumulo does not exist! Accumulo imports will fail.
Please set $ACCUMULO_HOME to the root of your Accumulo installation.
18/09/27 23:57:00 INFO sqoop.Sqoop: Running Sqoop version: 1.4.7
usage: sqoop COMMAND [ARGS]Available commands:
codegen Generate code to interact with database records
create-hive-table Import a table definition into Hive
eval Evaluate a SQL statement and display the results
export Export an HDFS directory to a database table
help List available commands
import Import a table from a database to HDFS
import-all-tables Import tables from a database to HDFS
import-mainframe Import datasets from a mainframe server to HDFS
job Work with saved jobs
list-databases List available databases on a server
list-tables List available tables in a database
merge Merge results of incremental imports
metastore Run a standalone Sqoop metastore
version Display version informationSee 'sqoop help COMMAND' for information on a specific command.
可见Sqoop的安装过程非常简单!祝你玩得愉快!