Sqoop是一个用来完成Hadoop和关系型数据库中的数据相互转移的工具,它可以将关系型数据库中的数据导入到Hadoop的HDFS中,也可以将HDFS的数据导入到关系型数据库中。

  Kafka是一个开源的分布式消息订阅系统

  一、Sqoop的安装

  1.http://www-eu.apache.org/dist/sqoop/1.4.7/下载sqoop-1.4.7.bin__hadoop-2.6.0.tar.gz并解压到/home/jun下

  1. [jun@master sqoop-1.4..bin__hadoop-2.6.]$ ls -l
  2. total
  3. drwxr-xr-x. jun jun Dec bin
  4. -rw-rw-r--. jun jun Dec build.xml
  5. -rw-rw-r--. jun jun Dec CHANGELOG.txt
  6. -rw-rw-r--. jun jun Dec COMPILING.txt
  7. drwxr-xr-x. jun jun Dec conf
  8. drwxr-xr-x. jun jun Dec docs
  9. drwxr-xr-x. jun jun Dec ivy
  10. -rw-rw-r--. jun jun Dec ivy.xml
  11. drwxr-xr-x. jun jun Dec lib
  12. -rw-rw-r--. jun jun Dec LICENSE.txt
  13. -rw-rw-r--. jun jun Dec NOTICE.txt
  14. -rw-rw-r--. jun jun Dec pom-old.xml
  15. -rw-rw-r--. jun jun Dec README.txt
  16. -rw-rw-r--. jun jun Dec sqoop-1.4..jar
  17. -rw-rw-r--. jun jun Dec sqoop-patch-review.py
  18. -rw-rw-r--. jun jun Dec sqoop-test-1.4..jar
  19. drwxr-xr-x. jun jun Dec src
  20. drwxr-xr-x. jun jun Dec testdata

  2.配置MySQL连接器

  1. [jun@master sqoop-1.4..bin__hadoop-2.6.]$ cp /home/jun/Resources/mysql-connector-java-5.1./mysql-connector-java-5.1..jar /home/jun/sqoop-1.4..bin__hadoop-2.6./lib/

  3.配置Sqoop环境变量

  编辑配置文件

  1. [jun@master lib]$ cd /home/jun/sqoop-1.4..bin__hadoop-2.6./conf/
  2. [jun@master conf]$ ls
  3. oraoop-site-template.xml sqoop-env-template.cmd sqoop-env-template.sh sqoop-site-template.xml sqoop-site.xml
  4. [jun@master conf]$ cp sqoop-env-template.sh sqoop-env.sh
  5. [jun@master conf]$ gedit sqoop-env.sh

  增加下面的配置

  1. #Set path to where bin/hadoop is available
  2. export HADOOP_COMMON_HOME=/home/jun/hadoop
  3.  
  4. #Set path to where hadoop-*-core.jar is available
  5. export HADOOP_MAPRED_HOME=/home/jun/hadoop
  6.  
  7. #set the path to where bin/hbase is available
  8. export HBASE_HOME=/home/jun/hbase-1.2.6.1
  9.  
  10. #Set the path to where bin/hive is available
  11. export HIVE_HOME=/home/jun/apache-hive-2.3.-bin
  12.  
  13. #Set the path for where zookeper config dir is
  14. export ZOOCFGDIR=/usr/local/zk

  4.配置linux环境变量

  1. #sqoop
  2. export SQOOP_HOME=/home/jun/sqoop-1.4..bin__hadoop-2.6.
  3. export PATH=$PATH:$SQOOP_HOME/bin

  5.启动Sqoop,如果出现下面的内容就说明安装成功

  1. [jun@master ~]$ sqoop-help
  2. Warning: /home/jun/sqoop-1.4..bin__hadoop-2.6./../hcatalog does not exist! HCatalog jobs will fail.
  3. Please set $HCAT_HOME to the root of your HCatalog installation.
  4. Warning: /home/jun/sqoop-1.4..bin__hadoop-2.6./../accumulo does not exist! Accumulo imports will fail.
  5. Please set $ACCUMULO_HOME to the root of your Accumulo installation.
  6. Warning: /home/jun/sqoop-1.4..bin__hadoop-2.6./../zookeeper does not exist! Accumulo imports will fail.
  7. Please set $ZOOKEEPER_HOME to the root of your Zookeeper installation.
  8. // :: INFO sqoop.Sqoop: Running Sqoop version: 1.4.
  9. SLF4J: Class path contains multiple SLF4J bindings.
  10. SLF4J: Found binding in [jar:file:/home/jun/hadoop/share/hadoop/common/lib/slf4j-log4j12-1.7..jar!/org/slf4j/impl/StaticLoggerBinder.class]
  11. SLF4J: Found binding in [jar:file:/home/jun/hbase-1.2.6.1/lib/slf4j-log4j12-1.7..jar!/org/slf4j/impl/StaticLoggerBinder.class]
  12. SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
  13. SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
  14. usage: sqoop COMMAND [ARGS]
  15.  
  16. Available commands:
  17. codegen Generate code to interact with database records
  18. create-hive-table Import a table definition into Hive
  19. eval Evaluate a SQL statement and display the results
  20. export Export an HDFS directory to a database table
  21. help List available commands
  22. import Import a table from a database to HDFS
  23. import-all-tables Import tables from a database to HDFS
  24. import-mainframe Import datasets from a mainframe server to HDFS
  25. job Work with saved jobs
  26. list-databases List available databases on a server
  27. list-tables List available tables in a database
  28. merge Merge results of incremental imports
  29. metastore Run a standalone Sqoop metastore
  30. version Display version information
  31.  
  32. See 'sqoop help COMMAND' for information on a specific command.

  6.测试与MySQL的连接

  (1)列出MySQL的所有数据库

  1. [jun@master ~]$ sqoop-list-databases --connect jdbc:mysql://localhost:3306 --username root -P
  2. Warning: /home/jun/sqoop-1.4..bin__hadoop-2.6./../hcatalog does not exist! HCatalog jobs will fail.
  3. Please set $HCAT_HOME to the root of your HCatalog installation.
  4. Warning: /home/jun/sqoop-1.4..bin__hadoop-2.6./../accumulo does not exist! Accumulo imports will fail.
  5. Please set $ACCUMULO_HOME to the root of your Accumulo installation.
  6. Warning: /home/jun/sqoop-1.4..bin__hadoop-2.6./../zookeeper does not exist! Accumulo imports will fail.
  7. Please set $ZOOKEEPER_HOME to the root of your Zookeeper installation.
  8. // :: INFO sqoop.Sqoop: Running Sqoop version: 1.4.
  9. SLF4J: Class path contains multiple SLF4J bindings.
  10. SLF4J: Found binding in [jar:file:/home/jun/hadoop/share/hadoop/common/lib/slf4j-log4j12-1.7..jar!/org/slf4j/impl/StaticLoggerBinder.class]
  11. SLF4J: Found binding in [jar:file:/home/jun/hbase-1.2.6.1/lib/slf4j-log4j12-1.7..jar!/org/slf4j/impl/StaticLoggerBinder.class]
  12. SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
  13. SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
  14. Enter password:
  15. // :: INFO manager.MySQLManager: Preparing to use a MySQL streaming resultset.
  16. Mon Jul :: CST WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
  17. information_schema
  18. hive_db
  19. mysql
  20. performance_schema
  21. sys

  (2)列出数据库下的所有数据表

  1. [jun@master ~]$ sqoop-list-tables --connect jdbc:mysql://localhost:3306/mysql --username root -P
  2. Warning: /home/jun/sqoop-1.4..bin__hadoop-2.6./../hcatalog does not exist! HCatalog jobs will fail.
  3. Please set $HCAT_HOME to the root of your HCatalog installation.
  4. Warning: /home/jun/sqoop-1.4..bin__hadoop-2.6./../accumulo does not exist! Accumulo imports will fail.
  5. Please set $ACCUMULO_HOME to the root of your Accumulo installation.
  6. Warning: /home/jun/sqoop-1.4..bin__hadoop-2.6./../zookeeper does not exist! Accumulo imports will fail.
  7. Please set $ZOOKEEPER_HOME to the root of your Zookeeper installation.
  8. // :: INFO sqoop.Sqoop: Running Sqoop version: 1.4.
  9. SLF4J: Class path contains multiple SLF4J bindings.
  10. SLF4J: Found binding in [jar:file:/home/jun/hadoop/share/hadoop/common/lib/slf4j-log4j12-1.7..jar!/org/slf4j/impl/StaticLoggerBinder.class]
  11. SLF4J: Found binding in [jar:file:/home/jun/hbase-1.2.6.1/lib/slf4j-log4j12-1.7..jar!/org/slf4j/impl/StaticLoggerBinder.class]
  12. SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
  13. SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
  14. Enter password:
  15. // :: INFO manager.MySQLManager: Preparing to use a MySQL streaming resultset.
  16. Mon Jul :: CST WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
  17. columns_priv
  18. db
  19. engine_cost
  20. event
  21. func
  22. general_log
  23. gtid_executed
  24. help_category
  25. help_keyword
  26. help_relation
  27. help_topic
  28. innodb_index_stats
  29. innodb_table_stats
  30. ndb_binlog_index
  31. plugin
  32. proc
  33. procs_priv
  34. proxies_priv
  35. server_cost
  36. servers
  37. slave_master_info
  38. slave_relay_log_info
  39. slave_worker_info
  40. slow_log
  41. tables_priv
  42. time_zone
  43. time_zone_leap_second
  44. time_zone_name
  45. time_zone_transition
  46. time_zone_transition_type
  47. user

  (3)执行MySQL的查询语句

  1. [jun@master ~]$ sqoop-eval --connect jdbc:mysql://localhost:3306/mysql --username root -P --query "select * from plugin"
  2. Warning: /home/jun/sqoop-1.4..bin__hadoop-2.6./../hcatalog does not exist! HCatalog jobs will fail.
  3. Please set $HCAT_HOME to the root of your HCatalog installation.
  4. Warning: /home/jun/sqoop-1.4..bin__hadoop-2.6./../accumulo does not exist! Accumulo imports will fail.
  5. Please set $ACCUMULO_HOME to the root of your Accumulo installation.
  6. Warning: /home/jun/sqoop-1.4..bin__hadoop-2.6./../zookeeper does not exist! Accumulo imports will fail.
  7. Please set $ZOOKEEPER_HOME to the root of your Zookeeper installation.
  8. // :: INFO sqoop.Sqoop: Running Sqoop version: 1.4.
  9. SLF4J: Class path contains multiple SLF4J bindings.
  10. SLF4J: Found binding in [jar:file:/home/jun/hadoop/share/hadoop/common/lib/slf4j-log4j12-1.7..jar!/org/slf4j/impl/StaticLoggerBinder.class]
  11. SLF4J: Found binding in [jar:file:/home/jun/hbase-1.2.6.1/lib/slf4j-log4j12-1.7..jar!/org/slf4j/impl/StaticLoggerBinder.class]
  12. SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
  13. SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
  14. Enter password:
  15. // :: INFO manager.MySQLManager: Preparing to use a MySQL streaming resultset.
  16. Mon Jul :: CST WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
  17. -----------------------------------------------
  18. | name | dl |
  19. -----------------------------------------------
  20. | validate_password | validate_password.so |
  21. -----------------------------------------------

