In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the relevant knowledge of "how to install RocketMQ 4.7.1 in CentOS7". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Installation process
OpenJDK 8 is installed on the server and JAVA_HOME is set up.
Download and extract RocketMQ
Find the link to download RocketMQ 4.7.1 on the RocketMQ website and download and extract RocketMQ:
# download wget http://ftp.cuhk.edu.hk/pub/packages/apache.org/rocketmq/4.7.1/rocketmq-all-4.7.1-bin-release.zip # extract unzip rocketmq-all-4.7.1-bin-release.zip # install to / usr/local/rocketmq mv rocketmq-all-4.7.1-bin-release / usr/local ln-s / usr/local/rocketmq-all-4.7.1-bin-release / usr/local/rocketmq
Reduce the JVM size of RocketMQ
The default JVM of RocketMQ is too large to be used in a development test environment, and the JVM size needs to be reduced.
In the RocketMQ installation directory (/ usr/local/rocketmq in this example), look for the JVM parameter setting in the sh script:
Find. -name'* .sh'| xargs egrep 'Xms'
You need to modify the JVM parameters of the following sh script:
Bin/runserver.sh bin/runbroker.sh bin/tools.sh
Remember to back up the corresponding script before modification, and the specific JVM size is set according to the actual situation.
-bin/runserver.sh
Before modification:
JAVA_OPT= "${JAVA_OPT}-server-Xms4g-Xmx4g-Xmn2g-XX:MetaspaceSize=128m-XX:MaxMetaspaceSize=320m"
After modification:
JAVA_OPT= "${JAVA_OPT}-server-Xms256m-Xmx256m-Xmn128m-XX:MetaspaceSize=128m-XX:MaxMetaspaceSize=320m"
-bin/runserver.sh
Before modification:
JAVA_OPT= "${JAVA_OPT}-server-Xms4g-Xmx4g-Xmn2g-XX:MetaspaceSize=128m-XX:MaxMetaspaceSize=320m"
After modification:
JAVA_OPT= "${JAVA_OPT}-server-Xms256m-Xmx256m-Xmn128m-XX:MetaspaceSize=128m-XX:MaxMetaspaceSize=320m"
-before bin/tools.sh modification:
JAVA_OPT= "${JAVA_OPT}-server-Xms1g-Xmx1g-Xmn256m-XX:MetaspaceSize=128m-XX:MaxMetaspaceSize=128m"
After modification:
JAVA_OPT= "${JAVA_OPT}-server-Xms256m-Xmx256m-Xmn128m-XX:MetaspaceSize=128m-XX:MaxMetaspaceSize=128m"
Start Name Server
# launch nohup sh bin/mqnamesrv > / dev/null 2 > & 1 & at backend
The default port of Name Server is 9876. Run sh bin/mqnamesrv-p to view the configuration items of Name Server, and you can specify the configuration file to start with-c namesrv.conf.
The default log path of RocketMQ is `~ / logs/rocketmqlogs/ ``
You can save the startup Name Server command as a script to facilitate the next launch.
Start Broker
You need to specify the Name Server to connect to when you start Broker:
# launch nohup sh bin/mqbroker-n localhost:9876 > / dev/null 2 > & 1 & in the background
You can save the startup Broker command as a script to facilitate the next launch.
View RocketMQ processes
Ps-ef | grep-v grep | grep rocketmq
Test RocketMQ
Test sending and receiving messages
Use the message producer and consumer examples that come with RocketMQ to test sending and receiving messages:
Export NAMESRV_ADDR=localhost:9876 sh bin/tools.sh org.apache.rocketmq.example.quickstart.Producer sh bin/tools.sh org.apache.rocketmq.example.quickstart.Consumer
Close RocketMQ
Close Broker
Sh bin/mqshutdown broker
You can save the close Broker command as a script to facilitate the next shutdown.
Close Name Server
Sh bin/mqshutdown namesrv
You need to turn off Broker before shutting down Name Server
You can save the close Name Server command as a script to facilitate the next shutdown.
Modify the port of Name Server
The default port of RocketMQ Name Server is 9876, and the port of Name Server can be modified in the following ways:
Hongmeng official Strategic Cooperation to build HarmonyOS Technology Community
Add a new Name Server configuration file namesrv.conf, which is saved as follows:
ListenPort=10076
two。 Specify a profile when you start Name Server:
Nohup sh bin/mqnamesrv-c namesrv.conf > / dev/null 2 > & 1 &
3. View the RocketMQ process:
Ps-ef | grep rocketmq
4. View the port number of RocketMQ Name Server:
Netstat-tnlp | grep
5. The modified Broker needs to specify a new Name Server address (port).
Install the RocketMQ console
Clone the rocketmq-externals project and compile rocketmq-console.
Example of the command:
Git clone https://github.com/apache/rocketmq-externals.git cd rocketmq-externals/rocketmq-console mvn clean package-Dmaven.test.skip=true
Put target/rocketmq-console-ng*.jar in the and RocketMQ installation directory (/ usr/local/rocketmq in this example).
Create a new script to start the RocketMQ console under the RocketMQ installation directory to start the RocketMQ console:
Nohup java-jar rocketmq-console-ng*.jar-server.port=8080-rocketmq.config.namesrvAddr=localhost:9876 > / dev/null 2 > & 1 &
The default RocketMQ console does not require a password to log in. Please refer to the RocketMQ usage documentation for configuration.
Troubleshooting
Question1: start Name Server and Broker, or test Times error Please set the JAVA_HOME variable in your environment, We need java (x64)! But the system has OpenJDK8 installed and JAVA_HOME has been set up.
Solution: run which java to see the path to java, such as / usr/bin/java.
Modify bin/runserver.sh and bin/runbroker.sh and bin/tools.sh, comment out the check JAVA_HOME statement, and specify the JAVA path explicitly:
# [!-e "$JAVA_HOME/bin/java"] & & JAVA_HOME=$HOME/jdk/java # [!-e "$JAVA_HOME/bin/java"] & & JAVA_HOME=/usr/java # [!-e "$JAVA_HOME/bin/java"] & & error_exit "Please set the JAVA_HOME variable in your environment We need java (x64)! that's all for "# export JAVA_HOME export JAVA=" / usr/bin/java "how to install RocketMQ 4.7.1 in CentOS7". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.