注意:sqoop1与sqoop2完全不兼容,1.4.6及之前的版本是sqoop1,之后的是sqoop2。ubuntu安装sqoop1
其他环境:
hadoop:2.7.2
mysql:5.7.15
sqoop:1.99.5
1. 下载并解压sqoop源程序
sqoop下载地址
sudo tar -zvxf sqoop-1.99.5-bin-hadoop200.tar.gz -C /usr/local #解压sqoop并拷贝到/usr/local
cd /usr/local #切换目录
sudo mv sqoop-1.99.5-bin-hadoop200 sqoop #重命名
sudo chown -R dblab:dblab sqoop #更改权限
2. 修改环境变量
在~/.bashrc
中第一行添加sqoop的环境变量,方便使用。
export SQOOP_HOME=/usr/local/sqoop
export CATALINA_HOME=$SQOOP_HOME/server
export PATH=$PATH:/usr/local/sqoop/bin:$CATALINA_HOME/bin
#冒号为分隔符
source ~/.bashrc
使其立即生效
3. 修改sqoop/server/conf/sqoop.properties
修改指向hadoop安装目录
org.apache.sqoop.submission.engine.mapreduce.configuration.directory=/usr/local/hadoop
4. 修改sqoop/server/conf/catalina.properties
把hadoop目录下的jar包都引进来,如果有用到Hive或HBase也需要引入所有jar包。
common.loader=/usr/local/hadoop/share/hadoop/common/*.jar,/usr/local/hadoop/share/hadoop/common/lib/*.jar,/usr/local/hadoop/share/hadoop/yarn/*.jar,/usr/local/hadoop/share/hadoop/yarn/lib/*.jar,/usr/local/hadoop/share/hadoop/hdfs/*.jar,/usr/local/hadoop/share/hadoop/hdfs/lib/*.jar,/usr/local/hadoop/share/hadoop/mapreduce/*.jar,/usr/local/hadoop/share/hadoop/mapreduce/lib/*.jar,/usr/local/hadoop/share/hadoop/httpfs/*.jar,/usr/local/hadoop/share/hadoop/httpfs/lib/*.jar,/usr/local/hadoop/share/hadoop/kms/*.jar,/usr/local/hadoop/share/hadoop/kms/lib/*.jar,/usr/local/hadoop/share/hadoop/tools/*.jar,/usr/local/hadoop/share/hadoop/tools/lib/*.jar
5. 下载安装mysql JDBC驱动jar包
解压后将jar包放入sqoop/server/lib/目录下。下载地址:mysql-connector-java-x.x.x.tar.gz
博主使用的是:mysql-connector-java-5.1.40-bin.jar
6. 启动/关闭sqoop
启动sqoop前先启动hadoop
start-all.sh #启动hadoop
sqoop.sh server start #启动
sqoop.sh server stop #关闭
sqoop.sh client #进入sqoop客户端(shell界面)