Flume NG version 설치 및 로그 수집

 

 Flume NG 설치 및 로그 수집 하기 입니다.

 

각각 아래와 같이 구성하였습니다.

 

0번 HDFS  <--- 저장소

1번 agent01  <--- 로그의 데이터가 모아져 HDFS에 저장함.

2번 agent02  <--- 로그 수집

3번 agent03  <--- 로그 수집

 

 

먼저 Flume NG 를 다운로드 합니다.

apache 홈페이지에서 다운로드 하시거나 wget 명령어로 다운로드 합니다.

wget http://archive.apache.org/dist/flume/1.3.1/apache-flume-1.3.1-bin.tar.gz 를 입력합니다.

 

 

 

다운로드한 파일을 압축해제 후 원하는 경로에 위치 시킵니다.

tar xvfzp apache-flume-1.3.1-bin.tar.gz    <-- 압축해제

mv flume-1.3.1 /usr/local/flume   <-- 원하는 경로로 이동

 

그다음 리눅스 환경변수를 설정합니다. (로그 수집 할 노드 모두)
 vi /etc/profile    <-- 입력하여 환경변수를 설정합니다.

 

export FLUME_HOME=/usr/local/flume    <-- 추가합니다.
PATH 지정해주기                                  <-- 추가합니다.

source /etc/profile   <-- 환경변수를 입력하였으면 적용 시킵니다.

 

 

그다음 flume폴더를 압축하여 각 노드에 배포를 합니다.


 tar cvfpz flume디렉토리  <- 압축
- scp –rp flume.tar.gz DataNode02:/usr/local   <-배포
- scp –rp flume.tar.gz DataNode03:/usr/local

 

배포된 flume압축파일을 압축해제 후 원하는 경로에 위치 합니다.
tar xvfzp flume.tar.gz
mv  flume  /usr/local/flum

 

 

 

그다음 flume디렉토리 안에 conf디렉토리 안에 있는  flume-conf.properties.template

파일을 flume.conf 파일로 복사 합니다.

 

 

 

 

 복사한 flume.conf 파일을 vi 편집기를 이용하여 환경설정을 합니다.
 로그데이터가 모아질 1번 노드와 로그를 수집 할 노드의 환경설정은 조금 다릅니다.

 

경축! 아무것도 안하여 에스천사게임즈가 새로운 모습으로 재오픈 하였습니다.
어린이용이며, 설치가 필요없는 브라우저 게임입니다.
https://s1004games.com

 

 

1번 노드의 flume.conf 파일 내용
agent01.sources = avroGenSrc
agent01.channels = memoryChannel
agent01.sinks = hdfs-Cluster1-sink

# For each one of the sources, the type is defined
agent01.sources.avroGenSrc.type = avro
agent01.sources.avroGenSrc.bind = SNameNode
agent01.sources.avroGenSrc.port = 3333

# The channel can be defined as follows.
agent01.sources.avroGenSrc.channels = memoryChannel

# Each sink's type must be defined
agent01.sinks.hdfs-Cluster1-sink.type = hdfs
agent01.sinks.hdfs-Cluster1-sink.hdfs.path = hdfs://NameNode:9000/flume/data
agent01.sinks.hdfs-Cluster1-sink.rollInterval = 30
agent01.sinks.hdfs-Cluster1-sink.sink.batchSize = 100


#Specify the channel the sink should use
agent01.sinks.hdfs-Cluster1-sink.channel = memoryChannel

# Each channel's type is defined.
agent01.channels.memoryChannel.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
agent01.channels.memoryChannel.capacity = 100000
agent01.channels.memoryChannel.transactionCapacity = 10000

 

 

 

 

2,3번 노드의 flume.conf 파일 내용(2,3번 agent의 내용은 같으며 agent의 이름만 다르게 주시면 됩니다.)

agent02.sources = execGenSrc
agent02.channels = memoryChannel
agent02.sinks = avroSink

# For each one of the sources, the type is defined
agent02.sources.execGenSrc.type = exec
agent02.sources.execGenSrc.command = tail -F /home/aaaaa/hadoop/logs/logsample.log  <--- 수집할 로그 파일 경로
agent02.sources.execGenSrc.batchSize = 10

# The channel can be defined as follows.
agent02.sources.execGenSrc.channels = memoryChannel

# Each sink's type must be defined
agent02.sinks.avroSink.type = avro
agent02.sinks.avroSink.hostname = 로그데이터가 모아질 호스트 네임 & 주소
agent02.sinks.avroSink.port = 3333
agent02.sinks.avroSink.batch-size = 10


