메뉴 건너뛰기

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

번호 제목 날짜 조회 수
52 hbase shell에서 컬럼값 검색하기(SingleColumnValueFilter이용) 2014.04.25 5261
51 unique한 값 생성 2014.04.25 4831
50 sequence한 번호 생성방법 2014.04.25 4873
49 ubuntu 12.4에서 eclipse설치후 기동시 library(swt-gtk*)관련 오류 2014.04.23 3713
48 Building a Cluster docs 2014.04.22 3880
47 sqoop 1.4.4 설치및 테스트 2014.04.21 5603
46 The disk drive for uuid= is not ready yet or not present 오류 해결방법 2014.04.21 4807
45 os가 windows7인 host pc에서 ubuntu가 os인 guest pc에 접근하기 위한 네트워크설정 2014.04.20 5029
44 oozie에서 share lib설정시 action type별로 구분하여 넣을것 2014.04.18 4945
43 json serde사용법 2014.04.17 4738
42 json 값 다루기 2014.04.17 4621
41 통계자료 구할수 있는 곳 2014.04.16 4425
40 column family삭제시 Column family 'delete' does not exist오류 발생하는 경우 2014.04.14 4642
39 hive에서 생성된 external table에서 hbase의 table에 값 insert하기 2014.04.11 4703
38 Oozie 설치, 환경설정 및 테스트 2014.04.08 4671
37 다수의 로그 에이전트로 부터 로그를 받아 각각의 파일로 저장하는 방법(interceptor및 multiplexing) 2014.04.04 6744
36 external partition table생성및 data확인 2014.04.03 4576
» 동일서버에서 LA와 LC동시에 기동하여 테스트 2014.04.01 4441
34 의사분산모드에서 presto설치하기 2014.03.31 5641
33 Hive Query Examples from test code (2 of 2) 2014.03.26 13564
위로