Home > Database > Mysql Tutorial > Sqoop安装及验证_MySQL

Sqoop安装及验证_MySQL

WBOY
Release: 2016-05-31 08:48:51
Original
1370 people have browsed it

Sqoop安装及验证环境:

系统

Red Hatlinux 6.4

Hadoop版本

1.2.1

Sqoop版本

1.4.4

Mysql数据库版本

5.6.15

通过Sqoop实现Mysql /Oracle与HDFS / Hbase互导数据http://www.linuxidc.com/Linux/2013-06/85817.htm

[Hadoop] Sqoop安装过程详解http://www.linuxidc.com/Linux/2013-05/84082.htm

用Sqoop进行MySQL和HDFS系统间的数据互导http://www.linuxidc.com/Linux/2013-04/83447.htm

Hadoop Oozie学习笔记 Oozie不支持Sqoop问题解决http://www.linuxidc.com/Linux/2012-08/67027.htm

Hadoop生态系统搭建(hadoop hive hbase zookeeper oozie Sqoop)http://www.linuxidc.com/Linux/2012-03/55721.htm

Hadoop学习全程记录——使用Sqoop将MySQL中数据导入到Hive中http://www.linuxidc.com/Linux/2012-01/51993.htm

获取sqoop:http://sqoop.apache.org/

Step1. 下载sqoop及mysqlconnector并解压

Step2. 将解压后的connector中的jar包拷贝到sqoop的lib目录下

修改bin目录下 configure-sqoop 文件:

注释掉hbase和 zookeeper检查,因为目前还没有启用hbase/zookeeper等hadoop上的组件

Step3. 设置环境变量

注意重新连接使环境变量生效!

Sqoop:

Hadoop_home:

测试运行下sqoop:

可以使用help命令查看帮助:

Step4. 测试mysql导入HDFS:

创建一张测试表并插入数据:

利用sqoop将测试表导入到hdfs:

注意:可以用sqoop help import 查看帮助信息

登陆mysql创建用户,授予从任何ip登陆mysql权限

这里创建用户sqoopuser

GRANT ALL PRIVILEGES ON *.* TO 'sqoopuser'@'%' IDENTIFIED BY 'sqoopuser' WITH GRANT OPTION;

查看数据库列表:

sqoop list-databases --connect jdbc:mysql://10.55.15.89:3306/ --username sqoopuser --P

执行导入命令将sqoop_test表导入到hdfs:

sqoop import --connect jdbc:mysql://10.55.15.89:3306/sqoop_db --username sqoopuser --P --table sqoop_test -m 1

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template