#Specify the channel the sink should use
agent02.sinks.avroSink.channel = memoryChannel

# Each channel's type is defined.
agent02.channels.memoryChannel.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
agent02.channels.memoryChannel.capacity = 100000
agent02.channels.memoryChannel.transactionCapacity = 10000

 

 

-------------------------------------------------------------------------------------

 


  환경 설정이 마무리 되었다면 각각의 노드에서 agent를 실행합니다.

 

- flume-ng agent --conf-file ./conf/flume.conf --name agent01    <-- 1번 노드
- flume-ng agent --conf-file ./conf/flume.conf --name agent02    <-- 2번 노드
- flume-ng agent --conf-file ./conf/flume.conf --name agent03    <-- 3번 노드

 

각각 실행 하고 정상적으로 올라 왔다면 아래와 같이 구성 된 것입니다.

 

 

 

 

바로 HDFS를 확인하여 보면 로그가 수집이 되는 것을 확인 할 수있습니다.

./bin/hadoop fs -ls /logs/1500

 

 

 

 

[출처] http://1004jonghee.tistory.com/entry/Flume-NG-version-%EC%84%A4%EC%B9%98-%EB%B0%8F-%EB%A1%9C%EA%B7%B8-%EC%88%98%EC%A7%91

본 웹사이트는 광고를 포함하고 있습니다.
광고 클릭에서 발생하는 수익금은 모두 웹사이트 서버의 유지 및 관리, 그리고 기술 콘텐츠 향상을 위해 쓰여집니다.
번호 제목 글쓴이 날짜 조회 수
공지 오라클 기본 샘플 데이터베이스 졸리운_곰 2014.01.02 86541
공지 [SQL컨셉] 서적 "SQL컨셉"의 샘플 데이타 베이스 SAMPLE DATABASE of ORACLE 가을의 곰을... 2013.02.10 78955
공지 [G_SQL] Sample Database 가을의 곰을... 2012.05.20 95706
164 6. 주키퍼(zookeeper) 활용 - 분산서버 구현 1편 file 졸리운_곰 2016.05.30 1417
163 주키퍼 (ZooKeeper)란? file 졸리운_곰 2016.05.30 1347
162 ZooKeeper란 무엇인가? file 졸리운_곰 2016.05.30 1887
161 Parse Redis dump.rdb files, Analyze Memory, and Export Data to JSON 졸리운_곰 2016.05.29 1982
160 Flume or Kafka? Try both! 졸리운_곰 2016.05.29 1004
159 Flafka: Apache Flume Meets Apache Kafka for Event Processing file 졸리운_곰 2016.05.29 1541
158 빅데이터 플랫폼 아키텍처의 두 가지 file 졸리운_곰 2016.05.29 1686
157 Hadoop 적용 사례 기사 정리 졸리운_곰 2016.05.29 2004
156 빅데이터 잡설 , 하둡은 어디로 갈꺼나 … file 졸리운_곰 2016.05.29 1741
155 Hadoop과 MongoDB를 이용한 로그분석시스템 file 졸리운_곰 2016.05.29 1433
154 네이버 라인은 왜 카카오톡보다 병목현상이 적을까? file 졸리운_곰 2016.05.29 2540
153 최악의 빅데이터 프랙티스 10가지 졸리운_곰 2016.05.29 1446
152 하둡, 데이터 분석에 활용하기까지 file 졸리운_곰 2016.05.29 2141
151 Redis(레디스)를 어떻게 활용할 수 있을까? 졸리운_곰 2016.05.29 2060
150 [NoSQL & Cache] Redis vs Memcached ( 왜 Redis 를 사용해야 하는가? ) 졸리운_곰 2016.05.29 1169
149 REDIS 소개, 설치, 데이터 타입 테스트 file 졸리운_곰 2016.05.29 1438
148 FlumeNG + Kafka Plugin (플럼+카프카 플러그인) file 졸리운_곰 2016.05.29 1444
147 flume 설치 해보고 로그 수집하기 file 졸리운_곰 2016.05.29 1423
» Flume NG version 설치 및 로그 수집 file 졸리운_곰 2016.05.29 1680
145 Flume(플럼) 참고 사이트 정리 졸리운_곰 2016.05.29 1833
대표 김성준 주소 : 경기 용인 분당수지 U타워 등록번호 : 142-07-27414
통신판매업 신고 : 제2012-용인수지-0185호 출판업 신고 : 수지구청 제 123호 개인정보보호최고책임자 : 김성준 sjkim70@stechstar.com
대표전화 : 010-4589-2193 [fax] 02-6280-1294 COPYRIGHT(C) stechstar.com ALL RIGHTS RESERVED