亚洲免费在线-亚洲免费在线播放-亚洲免费在线观看-亚洲免费在线观看视频-亚洲免费在线看-亚洲免费在线视频

flume ng 1.3 安裝

系統 1669 0

http://blog.csdn.net/hijk139/article/details/8308224

業務系統需要收集監控系統日志,想到了hadoop的flume。經過試驗,雖說功能不算足夠強大,但基本上能夠滿足功能需求。Flume 是一個分布式、可靠和高可用的服務日志收集工具,能夠和hadoop,hive等配置完成日志收集,存儲,分析處理等工作,更詳細的介紹可以參見apache網站。下面介紹下簡單的安裝配置方法

1,網上下載flume-ng安裝包,分別部署在收集和接收日志文件的服務器上,服務器上需安裝jdk 1.6以上,

http://flume.apache.org/download.html
tar -zxvf apache-flume-1.3.0-bin.tar.gz
2, 日志文件接收端端新建conf/flume-conf.properties server端的具體配置如下

從avro source端接收數據,然后寫入到HDFS文件系統中

  1. [flume@?conf]$?cat??flume-conf.properties??
  2. agent.sources?=? avrosrc??
  3. agent.channels?=? memoryChanne3??
  4. agent.sinks?=? hdfsSink??
  5. ??
  6. #?For?each?one?of?the?sources,?the?type?is?defined??
  7. agent.sources.avrosrc.type?=? avro??
  8. agent.sources.avrosrc.bind?=? 172.16.251.1??
  9. agent.sources.avrosrc.port?=? 44444??
  10. ??
  11. #?The?channel?can?be?defined?as?follows.??
  12. agent.sources.avrosrc.channels?=? memoryChanne3??
  13. ??
  14. #?Each?channel's?type?is?defined.??
  15. agent.channels.memoryChanne3.type?=? memory??
  16. agent.channels.memoryChanne3.keep-alive?=? 10??
  17. agent.channels.memoryChanne3.capacity?=? 100000??
  18. agent.channels.memoryChanne3.transactionCapacity?= 100000??
  19. ??
  20. #?Each?sink's?type?must?be?defined??
  21. agent.sinks.hdfsSink.type?=? hdfs??
  22. agent.sinks.hdfsSink.channel?=? memoryChanne3??
  23. agent.sinks.hdfsSink.hdfs.path?=?/logdata/%{hostname}_linux/%Y%m%d_date??
  24. agent.sinks.hdfsSink.hdfs.filePrefix?=?%{datacenter}_??
  25. agent.sinks.hdfsSink.hdfs.rollInterval?=? 0??
  26. agent.sinks.hdfsSink.hdfs.rollSize?=? 4000000??
  27. agent.sinks.hdfsSink.hdfs.rollCount?=? 0??
  28. agent.sinks.hdfsSink.hdfs.writeFormat?=? Text??
  29. agent.sinks.hdfsSink.hdfs.fileType?=? DataStream??
  30. agent.sinks.hdfsSink.hdfs.batchSize?=? 10??


如果flume和hadoop不是同一用戶,需要注意相關權限問題

