(1)安装环境
操作系统:Linux(centos6.5)
JDK版本:1.7.0_45
Hadoop版本:hadoop2.6.0
Sqoop2版本:sqoop-1.99.4-bin-hadoop200
hadoop安装目录:/usr/local/hadoop/hadoop-2.2.0
Sqoop2安装目录:/usr/local/sqoop/sqoop-1.99.4-bin-hadoop200
Hadoop和Sqoop都是同一个用户hadoop下面,hadoop用户的的家目录:/home/hadoop
(2)修改Sqoop2的配置文件
1、首先修改配置文件/home/hadoop/sqoop-1.99.4-bin-hadoop200/server/conf/sqoop.properties指定hadoop的配置文件所属路径。
将原来的如下配置:
-
# Hadoop configuration directory
-
org.apache.sqoop.submission.engine.mapreduce.configuration.directory=/etc/hadoop/conf/
修改为:
-
# Hadoop configuration directory
-
org.apache.sqoop.submission.engine.mapreduce.configuration.directory=/usr/local/hadoop/hadoop-2.6.0/etc/hadoop/
2、修改配置文件/home/hadoop/sqoop-1.99.4-bin-hadoop200/server/conf/catalina.properties。
这里即时把/home/hadoop/hadoop-2.2.0/share/hadoop下全部的*.jar包加入到sqoop2的类路径中去。
将原来的如下配置:
-
common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar,${catalina.home}/../lib/*.jar,/usr/lib/hadoop/*.jar,/usr/lib/hadoop/lib/*.jar,/usr/lib/hadoop-hdfs/*.jar,/usr/lib/hadoop-hdfs/lib/*.jar,/usr/lib/hadoop-mapreduce/*.jar,/usr/lib/hadoop-mapreduce/lib/*.jar,/usr/lib/hadoop-yarn/*.jar,/usr/lib/hadoop-yarn/lib/*.jar
修改为:
-
common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar,${catalina.home}/../lib/*.jar,/usr/local/hadoop/hadoop-2.6.0/share/hadoop/common/*.jar,/usr/local/hadoop/hadoop-2.6.0/share/hadoop/common/lib/*.jar,/usr/local/hadoop/hadoop-2.6.0/share/hadoop/hdfs/*.jar,/usr/local/hadoop/hadoop-2.6.0/share/hadoop/hdfs/lib/*.jar,/usr/local/hadoop/hadoop-2.6.0/share/hadoop/mapreduce/*.jar,/usr/local/hadoop/hadoop-2.6.0/share/hadoop/mapreduce/lib/*.jar,/usr/local/hadoop/hadoop-2.6.0/share/hadoop/tools/*.jar,/usr/local/hadoop/hadoop-2.6.0/share/hadoop/tools/lib/*.jar,/usr/local/hadoop/hadoop-2.6.0/share/hadoop/yarn/*.jar,/usr/local/hadoop/hadoop-2.6.0/share/hadoop/yarn/lib/*.jar,/usr/local/hadoop/hadoop-2.6.0/share/hadoop/httpfs/tomcat/lib/*.jar
(3)修改环境变量
直接修改~/.bashrc在文件末尾追加如下内容即可:
-
export SQOOP_HOME=/usr/local/sqoop/sqoop-1.99.4-bin-hadoop200
-
export PATH=$SQOOP_HOME/bin:$PATH
-
export CATALINA_HOME=$SQOOP_HOME/server
-
export LOGDIR=$SQOOP_HOME/logs
当然完成上述修改后需要在hadoop用户下执行命令来让配置即可生效:
启停sqoop-server:
$SQOOP2_HOME/bin/sqoop.sh server start $SQOOP2_HOME/bin/sqoop.sh server stop 或者 $SQOOP2_HOME/bin/sqoop2-server start $SQOOP2_HOME/bin/sqoop2-server stop
验证是否启动成功:
方式一:jps查看进程: Bootstrap
方式二:http://hadoop000:12000/sqoop/version
方式三:wget -qO – hadoop000:12000/sqoop/version
启动sqoop客户端:
$SQOOP2_HOME/bin/sqoop.sh client 或者 $SQOOP2_HOME/bin/sqoop2-shell
为客户端配置服务器:
sqoop:000> set server --host hadoop000 --port 12000 --webapp sqoop
查看服务器端信息:
sqoop:000> show server --all
原创文章,作者:3628473679,如若转载,请注明出处:https://blog.ytso.com/190927.html