分享

Ubuntu14 server + Hadoop2.2.0环境下Sqoop1.99.3部署记录

问题导读


1.如何解决log4j包冲突问题?
2.如何配置sqoop环境变量?








第一步,下载、解压、配置环境变量:


官网下载sqoop1.99.3
http://mirrors.cnnic.cn/apache/sqoop/1.99.3/


将sqoop解压到目标目录,我的是
/home/fulong/Sqoop/sqoop-1.99.3-bin-hadoop200

配置环境变量:
  1. export SQOOP_HOME=/home/fulong/Sqoop/sqoop-1.99.3-bin-hadoop200
  2. export PATH=$PATH:$SQOOP_HOME/bin
  3. export CATALINA_BASE=$SQOOP_HOME/server
  4. export LOGDIR=$SQOOP_HOME/logs/
复制代码

第二步,修改配置文件:


修改配置文件catalina.properties:
vim $SQOOP_HOME/server/conf/catalina.properties
在文件中找到common.loader,在其后添加hadoop相关jar包路径,最终效果如下

  1. common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar,${catalina.home}/../lib/*.jar,/home/fulong/Hadoop/hadoop-2.2.0/share/hadoop/common/*.jar,/home/fulong/Hadoop/hadoop-2.2.0/share/hadoop/common/lib/*.jar,/home/fulong/Hadoop/hadoop-2.2.0/share/hadoop/hdfs/*.jar,/home/fulong/Hadoop/hadoop-2.2.0/share/hadoop/hdfs/lib/*.jar,/home/fulong/Hadoop/hadoop-2.2.0/share/hadoop/mapreduce/*.jar,/home/fulong/Hadoop/hadoop-2.2.0/share/hadoop/mapreduce/lib/*.jar,/home/fulong/Hadoop/hadoop-2.2.0/share/hadoop/tools/*.jar,/home/fulong/Hadoop/hadoop-2.2.0/share/hadoop/tools/lib/*.jar,/home/fulong/Hadoop/hadoop-2.2.0/share/hadoop/yarn/*.jar,/home/fulong/Hadoop/hadoop-2.2.0/share/hadoop/yarn/lib/*.jar
复制代码
修改配置文件sqoop.properties:
vim $SQOOP_HOME/conf/sqoop.properties

在文件中找到org.apache.sqoop.submission.engine.mapreduce.configuration.directory,用Hadoop的配置文件目录赋值,最终效果如下:
org.apache.sqoop.submission.engine.mapreduce.configuration.directory=/home/fulong/Hadoop/hadoop-2.2.0/etc/hadoop


!!!!!!切记!!!!!!

sqoop配置文件中不能用环境变量(比如$HADOOP_HOME),必须用全路径!!!


第三步,jar包相关工作:

1)首先,拷入需要用到的Oracle的jdbc包classes12.jar:
我拷贝到了两个目录下
/home/fulong/Sqoop/sqoop-1.99.3-bin-hadoop200/server/webapps/sqoop/WEB-INF/lib
/home/fulong/Sqoop/sqoop-1.99.3-bin-hadoop200/server/lib


2)解决log4j包冲突问题
由于在catalina.properties配置文件的common.loader属性中配置引入了所有的hadoop相关jar包,而hadoop的lib目录下是有log4j包的,只是版本和sqoop自带的log4j不一致。
我们需要将/home/fulong/Sqoop/sqoop-1.99.3-bin-hadoop200/server/webapps/sqoop/WEB-INF/lib目录下的log4j-1.2.16.jar移除即可。


启动:

Sqoop分为server端和client端,server端只需要在一个hadoop节点上运行即可,client端可以在任意能运行hadoop client的节点上运行。

首先启动server端:

  1. fulong@FBI003:~/Sqoop/sqoop-1.99.3-bin-hadoop200/server/webapps/sqoop/WEB-INF/lib$ sqoop.sh server start
  2. Sqoop home directory: /home/fulong/Sqoop/sqoop-1.99.3-bin-hadoop200
  3. Setting SQOOP_HTTP_PORT:     12000
  4. Setting SQOOP_ADMIN_PORT:     12001
  5. Using   CATALINA_OPTS:
  6. Adding to CATALINA_OPTS:    -Dsqoop.http.port=12000 -Dsqoop.admin.port=12001
  7. Using CATALINA_BASE:   /home/fulong/Sqoop/sqoop-1.99.3-bin-hadoop200/server
  8. Using CATALINA_HOME:   /home/fulong/Sqoop/sqoop-1.99.3-bin-hadoop200/server
  9. Using CATALINA_TMPDIR: /home/fulong/Sqoop/sqoop-1.99.3-bin-hadoop200/server/temp
  10. Using JRE_HOME:        /usr/lib/jvm/java
  11. Using CLASSPATH:       /home/fulong/Sqoop/sqoop-1.99.3-bin-hadoop200/server/bin/bootstrap.jar
复制代码
然后启动client端,设置指向服务器端,查看版本:
  1. fulong@FBI008:~$ sqoop.sh client
  2. Sqoop home directory: /home/fulong/Sqoop/sqoop-1.99.3-bin-hadoop200
  3. Sqoop Shell: Type 'help' or '\h' for help.
  4. sqoop:000> set server --host FBI003 --port 12000 --webapp sqoop
  5. Server is set successfully
  6. sqoop:000> show version --all
  7. client version:
  8.   Sqoop 1.99.3 revision 2404393160301df16a94716a3034e31b03e27b0b
  9.   Compiled by mengweid on Fri Oct 18 14:15:53 EDT 2013
  10. server version:
  11.   Sqoop 1.99.3 revision 2404393160301df16a94716a3034e31b03e27b0b
  12.   Compiled by mengweid on Fri Oct 18 14:15:53 EDT 2013
  13. Protocol version:
  14.   [1]
  15. sqoop:000>
复制代码
到此,Sqoop1.99.3正常启动!







欢迎加入about云群90371779322273151432264021 ,云计算爱好者群,亦可关注about云腾讯认证空间||关注本站微信

没找到任何评论,期待你打破沉寂

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

推荐上一条 /2 下一条