apache flume 설치 - ubuntu 클라우드/빅데이터/가상화

flume은 로그 데이터를 수집->집계->이동하는 목적으로 만들어졌다.
운영중인 데이터를 수집하고 kafka와 같은 큐 클러스터에 전달한다.

1. 파일 다운로드
http://mirror.apache-kr.org/flume/stable/

2. 일반계정으로 압축 해제
$ cd /home/user/ && tar -vxzf apache-flume-1.6.0-bin.tar.gz

3. 환경설정(1)
$ cd /home/user/apache-flume-1.6.0-bin/conf
$ cp flume-conf.properties.template flume-conf.properties
$ cp flume-env.sh.template flume-env.sh
$ vi flume-env.sh
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
$ vi ~/.profile
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64

   환경설정(2)
$ vi flume-conf.properties

  agent.sources = seqGenSrc
  agent.channels = memoryChannel
  agent.sinks = loggerSink

  # sources 항목 설정(데이터를 읽어 들이는 방식이다.)
  # tcp등 다양한 방법이있다.
  agent.sources.seqGenSrc.type = spooldir
  agent.sources.seqGenSrc.spoolDir = /home/user/apache-flume-1.6.0-bin/data/in
  agent.sources.seqGenSrc.channels = memoryChannel

  # sinks 항목으로 보관 데이터를 저장/전달하는 방법이다.
  # hadoop을 통하거나 타 솔루션으로 전달이 가능하다.
  agent.sinks.loggerSink.type = file_roll
  agent.sinks.loggerSink.sink.directory = /home/user/apache-flume-1.6.0-bin/data/out
  agent.sinks.loggerSink.sink.rollInterval = 0
  agent.sinks.loggerSink.channel = memoryChannel

  # channels 항목으로 수신한 데이터를 보관하는 방법이다.
  agent.channels.memoryChannel.type = memory
  agent.channels.memoryChannel.capacity = 100

4. 실행
  $ bin/flume-ng agent -c conf -f conf/flume-conf.properties --name agent 
      -Dflume.monitoring.type=http -Dflume.monitoring.port=5555
  => "--name agent" 항목은 flume-conf.properties의 설정 첫번째 이름이다.(agent.sources = .....)
  => 5555는 모니터링 포트이다. 웹으로 접속하면 확인할 수 있다.

5. 팁
   디버깅으로 파일을 생성하기 위해선 ~/conf/log4j.properties파일의
   아래 항목을 수정하면 된다.
   #flume.root.logger=DEBUG,console
   flume.root.logger=INFO,LOGFILE


5. 실제 동작하여 파일을 옮긴 상태(이미지)
   첫번째 이미지는 수집 대상 디렉토리의 파일이다. 파일명.COMPLETED라는것은 옮겨졌다는 것이다.
   두번째 이미지는 특정한 파일 이름으로 옮긴 데이터를 통합한 그림이다.
제세한 문서는 요기 => https://flume.apache.org/FlumeUserGuide.html


덧글

댓글 입력 영역