메뉴 건너뛰기

Bigdata, Semantic IoT, Hadoop, NoSQL

Bigdata, 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

번호 제목 글쓴이 날짜 조회 수
19 No broker partitions consumed by consumer thread오류 발생시 확인/조치할 사항 총관리자 2016.09.02 151
18 producer / consumer구현시 설정 옵션 설명 총관리자 2016.10.19 121
17 운영중인 상태에서 kafka topic삭제하고 재생성하여 처리되지 않은 메세지 모두 삭제하기 총관리자 2016.10.24 156
16 Flume과 Kafka를 사용한 초당 100만개 로그 수집 테스트 file 총관리자 2016.10.31 1021
15 Kafka Offset Monitor로 kafka 상태 모니터링 하기 file 총관리자 2016.11.08 528
14 kafka-manager 1.3.3.4 설정및 실행하기 총관리자 2017.03.20 617
13 Kafka의 API중 Consumer.createJavaConsumerConnector()를 이용하고 다수의 thread를 생성하여 Kafka broker의 topic에 접근하여 데이타를 가져오고 처리하는 예제 소스 총관리자 2017.04.26 226
12 sqoop으로 mariadb에 접근해서 hive 테이블로 자동으로 생성하기 총관리자 2018.08.03 673
11 컬럼및 라인의 구분자를 지정하여 sqoop으로 데이타를 가져오고 hive테이블을 생성하는 명령문 총관리자 2018.08.03 418
10 kafka에서 메세지 중복 consume이 발생할 수 있는 상황 총관리자 2018.10.23 258
9 kerberos설정된 상태의 spooldir->memory->hdfs로 저장하는 과정의 flume agent configuration구성 예시 총관리자 2019.05.30 171
8 source, sink를 직접 구현하여 사용하는 예시 총관리자 2019.05.30 398
7 [sqoop] mapper를 2이상으로 설정하기 위한 split-by컬럼을 찾을때 유용하게 활용할 수 있는 쿼리 총관리자 2020.05.13 339
6 [sap] Error: java.io.IOException: SQLException in nextKeyValue 오류 발생 총관리자 2020.06.08 270
5 oracle 12에 sqoop해서 데이터 import하기 (console에서 sqoop import하는 방법) 총관리자 2021.12.31 52
4 Oracle NLOB type의 데이터를 import하는 경우 No Java type for SQL type 2011 for column rst와 같은 오류 발생시 조치사항 총관리자 2022.01.14 35
3 oracle 접속 방식에 따른 --connect 지정 방법 총관리자 2022.02.11 24
2 Oracle 12c DB의 LOB타입 컬럼이 있는 테이블을 import할 때 주의 할 사항 gooper 2022.09.14 168
1 [CDP7.1.7] oozie sqoop action으로 import혹은 export수행시 발생한 오류에 대한 자세한 로그 확인 하는 방법 gooper 2024.04.19 0

A personal place to organize information learned during the development of such Hadoop, Hive, Hbase, Semantic IoT, etc.
We are open to the required minutes. Please send inquiries to gooper@gooper.com.

위로