rocketmq安装与基本操作
如果不是因为政治原因,就rocketmq的社区活跃度、版本、特性和文档完善度,我是无论如何也不会使用rocketmq的。
rocketmq严格意义上并不支持高可靠性,因为其持久化只支持异步,有另外一个线程flush,不支持配置同步刷新到磁盘。只能说多个节点宕机的概率很低很低,外加现在的服务器一般都是UPS。
rocketmq官方提供了一份与activemq,kafka的特性对比(但没有包括与rabbitmq的比较,可参考http://www.cnblogs.com/zhjh256/p/6985889.html)。引用如下:
| Messaging Product | Client SDK | Protocol and Specification | Order Message | Message Filter | Server Triggered Redelivery | Persistent Message | Retroactive Consumers | Message Priority | High Availability and Failover | Message Track | Configuration | Management and Operation Tools |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ActiveMQ | Java, .NET, C++ etc. | Push model, support OpenWire, STOMP, AMQP, MQTT, JMS | Exclusive Consumer or Exclusive Queues can ensure ordering | Supported | Not Supported | Supports very fast persistence using JDBC along with a high performance journal,such as levelDB, kahaDB | Supported | Supported | Supported, depending on storage,if using kahadb it requires a ZooKeeper server | Not Supported | The default configuration is low level, user need to optimize the configuration parameters | Supported |
| Kafka | Java, Scala etc. | Pull model, support TCP | Ensure ordering of messages within a partition | Supported, you can use Kafka Streams to filter messages | Not Supported | High performance file storage | Supported offset indicate | Not Supported | Supported, requires a ZooKeeper server | Not Supported | Kafka uses key-value pairs format for configuration. These values can be supplied either from a file or programmatically. | Supported, use terminal command to expose core metrics |
| RocketMQ | Java, .NET, C++ | Pull model, support TCP, JMS | Ensure strict ordering of messages, have no hot spot problem,and can scale out gracefully | Supported, you can even upload yourself custom-built filter code snippets | Supported | High performance and low latency file storage | Supported timestamp and offset 2 indicates | Not Supported | Supported, Master-Slave model, without another kit | Supported | Work out of box,user only need to pay attention to a few configurations | Supported, rich web and terminal command to expose core metrics |
rocketmq的整体架构如下:

集群本身没有什么特殊之处,唯一的差别就是阿里啥都喜欢搞分布式,加了注册中心的概念(说白了就是抄袭zookeeper理念)。所以,要使用rocketmq,至少需要启动两个进程,nameserver、broker,前者是各种topic注册中心,后者是真正的broker。
从apache rocketmq官方http://rocketmq.apache.org/release_notes/release-notes-4.0.0-incubating/现在最新版本二进制,当前是4.0.0孵化版。
下载解压后得到apache-rocketmq-all。
在启动前,如果测试服务器配置较低,则应该修改启动命令runserver.sh(mqnamesrv里面调用)和runbroker.sh(mqbroker里面调用),将Xmx和Xms、Xmn值注释或者降低,否则可能会在启动时报内存分配失败。


首先启动nameserver。
nohup sh bin/mqnamesrv &
The Name Server boot success...
默认情况下,nameserver监听的是9876端口。
其次启动broker。
nohup sh bin/mqbroker -n localhost:9876 &
The broker[%s, 172.30.30.233:10911] boot success...
默认情况下,监听的是10911端口。
安装rocket web console。
默认情况下,rocketmq没有提供二进制监控控制台,需要自己build,可从github下载maven源码builder。为方便,笔者打包了一份,https://pan.baidu.com/s/1jIp6Age。放到tomcat下启动后,如下:

下载后,只要更改WEB-INF\classes\config.properties中的rocketmq.namesrv.addr为nameserver地址即可。
停止的时候,顺序相反,要先停止broker,其次停止nameserver。
sh bin/mqshutdown broker
The mqbroker(36695) is running...
Send shutdown request to mqbroker(36695) OK
sh bin/mqshutdown namesrv
The mqnamesrv(36664) is running...
Send shutdown request to mqnamesrv(36664) OK
同其他应用服务器应用一样,rocketmq也提供了一些命令行工具用于不需要通过编程API可以管理mq服务器本身,主命令是mqadmin,支持的子命令包括:
The most commonly used mqadmin commands are:
updateTopic Update or create topic
deleteTopic Delete topic from broker and NameServer.
updateSubGroup Update or create subscription group
deleteSubGroup Delete subscription group from broker.
updateBrokerConfig Update broker's config
updateTopicPerm Update topic perm
topicRoute Examine topic route info
topicStatus Examine topic Status info
topicClusterList get cluster info for topic
brokerStatus Fetch broker runtime status data
queryMsgById Query Message by Id
queryMsgByKey Query Message by Key
queryMsgByUniqueKey Query Message by Unique key
queryMsgByOffset Query Message by offset
queryMsgByUniqueKey Query Message by Unique key
printMsg Print Message Detail
sendMsgStatus send msg to broker.
brokerConsumeStats Fetch broker consume stats data
producerConnection Query producer's socket connection and client version
consumerConnection Query consumer's socket connection, client version and subscription
consumerProgress Query consumers's progress, speed
consumerStatus Query consumer's internal data structure
cloneGroupOffset clone offset from other group.
clusterList List all of clusters
topicList Fetch all topic list from name server
updateKvConfig Create or update KV config.
deleteKvConfig Delete KV config.
wipeWritePerm Wipe write perm of broker in all name server
resetOffsetByTime Reset consumer offset by timestamp(without client restart).
updateOrderConf Create or update or delete order conf
cleanExpiredCQ Clean expired ConsumeQueue on broker.
cleanUnusedTopic Clean unused topic on broker.
startMonitoring Start Monitoring
statsAll Topic and Consumer tps stats
syncDocs Synchronize wiki and issue to github.com
allocateMQ Allocate MQ
checkMsgSendRT check message send response time
clusterRT List All clusters Message Send RT
See 'mqadmin help <command>' for more information on a specific command.
更多文档可参考:http://rocketmq.apache.org/docs/quick-start/
rocketmq集群安装可参考https://my.oschina.net/tantexian/blog/698109。
生产者、消费者最佳实践参考http://blog.csdn.net/zhu_tianwei/article/details/40948447。
各种简单、有序、批量、广播、过滤、轮训拉取实例可参考http://rocketmq.apache.org/docs/simple-example/。
rocketmq安装与基本操作的更多相关文章
- RocketMQ安装与部署说明
一.安装说明1.下载安装包,下载地址:https://github.com/alibaba/RocketMQ/releases/download/v3.1.7/alibaba-rocketmq-3.1 ...
- Linux系统下MongoDB的简单安装与基本操作
这篇文章主要介绍了Linux系统下MongoDB的简单安装与基本操作,需要的朋友可以参考下 Mongo DB ,是目前在IT行业非常流行的一种非关系型数据库(NoSql),其灵活的数据存储方式,备 ...
- elk系列1之入门安装与基本操作【转】
preface 我们每天都要查看服务器的日志,一方面是为了开发的同事翻找日志,另一方面是巡检服务器查看日志,而随着服务器数量以及越来越多的业务上线,日志越来越多,人肉运维相当痛苦了,此时,参考现在非常 ...
- RocketMQ 安装
RocketMQ 安装 1.进入目录 cd /usr 2.下载 wget http://mirrors.tuna.tsinghua.edu.cn/apache/rocketmq/4.3.0/rocke ...
- RocketMQ 安装详细说明
原文:RocketMQ 安装详细说明 目录 本文导读 环境说明 RocketMQ 下载 从 Apache 下载 从 GitHub 下载 RocketMQ 安装 文件上传 项目解压 编译部署 Rocke ...
- (转)阿里 RocketMQ 安装与简介
原文:阿里 RocketMQ 安装与简介 一.简介 官方简介: l RocketMQ是一款分布式.队列模型的消息中间件,具有以下特点: l 能够保证严格的消息顺序 l 提供丰富的消息拉取模式 l ...
- RocketMQ安装及入门
本文是作者原创,版权归作者所有.若要转载,请注明出处. 本文RocketMQ版本为rocketmq-all-4.7.0,系统为win10.请各位去官网下载,也可以留言,我发安装包 RocketMQ安装 ...
- rocketMq安装及集群配置
网上关于rocketMq安装.集群配置的文章有很多,作为一个初学者,跟着网上的各种教程安装遇到了各种坑,可谓是一路坎坷.本文记录下rocketMq安装的完整过程.希望对你有一点帮助 安装rocketM ...
- 阿里 RocketMQ 安装与简介
一.简介 官方简介: l RocketMQ是一款分布式.队列模型的消息中间件,具有以下特点: l 能够保证严格的消息顺序 l 提供丰富的消息拉取模式 l 高效的订阅者水平扩展能力 l 实时的 ...
随机推荐
- cookie之三天免登录代码
LoginCookie.java 1 package com.bjsxt.cookie; import java.io.IOException; import java.net.URLDecoder; ...
- mysql set
sql server中变量要先申明后赋值: 局部变量用一个@标识,全局变量用两个@(常用的全局变量一般都是已经定义好的): 申明局部变量语法:declare @变量名 数据类型:例如:declare ...
- python -- 判断给定的参数是否是地理位置的经度和纬度
例子: coordinates = "2.3,-8ui" 无效地理位置 coordinates = "2.3,-8i" 有效地理位置 方法一:使用try...e ...
- 利用python 数据分析入门,详细教程,教小白快速入门
这是一篇的数据的分析的典型案列,本人也是经历一次从无到有的过程,倍感珍惜,所以将其详细的记录下来,用来帮助后来者快速入门,,希望你能看到最后! 需求:对obo文件进行解析,输出为json字典格式 数据 ...
- 关于JS的几个基础题目
1.截取字符串abcdefg的efg alert("abcdefg".substring(4)); 2.判断一个字符串中出现次数最多的字符,统计这个次数 var str = 'as ...
- 浅谈大数据与hadoop家族
按照时间的早晚从大数据出现之前的时代讲到现在.暂时按一个城市来比喻吧,反正Landscape的意思也大概是”风景“的意思. 早在大数据概念出现以前就存在了各种各样的关于数学.统计学.算法.编程语言的研 ...
- urllib2 post请求方式,带cookie,添加请求头
#encoding = utf-8 import urllib2import urllib url = 'http://httpbin.org/post'data={"name": ...
- 【Alpha版本】冲刺阶段——Day5
[Alpha版本]冲刺阶段--Day5 阅读目录 今日进展 问题困难 明日任务 今日贡献量 站立式会议 TODOlist [今日进展] 完成登录类代码 public void LOGIN() { co ...
- 苹果企业版签名分发相关问题,蒲公英签名,fir.im分发,安装ipa设置信任
苹果企业版签名分发相关问题,蒲公英签名,fir.im分发,安装ipa设置信任蒲公英 - 高效安全的内测应用发布.管理平台https://www.pgyer.com/app/signature分发版 2 ...
- System.getSecurityManager()
https://www.cnblogs.com/yiwangzhibujian/p/6207212.html java安全管理器SecurityManager入门 一.文章的目的 这是一篇对Jav ...