CentOS 7部署flume

准备工作:##

安装java并设置java环境变量,在`/etc/profile`中加入

export JAVA_HOME=/usr/java/jdk1.8.0_65
export PATH=$PATH:$JAVA_HOME/bin

注意事项

需要启动多个shell脚本交互客户端进行验证,运行中的客户端不要停止。

安装flume

  • 下载:wget http://mirrors.hust.edu.cn/apache/flume/1.6.0/apache-flume-1.6.0-bin.tar.gz

  • 解压:tar -zxvf apache-flume-1.6.0-bin.tar.gz

  • 移动到指定目录:mv apache-flume-1.6.0 /usr/local/flume

配置

source 使用 necat 类型,sink 采用 file_roll 类型, 从监听端口获取数据,保存到本地文件。 拷贝配置模板:

cp conf/flume-conf.properties.template conf/flume-conf.properties

编辑配置如下:

# The configuration file needs to define the sources,
# the channels and the sinks.
# Sources, channels and sinks are defined per agent,
# in this case called 'agent' agent.sources = r1
agent.channels = c1
agent.sinks = s1 # For each one of the sources, the type is defined
agent.sources.r1.type = netcat
agent.sources.r1.bind = localhost
agent.sources.r1.port = 8888 # The channel can be defined as follows.
agent.sources.r1.channels = c1 # Each sink's type must be defined
agent.sinks.s1.type = file_roll
agent.sinks.s1.sink.directory = /tmp/log/flume #Specify the channel the sink should use
agent.sinks.s1.channel = c1 # Each channel's type is defined.
agent.channels.c1.type = memory # Other config values specific to each type of channel(sink or source)
# can be defined as well
# In this case, it specifies the capacity of the memory channel
agent.channels.c1.capacity = 100

功能验证

1.建立输出目录

mkdir -p /tmp/log/flume

2.启动服务

bin/flume-ng agent --conf conf -f conf/flume-conf.properties -n agent&

运行日志位于logs目录,或者启动时添加-Dflume.root.logger=INFO,console 选项前台启动,输出打印日志,查看具体运行日志,服务异常时查原因。

3.发送数据

telnet localhost 8888

输入

hello world!
hello Flume!

4.查看数据文件 查看 /tmp/log/flume 目录文件:###

# 文件名不同,需要根据实际情况修改和查看
cat /tmp/log/flume/1447671188760-2
hello world!
hello Flume!

参考文档:

CentOS 7部署flume的更多相关文章

  1. CentOS 7部署Kafka和Kafka集群

    CentOS 7部署Kafka和Kafka集群 注意事项 需要启动多个shell脚本交互客户端进行验证,运行中的客户端不要停止. 准备工作: 安装java并设置java环境变量,在`/etc/prof ...

  2. 在centos中部署jenkins

    在centos中部署jenkins,需要的环境:安装jdk,Apache-tomcat 这两步我前面文章里已写,再次忽略 到官网下载最新的jenkins 我这里的是  jenkins.war 把该文件 ...

  3. Centos 上部署 tomcat7

     在 Centos 上部署 tomcat7 搜索tomcat,选下面红色框框的官网 选箭头指着的版本7, 选 tar.gz 格式, 下载完压缩包,使用 ftpx 工具,放在 centos 的 /opt ...

  4. SSM 项目从搭建爬坑到 CentOS 服务器部署 - 速查手册

    SSM 项目从搭建爬坑到 CentOS 服务器部署 - 速查手册 提示: (1)CSDN 博客左边有操作工具条上有文章目录 (2)SSM 指 Spring,Spring MVC,MyBatis Mav ...

  5. CentOS上部署Django+Nginx+Uwsgi环境

    在CentOS上部署Django+Nginx+Uwsgi环境 奇谭  2016-09-01 评论  Linux  python django nginx uwsgi VirtualEnv的作用:创建隔 ...

  6. Linux CentOS下部署Java Web项目

    本文讲解如何在Linux CentOS下部署Java Web项目的步骤. 一.环境准备: (1)Linux CentOS (2)apache-tomcat-9.0.10 (3)XShell 二.启动t ...

  7. CentOS 7 部署 ASP.NET Core 应用程序

    原文:CentOS 7 部署 ASP.NET Core 应用程序 看了几篇大牛写的关于 Linux 部署 ASP.NET Core 程序的文章,今天来实战演练一下.2017年最后一个工作日,提前预祝大 ...

  8. 在CentOS上部署kubernetes1.9.0集群

    原文链接: https://jimmysong.io/kubernetes-handbook/cloud-native/play-with-kubernetes.html (在CentOS上部署kub ...

  9. java部署系列:CentOS下部署Java7/Java8

    一.前言 1.本文主要内容 CentOS下部署OracleJDK CentOS下部署OpenJDK 2.适用范围与本篇环境 适用范围 1.CentOS 6+2.Java 7+ 本篇环境 1.CentO ...

随机推荐

  1. Orchard源码分析(5.2):BeginRequest事件处理(DefaultOrchardHost.BeginRequest方法)

    BeginRequest事件处理的作用是确保所有Shell已经加载,或者在扩展有变化的时候重新加载.          void IOrchardHost .BeginRequest() {      ...

  2. jQuery源码-jQuery.fn.attr与jQuery.fn.prop

    jQuery.fn.attr.jQuery.fn.prop的区别 假设页面有下面这么个标签,$('#ddd').attr('nick').$('#ddd').prop('nick')分别会取得什么值? ...

  3. jquery Ajax跨域调用WebServices方法

    由于公司需要开发一个手机页面,想提供给同事直接在手机上可以查询SAP资料.数据需要使用js调用webserver来获取. 因为初次使用Jquery调用Webserver,所以期间并不顺利.测试调用We ...

  4. eclipse tomcat debug启动慢

    myeclipse或eclipse下debug模式启动很慢,默认模式也是debug,网上找了终于解决, 原因是有eclipse或myeclipse启动debug时自动添加断点,所以必须删除一些东西. ...

  5. Mac 命令

    1.du 获取某个目录下各个文件和子目录占用多少空间,可以输入:du -sh *

  6. 机器学习之Hash集合问题

    问题来源与七月学习之 (3.x线性代数与矩阵运算基础)

  7. InnoDB锁机制分析

    InnoDB锁机制常常困扰大家,不同的条件下往往表现出不同的锁竞争,在实际工作中经常要分析各种锁超时.死锁的问题.本文通过不同条件下的实验,利用InnoDB系统给出的各种信息,分析了锁的工作机制.通过 ...

  8. Android Studio模拟器的问题及解决办法

    1.could not bind gl_array_buffer error=0x502 环境:Windows10 解决办法: 在AVD Manager中,将模拟器的RAM设置为1G.

  9. Python-Matplotlib安装及简单使用

    在使用NumPy进行学习统计计算时是枯燥的,大量的数据令我们很头疼,所以我们需要把它图形化显示. Matplotlib是一个Python的图形框架,类似于MATLAB和R语言. Matplotlib的 ...

  10. 使用Carthage安装第三方Swift库

    http://blog.crazyphper.com/?p=3661 carthage update