1、下载软件:http://archive.cloudera.com/cdh5/cdh/5/
2、解压:tar -zxvf mysofts/sqoop2-1.99.5-cdh5.6.0.tar.gz
3、配置环境变量
[root@Hadoop-NN-01 ~]# vim /etc/profile
#sqoop2 export SQOOP2_HOME=/home/hadoopuser/sqoop2-1.99.5-cdh5.6.0 export CATALINA_BASE=$SQOOP2_HOME/server export PATH=$PATH:$SQOOP2_HOME/bin [root@Hadoop-NN-01 ~]# source /etc/profile #使用环境变量生效
4、拷贝mysql驱动包到 $SQOOP2_HOME/server/lib下
驱动包下载:http://dev.mysql.com/downloads/connector/j/
[hadoopuser@Hadoop-NN-01 ~]$ cp mysql-connector-java-5.1.10-bin.jar $SQOOP2_HOME/server/lib/
5、修改hadoop配置文件所属路径
[hadoopuser@Hadoop-NN-01 ~]$ vim $SQOOP2_HOME/server/conf/sqoop.properties org.apache.sqoop.submission.engine.mapreduce.configuration.directory=/home/hadoopuser/hadoop-2.6.0-cdh5.6.0/etc/hadoop
6、把/home/hadoopuser/hadoop-2.6.0-cdh5.6.0/share/hadoop下所有*.jar包加入到类路径里:
[hadoopuser@Hadoop-NN-01 ~]$ vim $SQOOP2_HOME/server/conf/catalina.properties #修改后 common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar,${catalina.home}/../lib/*.jar,/home/hadoopuser/hadoop-2.6.0-cdh5.6.0/share/hadoop/common/*.jar,/home/hadoopuser/hadoop-2.6.0-cdh5.6.0/share/hadoop/common/lib/*.jar,/home/hadoopuser/hadoop-2.6.0-cdh5.6.0/share/hadoop/hdfs/*.jar,/home/hadoopuser/hadoop-2.6.0-cdh5.6.0/share/hadoop/hdfs/lib/*.jar,/home/hadoopuser/hadoop-2.6.0-cdh5.6.0/share/hadoop/mapreduce/*.jar,/home/hadoopuser/hadoop-2.6.0-cdh5.6.0/share/hadoop/mapreduce/lib/*.jar,/home/hadoopuser/hadoop-2.6.0-cdh5.6.0/share/hadoop/tools/*.jar,/home/hadoopuser/hadoop-2.6.0-cdh5.6.0/share/hadoop/tools/lib/*.jar,/home/hadoopuser/hadoop-2.6.0-cdh5.6.0/share/hadoop/yarn/*.jar,/home/hadoopuser/hadoop-2.6.0-cdh5.6.0/share/hadoop/yarn/lib/*.jar,/home/hadoopuser/hadoop-2.6.0-cdh5.6.0/share/hadoop/httpfs/tomcat/lib/*.jar
注:如果想修改tomcat的端口号等信息可以在$SQOOP2_HOME/server/conf/server.xml中进行设置。
7、启停sqoop-server
[hadoopuser@Hadoop-NN-01 sqoop2-1.99.5-cdh5.6.0]$ bin/sqoop.sh server start
[hadoopuser@Hadoop-NN-01 sqoop2-1.99.5-cdh5.6.0]$ bin/sqoop.sh server stop
8、验证是否启动成功
方式一:jps查看进程:Bootstrap
方式二:http://Hadoop-NN-01:12000/sqoop/version
9、进入sqoop客户端
[hadoopuser@Hadoop-NN-01 sqoop2-1.99.5-cdh5.6.0]$ bin/sqoop.sh client
10、为客户端配置服务器
sqoop:000> set server --host Hadoop-NN-01 --port 12000 --webapp sqoop
Server is set successfully
查看服务器端信息:
sqoop:000> show server --all Server host: Hadoop-NN-01 Server port: 12000 Server webapp: sqoop