1.添加阿里云服务器的安全组规则
    将服务器的以下端口开放:9876、10909、10911

    2.修改rocketmq-console的application.properties配置
    #设置RocketMQ对应的公网IP和端口
    rocketmq.config.namesrvAddr=你的IP:9876

    3.修改RocketMQ的配置文件
    #进入rocketmq/conf目录,在broker.conf文件中添加配置
    brokerIP1 = 192.XXX.7.201【宿主机IP,自行修改】
    #加载新修改的配置文件broker.conf重新启动broker(先关闭原有broker)
    nohup sh mqbroker -n 192.XXX.7.201:9876 -c /usr/local/rocketmq/conf/broker.conf &

    最后关闭boker和namesrv服务再重启

    1. # 1.启动Nameserver(首先进入mq安装目录下的bin目录)
    2. nohup sh mqnamesrv &
    3. # 2.查看启动日志
    4. tail -f ~/logs/rocketmqlogs/namesrv.log
    5. # 3.启动Broker(首先进入mq安装目录下的bin目录)
    6. nohup sh mqbroker -n 192.xxx.xxx.xxx:9876 &
    7. # 4.查看启动日志
    8. tail -f ~/logs/rocketmqlogs/broker.log
    9. # 停止RocketMQ命令
    10. nohup sh mqshutdown namesrv
    11. nohup sh mqshutdown broker

    nohup sh bin/mqnamesrv -n 8.131.77.50:9876 &
    nohup sh bin/mqbroker -n 8.131.77.50:9876 -c conf/broker.conf autoCreateTopicEnable=true &

    nohup sh bin/mqbroker -n 172.16.48.48:9876 -c conf/broker.conf autoCreateTopicEnable=true &