메뉴 건너뛰기

Cloudera, BigData, Semantic IoT, Hadoop, NoSQL

Cloudera CDH/CDP 및 Hadoop EcoSystem, Semantic IoT등의 개발/운영 기술을 정리합니다. gooper@gooper.com로 문의 주세요.


1. 로그를 받을 agent설정 파일(flume-conf.properties)

agent.sources = avroGenSrc
agent.channels = memoryChannel
agent.sinks = fileSink

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

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

# Each sink's type must be defined
agent.sinks.fileSink.type = file_roll
agent.sinks.fileSink.sink.directory=/home/hadoop/saved_data
agent.sinks.fileSink.sink.rollInterval = 10
agent.sinks.fileSink.sink.batchSize = 10

#Specify the channel the sink should use
agent.sinks.fileSink.channel = memoryChannel

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


2. 로그를 전송하는 agent(flume-conf-agent01.properties)


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

# For each one of the sources, the type is defined
agent01.sources.execGenSrc.type = exec
agent01.sources.execGenSrc.command = tail -f /home/hadoop/log_data/log1.log
agent01.sources.execGenSrc.batchSize = 10

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

# Each sink's type must be defined
agent01.sinks.avroSink.type = avro
agent01.sinks.avroSink.hostname=localhost
agent01.sinks.avroSink.port=3333
agent01.sinks.avroSink.batch-size = 10

#Specify the channel the sink should use
agent01.sinks.avroSink.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 = 10000
agent01.channels.memoryChannel.transctionCapacity = 10000


3. log를 받을 폴더 생성및 전송할 데이타 생성

   가. 받을 폴더 : mkdir /home/hadoop/flume/saved_data

   나. 보낼 폴더 : mkdir /home/hadoop/flume/log_data

   다. 보낼파일 :  touch /home/hadoop/flume/log1.log

   라. 폴더로 이동 : cd /home/hadoop/flume

   마. log1.log에 간단하게 로그 추가 : echo "aaaaabbbbbcccc" >> log1.log

 

4. agent실행

  가. 로그를 받을 agent : flume-ng agent --conf-file ./conf/flume-conf.properties --name agent

  나. 로그를 전송할 agent : flume-ng agent --conf-file ./conf/flume-conf-agent01.properties --name agent01

번호 제목 날짜 조회 수
347 hadoop 클러스터 실행 스크립트 정리 2018.03.20 4817
346 mysql에서 외부 디비를 커넥션할 경우 접속 속도가 느려질때 2017.06.30 4815
345 update 샘플 2018.03.12 4813
344 hive의 메타정보 테이블을 MariaDB로 사용하는 경우 table comment나 column comment에 한글 입력시 깨지는 경우 utf8로 바꾸는 방법. 2023.03.10 4812
343 impald에서 idle_query_timeout 와 idle_session_timeout 구분 2021.05.20 4809
342 hbase에 필요한 jar들 2013.04.01 4802
341 hbase CustomFilter만들기 (0.98.X이상) 2015.05.08 4795
340 Hadoop 설치 및 시작하기 file 2013.03.06 4778
339 HDFS 파일및 디렉토리 생성시 생성방법에 따라 권한이 다르게 부여된다. 2022.05.30 4750
338 beeline실행시 User: root is not allowed to impersonate오류 발생시 조치사항 2016.06.03 4750
337 spark client프로그램 기동시 "Error initializing SparkContext"오류 발생할때 조치사항 2016.05.27 4750
336 mongodb에서 큰데이타 sort시 오류발생에 대한 해결방법 2015.12.22 4740
335 [oozie]oozie ssh action으로 패스워드 없이 다른 서버에 ssh로그인 하여 shellscript호출하는 설정하는 방법 2022.11.10 4734
334 physical memory used되면서 mapper가 kill되는 경우 오류 발생시 조치 2018.09.20 4732
333 console명령과 API비교 2015.12.21 4732
332 [Hue admin]Add/Sync LDAP user, Sync LDAP users/groups 버튼 기능 설명 2023.08.09 4725
331 Nodes of the cluster (unhealthy)중 1/1 log-dirs are bad: 오류 해결방법 2015.05.17 4723
330 [EncryptionZone]User:hdfs not allowed to do 'DECRYPT_EEK on 'enc_key'오류 2023.11.02 4720
329 zookeeper 3.4.6 설치(3대) 2015.04.28 4718
328 hive metadata(hive, impala, kudu 정보가 있음) 테이블에서 db, table, owner, location를 조회하는 쿼리 2020.02.07 4709
위로