flume-ng 多节点集群示例



假设:现有两台机子,命名为:agent,collect。
agent IP地址为:192.168.150.137,
collect为192.168.150.135
要求:实现agent到collect的连接,并能向collect发送日志。
步骤:
  • 两台电脑上分别装上 jdk,flume-ng(不是flume-og),配置好profile。
  • agent的处理
      (1)找到flume-ng安装目录下的conf文件夹,新建test.conf



    #name the  components on this agent
    a1.sources  = r1
    a1.sinks =  k1
    a1.channels  = c1
   #  Describe/configure the source
    a1.sources.r1.type  = netcat //这里的数据源设置成netcat,后面将通过telnet传送信息
    a1.sources.r1.bind  = 0.0.0.0 //建议  
    a1.sources.r1.port  = 44444
    # Describe  the sink
    a1.sinks.k1.type  =avro
    a1.sinks.k1.hostname=192.168.150.135  //collect 的IP地址,注意
    a1.sinks.k1.port=60000 //这里的接口要与collect source的接口一致。
# Use a  channel which buffers events in memory
    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
设置好后,暂时不要开启agent。
3.下面设置collect,同agent,新建test.conf 文件
# Name the  components on this agent
a1.sources  = r1
a1.sinks =  k1
a1.channels  = c1
#  Describe/configure the source
a1.sources.r1.type  = avro
a1.sources.r1.bind  = 192.168.150.135 //绑定本机的IP的地址
a1.sources.r1.port  =60000 //接口要与agent sink的port一致
# Describe  the sink
a1.sinks.k1.type  = logger
# Use a  channel which buffers events in memory
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

4.设置好之后保存退出,输入命令:(当前目录为$FLUME_HOME/conf)
flume-ng agent -n a1 -c conf -f test.conf,若没有问题在agent机上输入命令:
flume-ng  agent -c conf -f test.conf -n a1 -Dflume.root.logger=INFO,console
collect机上会出现:

则表示没有问题。
进入下一步
5.在agent另开一个 terminal,输入 telnet 127.0.0.1 44444 后(需要安装,yum install telnet)
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
然后就可以输入如:ss,enter后到collect机上查看
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值