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 86833
공지 [SQL컨셉] 서적 "SQL컨셉"의 샘플 데이타 베이스 SAMPLE DATABASE of ORACLE 가을의 곰을... 2013.02.10 79132
공지 [G_SQL] Sample Database 가을의 곰을... 2012.05.20 95879
18 TensorFlow Lite 101 - MoblieNet 맛보기 file 졸리운_곰 2018.05.30 1093
17 Apache MXNet에서 사전 트레이닝된 모델을 사용해 보세요. 졸리운_곰 2018.05.30 992
16 MXNet을 활용한 이미지 분류 앱 개발하기 file 졸리운_곰 2018.05.30 1428
15 세상에 있는 (거의) 모든 머신러닝 문제 공략법 file 졸리운_곰 2018.05.30 1120
14 sklearn 내부의 pickle lib 를 통해 모델을 저장하고 다시 로드하여 재사용할 수 있다. 졸리운_곰 2018.05.30 1640
13 텐서플로우 기반 딥러닝 훈련 모델 파일 저장, 로딩 및 재활용 file 졸리운_곰 2018.05.30 1772
12 TensorFlow 모델을 저장하고 불러오기 (save and restore) 졸리운_곰 2018.05.30 1638
11 텐서플로우(TensorFlow)를 이용해서 글자 생성(Text Generation) 해보기 – Recurrent Neural Networks(RNNs) 예제 – Char-RNN file 졸리운_곰 2018.05.13 1125
10 외장형 그래픽카드로 우분투에서 텐서플로우 사용 How to setup an eGPU on Ubuntu for TensorFlow file 졸리운_곰 2018.05.09 1427
9 Keras and NLTK 케라스를 이용한 NLTK 자연어처리 졸리운_곰 2018.05.08 1607
8 Windows7에서 "처음 심층 학습 프로그램」을 사경 보면 (1-2) 제 1 장 후반 file 졸리운_곰 2018.05.08 1143
7 CSLAIER CSLAIER에 의한 LSTM file 졸리운_곰 2018.05.08 1665
6 Tensorboard 사용하기 1 file 졸리운_곰 2018.05.08 1417
5 텐서보드 사용법 file 졸리운_곰 2018.05.08 1415
4 Ubuntu 18.04 Settings for TensorFlow 설치 file 졸리운_곰 2018.05.08 1183
3 딥러닝용 서버 설치기 file 졸리운_곰 2018.05.07 1396
2 Installing Tensorflow GPU on Ubuntu 18.04 LTS file 졸리운_곰 2018.05.06 1217
1 TensorFlow Lite 101 - MoblieNet 맛보기 file 졸리운_곰 2018.04.07 1275
대표 김성준 주소 : 경기 용인 분당수지 U타워 등록번호 : 142-07-27414
통신판매업 신고 : 제2012-용인수지-0185호 출판업 신고 : 수지구청 제 123호 개인정보보호최고책임자 : 김성준 sjkim70@stechstar.com
대표전화 : 010-4589-2193 [fax] 02-6280-1294 COPYRIGHT(C) stechstar.com ALL RIGHTS RESERVED