메뉴 건너뛰기

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

번호 제목 날짜 조회 수
» 동일서버에서 LA와 LC동시에 기동하여 테스트 2014.04.01 1047
580 column family삭제시 Column family 'delete' does not exist오류 발생하는 경우 2014.04.14 1031
579 update 샘플 2018.03.12 1029
578 하둡 분산 파일 시스템을 기반으로 색인하고 검색하기 2014.09.25 1016
577 solr 6.2에 한글 형태소 분석기(arirang 6.x) 적용 및 테스트 file 2017.06.27 1007
576 hadoop cluster에 포함된 노드중에서 문제있는 decommission하는 방법및 절차 file 2017.12.28 993
575 [Kerberos]Kerberos상태의 클러스터에 JDBC로 접근할때 케이스별 오류내용 2020.02.14 972
574 Hive JDBC Connection과 유형별 에러및 필요한 jar파일 2021.05.24 961
573 원격 리포지토리에서 최초 clone시 Permission denied (publickey). 오류발생시 조치사항 2017.06.20 961
572 [SBT] SBT 사용법 정리(링크) 2016.08.04 959
571 mongodb aggregation query를 Java code로 변환한 샘플 2016.12.15 952
570 ubuntu에 maven 3.6.1설치 및 환경변수 설정 2019.06.02 947
569 sqoop export/import등을 할때 driver를 못찾는 오류가 발생하면... 2014.05.15 939
568 oozie job 구동시 JA009: User: hadoop is not allowed to impersonate hadoop 오류나는 경우 2014.06.02 938
567 oracle to hive data type정리표 2018.08.22 937
566 [Mybatis]Spring과 연동하지 않고 Java+Mybatis 형태의 프로그램 샘플소스 2016.09.01 935
565 [shellscript]엑셀파일에서 여러줄에 존재하는 단어를 한줄의 문자열로 합치는 방법(comma로 구분) 2019.07.15 897
564 hive query에서 mapreduce돌리지 않고 select하는 방법 2014.05.23 897
563 hive테이블의 물리적인 위치인 HDFS에 여러개의 데이터 파일이 존재할때 한개의 파일로 merge하여 동일한 테이블에 입력하는 방법 2019.05.23 895
562 sentry설정 방법및 활성화시 설정이 필요한 파일및 설정값, 계정생성 방법 2018.08.16 891
위로