美文网首页
Apache Flume基础(二)安装部署

Apache Flume基础(二)安装部署

作者: 做个合格的大厂程序员 | 来源:发表于2020-06-25 21:48 被阅读0次

    step1

    上传安装包到数据源所在节点上,然后解压 tar -zxvf apache-flume-1.8.0-bin.tar.gz

    然后进入 flume 的目录,修改 conf 下的 flume-env.sh,在里面配置 JAVA_HOME

    • 根据数据采集需求配置采集方案,描述在配置文件中(文件名可任意自定义)
    • 指定采集方案配置文件,在相应的节点上启动 flume agent

    step 2

    先在 flume 的 conf 目录下新建一个文件

    vi netcat-logger.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
    a1.sources.r1.bind = localhost
    a1.sources.r1.port = 44444
    
    # 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
    

    step 3

    启动 agent 去采集数据

    bin/flume-ng agent -c conf -f conf/netcat-logger.conf -n a1 -Dflume.root.logger=INFO,console
    

    -c conf 指定 flume 自身的配置文件所在目录
    -f conf/netcat-logger.con 指定我们所描述的采集方案
    -n a1 指定我们这个 agent 的名字

    step 4

    测试

    先要往 agent 采集监听的端口上发送数据,让 agent 有数据可采。
    随便在一个能跟 agent 节点联网的机器上:

    telnet anget-hostname port (telnet localhost 44444)
    

    如果没有telnet,安装步骤为

    yum list telnet*              列出telnet相关的安装包
    yum install telnet-server     安装telnet服务
    yum install telnet.*          安装telnet客户端
    

    相关文章

      网友评论

          本文标题:Apache Flume基础(二)安装部署

          本文链接:https://www.haomeiwen.com/subject/zzsefktx.html