Using Sqoop2 to import mysql data to HDFS

On Sqoop2 server:
MySQL JDBC Driver:
cp mysql-connector-java-5.1.33/mysql-connector-java-5.1.33-bin.jar /var/lib/sqoop2/

Oracle JDBC Driver:
cp ojdbc6.jar /var/lib/sqoop2/

Microsoft SQL Server JDBC Driver:
cp sqljdbc_4.0/enu/sqljdbc4.jar /var/lib/sqoop2/

cd /var/lib/sqoop2
chown sqoop2:sqoop2 mysql-connector-java-5.1.33-bin.jar ojdbc6.jar sqljdbc4.jar
chmod 755 mysql-connector-java-5.1.33-bin.jar ojdbc6.jar sqljdbc4.jar

restart sqoop2 service

On Sqoop2 client:
MySQL JDBC Driver:
cp mysql-connector-java-5.1.33/mysql-connector-java-5.1.33-bin.jar /var/lib/sqoop2/

Oracle JDBC Driver:
cp ojdbc6.jar /var/lib/sqoop2/

Microsoft SQL Server JDBC Driver:
cp sqljdbc_4.0/enu/sqljdbc4.jar /var/lib/sqoop2/

cd /var/lib/sqoop2
chown sqoop2:sqoop2 mysql-connector-java-5.1.33-bin.jar ojdbc6.jar sqljdbc4.jar
chmod 755 mysql-connector-java-5.1.33-bin.jar ojdbc6.jar sqljdbc4.jar

sqoop2 (you can also use HUE web UI > sqoop transfer)
sqoop:000> set server --host sqoop2-server-ip
sqoop:000> show connector --all

sqoop:000> create connection --cid 1
Creating connection for connector with id 1
Please fill following values to create new connection object
Name: mysql-conection

Connection configuration

JDBC Driver Class: com.mysql.jdbc.Driver
JDBC Connection String: jdbc:mysql://remote-mysql-server/dbname      
Username: username
Password: *******
JDBC Connection Properties:
There are currently 0 values in the map:
entry#

Security related configuration options

Max connections: 10
New connection was successfully created with validation status FINE and persistent id 1

sqoop:000> create job --xid 1 --type import
Creating job for connection with id 1
Please fill following values to create new job object
Name: export-job1

Database configuration

Schema name: dbname
Table name: tablename
Table SQL statement:
Table column names:
Partition column name:
Nulls in partition column:
Boundary query:

Output configuration

Storage type:
  0 : HDFS
Choose: 0
Output format:
  0 : TEXT_FILE
  1 : SEQUENCE_FILE
Choose: 0
Compression format:
  0 : NONE
  1 : DEFAULT
  2 : DEFLATE
  3 : GZIP
  4 : BZIP2
  5 : LZO
  6 : LZ4
  7 : SNAPPY
Choose: 0
Output directory: /user/sqoop2/output

Throttling resources

Extractors:
Loaders:
New job was successfully created with validation status FINE  and persistent id 1

sqoop:000> start job --jid 1

sqoop:000> status job --jid 1

JDBC Driver Class: com.mysql.jdbc.Driver
JDBC Connection String: jdbc:mysql://remote-mysql-server/dbname

JDBC Driver Class: com.microsoft.sqlserver.jdbc.SQLServerDriver
JDBC Connection String: jdbc:sqlserver://remote-mysql-server/dbname

JDBC Driver Class: oracle.jdbc.driver.OracleDriver
JDBC Connection String:

时间: 2024-11-05 01:02:25

Using Sqoop2 to import mysql data to HDFS的相关文章

sqoop从mysql导入到hdfs

1.mysql -- 创建数据库 create database logs; -- 使用 use logs; -- 创建表 create table weblogs(  md5 varchar(32),  url varchar(64),  request_date date,  request_time time,  ip varchar(15) ); -- 从外部文本文件加载数据 load data infile '/path/weblogs_entries.txt' into table

