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

How to install RocketMQ on CentOS7 system

2025-04-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

This article is about how to install RocketMQ on CentOS7 systems. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

1. Install RocketMQ method 1: download source code, compile and install

Necessary dependencies for installation

Sudo yum install-y unzip

Download the RocketMQ source code

Find the RocketMQ source code: https://github.com/apache/rocketmq.git on GitHub, clone it to the / www/codes directory of the 128server, and execute the install command locally:

[root@bogon codes] # git clone https://github.com/apache/rocketmq.git[root@bogon codes] # mvn-Prelease-all-DskipTests clean install-U [root@bogon codes] # cd distribution/target/apache-rocketmq mode 2: download binaries and install

Go to https://www-eu.apache.org/dist/rocketmq/ or https://www-us.apache.org/dist/rocketmq/ to find the version we want and download it. The latest version of rocketmq-all-4.5.2-bin-release.zip is selected here.

Download and upload the binaries to the / www/tools directory on server 128, and then extract them with the unzip command:

[root@localhost tools] # unzip rocketmq-all-4.5.2-bin-release.zip

Move the extracted files to the / usr/local/sbin/ directory:

[root@localhost tools] # use of mv rocketmq-all-4.5.2-bin-release / usr/local/sbin/2 and RabbitMQ

Resize the memory allocation and modify the bin/runserver.sh file:

# JAVA_OPT= "${JAVA_OPT}-server-Xms4g-Xmx4g-Xmn2g-XX:MetaspaceSize=128m-XX:MaxMetaspaceSize=320m" JAVA_OPT= "${JAVA_OPT}-server-Xms1g-Xmx1g-Xmn512m-XX:MetaspaceSize=128m-XX:MaxMetaspaceSize=320m"

Modify the bin/runbroker.sh file:

# JAVA_OPT= "${JAVA_OPT}-server-Xms8g-Xmx8g-Xmn4g" JAVA_OPT= "${JAVA_OPT}-server-Xms1g-Xmx1g-Xmn512m"

Start the Name Server service:

[root@localhost rocketmq-all-4.5.2-bin-release] # nohup sh bin/mqnamesrv &

After the Name Server service is started, the log is output to the current user's logs directory. You can view the log with the following command:

[root@localhost rocketmq-all-4.5.2-bin-release] # tail-f ~ / logs/rocketmqlogs/namesrv.log

Or cd directly cuts to the log directory of the current user to view:

[root@localhost rocketmq-all-4.5.2-bin-release] # cd [root@localhost ~] # cd logs/rocketmqlogs/ [root@localhost rocketmqlogs] # tail-f namesrv.log

Start the Broker service

[root@localhost rocketmq-all-4.5.2-bin-release] # nohup sh bin/mqbroker-n localhost:9876 &

The log is viewed in the same way as Name Server, which is output to the current user's logs directory

[root@localhost rocketmq-all-4.5.2-bin-release] # tail-f ~ / logs/rocketmqlogs/broker.log

Shutdown service: when starting the service, we start the nameserv service first, and then start the broker service. When shutting down, we need to adjust the order, first shut down the broker service, and then shut down the nameserv service.

[root@localhost rocketmq-all-4.5.2-bin-release] # sh bin/mqshutdown brokerThe mqbroker (12933) is running...Send shutdown request to mqbroker (12933) OK [root@localhost rocketmq-all-4.5.2-bin-release] # sh bin/mqshutdown namesrvThe mqnamesrv (12442) is running...Send shutdown request to mqnamesrv (12442) OK

Alternatively, we can shut down directly in the form of a kill process. Note here that we need to shut down six processes:

[root@localhost rocketmq-all-4.5.2-bin-release] # ps-ef | grep mqroot 12435 11747 0 09:05 pts/0 00:00:00 sh bin/mqnamesrvroot 12439 12435 0 09:05 pts/0 00:00:00 sh / usr/local/sbin/rocketmq-all-4.5.2-bin-release/bin/runserver.sh org.apache.rocketmq.namesrv.NamesrvStartuproot 12442 12439 0 09:05 pts/0 00:00:12 / usr/java/jdk1 .8.0_212-amd64/bin/java-server-Xms1g-Xmx1g-Xmn512m-XX:MetaspaceSize=128m-XX:MaxMetaspaceSize=320m-XX:+UseConcMarkSweepGC-XX:+UseCMSCompactAtFullCollection-XX:CMSInitiatingOccupancyFraction=70-XX:+CMSParallelRemarkEnabled-XX:SoftRefLRUPolicyMSPerMB=0-XX:+CMSClassUnloadingEnabled-XX:SurvivorRatio=8-XX:-UseParNewGC-verbose:gc-Xloggc:/dev/shm/rmq_srv_gc_%p_%t.log-XX:+PrintGCDetails-XX:+UseGCLogFileRotation-XX:NumberOfGCLogFiles=5-XX:GCLogFileSize=30m-XX:-OmitStackTraceInFastThrow-XX:-UseLargePages-Djava.ext.dirs=/usr / java/jdk1.8.0_212-amd64/jre/lib/ext:/usr/local/sbin/rocketmq-all-4.5.2-bin-release/bin/../lib-cp.: / usr/local/sbin/rocketmq-all-4.5.2-bin-release/bin/../conf: org.apache.rocketmq.namesrv.NamesrvStartuproot 12925 11747 0 09:15 pts/0 00:00:00 sh bin/mqbroker-n localhost:9876root 12929 12925 0 09: 15 pts/0 00:00:00 sh / usr/local/sbin/rocketmq-all-4.5.2-bin-release/bin/runbroker.sh org.apache.rocketmq.broker.BrokerStartup-n localhost:9876root 12933 12929 6 09:15 pts/0 00:01:28 / usr/java/jdk1.8.0_212-amd64/bin/java-server-Xms1g-Xmx1g-Xmn512m-XX:+UseG1GC-XX:G1HeapRegionSize=16m-XX:G1ReservePercent=25-XX:InitiatingHeapOccupancyPercent=30-XX:SoftRefLRUPolicyMSPerMB=0-verbose:gc-Xloggc / usr/java/jdk1.8.0_212-amd64/bin/java-server-Xms1g-Xmn512m-XX:G1HeapRegionSize=16m-Xloggc / dev/shm/rmq_broker_gc_%p_%t.log-XX:+PrintGCDetails-XX:+PrintGCDateStamps-XX:+PrintGCApplicationStoppedTime-XX:+PrintAdaptiveSizePolicy-XX:+UseGCLogFileRotation-XX:NumberOfGCLogFiles=5-XX:GCLogFileSize=30m-XX:-OmitStackTraceInFastThrow-XX:+AlwaysPreTouch-XX:MaxDirectMemorySize=15g-XX:-UseLargePages-XX:-UseBiasedLocking-Djava.ext.dirs=/usr/java/jdk1.8.0_212-amd64/jre/lib/ext:/usr/local/sbin/rocketmq-all-4.5.2-bin-release/bin/ .. / lib-cp.: / usr/local/sbin/rocketmq-all-4.5.2-bin-release/bin/../conf: org.apache.rocketmq.broker.BrokerStartup-n localhost:9876root 14154 11747 0 09:38 pts/0 00:00:00 grep-- color=auto mq

You can learn from ps-ef | grep mq that 6 processes need to be shut down in order to kill processes directly by kill, so we recommend using mqshutdown provided by rocketmq to shut down.

Thank you for reading! This is the end of the article on "how to install RocketMQ in CentOS7 system". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!

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

Internet Technology

Wechat

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

12
Report