Sqoop的安装和验证的更多相关文章

  1. 【sqoop】安装配置测试sqoop1

    3.1.1 下载sqoop1:sqoop-1.4.7.bin__hadoop-2.6.0.tar.gz 3.1.2 解压并查看目录: [hadoop@hadoop01 ~]$ tar -zxvf sq ...

  2. Hadoop 2.6.0-cdh5.4.0集群环境搭建和Apache-Hive、Sqoop的安装

    搭建此环境主要用来hadoop的学习,因此我们的操作直接在root用户下,不涉及HA. Software: Hadoop 2.6.0-cdh5.4.0 Apache-hive-2.1.0-bin Sq ...

  3. sqoop的安装

    Sqoop是一个用来完成Hadoop和关系型数据库中的数据相互转移的工具, 他可以将关系型数据库(MySql,Oracle,Postgres等)中的数据导入Hadoop的HDFS中, 也可以将HDFS ...

  4. Hive/Hbase/Sqoop的安装教程

    Hive/Hbase/Sqoop的安装教程 HIVE INSTALL 1.下载安装包:https://mirrors.tuna.tsinghua.edu.cn/apache/hive/hive-2.3 ...

  5. Sqoop的安装及简单使用

    SQOOP是用于对数据进行导入导出的. (1)把MySQL.Oracle等数据库中的数据导入到HDFS.Hive.HBase中   (2)把HDFS.Hive.HBase中的数据导出到MySQL.Or ...

  6. Sqoop的安装配置及使用

    一.Sqoop基础:连接关系型数据库与Hadoop的桥梁 1.1 Sqoop的基本概念 Hadoop正成为企业用于大数据分析的最热门选择,但想将你的数据移植过去并不容易.Apache Sqoop正在加 ...

  7. Sqoop环境安装

    环境下载 首先将下载的 sqoop-1.4.6.bin__hadoop-2.0.4-alpha.tar.gz放到 /usr/hadoop/目录下(该目录可以自定义,一般为Hadoop集群安装目录),然 ...

  8. 大数据之路week07--day06 (Sqoop 的安装及配置)

    Sqoop 的安装配置比较简单. 提供安装需要的安装包和连接mysql的驱动的百度云链接: 链接:https://pan.baidu.com/s/1pdFj0u2lZVFasgoSyhz-yQ 提取码 ...

  9. Python下载安装及验证

      目录: 一.Python介绍 二.python安装及验证 一.Python介绍 Python是著名的“龟叔”Guido van Rossum在1989年圣诞节期间,为了打发无聊的圣诞节而编写的一个 ...

