04 使用Sqoop将mysql数据导入hbase

2020-06-30  本文已影响0人  张力的程序园

本节演示使用Sqoop将mysql数据导入hbase。

1、前提约束

2、操作步骤

(1)mysql数据导入hbase

mysql -uroot -pzhangli
create database test;
use test;
create table t_info(id int,name varchar(20),age int);
insert into t_info(id,name,age) values(1,'ali',20);
insert into t_info(id,name,age) values(2,'xiaoli',3);
exit;
cd /root/hbase-1.2.6/bin
./hbase
create 't1','f1'
exit
cd /root/hbase-1.2.6
./sqoop import --connect jdbc:mysql://localhost:3306/test --username root --password zhangli --table t_user --hbase-table t1 --column-family f1 --hbase-create-table --hbase-row-key id

如此,就完成了把mysql导入了hbase。

上一篇 下一篇

猜你喜欢

热点阅读