Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Steps for RocketMQ to build a cluster

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

Preparation materials: Linux operating environment (assuming that the two servers ip are 192.168.74.130 and 192.168.74.131); RocketMQJDK 1.8 + modifies the configuration files of the two service RockerMQ respectively, and the path is: rocketmq-4.6.1/conf/2m-2s-async (asynchronous as an example) broker-a.properties (Master configuration file of broker a) broker-a-s.properties (Slave configuration file of broker a)

Broker-b.properties (Master profile for broker b) broker-b-s.properties (Slave profile for broker b)

1330server modifies master of an and slave configuration file of b, 131server modifies master of b and slave configuration file of a

Take the configuration file of 130 as an example:

Master file:

BrokerClusterName=DefaultCluster # broker name brokerName=broker-a # broker id 0-Master other-Slave brokerId=0 deleteWhen=04 FileReservedTime=48 brokerRole=ASYNC_MASTER flushDiskType=ASYNC_FLUSH # namesrv address list Multiple uses, or Split namesrvAddr=192.168.74.130:9876 192.168.74.131broker 9876 # listening port. Default is 10911. Multiple broker ports cannot be the same listenPort=10911 # log. The configuration path of multiple broker on the same server cannot be the same. Otherwise, an error is reported: the service has started storePathRootDir=/data/rocketmq/store/rootdir-a storePathCommitLog=/data/rocketmq/store/commitlog-a

Slave file:

BrokerClusterName=DefaultCluste brokerName=broker-b brokerId=1 deleteWhen=04 fileReservedTime=48 brokerRole=SLAVE flushDiskType=ASYNC_FLUS ListenPort=10921 namesrvAddr=192.168.74.130:9876192.168.74.131:9876 storePathRootDir=/data/rocketmq/store/rootdir-b-s storePathCommitLog=/data/rocketmq/store/commitlog-b-s

Start step

Start the NameSrv of each server (the default port number is 9876)

The master broker-c parameter of nohup sh bin/mqnamesrv &; starting the server for two days respectively specifies the path of the configuration file read at startup, without reading the default configuration file.

Execute the master that starts a broker on nohup sh bin/mqbroker-c. / conf/2m-2s-async/broker-a.properties & / / 130

The master executing startup b broker on nohup sh bin/mqbroker-c. / conf/2m-2s-async/broker-b.properties & / / 131starts the slave broker of two servers respectively.

Execute the slave that launches b broker on nohup sh bin/mqbroker-c. / conf/2m-2s-async/broker-b-s.properties & / / 130

Execute the slave that starts a broker on nohup sh bin/mqbroker-c. / conf/2m-2s-async/broker-b.properties & / / 131,

Use the jps command to see if the service is started

[root@localhost bin] # jps

5329 Jps

3161 NamesrvStartup

3401 BrokerStartup

4509 BrokerStartup

At this point, it started successfully.

Other commands

Close broker: sh bin/mqshutdown broker

Close the namesrv:sh bin/mqshutdown namesrv problem summary:

1. Start broker Times jvm is out of memory

Reason: default jvm memory configuration is higher than physical memory configuration

Solution: modify runbroker.sh and runserver.sh under bin directory

JAVA_OPT= "${JAVA_OPT}-server-Xms256m-Xmx256m-Xmn125m"

JAVA_OPT= "${JAVA_OPT}-server-Xms256m-Xmx256m-Xmn128m-XX:MetaspaceSize=128m-XX:MaxMetaspaceSize=320m"

2.broker cannot register for another namesrv

Reason: the network is unreachable (check the network) check if the firewall is on (turn off the firewall command systemctl stop firewalld)

3. Start multiple broker Times broker has been launched

Reason:

1. No profile specified or no modified profile listening port at startup, resulting in port conflict

two。 No log file path specified or consistent path

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report