flume入门基础
- 在flume的conf目录下创建 example.conf,内容如下
# example.conf: A single-node Flume configuration # Name the components on this agent a1.sources = r1 a1.sinks = k1 a1.channels = c1 # Describe/configure the source # Flume提供了各种source的实现,包括Avro Source、 Exce Source、 Spooling Directory Source、 NetCat Source、 Syslog Source、 Syslog TCP Source、Syslog UDP Source、 HTTP Source、 HDFS Source, etc a1.sources.r1.type = netcat a1.sources.r1.bind = localhost a1.sources.r1.port = 44444 # Describe the sink # 包括HDFS sink、 Logger sink、 Avro sink、 File Roll sink、 Null sink、 HBasesink, etc a1.sinks.k1.type = logger # Use a channel which buffers events in memory # Flume对于Channel,则提供了Memory Channel、 JDBC Chanel、 File Channel,etc a1.channels.c1.type = memory a1.channels.c1.capacity = 1000 a1.channels.c1.transactionCapacity = 100 # Bind the source and sink to the channel a1.sources.r1.channels = c1 a1.sinks.k1.channel = c1
2. 用cmd进入到flume的bin目录下,运行
flume-ng.cmd agent -conf ../conf -conf-file ../conf/example.conf -name a1 -property flume.root.logger=INFO,console
3、 另起一个cmd窗口:输入
telent 127.0.0.1 44444
进入到可编辑窗口,在窗口里面输入内容即可在flume启动的窗口中看到内容了