56gt 发表于 2019-1-30 09:15:03

Flume 入门--几种不同的Sinks

m3:  
                编写配置文件:
  
                  #命名Agent组件
  
                  a1.sources=r1
  
                  a1.sinks=k1
  
                  a1.channels=c1
  
                  #描述/配置Source
  
                  a1.sources.r1.type=avro
  
                  a1.sources.r1.bind=0.0.0.0
  
                  a1.sources.r1.port=4141
  
                  #描述Sink
  
                  a1.sinks.k1.type=logger
  
                  #描述内存Channel
  
                  a1.channels.c1.type=memory
  
                  a1.channels.c1.capacity=1000
  
                  a1.channels.c1.transactionCapacity=1000
  
                  #为Channel绑定Source和Sink
  
                  a1.sources.r1.channels=c1
  
                  a1.sinks.k1.channel=c1
  
                启动flume:
  
                  ./flume-ng agent --conf ../conf --conf-file ../conf/template.conf --name a1 -Dflume.root.logger=INFO,console
  

  
            m1、m2:
  
                编写配置文件:
  
                  #命名Agent组件
  
                  a1.sources=r1
  
                  a1.sinks=k1
  
                  a1.channels=c1
  

  
                  #描述/配置Source
  
                  a1.sources.r1.type=http
  
                  a1.sources.r1.port=8888
  
                  #描述Sink
  
                  a1.sinks.k1.type=avro
  
                  a1.sinks.k1.hostname=192.168.242.135
  
                  a1.sinks.k1.port=4141
  
                  #描述内存Channel
  
                  a1.channels.c1.type=memory
  
                  a1.channels.c1.capacity=1000
  
                  a1.channels.c1.transactionCapacity=1000
  
                  #为Channel绑定Source和Sink
  
                  a1.sources.r1.channels=c1
  
                  a1.sinks.k1.channel=c1
  
                启动flume:
  
                  ./flume-ng agent --conf ../conf --conf-file ../conf/template9.conf --name a1 -Dflume.root.logger=INFO,console
  
                m1通过curl发送一条http请求,由于默认使用的是jsonHandler,数据格式必须是指定的json格式:
  
                  # curl -X POST -d '[{ "headers" :{"flag" : "c"},"body" : "idoall.org_body"}]' http://0.0.0.0:8888
  
                m2通过curl发送一条http请求,由于默认使用的是jsonHandler,数据格式必须是指定的json格式:
  
                  # curl -X POST -d '[{ "headers" :{"flag" : "c"},"body" : "idoall.org_body"}]' http://0.0.0.0:8888
  
                发现m3均能正确收到消息


页: [1]
查看完整版本: Flume 入门--几种不同的Sinks