---
title: "rocketMq实战(4)-集群配置"
author: "chenchangqun"
date: "2016-11-29T18:03:32Z"
tags: []
categories: ["企业架构"]
slug: "rocketmq-4"
draft: false
lastmod: "2016-11-29T18:06:40Z"
id: 2341869
url: "https://chenchangqun.iteye.com/blog/2341869"
---

rocketmq的安装和配置请参照下文，附件中的电子书 用户指南3.2.4第44页有相关内容

http://chenchangqun.iteye.com/admin/blogs/2341749

 

这里讲多主多重异步复制 模式的配置，假设2主2从,2个nameserver，且环境已经配置好,

nameserver都已经启动。

则命令如下

/opt/ali-rocketmq/devenv 是安装 rocketmq 的目录。注意 多个nameserver使用分号 分割

master1启动

nohup sh mqbroker -n "10.103.16.77:9876;10.103.16.15:9876" -c /opt/ali-rocketmq/devenv/conf/2m-2s-async/broker-a.properties &

slave1启动

nohup sh mqbroker -n "10.103.16.77:9876;10.103.16.15:9876" -c /opt/ali-rocketmq/conf/2m-2s-async/broker-a-s.properties &

master2启动

nohup sh mqbroker -n "10.103.16.77:9876;10.103.16.15:9876" -c /opt/ali-rocketmq/devenv/conf/2m-2s-async/broker-b.properties &

slave2启动

nohup sh mqbroker -n "10.103.16.77:9876;10.103.16.15:9876" -c /opt/ali-rocketmq/conf/2m-2s-async/broker-b-s.properties &

目前的rocketmq版本 master挂掉后，不能生产，可以从slave继续消费。

 

执行命令后 可以模拟主或从挂掉来测试一下。