黑猴子的家:Sqoop 安装

安装Sqoop的前提是已经具备Java和Hadoop的环境,为后续的测试,最好也安装好Hive、HBase、Zookeeper、Mysql

1、下载地址

http://mirrors.hust.edu.cn/apache/sqoop

2、上传安装包

sqoop-1.4.7.bin__hadoop-2.6.0.tar.gz到虚拟机中

3、解压sqoop安装包到指定目录

[victor@node1 software]$ tar -xzvf sqoop-1.4.7.bin_hadoop-2.6.0.tar.gz -C /opt/module

4、修改配置文件

[victor@node1 software]$ cd /opt/module/sqoop-1.4.7/conf
[victor@node1 conf]$ pwd
/opt/module/sqoop-1.4.7/conf
[victor@node1 conf]$ cp sqoop-env-template.sh sqoop-env.sh
[victor@node1 conf]$ cp sqoop-site-template.xml sqoop-site.xml
[victor@node1 conf]$ vim sqoop-env.sh
export HADOOP_COMMON_HOME=/opt/module/hadoop-2.8.2
export HADOOP_MAPRED_HOME=/opt/module/hadoop-2.8.2
export HBASE_HOME=/opt/module/hbase-1.2.5
export HIVE_HOME=/opt/module/apache-hive-1.2.5-bin
export ZOOKEEPER_HOME=/opt/module/zookeeper-3.4.10
export ZOOCFGDIR=/opt/module/zookeeper-3.4.10
#尖叫提示:ZOOKEEPER_HOME官方默认没有,不配置 sqoop启动报错

5、拷贝jdbc驱动到sqoop的lib目录下

[victor@node1 conf]$ cp -a mysql-connector-java-5.1.27-bin.jar /opt/module/sqoop-1.4.7/lib/

6、验证Sqoop

[victor@node1 sqoop-1.4.7]$ bin/sqoop help
(警告信息已省略)
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 information

7、测试Sqoop是否能够成功连接数据库

[victor@node1 sqoop-1.4.7]$ bin/sqoop list-databases  \
--connect jdbc:mysql://node1:3306/ --username root --password 000000
##出现如下输出
information_schema
metastore
mysql
performance_schema

你可能感兴趣的:(黑猴子的家:Sqoop 安装)