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
댓글 0
번호 | 제목 | 날짜 | 조회 수 |
---|---|---|---|
161 | mongodb에서 큰데이타 sort시 오류발생에 대한 해결방법 | 2015.12.22 | 513 |
160 | console명령과 API비교 | 2015.12.21 | 484 |
159 | java quartz 시간 설정 참고사항 | 2015.12.16 | 300 |
158 | 천문학적, 기후학적, 기상학적, 생물학적, 농사계절 구분 | 2015.12.16 | 191 |
157 | 대표 오픈소스 라이선스, 한 눈에 보기! | 2015.12.10 | 226 |
156 | sparql 문법구조 설명 | 2015.12.09 | 490 |
155 | git설명 한글판 | 2015.12.09 | 440 |
154 | protege 4.3 다운로드 | 2015.12.09 | 227 |
153 | ontology, jena, sparql등 전반에 대한 설명및 예제를 제공하는 사이트 | 2015.12.08 | 490 |
152 | 마이바티스(MyBatis)쿼리로그 출력및 정렬하기 | 2015.12.01 | 1546 |
151 | sparql에서 concat에제 | 2015.11.27 | 238 |
150 | Runtime.getRuntime().exec(cmd) sample 소스 | 2015.11.19 | 359 |
149 | Resource temporarily unavailable(자원이 일시적으로 사용 불가능함) 오류조치 | 2015.11.19 | 7709 |
148 | mybais #과 $의 차이점 | 2015.11.10 | 460 |
147 | Mybatis foreach 문법정리(상황에 따른 사용법) | 2015.11.10 | 1466 |
146 | DB별 JDBC 드라이버 | 2015.10.02 | 468 |
145 | root계정으로 MariaDB설치후 mysql -u root -p로 db에 접근하여 바로 해줘야 하는일..(케릭터셑은 utf8) | 2015.10.02 | 554 |
144 | SQL문장과 Mongo에서 사용하는 명령어를 비교한 것입니다. | 2015.09.30 | 327 |
143 | mongodb 2.6.6 설치(64bit) | 2015.09.30 | 324 |
142 | pom.xml에서 build.gradle로 변환 | 2015.09.14 | 311 |