玩转大数据大数据,机器学习,人工智能大数据

Sqoop2的安装和使用

2017-04-10  本文已影响1150人  玄月府的小妖在debug
  1. 解压并安装
sudo tar xvfz sqoop-1.99.6-bin-hadoop200.tar.gz 
sudo mv sqoop-1.99.6-bin-hadoop200 sqoop/
sudo chmod -R 775 sqoop/
 sudo chown -R zhonglan  sqoop/
  1. 修改环境变量
zhonglan@Master:~$ sudo vim  /etc/profile
#sqoop
export SQOOP_HOME=$HOME/sqoop
export PATH=$SQOOP_HOME/bin:$PATH
export CATALINA_BASE=$SQOOP_HOME/server
export LOGDIR=$SQOOP_HOME/logs
hadoop@Master:~$ source /etc/profile
  1. 修改sqoop的环境变量
zhonglan@Master:/$ sudo vim  /home/zhonglan/sqoop/server/conf/sqoop.properties 
#修改指向我的hadoop安装目录  
org.apache.sqoop.submission.engine.mapreduce.configuration.directory= /home/zhonglan/hadoop/etc/hadoop  
#catalina.properties 
zhonglan@Master:/$ sudo vim /home/zhonglan/sqoop/server/catalina.properties 
common.loader=/home/zhonglan/hadoop/share/hadoop/common/*.jar,/home/zhonglan/hadoop/share/hadoop/common/lib/*.jar,/home/zhonglan/hadoop/share/hadoop/hdfs/*.jar,/home/zhonglan/hadoop/share/hadoop/hdfs/lib/*.jar,/home/zhonglan/hadoop/share/hadoop/mapreduce/*.jar,/home/zhonglan/hadoop/share/hadoop/mapreduce/lib/*.jar,/home/zhonglan/hadoop/share/hadoop/tools/*.jar,/home/zhonglan/hadoop/share/hadoop/tools/lib/*.jar,/home/zhonglan/hadoop/share/hadoop/yarn/*.jar,/home/zhonglan/hadoop/share/hadoop/yarn/lib/*.jar,/home/zhonglan/hadoop/share/hadoop/httpfs/tomcat/lib/*.jar,

下载mysql驱动包,mysql-connector-java-5.1.27.jar
把jar包丢到到$SQOOP_HOME/server/lib下面

sudo cp mysql-connector-java-5.1.27.jar $SQOOP_HOME/server/lib

有时,启动sqoop时可能会遇到找不到JAVA_HOME的情况,为了保险起见我们直接在配置文件中写入JAVA_HOME
在/home/zhonglan/sqoop/bin/sqoop.sh中,添加

   export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.111-1.b15.el7_2.x86_64
  HADOOP_COMMON_HOME=/home/zhonglan/hadoop/share/hadoop/common
  HADOOP_HDFS_HOME=/home/zhonglan/hadoop/share/hadoop/hdfs
  HADOOP_MAPRED_HOME=/home/zhonglan/hadoop/share/hadoop/mapreduce
  HADOOP_YARN_HOME=/home/zhonglan/hadoop/share/hadoop/yarn
  1. 启动sqoop
    sqoop.sh server start
  2. 验证启动成功
./sqoop.sh server start    启动 
./sqoop.sh server stop     停止
./sqoop.sh client          进入客户端
set server --host hadoopMaster --port 12000 --webapp sqoop 设置服务器,注意hadoopMaster为hdfs主机名
show connector --all    查看连接类型
create link --cid 1    创建连接,cid为连接类型id
show link 查看连接
update link -l 1 修改id为1的连接
delete link -l 1 删除id为1的连接
create job -f 1 -t 2 创建从连接1到连接2的job
show job 查看job
update job -jid 1    修改job
delete job -jid 1    删除job
status job -jid 1    看看job状态
stop job -jid    1   停止job
  1. Sqoop2使用
sqoop.sh client

7.Sqoop2和Sqoop1区别

参考文档:
1.sqoo2安装
https://chu888chu888.gitbooks.io/hadoopstudy/content/Content/9/chapter0901.html
2.Sqoop1、Sqoop2功能差异及使用示例
http://udn.yyuap.com/doc/ae/921008.html#_Toc428540440

上一篇下一篇

猜你喜欢

热点阅读