First, installation instructions
1. Download the installation package: Https://github.com/alibaba/RocketMQ/releases/download/v3.1.7/alibaba-rocketmq-3.1.7.tar.gz.
2. Unzip the installation package to the specified directory.
3. References:
ROCKETMQ Management Class Command summary: Http://alibaba.github.io/RocketMQ-docs/document/openuser/RocketMQ_admin.pdf
II. Deployment Notes
(a) nameserver
1. Parameter configuration
(1) Default boot port: 9876, no additional configuration
2. Start and close
(1) Start Nameserver:nohup Mqnamesrv &
(2) In the production environment deployment, please refer to the following hardware and software requirements: https://github.com/alibaba/RocketMQ/wiki/system_requirements
(ii) Brokerserver
1. Parameter configuration
(1) Get broker default configuration: SH mqbroker-m
(2) How to load the configuration at startup:
A. Generate broker default configuration template: Sh mqbroker-m > BROKER.P
B. Modifying a configuration file BROKER.P
C. Load the modified configuration file: Nohup sh mqbroker-c broker.p
(3) configuration file Option description
Listenportbroker Listening port for external service (default: 10911, no modification recommended)
Namesrvaddrnameserver Address
BROKERIP1 native IP address, the default system is automatically recognized, but some multi-network card machine will have a recognition error situation, in this case can be manually set
Brokername Native Host Name
Which cluster brokerclusternamebroker belongs to (default value: Defaultcluster)
Brokeridbrokerid, must be an integer greater than or equal to 0, 0 means master,>0 represents slave, one master can hang multiple slave,master and slave to pair by brokername
Autocreatetopicenable whether the broker is allowed to create topic automatically, it is recommended to turn it off offline (default value: TRUE)
Autocreatesubscriptiongroup allow Broker to create subscription groups automatically, suggest offline on, offline off (default: TRUE)
Rejecttransactionmessage whether transaction message access is denied (default: FALSE)
Fetchnamesrvaddrbyaddressserver if the name server address is obtained from the Web server, this method is recommended for large-scale broker clusters (default: FALSE)
Storepathcommitlogcommitlog Storage Path (default: $HOME/store/commitlog)
Storepathconsumequeue Consumption queue storage path (default: $HOME/store/consumequeue)
Storepahtindex Message Index Storage path (default: $HOME/store/index)
Storecheckpointcheckpoint File Store path (default: $HOME/store/checkpoint)
Abortfileabort File Store path (default: $HOME/store/abort)
Deletewhen Delete file point in time, default 4 o'clock in the morning (default: 4)
Filereservedtime file retention time, default 48 hours (default: 48)
Maxtransferbytesonmessageinmemory maximum number of bytes transferred in a single pull message (memory) (default: 262114)
Maxtransfercountonmessageinmemory Maximum number of bars (default: 32) for a single pull message (memory) transfer
Maxtransferbytesonmessageindisk maximum number of bytes transferred for a single pull message (disk) (default: 65536)
Maxtransfercountonmessageindisk maximum number of bars transferred (default: 8) for a single pull message (disk)
Messageindexenable whether the message indexing feature is turned on (default: TRUE)
Messageindexsafe whether to provide a secure message indexing mechanism, the index guarantee is not lost (default: FALSE)
Hamasteraddress set the master address directly on slave, which is automatically obtained from name server by default, or can be manually forced to configure
Brokerrolebroker role, Async_master asynchronous copy master, Sync_master synchronous Dual Write master, SLAVE (default: Async_master)
Flushdisktype Brush Disc mode, Async_flush asynchronous brush disk, Sync--flush synchronous brush Disk (default: Async_flush)
Cleanfileforciblyenable true if disk is full and no expiration file is forced to delete files, priority guaranteed service available, False Mark Service unavailable, File not deleted (default: TRUE)
2. Start and close
(1) Start: Mode 1:mqbroker-n "192.168.0.1:9876;192.168.0.2:9876" (IP, port refers to nameserver IP and port)
Mode 2: Set environment variables before starting export namesrv_addr=127.0.0.1:9876, start broker:nohup sh mqbroker &
(2) Restart: sh mqadmin wipewriteperm-b brokername-n namesrvaddr
The broker restart may cause the message sent to this machine to fail, ROCKETMQ provides an elegant way to close the broker, by executing the above command will clear the broker's write permissions, after 40s, all clients will update the broker routing information, Closing the broker at this point will not cause the message to fail because all messages are sent to the other broker.
(iii) Broker cluster deployment
1. Individual master (single master)
Start nameserver and broker, no configuration required
2. Multi-Master mode (no slave, all master)
A. Start name Server:nohup sh mqnamesrv &
B. Start the first master:nohup sh mqbroker-n 192.168.1.1:9876-c $ROCKETMQ _home/conf/2m-noslave/broker-a.properties on Machine A &
C. Start a second master:nohup sh mqbroker-n 192.168.1.1:9876-c on machine b $ROCKETMQ _home/conf/2m-noslave/broker-b.properties &
3. Multi-master multi-slave mode, asynchronous replication
A. Start name Server:nohup sh mqnamesrv &
B. Start the first master:nohup sh mqbroker-n 192.168.1.1:9876-c $ROCKETMQ _home/conf/2m-2s-async/broker-a.properties on Machine A &
C. Start a second master:nohup sh mqbroker-n 192.168.1.1:9876-c on machine b $ROCKETMQ _home/conf/2m-2s-async/broker-b.properties &
D. Start the first slave:nohup sh mqbroker-n 192.168.1.1:9876-c $ROCKETMQ _home/conf/2m-2s-async/broker-a-s.properties on machine C &
E. Start a second slave:nohup sh mqbroker-n 192.168.1.1:9876-c $ROCKETMQ _home/conf/2m-2s-async/broker-b-s.properties on machine D &
4. Multi-master multi-slave mode, synchronous double write
A. Start name Server:nohup sh mqnamesrv &
B. Start the first master:nohup sh mqbroker-n 192.168.1.1:9876-c $ROCKETMQ _home/conf/2m-2s-sync/broker-a.properties on Machine A &
C. Start a second master:nohup sh mqbroker-n 192.168.1.1:9876-c on machine b $ROCKETMQ _home/conf/2m-2s-sync/broker-b.properties &
D. Start the first slave:nohup sh mqbroker-n 192.168.1.1:9876-c $ROCKETMQ _home/conf/2m-2s-sync/broker-a-s.properties on machine C &
E. Start a second slave:nohup sh mqbroker-n 192.168.1.1:9876-c $ROCKETMQ _home/conf/2m-2s-sync/broker-b-s.properties on machine D &
Note: The above broker is paired with slave by specifying the same brokername parameter, and the master Brokerid must be 0,slave Brokerid must be greater than 0. Another master can mount multiple slave, and multiple slave under the same master are differentiated by specifying different brokerid.
$ROCKETmQ _host refers to the ROCKETMQ installation directory, you need to set this environment variable manually.
ROCKETMQ Installation and deployment instructions