Centos7.6安装RocketMQ4.9.2并配置开机自启

简介: Centos7.6安装RocketMQ4.9.2并配置开机自启

1、下载RocketMQ

编译后的压缩包

wget https://dlcdn.apache.org/rocketmq/4.9.2/rocketmq-all-4.9.2-bin-release.zip

如网络情况不佳,使用上传工具,上传压缩包到服务器。

2、解压

unzip rocketmq-all-4.9.2-bin-release.zip

3、进入解压文件夹

cd rocketmq-all-4.9.2/

4、编辑配置文件/usr/local/rocketmq/conf/broker.conf

# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
#  Unless required by applicable law or agreed to in writing, software
#  distributed under the License is distributed on an "AS IS" BASIS,
#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#  See the License for the specific language governing permissions and
#  limitations under the License.
 
brokerClusterName = DefaultCluster
brokerName = broker-a
brokerIP1=192.168.0.130
brokerIP2=192.168.0.130
namesrvAddr = 192.168.0.130:9876
brokerId = 0
deleteWhen = 04
fileReservedTime = 48
brokerRole = ASYNC_MASTER
flushDiskType = ASYNC_FLUSH 
#autoCreateTopicEnable=true
 

5、配置占用内存大小

修改booker、server、tools里边配置的占用内存大小

6、配置开机自启

rocketmqname.service

[Unit]
Description=rocketmq-nameserver
Documentation=http://mirror.bit.edu.cn/apache/rocketmq/
After=network.target
 
[Service]
Type=sample
User=root
ExecStart=/usr/local/rocketmq/bin/mqnamesrv
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
Restart=0
LimitNOFILE=65536
 
[Install]
WantedBy=multi-user.target

rocketmqbroker.service

[Unit]
Description=rocketmq-broker
Documentation=http://mirror.bit.edu.cn/apache/rocketmq/
After=network.target
 
[Service]
Type=sample
User=root
#ExecStart=/usr/local/rocketmq/bin/mqbroker -c /usr/local/rocketmq/conf/2m-noslave/broker-b.properties
#/usr/local/rocketmq/conf/2m-2s-async/broker-a.properties
ExecStart=/usr/local/rocketmq/bin/mqbroker -c /usr/local/rocketmq/conf/broker.conf
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
Restart=0
LimitNOFILE=65536
 
[Install]
WantedBy=multi-user.target

开启开机自启

systemctl daemon-reload
systemctl start rocketmqname.service
systemctl start rocketmqbroker.service
 
systemctl enable rocketmqname.service
systemctl enable rocketmqbroker.service
 

7、验证

ps -ef|grep java
jps

相关实践学习
RocketMQ一站式入门使用
从源码编译、部署broker、部署namesrv,使用java客户端首发消息等一站式入门RocketMQ。
消息队列 MNS 入门课程
1、消息队列MNS简介 本节课介绍消息队列的MNS的基础概念 2、消息队列MNS特性 本节课介绍消息队列的MNS的主要特性 3、MNS的最佳实践及场景应用 本节课介绍消息队列的MNS的最佳实践及场景应用案例 4、手把手系列:消息队列MNS实操讲 本节课介绍消息队列的MNS的实际操作演示 5、动手实验:基于MNS,0基础轻松构建 Web Client 本节课带您一起基于MNS,0基础轻松构建 Web Client
目录
相关文章
|
2天前
|
消息中间件 Linux
Centos安装RabbitMQ
Centos安装RabbitMQ
10 3
|
2天前
|
消息中间件 Ubuntu 数据安全/隐私保护
Ubuntu上安装RabbitMQ
Ubuntu上安装RabbitMQ
7 1
|
2天前
|
Linux Docker 容器
Centos8安装Docker
Centos8安装Docker
17 1
|
2天前
|
Linux 测试技术 开发工具
CentOS Linux 8使用阿里源(安装jdk11、git测试)
CentOS Linux 8使用阿里源(安装jdk11、git测试)
14 1
|
23小时前
|
消息中间件 Java RocketMQ
教程:Spring Boot整合RocketMQ的配置与优化
教程:Spring Boot整合RocketMQ的配置与优化
|
1天前
|
缓存 Linux Docker
CentOS 7 下安装 Docker 及配置阿里云加速服务
CentOS 7 下安装 Docker 及配置阿里云加速服务
23 0
|
2天前
|
Java Linux
Centos安装openjdk11并配置JAVA_HOME
Centos安装openjdk11并配置JAVA_HOME
7 0
|
2天前
|
Linux
centos如何安装libssl-dev libsdl-dev libavcodec-dev libavutil-dev ffmpeg
centos如何安装libssl-dev libsdl-dev libavcodec-dev libavutil-dev ffmpeg
6 0
|
消息中间件 Java Shell
在CentOS7上安装RocketMQ 4.8.0
本文是博主在CentOS7上安装RocketMQ 4.8.0的记录,希望对大家有所帮助。
716 0
|
消息中间件 Shell Apache
CentOS7.0 安装 RocketMq
首先要安装mavenhttps://www.jianshu.com/p/d41f0504e7a9和jdkhttps://www.jianshu.com/p/89cd77509a4b wget https://github.
1348 0