Hadoop 2.2下的Sqoop-1.99.3配置部署

时间:2022-09-22 20:27:46

1、Hadoop2.2已经确保安装完成

2、下载Sqoop:http://mirrors.cnnic.cn/apache/sqoop/1.99.3/sqoop-1.99.3-bin-hadoop200.tar.gz
3、解压sqoop安装文件  tar -zxvf sqoop-1.99.3-bin-hadoop200.tar.gz

4、配置sqoop环境变量

(1)修改profile配置文件

#Sqoop Configure
export SQOOP_HOME=/root/install/sqoop-1.99.3-bin-hadoop200
export PATH=$SQOOP_HOME/bin:$PATH
export CATALINA_BASE=$SQOOP_HOME/server
export LOGDIR=$SQOOP_HOME/logs/
(2)修改catalina.properties

[root@S1PA124 conf]# pwd
/root/install/sqoop-1.99.3-bin-hadoop200/server/conf
[root@S1PA124 conf]# ls
catalina.policy catalina.properties context.xml logging.properties server.xml sqoop_bootstrap.properties sqoop.properties tomcat-users.xml web.xml
找到common.loader行,把/usr/lib/hadoop/lib/*.jar改成hadoop的类路径

common.loader=/root/install/hadoop-2.2.0/share/hadoop/yarn/lib/*.jar,/root/install/hadoop-2.2.0/share/hadoop/yarn/*.jar,/root/install/hadoop-2.2.0/share/hadoop/hdfs/*.jar,/root/install/hadoop-2.2.0/share/hadoop/hdfs/lib/*.jar,/home/hadoop/hadoop/share/hadoop/mapreduce/*.jar,/root/install/hadoop-2.2.0/share/hadoop/mapreduce/lib/*.jar,/root/install/hadoop-2.2.0/share/hadoop/common/lib/*.jar,/root/install/hadoop-2.2.0/share/hadoop/common/*.jar

(3)修改sqoop.properties
[root@S1PA124 conf]# pwd
/root/install/sqoop-1.99.3-bin-hadoop200/server/conf
[root@S1PA124 conf]# ls
catalina.policy catalina.properties context.xml logging.properties server.xml sqoop_bootstrap.properties sqoop.properties tomcat-users.xml web.xml
找到:org.apache.sqoop.submission.engine.mapreduce.configuration.directory

org.apache.sqoop.submission.engine.mapreduce.configuration.directory=/root/install/hadoop-2.2.0/etc/hadoop
(4)替换如下变量

[root@S1PA124 conf]# sed -i 's/@BASEDIR@/base/g' sqoop.properties 
[root@S1PA124 conf]# sed -i 's/@LOGDIR@/logs/g' sqoop.properties
(5)把数据库jdbc驱动复制到$SQOOP_HOME/lib目录下

(6)启动sqoop服务

[root@S1PA124 sqoop-1.99.3-bin-hadoop200]# ./bin/sqoop.sh server start
Sqoop home directory: /root/install/sqoop-1.99.3-bin-hadoop200
Setting SQOOP_HTTP_PORT:     12000
Setting SQOOP_ADMIN_PORT:     12001
Using   CATALINA_OPTS:       
Adding to CATALINA_OPTS:    -Dsqoop.http.port=12000 -Dsqoop.admin.port=12001
Using CATALINA_BASE:   /root/install/sqoop-1.99.3-bin-hadoop200/server
Using CATALINA_HOME:   /root/install/sqoop-1.99.3-bin-hadoop200/server
Using CATALINA_TMPDIR: /root/install/sqoop-1.99.3-bin-hadoop200/server/temp
Using JRE_HOME:        /opt/lxx/jdk1.7.0_51
Using CLASSPATH:       /root/install/sqoop-1.99.3-bin-hadoop200/server/bin/bootstrap.jar
(7)关闭sqoop服务

[root@S1PA124 sqoop-1.99.3-bin-hadoop200]# ./bin/sqoop.sh server stop
(8)使用sqoop客户端

[root@S1PA124 sqoop-1.99.3-bin-hadoop200]# bin/sqoop.sh client
Sqoop home directory: /root/install/sqoop-1.99.3-bin-hadoop200
Aug 27, 2014 4:16:48 PM java.util.prefs.FileSystemPreferences$1 run
INFO: Created user preferences directory.
Sqoop Shell: Type 'help' or '\h' for help.

sqoop:000> show version
client version:
Sqoop 1.99.3 revision 2404393160301df16a94716a3034e31b03e27b0b
Compiled by mengweid on Fri Oct 18 14:15:53 EDT 2013

遇到问题,解决以下问题:http://blog.csdn.net/panguoyuan/article/details/39578091

[root@S1PA124 bin]# sqoop.sh client
Sqoop home directory: /root/install/sqoop
Sqoop Shell: Type 'help' or '\h' for help.

sqoop:000>
sqoop:000>
sqoop:000> set server --host S1PA124 --port 12000 --webapp sqoop
Server is set successfully
sqoop:000> show version --all
client version:
Sqoop 1.99.3 revision 2404393160301df16a94716a3034e31b03e27b0b
Compiled by mengweid on Fri Oct 18 14:15:53 EDT 2013
Exception has occurred during processing command
Exception: com.sun.jersey.api.client.ClientHandlerException Message: java.net.ConnectException: Connection refused