一、准备工作
- 预先安装Hadoop(伪分布即可),可参考Hadoop2.7.3环境搭建之伪分布式
- 预先下载sqoop编译后安装包
- 下载地址
- 下载的版本:sqoop-1.4.7.bin__hadoop-2.6.0.tar.gz
二、安装配置
-
解压安装
tar -zvxf sqoop-1.4.7.bin__hadoop-2.6.0.tar.gz -C /training/
-
配置环境变量
执行:vi ~/.bash_profile
添加如下内容:#sqoop export SQOOP_HOME=/training/sqoop-1.4.7.bin__hadoop-2.6.0 export PATH=$PATH:$SQOOP_HOME/bin
-
配置sqoop文件
-
配置【configure-sqoop】
执行:vi /training/sqoop-1.4.7.bin__hadoop-2.6.0/bin/configure-sqoop
在打开的文件中,将HCAT_HOME和ACCUMULO_HOME相关部分内容注释掉 -
配置【sqoop-site.xml】
执行:vi /training/sqoop-1.4.7.bin__hadoop-2.6.0/conf/sqoop-site.xml
,配置内容如下:<?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> <configuration> <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> <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> </configuration>
-
配置【sqoop-env.sh】
执行:vi sqoop-env.sh
,添加如下内容:#Set path to where bin/hadoop is available export HADOOP_COMMON_HOME=/training/hadoop-2.7.3 #Set path to where hadoop-*-core.jar is available export HADOOP_MAPRED_HOME=/training/hadoop-2.7.3 #set the path to where bin/hbase is available export HBASE_HOME=/training/hbase-1.3.1 #Set the path to where bin/hive is available export HIVE_HOME=/training/apache-hive-2.3.3-bin #Set the path for where zookeper config dir is export ZOOCFGDIR=/training/zookeeper-3.4.5
-
-
将MySQL数据库的驱动(使用5.x版本,不要使用高版本的)需上传到sqoop安装目录下的lib目录下
下载地址 -
由于sqoop缺少java-json.jar包进行解析json,需上传到sqoop安装目录下的lib目录下
下载地址
提取码:hkmv
三、验证
- 命令行中,输入:
sqoop version
,看到如下即为安装成功: