rocketmq单机和集群的启动方式

背景:最近项目组选择了rocketmq作为消息中间件,测试环境的后台日志出现异常报错:9876端口unkown,推测可能的两个原因:

1、端口被临时屏蔽(因测试机器为同一区域,不太可能设置防火墙)

2、rocketmq异常挂机,需要对rocketmq进行重启。


单机启/停方式:

1、rocketmq的启动

进入rocketMQ解压目录下的bin文件夹

启动namesrv服务:nohup sh bin/mqnamesrv & 

//日志目录:{rocketMQ解压目录}/logs/rocketmqlogs/namesrv.log

启动broker服务:nohup sh bin/mqbroker &

//日志目录:{rocketMQ解压目录}/logs/rocketmqlogs/broker.log

以上的启动日志可以在启动目录下的nohub.out中看到

2、rocketmq服务关闭

关闭namesrv服务:sh bin/mqshutdown namesrv

关闭broker服务 :sh bin/mqshutdown broker


集群的启/停方式:

集群部署了两主两从,按照顺序分别启动主和从,命令如下:

nohup sh mqbroker -c /home/testx/rocketMQ/rocketmq-all-4.2.0/distribution/target/apache-rocketmq/conf/2m-2s-async/broker-a.properties >~/logs/rocketmqlogs/broker.log autoCreateTopicEnable=true &

nohup sh mqbroker -c /home/testx/rocketMQ/rocketmq-all-4.2.0/distribution/target/apache-rocketmq/conf/2m-2s-async/broker-b.properties >~/logs/rocketmqlogs/broker.log autoCreateTopicEnable=true &

nohup sh mqbroker -c /home/testx/rocketMQ/rocketmq-all-4.2.0/distribution/target/apache-rocketmq/conf/2m-2s-async/broker-a-s.properties >~/logs/rocketmqlogs/broker.log autoCreateTopicEnable=true &

nohup sh mqbroker -c /home/testx/rocketMQ/rocketmq-all-4.2.0/distribution/target/apache-rocketmq/conf/2m-2s-async/broker-b-s.properties >~/logs/rocketmqlogs/broker.log autoCreateTopicEnable=true &

你可能感兴趣的:(rocketmq单机和集群的启动方式)