簡介 | socket模式 | 簡單數據處理 | 開發公司 | |
Flume | 日誌採集系統html (管道流方式,提供了不少的默認實現,讓用戶經過參數部署,及擴展API.)node |
|
可編寫Interceptor,對數據進行攔截,對密碼進行MD5加密再寫入hdfs | Clouderalinux |
Kafka | 消息中間件(一個可持久化的分佈式的消息隊列) |
|
流處理系統,也就是做爲一個緩存(數據量大的時候會保存到本地硬盤,不僅僅是內存),生產消息太多了,消費不過來,就先存着。 |
Flume最先是Cloudera提供的日誌收集系統,目前是Apache下的一個孵化項目bootstrap
Kafka是知名社交網絡公司LinkedIn於2010年12月份開源的分佈式消息系統,主要由Scala語言開發,於2012年成爲Apache頂級項目,目前被普遍應用在包括Twitter,Netffix和Tumblr等在內的大型互聯網站點上。緩存
使用命令:安全
建立接收server | ||
Flume | flume-ng agent -c conf -f flume-demo-hdfs.conf --name agent1 -Dflume.root.logger=INFO,Console 根據conf文件配置來配置:bash agent1.sources = source1 agent1.sinks = sink1 agent1.channels = channel1 agent1.sources.source1.type = exec agent1.sources.source1.command = tail -f /var/log/1.log agent1.sinks.sink1.type = hdfs agent1.sinks.sink1.hdfs.path = hdfs://<namenode_server_ip>:8020/flume/test/data agent1.sinks.sink1.hdfs.filePrefix = events- agent1.sinks.sink1.hdfs.fileType = DataStream agent1.sinks.sink1.hdfs.writeFormat = Text agent1.sinks.sink1.hdfs.roundUnit = minute agent1.channels.channel1.type = memory agent1.channels.channel1.capacity = 100 agent1.channels.channel1.transactionCapacity = 100 agent1.sources.source1.channels = channel1 agent1.sinks.sink1.channel = channel1
|
|
Kafka | 建立topic: kafka-topics --create --zookeeper zookp-server-2:2181 --replication-factor 1 --partitions 1 --topic test2 建立消息生產者並逐行輸入消息(打開後能夠用鍵盤輸入,按回車即發送消息。注意somehost不能爲localhost): kafka-console-producer --broker-list somehost:9092 --topic test2 建立消費者並持續接收消息: kafka-console-consumer --bootstrap-server somehost:9092 --topic test2 --from-beginning --zookeeper zookp-server-2:2181 其餘命令詳解:Kafka 學習筆記之 Kafka0.11之console-producer/console-consumer: — kafka命令大全 —網絡 |
Flume也能夠打開端口來監聽,其配置文件爲:socket
agent1.sources = source1 agent1.sinks = sink1 agent1.channels = channel1 agent1.sources.source1.type = netcat agent1.sources.source1.bind = 0.0.0.0 agent1.sources.source1.port = 9999 agent1.sinks.sink1.type = logger agent1.channels.channel1.type = memory agent1.channels.channel1.capacity = 1000 agent1.channels.channel1.transactionCapacity = 100 agent1.sources.source1.channels = channel1 agent1.sinks.sink1.channel = channel1
啓動命令爲:分佈式
flume-ng agent -c conf -f conf/flume-demo-logger.conf --name agent1 -Dflume.root.logger=INFO,Console