1. 设置环境变量
Vim /etc/profile
export SQOOP_HOME=/opt/hadoop/packages/sqoop-1.99.7
export PATH=$SQOOP_HOME/bin:$PATH
export CATALINE_BASE=$SQOOP_HOME/server
export LOGDIR=$SQOOP_HOME/logs
使环境变量生效:source/etc/profile
2. 安装sqoop
解压: tar -zvxf sqoop-1.99.7-bin-hadoop200.tar.gz
改名: mv sqoop-1.99.7-bin-hadoop200.tar.gz sqoop-1.99.7
1. 配置参数文件(hadoop):
① Vim /opt/hadoop/packages/hadoop-2.6.0/etc/hadoop/container-executor.cfg
allowed.system.users=root //运行sqoop的用户名
② vim core-site.xml
<property>
<name>hadoop.proxyuser.root.hosts</name>
<value>*</value>
</property>
<property>
<name>hadoop.proxyuser.root.groups</name>
<value>*</value>
</property>
2. 配置服务器(sqoop)
☆ Vim conf/sqoop.properties
org.apache.sqoop.submission.engine.mapreduce.configuration.directory=/opt/hadoop/packages/hadoop-2.6.0/etc/hadoop
org.apache.sqoop.security.authentication.type=SIMPLE
org.apache.sqoop.security.authentication.handler=org.apache.sqoop.security.authentication.SimpleAuthenticationHandler
org.apache.sqoop.security.authentication.anonymous=true
☆mkdir server/conf 没有的话自己创建
find / -name hadoop //寻找hadoop的jar包
vim /server/conf/catalina.properties //将hadoop的jar的位置加到sqoop 中
common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar,${catalina.home}/../lib/*.jar,/opt/hadoop/packages/hadoop-2.6.0/share/doc/hadoop,/opt/hadoop/packages/hadoop-2.6.0/share/hadoop,/opt/hadoop/packages/hadoop-2.6.0/share/hadoop/httpfs/tomcat/webapps/webhdfs/WEB-INF/classes/org/apache/hadoop,/opt/hadoop/packages/hadoop-2.6.0/share/hadoop/httpfs/tomcat/webapps/webhdfs/WEB-INF/classes/org/apache/hadoop/lib/service/hadoop,/opt/hadoop/packages/hadoop-2.6.0/etc/hadoop,/opt/hadoop/packages/hadoop-2.6.0/bin/hadoop
☆vim ./ .sqoop2rc
# Configure our Sqoop 2 serverautomatically
set server --host slave2.server //设置为server服务的主机名
# Run in verbose mode by default
set option --name verbose --value true
3. 配置客户端
sqoop2客户端具有类似于其他命令行工具加载资源文件的能力,在执行开始时,Sqoop客户端将检查当前记录的用户的主目录中是否存在文件.sqoop2rc。如果此类文件存在,sqoop2客户端启动的时候将会被加载和解释,他可以用于执行任何批处理兼容命令
4. 配置第三方jar
创建目录:mkdir /opt/hadoop/packages/sqoop-1.99.7/extra
mkdir/opt/hadoop/packages/sqoop-1.99.7/logs
将mysql的jar包复制在该目录下:
cp mysql-connector-Java-5.1.41-bin.jar /opt/hadoop/packages/sqoop-1.99.7/extra
配置环境变量:
export SQOOP_SERVER_EXTRA_LIB=$SQOOP_HOME/extra
5. 验证是否有效(sqoop)
bin/sqoop2-tool verify
3. 启动
sqoop2-server start
Sqoop2-shell