在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