因为用的hadoop2.20所以下载sqoop-1.99.3-bin-hadoop200使用
随便找一个hadoop node节点做sqoop server:
1.下载安装
[hadoop@slave1 ~]$ wget http://mirror.bit.edu.cn/apache/sqoop/1.99.3/sqoop-1.99.3-bin-hadoop200.tar.gz
[hadoop@slave1 ~]$ tar xvf sqoop-1.99.3-bin-hadoop200.tar.gz
2.配置环境变量
[hadoop@slave1 ~]$ vi ~/.bash_profile
添加:
export SQOOP_HOME=/home/sqoop-1.99.3-bin-hadoop200
export PATH=${SQOOP_HOME}/bin:$PATH
[hadoop@slave1 ~]$ . ~/.bash_profile
3.配置包的依赖
[hadoop@slave1 ~]$ cd sqoop-1.99.3-bin-hadoop200/server/conf
[hadoop@slave1 conf]$ vi catalina.properties
修改common.loader
common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar,${catalina.home}/../lib/*.jar,/home/hadoop/hadoop-2.2.0/share/hadoop/mapreduce/*.jar
4.修改hadoop配置文件路径
org.apache.sqoop.submission.engine.mapreduce.configuration.directory=/home/hadoop/hadoop-2.2.0/etc/hadoop
5.添加驱动jar包到SQOOP_HOME/lib/下面
我现在用的是mysql-server-5.1.73
从http://dev.mysql.com/downloads/connector/j/下载mysql-connector-java-5.1.30.tar.gz
[hadoop@slave1 ~]$ tar xvf mysql-connector-java-5.1.30.tar.gz
[hadoop@slave1 ~]$ mkdir sqoop-1.99.3-bin-hadoop200/lib
[hadoop@slave1 ~]$ cp mysql-connector-java-5.1.30/mysql-connector-java-5.1.30-bin.jar sqoop-1.99.3-bin-hadoop200/lib/
[hadoop@slave1 ~]$ sqoop.sh server start
[hadoop@slave1 ~]$ sudo netstat -tnlp | grep java
tcp 0 0 :::12000 :::* LISTEN 2922/java
tcp 0 0 ::ffff:127.0.0.1:12001 :::* LISTEN 2922/java