分类: 架构设计与优化
2014-04-30 12:16:58
原文地址:分布式消息系统Jafka入门指南 作者:jieforest
一、JafkaMQ简介
JafkaMQ是一个分布式的发布/订阅消息系统,它是Apache Kafka的Java移植版。
JafkaMQ的特征如下:
1)消息持久化到磁盘的算法时间复杂度为O(1),即使是TB级的消息存储,也能保证常量时间的执行性能。二、JafkaMQ的安装
1、下载JafkaMQ
$ tar zvxf jafka-1.2.3.tgz $ mv jafka-1.2.3 jafka $ cd jafka
$ bin/server.sh conf/server.properties 2014-04-28 07:14:07.527 INFO Server - Starting Jafka server 1.2.3 2014-04-28 07:14:08.210 INFO LogManager - starting log cleaner every 60000 ms 2014-04-28 07:14:08.231 INFO SocketServer - start 8 Processor threads 2014-04-28 07:14:08.383 INFO Acceptor - Awaiting connection on port 9092 2014-04-28 07:14:08.385 INFO LogManager - Starting log flusher every 1000 ms with the following overrides {} 2014-04-28 07:14:08.386 INFO Server - Server started. 2014-04-28 07:15:15.403 INFO Log - loadSegments files from [/home/chuser/jafka/data/demo-0]: 0 2014-04-28 07:15:15.431 INFO Log - Loading the last segment /home/chuser/jafka/data/demo-0/00000000000000000000.jafka in mutable mode, recovery false 2014-04-28 07:15:15.440 INFO LogManager - Created log for [demo-0], now create other logs if necessary
$ bin/run.sh console
$ bin/producer-console.sh --broker-list 0:localhost:9092 --topic demo > Welcome to jafka > Hello world > 中文测试
$ .bin/simple-consumer-console.sh --topic demo --server jafka://localhost:9092 [1] 26: Welcome to jafka [2] 47: Hello world [3] 77: 锟斤拷锟侥诧拷锟斤拷