通过Sqoop实现Mysql / Oracle 与HDFS / Hbase互导数据

通过Sqoop实现Mysql / Oracle 与HDFS / Hbase互导数据\ 下文将重点说明通过Sqoop实现Mysql与HDFS互导数据,Mysql与Hbase,Oracle与Hbase的互导最后给出命令.一.Mysql与HDFS互导数据环境:宿主机器操作系统为Win7,Mysql安装在宿主机上,宿主机地址为192.168.66.963台虚拟机操作系统为Ubuntu-12.04.1-32位三台虚拟机已成功安装hadoop,并实现免密钥互访,配hosts为:192.168.66.91 m

mysql导入到hdfs中常见问题

mysql导入到hdfs中命令:sqoop import --connect jdbc:mysql://192.168.0.161:3306/angel --username anqi -password anqi --table test2 --fields-terminated-by '\t' -m 1 常见问题1:Warning: /opt/cloudera/parcels/CDH-5.12.0-1.cdh5.12.0.p0.29/bin/../lib/sqoop/../accumulo

Sqoop MySQL 导入到HDFS

从MySQL数据库phx中读取tree表到HDFS 执行命令: sqoop import --connect jdbc:mysql://node1:3306/phx \--username root --table tree --m 1 命令行输出: Warning: /csh/link/sqoop/../hcatalog does not exist! HCatalog jobs will fail. Please set $HCAT_HOME to the root of your HCat

MySQL Database Backup Methods Season 2 – MySQL Data Dumper

说到MySQL数据库的备份, MySQL Data Dumper(项目)也是常用的工具, 其有两个可执行程序: mydumper, 负责导出数据; myloader,  负责导入数据. mydumper相对于mysqldump, 多了些特性, 在下面分析选项的过程中能体会到. 由于是第三方工具, 先来看下安装, 及可能遇到的问题. a. mydumper需要依赖一些开发库, 使用yum安装即可. [email protected]: ~# yum install glib* zlib* pcre

php把图片存入mysql DATA库

php把图片存入mysql DATA库----在网站建设过程中,笔者与大家分享一下用php把图片存入mysqlDATA库中并在网页上显示的代码,具体如下: //保存图片到DATA库 If($Picture != "none") { $PSize = filesize($Picture); $mysqlPicture = addslashes(fread(fopen($Picture, "r"), $PSize)); mysql_connect($host,$user

Linux Centos 启动mysql ERROR * The server quit without updating PID file (/usr/local/mysql/data/mysql.pid).

做了一些尝试:比如kill -9 进程id  发现根本就杀不死. 查看ERROR.LOG 2015-12-07 18:50:08 29710 [ERROR] /usr/local/mysql/bin/mysqld: unknown variable 'scripts/mysql_install_db --user=mysql' 第一感觉:百度了下.大部分都是说安装的时候有这个问题:感觉场景不太一样:回到原点继续想: scripts/mysql_install_db --user=mysql --

更改ubuntu mysql data目录位置

更改ubuntu mysql data目录位置 很多时候,mysql的数据会非常大,数据默认放在/var/lib/mysql,由于/var所划分的空间不够大,所以我们需要将mysql数据存放路径修改一下,放到大分区里面,以便可以应付mysql数据增长. 1.设置新的存放路径 mkdir -p /data/mysql 2.复制原有数据 cp -R /var/lib/mysql/* /data/mysql 3.修改权限 chown -R mysql:mysql /data/mysql 4.修改配置文

Linux安装MySql.Data for mono

wget http://dev.mysql.com/get/Downloads/Connector-Net/mysql-connector-net-6.8.3-noinstall.zipunzip mysql-connector-net-6.8.3-noinstall.zip # Rename Files to Linux$ mv v2.0/mysql.data.cf.dll v2.0/MySql.Data.CF.dll$ mv v2.0/mysql.data.dll v2.0/MySql.Da