centos 7 安装rocketmq

丈夫欲遂平生志,一载寒窗一举汤。这篇文章主要讲述centos 7 安装rocketmq相关的知识,希望能为你提供帮助。


  • rocketmq官网地址:https://rocketmq.apache.org/dowloading/releases/


文章目录
  • ??一、安装java 1.8??
  • ??二、安装rocketmq 4.9.3??
  • ??2.1 安装rocketmq 4.9.3??
  • ??2.2 测试生产者和消费者??
一、安装java 1.8
  • 更新yum源
yum -y update

  • 安装jdk
yum install java-1.8.0-openjdk

  • 查看版本
# java -version
openjdk version "1.8.0_322"
OpenJDK Runtime Environment (build 1.8.0_322-b06)
OpenJDK 64-Bit Server VM (build 25.322-b06, mixed mode)

  • 设置java_home
找到java路径
# which java
/bin/java

在.bash_profile加入环境变量
# vi /root/.bash_profile
PATH=$PATH:$HOME/bin
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.322.b06-1.el7_9.x86_64/jre
PATH=$PATH:$JAVA_HOME/bin

生效
source /root/.bash_profile

查看
# echo $JAVA_HOME
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.322.b06-1.el7_9.x86_64/jre

二、安装rocketmq 4.9.3 2.1 安装rocketmq 4.9.3
  • 下载rocketmq二进制文件
wget https://dlcdn.apache.org/rocketmq/4.9.3/rocketmq-all-4.9.3-bin-release.zip

  • 解压rocketmq
unzip rocketmq-all-4.9.3-bin-release.zip

  • 启动namesrv
cd rocketmq-4.9.3/
启动命令:nohup sh bin/mqnamesrv -n 服务器内网ip:9876 &
查看日志:tail -f ~/logs/rocketmqlogs/namesrv.log



注:namesrv服务关闭命令


# 关闭
sh bin/mqshutdown namesrv
# The mqnamesrv(36664) is running...
# Send shutdown request to mqnamesrv(36664) OK

  • 启动broker
启动命令:nohup sh bin/mqbroker -n 服务器内网ip:9876 -c conf/broker.conf &
查看日志:tail -f ~/logs/rocketmqlogs/broker.log



注:broker服务关闭命令


# 关闭
sh bin/mqshutdown broker
# The mqbroker(36695) is running...
# Send shutdown request to mqbroker(36695) OK

2.2 测试生产者和消费者
export NAMESRV_ADDR=服务器内网IP:9876
sh bin/tools.sh org.apache.rocketmq.example.quickstart.Producer
sh bin/tools.sh org.apache.rocketmq.example.quickstart.Consumer

topic操作
# 查看所有topic
sh bin/mqadmin topicList -n8.142.157.45:9876



【centos 7 安装rocketmq】


    推荐阅读