In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces how to achieve stand-alone deployment of Apache RocketMQ, the article introduces in great detail, has a certain reference value, interested friends must read it!
Download the package
Just download the compiled binaries directly. After downloading them,
> unzip rocketmq-all-4.3.0-bin-release.zip
> cd rocketmq-all-4.3.0-bin-release/
Start name server
> nohup sh bin/mqnamesrv &
Tail check the log to see if it has been started successfully.
> tail-f ~ / logs/rocketmqlogs/namesrv.log
The Name Server boot success...
Start Broker
> nohup sh bin/mqbroker-n localhost:9876 &
Tail check the log to see if it has been started successfully.
> tail-f ~ / logs/rocketmqlogs/broker.log
The broker [% s, 172.30.30.233purl 10911] boot success...
Send and receive messages
For simple testing, we need to set the NAMESRV_ADDR environment variable before sending / receiving messages
> export NAMESRV_ADDR=localhost:9876
Send messages, the way in the test case is to send 1000 messages using a for loop
> sh bin/tools.sh org.apache.rocketmq.example.quickstart.Producer
SendResult [sendStatus=SEND_OK, msgId=...
Receive messages
> sh bin/tools.sh org.apache.rocketmq.example.quickstart.Consumer
SendResult [sendStatus=SEND_OK, msgId=...
Shut down the service > sh bin/mqshutdown broker The mqbroker (36695) is running... Send shutdown request to mqbroker (36695) OK > sh bin/mqshutdown namesrv The mqnamesrv (36664) is running... Send shutdown request to mqnamesrv (36664) OK
So far, we have completed a simple deployment and the sending and receiving of messages, but this is only the sending and receiving of messages under the intranet.
How does FAQ modify the startup memory of name server and broker?
At the beginning, the operation will not start directly according to the steps of the official website, indicating that the memory is insufficient. This is because the default startup JVM memory of name server and broker is 4G, and if the memory is not enough, the startup will fail naturally.
At this point, you need to modify the startup memory parameters of name server and broker.
The startup memory parameters of broker are modified under runbroker.sh and runbroker.cmd under windows
The startup memory parameters of name server are modified under runserver.sh and runserver.cmd under windows
Need to configure public network access how to configure it?
I have seen many students have problems when configuring public network access on the Internet, and most of the tips they get are No Topic Route Info.
This kind of hint usually indicates that the connection has failed.
1.broker does not allow automatic creation of topic, and the corresponding topic for sending messages does not exist
2.broker is not properly connected to name server
3.product is not properly connected to name server
For case 1, just add the autoCreateTopicEnable=true parameter when you start broker.
In case 2, it may be that name server does not exist or port conflicts. For more information, please see the cause of the error in the log.
In case 3, it is generally due to the port. If it is normal to send and receive messages locally on the server but fails to send messages with the client sdk, you can first check whether ports 9876 and 10911 of the local ping server are normal. If it is normal, you can close the vip channel and try again. For JAVA clients, this is the case.
Producer closes VIP channel:
Producer.setVipChannelEnabled (false)
Consumers close the VIP channel:
Consumer.setVipChannelEnabled (false)
Why can we just close the VIP channel? it is because the VIP channel occupies a port, port 10909, while the server's port 10909 is not open to the outside world, so it fails.
Configuration file
This is my broker.properties profile
BrokerClusterName = DefaultCluster brokerName = broker-a brokerId = 0 deleteWhen = 04 fileReservedTime = 48 brokerRole = ASYNC_MASTER flushDiskType = ASYNC_FLUSH brokerIP1=172.17.59.146 brokerIP2=172.17.59.146 namesrvAddr=172.17.59.146:5776 autoCreateTopicEnable=true
Because I do not use the default port 9876, there is also a configuration file for name server, namesrv.conf
ListenPort=5776
You can also download my broker.properties and namesrv.conf directly
When you start name server and broker with your own configuration file, you add a parameter to the specified file-c file path
These are all the contents of the article "how to deploy Apache RocketMQ on a stand-alone machine". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
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.