#启动服务(第一关启动了第二关可以不用启动)
sh /data/workspace/myshixun/service.sh
hbase shell
create 'book','info'
put 'book',1,'info:id',01
put 'book',1,'info:name','Hamlet'
put 'book',1,'info:author','William Shakespeare'
put 'book',1,'info:price',32
put 'book',2,'info:id',02
put 'book',2,'info:name','nahan'
put 'book',2,'info:author','luxun'
put 'book',2,'info:price',27
exit
hive
create database test;
CREATE EXTERNAL TABLE test.h_book (key int,id int,name string,author string,price int)
STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
WITH SERDEPROPERTIES (
"hbase.columns.mapping" =
":key,info:id, info:name,info:author,info:price"
)
TBLPROPERTIES( "hbase.table.name" = "book",
"hbase.mapred.output.outputtable" = "book");
CREATE TABLE test.book(key int,id int,name string,author string,price int)row format delimited fields terminated by ',' stored as textfile;
insert overwrite table test.book select * from test.h_book;
exit;
mysql -uroot -p123123
create database test;
create table test.book(rowkey int(11),id int(11),name varchar(20),author varchar(20),price int(11),primary key (id));
exit
sqoop export -connect jdbc:mysql://127.0.0.1:3306/test -username root -password 123123 -table book --fields-terminated-by ',' --export-dir /opt/hive/warehouse/test.db/book
Sqoop 操作 HBase第2关:Sqoop 在HBase中导出
最新推荐文章于 2024-06-17 12:28:27 发布