说明:

Sqoop(发音:skup)是一款开源的工具,主要用于在Hadoop(Hive)与传统的数据库(mysql、postgresql...)间进行数据的传递,可以将一个关系型数据库(例如 : MySQL ,Oracle ,Postgres等)中的数据导进到Hadoop的HDFS中,也可以将HDFS的数据导进到关系型数据库中。Sqoop依赖于hadoop

一、安装介质

安装包:sqoop-1.4.4.bin__hadoop-2.0.4-alpha.tar.gz

二、解压安装介质

[root@hadoop-server01 apps]# tar -xvf sqoop-1.4.4.bin__hadoop-2.0.4-alpha.tar.gz -C /usr/local/apps/

三、修改配置文件

这里只需要修改sqoop-env.sh文件即可

#cd /usr/local/apps/sqoop-1.4.4.bin__hadoop-2.0.4-alpha/conf

[root@hadoop-server01 conf]# mv sqoop-env-template.sh sqoop-env.sh

[root@hadoop-server01 conf]# vi sqoop-env.sh

#Set path to where bin/hadoop is available

export HADOOP_COMMON_HOME=/usr/local/apps/hadoop-2.4.1

#Set path to where hadoop-*-core.jar is available

export HADOOP_MAPRED_HOME=/usr/local/apps/hadoop-2.4.1

#set the path to where bin/hbase is available

export HBASE_HOME=/usr/local/apps/hbase-0.96.2-hadoop2

#Set the path to where bin/hive is available

export HIVE_HOME=/usr/local/apps/hive-0.12.0-bin

#Set the path for where zookeper config dir is

export ZOOCFGDIR=/usr/local/apps/zookeeper-3.4.5/conf

四、配置环境变量

export SQOOP_HOME=/usr/local/apps/sqoop-1.4.4.bin__hadoop-2.0.4-alpha

export PATH=$PATH:$ZK_HOME/bin:$HBASE_HOME/bin:$HIVE_HOME/bin:$SQOOP_HOME/bin

五、验证命令

[root@hadoop-server01 ~]# sqoop help      

Warning: /usr/lib/hcatalog does not exist! HCatalog jobs will fail.

Please set $HCAT_HOME to the root of your HCatalog installation.

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

 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

为此,sqoop安装配置完成