官網快速入門地址:http://rocketmq.apache.org/docs/quick-start/mysql
rocketmq4.2下載地址:https://www.apache.org/dyn/closer.cgi?path=rocketmqlinux
http://mirror.bit.edu.cn/apache/rocketmq/4.2.0/nginx
須要安裝maven和jdk8 linux系統須要64位(32位的不行)redis
建立目錄/opt/rocketmq4.2sql
[root@bogon opt]# pwd
/opt
[root@bogon opt]# ls
ipvsadm kafka10 keepalived1.2.18 maven3.5 mongodb3.2.1 mysql nginx1.6.2 redis4 rh tomcat8
[root@bogon opt]# mkdir rocketmq4.2
[root@bogon opt]# cd rocketmq4.2/
[root@bogon rocketmq4.2]# pwd
/opt/rocketmq4.2
[root@bogon rocketmq4.2]# mongodb
上傳文件rocketmq-all-4.2.0-source-release.zipshell
解壓apache
[root@bogon rocketmq4.2]# unzip rocketmq-all-4.2.0-source-release.ziptomcat
編譯mvn -Prelease-all -DskipTests clean install -U服務器
cd distribution/target/apache-rocketmq
> nohup sh bin/mqnamesrv &
> tail -f ~/logs/rocketmqlogs/namesrv.log
The Name Server boot success...
若是服務器內存不夠,能夠修改runserver.sh腳本(mqnamesrv文件中經過runserver.sh腳本調用Name Server的主函數com.alibaba.rocketmq.namesrv.NamesrvStartup啓動Name Server)中的JAVA_OPT參數
> nohup sh bin/mqbroker -n localhost:9876 &
> tail -f ~/logs/rocketmqlogs/broker.log
The broker[%s, 172.30.30.233:10911] boot success...
若是服務器內存不夠,能夠修改runbroker.sh腳本(mqbroker文件中經過runbroker.sh腳本調用Broker的主函數com.alibaba.rocketmq.broker.BrokerStartup啓動Broker)的JAVA_OPT參數
JAVA_OPT_="-server -Xms4g -Xmx4g -Xmn2g -XX:PermSize=128m -XX:MaxPermSize=320m"
This quick start guide is a detailed instruction of setting up RocketMQ messaging system on your local machine to send and receive messages.
The following softwares are assumed installed:
Click here to download the 4.2.0 source release. Also you could download a binary release from here.
Now execute the following commands to unpack 4.2.0 source release and build the binary artifact.
> unzip rocketmq-all-4.2.0-source-release.zip
> cd rocketmq-all-4.2.0/ > mvn -Prelease-all -DskipTests clean install -U > cd distribution/target/apache-rocketmq
> nohup sh bin/mqnamesrv &
> tail -f ~/logs/rocketmqlogs/namesrv.log
The Name Server boot success...
> nohup sh bin/mqbroker -n localhost:9876 &
> tail -f ~/logs/rocketmqlogs/broker.log
The broker[%s, 172.30.30.233:10911] boot success...
Before sending/receiving messages, we need to tell clients the location of name servers. RocketMQ provides multiple ways to achieve this. For simplicity, we use environment variable NAMESRV_ADDR
> export NAMESRV_ADDR=localhost:9876 > sh bin/tools.sh org.apache.rocketmq.example.quickstart.Producer SendResult [sendStatus=SEND_OK, msgId= ... > sh bin/tools.sh org.apache.rocketmq.example.quickstart.Consumer ConsumeMessageThread_%d Receive New Messages: [MessageExt...
> 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
This quick start guide is a detailed instruction of setting up RocketMQ messaging system on your local machine to send and receive messages.
The following softwares are assumed installed:
Click here to download the 4.2.0 source release. Also you could download a binary release from here.
Now execute the following commands to unpack 4.2.0 source release and build the binary artifact.
> unzip rocketmq-all-4.2.0-source-release.zip
> cd rocketmq-all-4.2.0/ > mvn -Prelease-all -DskipTests clean install -U > cd distribution/target/apache-rocketmq
> nohup sh bin/mqnamesrv &
> tail -f ~/logs/rocketmqlogs/namesrv.log
The Name Server boot success...
> nohup sh bin/mqbroker -n localhost:9876 &
> tail -f ~/logs/rocketmqlogs/broker.log
The broker[%s, 172.30.30.233:10911] boot success...
Before sending/receiving messages, we need to tell clients the location of name servers. RocketMQ provides multiple ways to achieve this. For simplicity, we use environment variable NAMESRV_ADDR
> export NAMESRV_ADDR=localhost:9876 > sh bin/tools.sh org.apache.rocketmq.example.quickstart.Producer SendResult [sendStatus=SEND_OK, msgId= ... > sh bin/tools.sh org.apache.rocketmq.example.quickstart.Consumer ConsumeMessageThread_%d Receive New Messages: [MessageExt...
> 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