This is the simplest, but also the riskiest mode, that makes the entire service unavailable once the broker restarts or goes down. Production environments are not recommended, but can be used for local testing and development. Here are the steps to build.
1)Start NameServer
### Start Name Server first $ nohup sh mqnamesrv & ### Then verify that the Name Server starts successfully $ tail -f ~/logs/rocketmqlogs/namesrv.log The Name Server boot success...
We can see 'The Name Server boot success.. ' in namesrv.log that indicates the NameServer has been started successfully.
2)Start Broker
### Also start broker first $ nohup sh bin/mqbroker -n localhost:9876 & ### Then verify that the broker is started successfully, for example, the IP of broker is 192.168.1.2 and the name is broker-a $ tail -f ~/logs/rocketmqlogs/Broker.log The broker[broker-a,192.169.1.2:10911] boot success...
We can see ‘The broker[brokerName,ip:port] boot success..’ in Broker.log that indicates the broker has been started successfully.
Multiple master mode means a mode with all master nodes(such as 2 or 3 master nodes) and no slave node. The advantages and disadvantages of this mode are as follows:
The starting steps for multiple master mode are as follows:
1)Start NameServer
### Start Name Server first $ nohup sh mqnamesrv & ### Then verify that the Name Server starts successfully $ tail -f ~/logs/rocketmqlogs/namesrv.log The Name Server boot success...
2)Start the Broker cluster
### For example, starting the first Master on machine A, assuming that the configured NameServer IP is: 192.168.1.1. $ nohup sh mqbroker -n 192.168.1.1:9876 -c $ROCKETMQ_HOME/conf/2m-noslave/broker-a.properties & ### Then starting the second Master on machine B, assuming that the configured NameServer IP is: 192.168.1.1. $ nohup sh mqbroker -n 192.168.1.1:9876 -c $ROCKETMQ_HOME/conf/2m-noslave/broker-b.properties & ...
The boot command shown above is used in the case of a single NameServer.For clusters of multiple NameServer, the address list after the -n argument in the broker boot command is separated by semicolons, for example, 192.168.1.1: 9876;192.161.2: 9876.
Each master node configures more thran one slave nodes, with multiple pairs of master-slave.HA uses asynchronous replication, with a short message delay (millisecond) between master node and slave node.The advantages and disadvantages of this mode are as follows:
The starting steps for multiple master and multiple slave mode are as follows:
1)Start NameServer
### Start Name Server first $ nohup sh mqnamesrv & ### Then verify that the Name Server starts successfully $ tail -f ~/logs/rocketmqlogs/namesrv.log The Name Server boot success...
2)Start the Broker cluster
### For example, starting the first Master on machine A, assuming that the configured NameServer IP is: 192.168.1.1 and port is 9876. $ nohup sh mqbroker -n 192.168.1.1:9876 -c $ROCKETMQ_HOME/conf/2m-2s-async/broker-a.properties & ### Then starting the second Master on machine B, assuming that the configured NameServer IP is: 192.168.1.1 and port is 9876. $ nohup sh mqbroker -n 192.168.1.1:9876 -c $ROCKETMQ_HOME/conf/2m-2s-async/broker-b.properties & ### Then starting the first Slave on machine C, assuming that the configured NameServer IP is: 192.168.1.1 and port is 9876. $ nohup sh mqbroker -n 192.168.1.1:9876 -c $ROCKETMQ_HOME/conf/2m-2s-async/broker-a-s.properties & ### Last starting the second Slave on machine D, assuming that the configured NameServer IP is: 192.168.1.1 and port is 9876. $ nohup sh mqbroker -n 192.168.1.1:9876 -c $ROCKETMQ_HOME/conf/2m-2s-async/broker-b-s.properties &
The above shows a startup command for 2M-2S-Async mode, similar to other nM-nS-Async modes.
In this mode, multiple slave node are configured for each master node and there are multiple pairs of Master-Slave.HA uses synchronous double-write, that is, the success response will be returned to the application only when the message is successfully written into the master node and replicated to more than one slave node.
The advantages and disadvantages of this model are as follows:
The starting steps are as follows:
1)Start NameServer
### Start Name Server first $ nohup sh mqnamesrv & ### Then verify that the Name Server starts successfully $ tail -f ~/logs/rocketmqlogs/namesrv.log The Name Server boot success...
2)Start the Broker cluster
### For example, starting the first Master on machine A, assuming that the configured NameServer IP is: 192.168.1.1 and port is 9876. $ nohup sh mqbroker -n 192.168.1.1:9876 -c $ROCKETMQ_HOME/conf/2m-2s-sync/broker-a.properties & ### Then starting the second Master on machine B, assuming that the configured NameServer IP is: 192.168.1.1 and port is 9876. $ nohup sh mqbroker -n 192.168.1.1:9876 -c $ROCKETMQ_HOME/conf/2m-2s-sync/broker-b.properties & ### Then starting the first Slave on machine C, assuming that the configured NameServer IP is: 192.168.1.1 and port is 9876. $ nohup sh mqbroker -n 192.168.1.1:9876 -c $ROCKETMQ_HOME/conf/2m-2s-sync/broker-a-s.properties & ### Last starting the second Slave on machine D, assuming that the configured NameServer IP is: 192.168.1.1 and port is 9876. $ nohup sh mqbroker -n 192.168.1.1:9876 -c $ROCKETMQ_HOME/conf/2m-2s-sync/broker-b-s.properties &
The above Master and Slave are paired by specifying the same config named “brokerName”, the “brokerId” of the master node must be 0, and the “brokerId” of the slave node must be greater than 0.