1, Download from the official website
This time, the current new release version is selected: 4.9.2. Download the binary version of the compressed package.
Or directly Click download
In Linux environment, use the following command to download:
wget https://dlcdn.apache.org/rocketmq/4.9.2/rocketmq-all-4.9.2-bin-release.zip
2, Windows environment installation (stand-alone) deployment
1. Confirm the Java environment
That is, whether your Java environment variables are normal.
2. Unzip & configure ROCKETMQ_HOME
Unzip the compressed package downloaded from the official website to a specified directory:
The directory I use here is D:\software\rocketmq\rocketmq-4.9.2
Then you need to configure the environment variable ROCKETMQ_HOME. As shown in the figure below:
3. Start nameserver
Switch to the bin file in the installation directory and open the cmd command window:
D:\software\rocketmq\rocketmq-4.9.2\bin>start mqnamesrv.cmd
A command window may then pop up, as follows:
Java HotSpot(TM) Server VM warning: Using the DefNew young collector with the CMS collector is deprecated and will likely be removed in a future release Java HotSpot(TM) Server VM warning: UseCMSCompactAtFullCollection is deprecated and will likely be removed in a future release. Error occurred during initialization of VM Could not reserve enough space for 2097152KB object heap D:\software\rocketmq\rocketmq-4.9.2\bin>
This is because the memory allocated at startup is too large. It needs to be modified:
Find runserver.cmd and runbroker.cmd in the bin directory and edit their contents.
3.1 edit the runserver.cmd file
If there are no problems such as insufficient memory, you can bypass the contents of 3.1 and 3.2.
Find the location of java memory configured in the original file:
set "JAVA_OPT=%JAVA_OPT% -server -Xms2g -Xmx2g -Xmn1g -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m"
Manually modify it a little smaller. I modify it here as:
set "JAVA_OPT=%JAVA_OPT% -server -Xms256m -Xmx256m -Xmn128m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m"
3.2 edit the runbroker.cmd file
If there are no problems such as insufficient memory, you can bypass the contents of 3.1 and 3.2.
Find the location of java memory configured in the original file:
set "JAVA_OPT=%JAVA_OPT% -server -Xms2g -Xmx2g"
Manually modify it a little smaller. I modify it here as:
set "JAVA_OPT=%JAVA_OPT% -server -Xms256m -Xmx256m"
Finally, use the command: start mqnamesrv.cmd again to start.
When the following contents are output, it indicates that the nameserver has been started successfully:
Java HotSpot(TM) Server VM warning: Using the DefNew young collector with the CMS collector is deprecated and will likely be removed in a future release Java HotSpot(TM) Server VM warning: UseCMSCompactAtFullCollection is deprecated and will likely be removed in a future release. The Name Server boot success. serializeType=JSON
Note that after successful startup, the command window that outputs the above information cannot be closed!
4. Start the broker
Switch to the bin directory, open a new command window, and execute the following commands:
start mqbroker.cmd -n 127.0.0.1:9876 autoCreateTopicEnable=true
If not, the following message appears:
Invalid maximum direct memory size: -XX:MaxDirectMemorySize=15g The specified size exceeds the maximum representable size. Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit.
The following modifications are required:
Edit runbroker.cmd to reduce the size of MaxDirectMemorySize to 1g
Start again. The following message indicates success:
The broker[DESKTOP-R7J3BHB, 172.173.173.69:10911] boot success. serializeType=JSON and name server is 127.0.0.1:9876
5. Verification
5.1 create topic
Use the command mqadmin updateTopic -b 127.0.0.1:10911 -t topicname_fbb360 -n 127.0.0.1:9876
The 10911 port corresponds to the broker port, topicname_fbb360 is the subject name I specified.
D:\software\rocketmq\rocketmq-4.9.2\bin>mqadmin updateTopic -b 127.0.0.1:10911 -t topicname_fbb360 -n 127.0.0.1:9876 RocketMQLog:WARN No appenders could be found for logger (io.netty.util.internal.InternalThreadLocalMap). RocketMQLog:WARN Please initialize the logger system properly. create topic to 127.0.0.1:10911 success. TopicConfig [topicName=topicname_fbb360, readQueueNums=8, writeQueueNums=8, perm=RW-, topicFilterType=SINGLE_TAG, topicSysFlag=0, order=false]
5.2 viewing topic
Using the command: mqadmin topicList -n 127.0.0.1:9876
D:\software\rocketmq\rocketmq-4.9.2\bin>mqadmin topicList -n 127.0.0.1:9876 RocketMQLog:WARN No appenders could be found for logger (io.netty.util.internal.InternalThreadLocalMap). RocketMQLog:WARN Please initialize the logger system properly. SCHEDULE_TOPIC_XXXX RMQ_SYS_TRANS_HALF_TOPIC DefaultCluster_REPLY_TOPIC BenchmarkTest OFFSET_MOVED_EVENT DESKTOP-R7J3BHB topicname_fbb360 TBW102 SELF_TEST_TOPIC DefaultCluster
3, Linux environment installation (stand-alone) deployment
// TODO to be added
Reference first: https://blog.csdn.net/wc1695040842/article/details/99941664