a1.sources = r1
a1.sinks = s1
a1.channels = c1
a1.sources.r1.type = netcat
a1.sources.r1.bind = localhost
a1.sources.r1.port = 44444
a1.sinks.s1.type = hive
a1.sinks.s1.type.hive.metastore=thrift://master:9083
a1.sinks.s1.type.hive.datebase=bd14
a1.sinks.s1.type.hive.table=flume_user
a1.sinks.s1.serializer=DELIMITED
a1.sinks.s1.serializer.delimiter="\t"
a1.sinks.s1.serializer.serdeSeparator=‘\t‘
a1.sinks.s1.serializer.fieldnames=user_id,user_name,age
a1.channels.c1.type = memory
a1.channels.c1.capacity = 1000
a1.channels.c1.transactionCapacity = 100
a1.sources.r1.channels = c1
a1.sink.s1.channel = c1
保存
运行flume-ng agent -c conf -f netcat_to_hive_user.conf --name a1
hive目录-->hcatalogatalog/下面的架包拷贝到flume的lib里面
在hive中
创建一张hive表 表名是flume_user,字段是user_id,user_name,age
create table flume_user(
user_id int
,user_name string
,age int
)
clustered by (user_id) into 2 buckets
stored as orc
tableproperties("transactional"=‘true‘)
set hive.support.concurrency=true
set hive.txn.manager=org.apache.hadoop.hive.ql.lockmgr.DbTxnManager;
select * from flume_user
打开一个连接 到服务器然后输入 :
telnet localhost 44444
然后输入 对应字符
1 tab键 王五 tab键 15 tab键