myt0 2020-07-18
cd /usr/local/flume/apache-flume-1.6.0-cdh5.9.0-bin/conf vim example.conf # 命名此代理上的组件 agent.sources = seqGenSrc # sources的名称 agent.channels = memoryChannel # Channel的名称 agent.sinks = loggerSink # Sink的名称 # 描述/配置源 agent.sources.seqGenSrc.type = netcat # 类型名称 seq agent.sources.seqGenSrc.bind = 0.0.0.0 # 绑定的ip agent.sources.seqGenSrc.port = 44444 # 绑定的端口 # 描述接收器 agent.sinks.loggerSink.type = logger # 以日志的形式输出到控制台 # 定义每个通道的类型 agent.channels.memoryChannel.type = memory agent.channels.memoryChannel.capacity = 1000 agent.channels.memoryChannel.transactionCapacity = 100 # 指定接收器应该使用的通道 agent.sinks.loggerSink.channel = memoryChannel agent.sources.seqGenSrc.channels = memoryChannel
cd /usr/local/flume/apache-flume-1.6.0-cdh5.9.0-bin/conf vim example.conf # 命名此代理上的组件 agent.sources = seqGenSrc # sources的名称 agent.channels = memoryChannel # Channel的名称 agent.sinks = loggerSink # Sink的名称 # 描述/配置源 agent.sources.seqGenSrc.type = exec # 命令行模式 agent.sources.seqGenSrc.command = tail -F /root/nohup.log agent.sources.seqGenSrc.shell = /bin/sh -c # 绑定的端口 # 描述接收器 agent.sinks.loggerSink.type = logger # 以日志的形式输出到控制台 # 定义每个通道的类型 agent.channels.memoryChannel.type = memory agent.channels.memoryChannel.capacity = 1000 agent.channels.memoryChannel.transactionCapacity = 100 # 指定接收器应该使用的通道 agent.sinks.loggerSink.channel = memoryChannel agent.sources.seqGenSrc.channels = memoryChannel
cd /usr/local/flume/apache-flume-1.6.0-cdh5.9.0-bin/conf vim example.conf # 命名此代理上的组件 agent.sources = seqGenSrc agent.channels = memoryChannel agent.sinks = loggerSink # 描述/配置源 agent.sources.seqGenSrc.type = exec agent.sources.seqGenSrc.command = tail -F /root/nohup.log agent.sources.seqGenSrc.shell = /bin/sh -c # 描述接收器 agent.sinks.loggerSink.type = avro agent.sinks.loggerSink.hostname = 192.168.104.94 agent.sinks.loggerSink.port = 44444 # 定义每个通道的类型 agent.channels.memoryChannel.type = memory agent.channels.memoryChannel.capacity = 1000 agent.channels.memoryChannel.transactionCapacity = 100 # 指定接收器应该使用的通道 agent.sinks.loggerSink.channel = memoryChannel agent.sources.seqGenSrc.channels = memoryChannel vim example.conf # 这个心启动 这启动了端口开启 上面Sink开绑定这个端口 # 命名此代理上的组件 agent.sources = seqGenSrc agent.channels = memoryChannel agent.sinks = loggerSink # 描述/配置源 agent.sources.seqGenSrc.type = avro agent.sources.seqGenSrc.bind = 0.0.0.0 # 绑定本机地址 agent.sources.seqGenSrc.port = 44444 # 描述接收器 agent.sinks.loggerSink.type = logger # 定义每个通道的类型 agent.channels.memoryChannel.type = memory agent.channels.memoryChannel.capacity = 1000 agent.channels.memoryChannel.transactionCapacity = 100 # 指定接收器应该使用的通道 agent.sinks.loggerSink.channel = memoryChannel agent.sources.seqGenSrc.channels = memoryChannel
flume-ng agent --conf $FLUME_HOME/conf --conf-file $FLUME_HOME/conf/example.conf --name agent -Dflume.root.logger=INFO,console # 启动 $FLUME_HOME: flume 路径 --name: agent名称 --conf: 制定flume conf路径 --conf-file: 制定自己写的配置文件 -Dflume.root.logger=INFO,console: log的参数 telnet 192.168.107.216 44444 # 连接到主机