之前已经在CentOS 6.7上安装部署Hadoop 2.7.2(http://www.jb51.cc/article/p-umbfvzwc-bew.html),并正常启动Hadoop集群。
master
[root@master ~]# wget https://mirrors.tuna.tsinghua.edu.cn/apache/sqoop/1.4.6/sqoop-1.4.6.bin__hadoop-2.0.4-alpha.tar.gz
[root@master ~]# tar -zxvf sqoop-1.4.6.bin__hadoop-2.0.4-alpha.tar.gz
[root@master ~]# mv sqoop-1.4.6.bin__hadoop-2.0.4-alpha /usr/local/
配置MysqL连接器
[root@master ~]# cp MysqL-connector-java-5.1.40/MysqL-connector-java-5.1.40-bin.jar /usr/local/sqoop-1.4.6.bin__hadoop-2.0.4-alpha/lib/
Sqoop环境变量
[root@master ~]# vi /etc/profile.d/sqoop.sh
export SQOOP_HOME=/usr/local/sqoop-1.4.6.bin__hadoop-2.0.4-alpha
export PATH=$PATH:$SQOOP_HOME/bin
保存退出
[root@master ~]# source /etc/profile.d/sqoop.sh
配置
[root@master ~]# cp /usr/local/sqoop-1.4.6.bin__hadoop-2.0.4-alpha/conf/sqoop-env-template.sh /usr/local/sqoop-1.4.6.bin__hadoop-2.0.4-alpha/conf/sqoop-env.sh
[root@master ~]# vi /usr/local/sqoop-1.4.6.bin__hadoop-2.0.4-alpha/conf/sqoop-env.sh
#Set path to where bin/hadoop is available #export HADOOP_COMMON_HOME= #Set path to where hadoop-*-core.jar is available #export HADOOP_MAPRED_HOME= #set the path to where bin/hbase is available #export HBASE_HOME= #Set the path to where bin/hive is available #export HIVE_HOME= #Set the path for where zookeper config dir is #export ZOOCFGDIR=
为
#Set path to where bin/hadoop is available export HADOOP_COMMON_HOME=/usr/local/hadoop-2.7.2 #Set path to where hadoop-*-core.jar is available export HADOOP_MAPRED_HOME=/usr/local/hadoop-2.7.2 #set the path to where bin/hbase is available export HBASE_HOME=/usr/local/hbase-0.98.23-hadoop2 #Set the path to where bin/hive is available export HIVE_HOME=/usr/local/apache-hive-1.2.1-bin #Set the path for where zookeper config dir is export ZOOCFGDIR=/usr/local/zookeeper-3.4.9
保存退出
启动并验证Sqoop
[root@master ~]# /usr/local/sqoop-1.4.6.bin__hadoop-2.0.4-alpha/bin/sqoop help
[root@master ~]# echo $?
0