简介 | 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