安装
unzip rocketmq-all-4.7.0-bin-release.zip
mv rocketmq-all-4.7.0-bin-release /usr/local/rocketmq
启动NameServer
nohup ./mqnamesrv &
查看端口netstat -an | grep 9876
启动Broker
启动报错(测试好像能用先没管)
编辑 bin/runbroker.sh和bin/runserver.sh文件,修改里面的(默认内存太大会报错)
JAVA_OPT="${JAVA_OPT} -server -Xms256m -Xmx256m -Xmn125m"
nohup ./mqbroker -n localhost:9876 &
测试
生产者
export NAMESRV_ADDR=localhost:9876
./tools.sh org.apache.rocketmq.example.quickstart.Producer
消费者
export NAMESRV_ADDR=localhost:9876
./tools.sh org.apache.rocketmq.example.quickstart.Consumer
关闭
./mqshutdown broker
./mqshutdown namesrv