AsyncHBaseSink
在hbase中创建表 t1 列族 f1
hbase(main):006:0> create 't1','f1'
0 row(s) in 1.2980 seconds
=> Hbase::Table - t1
hbase(main):007:0> list
TABLE
t1
1 row(s) in 0.0150 seconds
=> ["t1"]
hbase(main):008:0> scan 't1'
ROW COLUMN+CELL
0 row(s) in 0.1150 seconds
在/flume/conf/中配置文件
asynchbase-s.conf
#comonents
a1.sources = r1
a1.sinks = k1
a1.channels = c1
#source
a1.sources.r1.type = netcat
a1.sources.r1.bind = 0.0.0.0
a1.sources.r1.port = 8888
#sink
a1.sinks = k1
a1.sinks.k1.type = asynchbase
a1.sinks.k1.table = t1
a1.sinks.k1.columnFamily = f1
a1.sinks.k1.serializer = org.apache.flume.sink.hbase.SimpleAsyncHbaseEventSerializer
#channel
a1.channels.c1.type=memory
#bind
a1.sources.r1.channels=c1
a1.sinks.k1.channel=c1
执行操作在/flume/conf/目录中
flume-ng agent --conf-file asynchbase-s.conf --name a1
查看hbase中的表:
hbase(main):009:0> scan 't1'
ROW COLUMN+CELL
default593daa00-b746-4c1b-9e79-3989bcc column=f1:pCol, timestamp=1531021696153, value=tiananmen
73f7d
defaultb0fbdf9e-58b6-40a7-bd5c-c278f3b column=f1:pCol, timestamp=1531021680167, value=helloworld
c36dc
defaultb2abfdb7-93ef-4225-a3da-7a7b533 column=f1:pCol, timestamp=1531021688156, value=beijing
aaf48
defaultf5e1f10b-1d13-4d0e-9d43-524c406 column=f1:pCol, timestamp=1531021688151, value=jiayou
eb194
incRow column=f1:iCol, timestamp=1531021696153, value=\x00\x00\x00\x00\x00\x00\x00\x04
5 row(s) in 0.0600 seconds