目录

一.下载sqoop

二.安装

三.验证


一.下载sqoop

官网如下:

http://archive.apache.org/dist/sqoop/

可以选择要的版本!但后面一定要是.tar.gz

我用的是sqoop-1.4.6.bin__hadoop-2.0.4-alpha.tar.gz。

二.安装

1. 解压安装(在sqoop的目录下)

 tar -zvxf sqoop-1.4.6.bin__hadoop-2.0.4-alpha.tar.gz -C /training/

我的软件放在/training文件夹下。

2.配置环境变量

vi ~/.bash_profile

 加入

#sqoop
export SQOOP_HOME=/training/sqoop-1.4.6.bin__hadoop-2.0.4-alpha
export PATH=$PATH:$SQOOP_HOME/bin

环境变量生效

source ~/.bash_profile

3.mysql java connector 复制到sqoop的lib目录下

cp mysql-connector-java-5.1.27-bin.jar /training/sqoop-1.                                                                            4.6.bin__hadoop-2.0.4-alpha/lib/

mysql-connector-java-5.1.27-bin.jar可以在我的百度网盘下载

链接:https://pan.baidu.com/s/1uQTVMzg8E5QULQTAoppdcQ 
提取码:58c5

 4.配置

1.在sqoop的conf文件夹下打开sqoop-env.sh

加入以下内容(前提:安装了hadoop,hive,hbase,zookeeper!!!没有安装的可以看我的博客)

export HADOOP_COMMON_HOME=/training/hadoop-2.7.3
export HADOOP_MAPRED_HOME=/training/hadoop-2.7.3
export HBASE_HOME=/training/hbase-2.0.3
export HIVE_HOME=/training/apache-hive-3.1.2-bin
export ZOOCFGDIR=/training/zookeeper-3.4.5

2.在sqoop的conf文件夹下用vi新建sqoop-site.xml

加入以下内容

<configuration>
<property>
    <name>sqoop.metastore.client.autoconnect.username</name>
    <value>SA</value>
    <description>The username to bind to the metastore.
    </description>
  </property>
<property>
    <name>sqoop.metastore.client.autoconnect.password</name>
    <value></value>
    <description>The password to bind to the metastore.
    </description>
  </property>
<property>
    <name>sqoop.metastore.client.record.password</name>
    <value>true</value>
    <description>If true, allow saved passwords in the metastore.
    </description>
  </property>
<property>
    <name>sqoop.metastore.server.location</name>
    <value>/tmp/sqoop-metastore/shared.db</value>
    <description>Path to the shared metastore database files.
    If this is not set, it will be placed in ~/.sqoop/.
    </description>
  </property>
<property>
    <name>sqoop.metastore.server.port</name>
    <value>16000</value>
    <description>Port that this metastore should listen on.
    </description>
  </property>
<property>
    <name>sqoop.metastore.client.enable.autoconnect</name>
    <value>true</value>
    <description>If true, Sqoop will connect to a local metastore
      for job management when no other metastore arguments are
      provided.
    </description>
  </property>
<property>
    <name>sqoop.metastore.client.autoconnect.url</name>
    <value>jdbc:hsqldb:file:/tmp/sqoop-meta/meta.db;shutdown=true</value>
    <description>The connect string to use when connecting to a
      job-management metastore. If unspecified, uses ~/.sqoop/.
      You can specify a different path here.
    </description>
  </property>
</configuration>

三.验证

在sqoop的lib目录下输入

./sqoop help

会看到以下内容则表示安装成功!!

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