3,日志收集端的conf/flume-conf.properties server文件配置,這里收集二個日志文件到收集端

  1. agent.sources?=? tailsource-1?tailsource-2??
  2. agent.channels?=? memoryChannel-1?memoryChannel-2??
  3. agent.sinks?=? remotesink?remotesink-2??
  4. ??
  5. agent.sources.tailsource-1.type?=? exec??
  6. agent.sources.tailsource-1.command?=? tail?-F?/tmp/linux2.log??
  7. agent.sources.tailsource-1.channels?=? memoryChannel-1??
  8. ??
  9. agent.sources.tailsource-2.type?=? exec??
  10. agent.sources.tailsource-2.command?=? tail?-F?/tmp/linux2_2.log??
  11. agent.sources.tailsource-2.channels?=? memoryChannel-2??
  12. ??
  13. agent.sources.tailsource-1.interceptors?=? host_int?timestamp_int?inter1??
  14. agent.sources.tailsource-1.interceptors.host_int.type?=? host??
  15. agent.sources.tailsource-1.interceptors.host_int.hostHeader?=? hostname??
  16. ??
  17. agent.sources.tailsource-1.interceptors.timestamp_int.type?=? org.apache.flume.interceptor.TimestampInterceptor$Builder??
  18. ??
  19. # agent.sources.tailsource-1.interceptors?=? inter1??
  20. agent.sources.tailsource-1.interceptors.inter1.type?=? static??
  21. agent.sources.tailsource-1.interceptors.inter1.key?=? datacenter??
  22. agent.sources.tailsource-1.interceptors.inter1.value?=? BEIJING??
  23. ??
  24. agent.sources.tailsource-2.interceptors?=? host_int?timestamp_int?inter1??
  25. agent.sources.tailsource-2.interceptors.host_int.type?=? host??
  26. agent.sources.tailsource-2.interceptors.host_int.hostHeader?=? hostname??
  27. ??
  28. agent.sources.tailsource-2.interceptors.timestamp_int.type?=? org.apache.flume.interceptor.TimestampInterceptor$Builder??
  29. ??
  30. # agent.sources.tailsource-1.interceptors?=? inter1??
  31. agent.sources.tailsource-2.interceptors.inter1.type?=? static??
  32. agent.sources.tailsource-2.interceptors.inter1.key?=? datacenter??
  33. agent.sources.tailsource-2.interceptors.inter1.value?=? linux2_2??
  34. ??
  35. agent.channels.memoryChannel-1.type?=? memory??
  36. agent.channels.memoryChannel-1.keep-alive?=? 10??
  37. agent.channels.memoryChannel-1.capacity?=? 100000??
  38. agent.channels.memoryChannel-1.transactionCapacity?= 100000??
  39. ??
  40. agent.channels.memoryChannel-2.type?=? memory??
  41. agent.channels.memoryChannel-2.keep-alive?=? 10??
  42. agent.channels.memoryChannel-2.capacity?=? 100000??
  43. agent.channels.memoryChannel-2.transactionCapacity?= 100000??
  44. ??
  45. agent.sinks.remotesink.type?=? avro??
  46. agent.sinks.remotesink.hostname?=? 172.16.251.1??
  47. agent.sinks.remotesink.port?=? 44444??
  48. agent.sinks.remotesink.channel?=? memoryChannel-1??
  49. ??
  50. agent.sinks.remotesink-2.type?=? avro??
  51. agent.sinks.remotesink-2.hostname?=? 172.16.251.1??
  52. agent.sinks.remotesink-2.port?=? 44444??
  53. agent.sinks.remotesink-2.channel?=? memoryChannel-2??


4,后臺運行
nohup bin/flume-ng agent -n agent -c conf -f conf/flume-conf.properties >1.log &

查看日志vi flume.log
端口連接情況 netstat -an|grep 44444
[flume@dtydb6 flume-1.4]$ netstat -an|grep 44444
tcp??????? 0????? 0 ::ffff:172.16.251.1:44444?? :::*??????????????????????? LISTEN ?

?

5,測試方法

可以使用如下類似的腳本,定期向日志文件寫入來進行測試

for i in {1..1000000}; do echo "LINUX2? PRESS ************* Flume log rotation $i" >> /tmp/linux3.log; sleep 0.0001; done

?

?

參考資料:
http://flume.apache.org/FlumeUserGuide.html

flume ng 1.3 安裝


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦?。?!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 国产偷国产偷在线高清 | 亚洲香蕉中文网 | 亚洲成人av | 国产成人18黄网站免费 | 337p亚洲精品色噜噜狠狠 | 久久国产精品高清一区二区三区 | 欧美一级特毛片 | 日韩欧美一区二区三区 | 两性视频网站 | 国产精品婷婷久久爽一下 | 日韩视频中文字幕 | 麻豆精品在线 | 久久91精品久久91综合 | 欧美在线视频7777kkkk | 四虎永久在线观看 | 色综合久久久久久久久五月性色 | 五月天婷婷免费视频观看 | 成人精品一区二区三区中文字幕 | 国产热re99久久6国产精品 | 99精品国产成人一区二区 | 波多野结衣精品一区二区三区 | 国产一级一级一级成人毛片 | 两个人高清视频图片中文字幕 | 秘密影院久久综合亚洲综合 | 久草视频网址 | 91香蕉嫩草 | 国产成a人片在线观看视频99 | 午夜男人| 关婷哪一级毛片高清免费看 | 99青青 | 奇米第四影视 | 久久精品这里是免费国产 | 国产日韩欧美精品在线 | 日日摸天天添天天添破 | 又刺激又黄的一级毛片 | 福利社看片 | 高清不卡日本v在线二区 | 欧美在线一区二区三区 | 亚洲最大成人综合网 | 亚洲尹人香蕉网在线视颅 | 这里只有精品首页 |