参考:
http://rocketmq.apache.org/docs/quick-start/
1.环境
64bit OS, Linux/Unix/Mac is recommended;
64bit JDK 1.8+;
Maven 3.2.x
Git
2.下载代码 /apps/installFile
cd /apps/installFile git clone -b develop https://github.com/apache/incubator-rocketmq.git cd incubator-rocketmq mvn -Prelease-all -DskipTests clean install -U cd distribution/target/apache-rocketmq
3.Start Name Server
cd /apps/installFile/incubator-rocketmq/distribution/target/apache-rocketmq/ nohup sh bin/mqnamesrv & tail -f ~/logs/rocketmqlogs/namesrv.log
4.配置 JAVA_OPT,我的虚拟机配置了 4G内存
cd /apps/installFile/incubator-rocketmq/distribution/target/apache-rocketmq/bin
配置 vi runserver.sh ,
JAVA_OPT="${JAVA_OPT} -server -Xms1g -Xmx1g -Xmn512m -XX:PermSize=128m -XX:MaxPermSize=320m"
配置 vi runbroker.sh
JAVA_OPT="${JAVA_OPT} -server -Xms2g -Xmx2g -Xmn1g"
5.Start Broker
cd /apps/installFile/incubator-rocketmq/distribution/target/apache-rocketmq/ nohup sh bin/mqbroker -n localhost:9876 & tail -f ~/logs/rocketmqlogs/broker.log
6.测试
生产消息
cd /apps/installFile/incubator-rocketmq/distribution/target/apache-rocketmq 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