在github上的说法来看: Apache RocketMQ是一个分布式消息传递和流媒体平台,具备低延迟,高性能和可靠性,万亿级容量和灵活的可扩展性。它提供了多种功能:java
上面都是官方列举出来了,还有以下特色:git
官方网站: http://rocketmq.apache.org/docs/motivation/ 也对RocketMQ和ActiveMQ以及Kafka作了一个对比.github
参考: http://rocketmq.apache.org/docs/core-concept/ 本人英文阅读能力有点弱,你们请看官方文档.apache
1. 安装unzip命令: yum install unzip 2. 解压: unzip rocketmq-all-4.4.0-source-release.zip 3. 重命名: mv rocketmq-all-4.4.0 rocketmq 4. 进入文件夹: cd rocketmq 5. 使用maven进行源码编译: mvn -Prelease-all -DskipTests clean install -U 6. 进入文件夹: cd distribution/target/apache-rocketmq 7. 启动服务: sh bin/mqnamesrv (注意若是内存小于4G可能会失败)
[root@iZwz94sw188z3yfl7lpmmsZ apache-rocketmq]# sh bin/mqnamesrv Java HotSpot(TM) 64-Bit Server VM warning: Using the DefNew young collector with the CMS collector is deprecated and will likely be removed in a future release Java HotSpot(TM) 64-Bit Server VM warning: UseCMSCompactAtFullCollection is deprecated and will likely be removed in a future release. Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x00000006ec800000, 2147483648, 0) failed; error='Cannot allocate memory' (errno=12) # # There is insufficient memory for the Java Runtime Environment to continue. # Native memory allocation (mmap) failed to map 2147483648 bytes for committing reserved memory. # An error report file with more information is saved as: # /usr/local/software/rocketmq-all- 4.4.0/distribution/target/apache-rocketmq/hs_err_pid8993.log 这种缘由是内存不足致使的,默认是4G,解决办法是编辑 bin/runserver.sh: JAVA_OPT="${JAVA_OPT} -server -Xms256m -Xmx256m -Xmn256m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m"
nohup sh bin/mqnamesrv & 这个命令可能会nohup: ignoring input and appending output to ‘nohup.out’,若是出现这个,执行: tail -f nohup.out 这个时候ctrl+c就不会退出程序,仅仅是让程序后台运行
[root@wangzhi apache-rocketmq]# sh bin/mqbroker -n localhost:9876 Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x00000005c0000000, 8589934592, 0) failed; error='Cannot allocate memory' (errno=12) # # There is insufficient memory for the Java Runtime Environment to continue. # Native memory allocation (mmap) failed to map 8589934592 bytes for committing reserved memory. # An error report file with more information is saved as: # /usr/local/software/rocketmq/distribution/target/apache-rocketmq/hs_err_pid3012.log 出现了Broker内存不足的问题: vim bin/runbroker.sh 修改 JAVA_OPT="${JAVA_OPT} -server -Xms8g -Xmx8g -Xmn4g" 的内容为: JAVA_OPT="${JAVA_OPT} -server -Xms2g -Xmx2g -Xmn1g" 完成以后以守护进程的方式进行启动: nohup sh bin/mqbroker -n localhost:9876 & tail -f nohup.out 这个时候可使用jps查看进程,而且能够根据进程号来kill进程
export NAMESRV_ADDR=localhost:9876 sh bin/tools.sh org.apache.rocketmq.example.quickstart.Producer sh bin/tools.sh org.apache.rocketmq.example.quickstart.Consumer
先修改两个BUG,一个是修改pom.xml的版本号. cd rocketmq-console/ vim pom.xml : 将里面的rocketmq的版本号后面的snashop删掉,只留个4.4.0就好 在上一个console的路径下继续: cd src/main/resources/ vim application.properties : 修改nameserver地址 rocketmq.config.namesrvAddr=127.0.0.1:9876 返回到console目录,进行编译安装: mvn clean package -Dmaven.test.skip
cd target java -jar rocketmq-console-ng-1.0.0.jar 使用ctrl + c关闭程序,以守护进程的方式进行启动 nohup java -jar rocketmq-console-ng-1.0.0.jar & tail -f nohup.out