下载及安装:
1、官网下载最新安装包:
2、上传下载的安装包到对应服务器路径下解压:
[root@qgzmq01 data]# unzip rocketmq-all-5.2.0-bin-release.zip
Archive: rocketmq-all-5.2.0-bin-release.zip
inflating: rocketmq-all-5.2.0-bin-release/LICENSE
inflating: rocketmq-all-5.2.0-bin-release/NOTICE
inflating: rocketmq-all-5.2.0-bin-release/README.md
creating: rocketmq-all-5.2.0-bin-release/benchmark/
inflating: rocketmq-all-5.2.0-bin-release/benchmark/consumer.sh
...
inflating: rocketmq-all-5.2.0-bin-release/lib/jna-4.2.2.jar
inflating: rocketmq-all-5.2.0-bin-release/lib/opentelemetry-exporter-logging-otlp-1.29.0.jar
inflating: rocketmq-all-5.2.0-bin-release/lib/concurrentlinkedhashmap-lru-1.4.2.jar
[root@qgzmq01 data]#
3、进入到解压后的rocketmq的conf路径下
[root@qgzmq01 rocketmq-all-5.2.0-bin-release]# ll
总用量 56
drwxr-xr-x 2 root root 154 2月 11 19:25 benchmark
drwxr-xr-x 4 root root 4096 2月 11 17:53 bin
drwxr-xr-x 8 root root 4096 2月 11 19:25 conf
drwxr-xr-x 2 root root 8192 2月 11 19:25 lib
-rw-r--r-- 1 root root 17327 2月 11 17:53 LICENSE
-rw-r--r-- 1 root root 1338 2月 11 17:53 NOTICE
-rw-r--r-- 1 root root 12265 2月 11 17:53 README.md
[root@qgzmq01 rocketmq-all-5.2.0-bin-release]# cd conf
4、在 conf路径下创建一个broker.properties文件,内容如下(=后边为你运行mq服务器的ip):
brokerIP1=xxx.xx.x.xx
5、进入bin路径下
停止原来版本的rocketmq服务,并启动新版本服务
1、查看当前rocketmq服务的运行情况
[root@qgzmq01 bin]# ps -ef |grep rocketmq
root 7520 7516 0 16:21 pts/2 00:00:00 sh /data/rocketmq-all-5.1.2-bin-release/bin/runserver.sh -Drmq.logback.configurationFile=/data/rocketmq-all-5.1.2-bin-release/conf/rmq.namesrv.logback.xml org.apache.rocketmq.namesrv.NamesrvStartup
root 7604 7520 1 16:21 pts/2 00:00:21 /bin/java -server -Xms4g -Xmx4g -Xmn2g -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:+PrintGCDateStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=30m -XX:-OmitStackTraceInFastThrow -XX:-UseLargePages -cp .:/data/rocketmq-all-5.1.2-bin-release/bin/../conf:/data/rocketmq-all-5.1.2-bin-release/bin/../lib/*: -Drmq.logback.configurationFile=/data/rocketmq-all-5.1.2-bin-release/conf/rmq.namesrv.logback.xml org.apache.rocketmq.namesrv.NamesrvStartup
root 9660 63650 0 16:22 pts/2 00:00:00 sh mqbroker -n 172.23.2.15:9876 -c /data/rocketmq-all-5.1.2-bin-release/conf/broker.properties
root 9664 9660 0 16:22 pts/2 00:00:00 sh /data/rocketmq-all-5.1.2-bin-release/bin/runbroker.sh -Drmq.logback.configurationFile=/data/rocketmq-all-5.1.2-bin-release/conf/rmq.broker.logback.xml org.apache.rocketmq.broker.BrokerStartup -n 172.23.2.15:9876 -c /data/rocketmq-all-5.1.2-bin-release/conf/broker.properties
root 9750 9664 14 16:22 pts/2 00:03:26 /bin/java -server -Xms8g -Xmx8g -XX:+UseG1GC -XX:G1HeapRegionSize=16m -XX:G1ReservePercent=25 -XX:InitiatingHeapOccupancyPercent=30 -XX:SoftRefLRUPolicyMSPerMB=0 -verbose:gc -Xloggc:/dev/shm/rmq_srv_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 -Drocketmq.client.logUseSlf4j=true -cp .:/data/rocketmq-all-5.1.2-bin-release/bin/../conf:/data/rocketmq-all-5.1.2-bin-release/bin/../lib/*: -Drmq.logback.configurationFile=/data/rocketmq-all-5.1.2-bin-release/conf/rmq.broker.logback.xml org.apache.rocketmq.broker.BrokerStartup -n 172.23.2.15:9876 -c /data/rocketmq-all-5.1.2-bin-release/conf/broker.properties
root 50057 63650 0 16:46 pts/2 00:00:00 grep --color=auto rocketmq
[root@qgzmq01 bin]#
2、发现运行的是5.1.2版本,使用如下两个命令,优雅的停掉当前运行的版本
[root@qgzmq01 bin]# sh mqshutdown namesrv
The mqnamesrv(7604) is running...
Send shutdown request to mqnamesrv(7604) OK
[root@qgzmq01 bin]# sh mqshutdown broker
The mqbroker(9750) is running...
Send shutdown request to mqbroker(9750) OK
[1]- 退出 143 nohup ./mqnamesrv(工作目录:/data/rocketmq-all-5.1.2-bin-release/bin)
(当前工作目录:/data/rocketmq-all-5.2.0-bin-release/bin)
[root@qgzmq01 bin]#
3、再次执行查看rocketmq运行情况,发现已正常停运
[root@qgzmq01 bin]# ps -ef |grep rocketmq
root 58485 63650 0 16:48 pts/2 00:00:00 grep --color=auto rocketmq
[root@qgzmq01 bin]#
4、运行最新版本的rocketmq
###单机RocketMq启动:首先启动Name Server,
nohup ./mqnamesrv &
### 启动时,指定ip启动mq
nohup sh mqbroker -n xxx.xx.x.xx:9876 -c /data/rocketmq-all-5.2.0-bin-release/conf/broker.properties &
5、再次查看rocketmq是否正常启动
6、新版服务启动成功,旧版本文件夹可以备份后删除,然后去测试相关功能是否正常即可!