随机推荐

  1. 从 Int 到 Integer 对象,细细品来还是有不少东西

    int 是 Java 八大原始类型之一,是 Java 语言中为数不多不是对象的东西,Integer 是 int 的包装类,里面使用了一个 int 类型的变量来存储数据,提供了一些整数之间的常用操作,常 ...

  2. js---电商中常见的放大镜效果

    js中的放大镜效果 在电商中,放大镜效果是很常见的,如下图所示: 当鼠标悬浮时,遮罩所在区域在右侧进行放大. 在动手写之前,我们要先理清思路,分析需求,所需知识点,再将每一块进行组装,最后进行功能的完 ...

  3. JVM 调优 - jstat

    Java命令学习系列(四)——jstat 2015-07-31 分类:Java 阅读(11041) 评论(1) 阿里大牛珍藏架构资料,点击链接免费获取 jstat(JVM Statistics Mon ...

  4. Spring MVC-从零开始-@RequestMapping 注解method属性

    1.@RequestMapping 处理 HTTP 的各种方法(GET, PUT, POST, DELETE  PATCH) package com.jt; import org.springfram ...

  5. Java 代理模式 (二) 动态代理

    代理模式 代理(Proxy)是一种设计模式, 提供了对目标对象另外的访问方式:即通过代理访问目标对象. 这样好处: 可以在目标对象实现的基础上,增强额外的功能操作.(扩展目标对象的功能). 代理模式的 ...

  6. WebGL简易教程(七):绘制一个矩形体

    目录 1. 概述 2. 示例 2.1. 顶点索引绘制 2.2. MVP矩阵设置 2.2.1. 模型矩阵 2.2.2. 投影矩阵 2.2.3. 视图矩阵 2.2.4. MVP矩阵 3. 结果 4. 参考 ...

  7. 夯实Java基础系列17:一文搞懂Java多线程使用方式、实现原理以及常见面试题

    本系列文章将整理到我在GitHub上的<Java面试指南>仓库,更多精彩内容请到我的仓库里查看 https://github.com/h2pl/Java-Tutorial 喜欢的话麻烦点下 ...

  8. Thinkphp5.0终章

    thinkphp5.0最终总结 前期刚开始我是跟着b站上的千峰教育的视频走的,一路上做笔记进行深化与实际操作,中间因为不会开报错,并且视频里面也没有讲到怎么弄报错,因为是新手,那种出错了却不知道错在哪 ...

  9. Nginx开启Gzip压缩提升页面加载速度

    1.在 nginx 的conf 目录下新建 gzip.conf 文件 #开启gzip压缩 gzip on; #设置允许压缩的页面最小字节数 gzip_min_length 1k; #申请4个单位为16 ...

  10. eclipse中Tomcat version 9.0 only supports J2EE 1.2, 1.3, 1.4, and Java EE 5, 6, 7, and 8 Web modules

    eclipse中导入了一个别人的项目,运行时提示没有可以使用的服务器,如下: 查看了下项目属性设置中的服务器,还是提示没有可用服务器: 尝试对部署在已有服务器下的项目Add and Remove... ...