软件环境:
centos7.6
jdk1.8
maven3
rocketmq4.2.0
安装unzip zip命令
yum install -y unzip zip
查看下载地址
http://rocketmq.apache.org/dowloading/releases/
下载到/usr/local/software目录
cd /usr/local/software
wget http://mirrors.hust.edu.cn/apache/rocketmq/4.2.0/rocketmq-all-4.2.0-bin-release.zip
unzip -d /usr/local/software/rocketmq rocketmq-all-4.2.0-bin-release.zip
进入rocketmq的bin目录
cd /usr/local/software/rocketmq/bin
由于rocketmq默认配置的jvm内存参数比较高,需根据实际调整进行编辑调整
修改runserver.sh调整如下
JAVA_OPT="${JAVA_OPT} -server -Xms256m -Xmx256m -Xmn128m -XX:PermSize=128m -XX:MaxPermSize=320m"
修改runbroker.sh调整如下
JAVA_OPT="${JAVA_OPT} -server -Xms256m -Xmx256m -Xmn128m
启动NameServer
nohup sh mqnamesrv &
查看启动日志能看到:The Name Server boot success字样则成功
tail -f ~/logs/rocketmqlogs/namesrv.log
启动Broker
注意ip地址要配置成为实际服务的ip地址,保证地址以及端口能够访问
nohup sh mqbroker -n "localhost:9876" -c ../conf/broker.conf > broker.out &
查看启动日志
tail -f ~/logs/rocketmqlogs/broker.log
停止Broker
sh mqshutdown broker
停止NameServer
sh mqshutdown namesrv
开放指定端口
firewall-cmd --zone=public --add-port=9876/tcp --permanent
firewall-cmd --reload
安装配置rocketmq-console控制台
下载地址
https://github.com/apache/rocketmq-externals
cd /usr/local/software
直接去下载压缩包
wget https://github.com/apache/rocketmq-externals/archive/rocketmq-console-1.0.0.tar.gz
tar -zxvf rocketmq-console-1.0.0.tar.gz
进入rocketmq-console目录
修改配置
vim src/main/resources/application.properties
修改web访问端口
server.port=8181
Name Server地址,修改成你自己的服务地址,多个分号隔开
rocketmq.config.namesrvAddr=localhost:9876
server.contextPath=/ server.port=8181 #spring.application.index=true spring.application.name=rocketmq-console spring.http.encoding.charset=UTF-8 spring.http.encoding.enabled=true spring.http.encoding.force=true logging.config=classpath:logback.xml #if this value is empty,use env value rocketmq.config.namesrvAddr NAMESRV_ADDR | now, you can set it in ops page.default localhost:9876 rocketmq.config.namesrvAddr=localhost:9876 #if you use rocketmq version < 3.5.8, rocketmq.config.isVIPChannel should be false.default true rocketmq.config.isVIPChannel=true #rocketmq-console's data path:dashboard/monitor rocketmq.config.dataPath=/tmp/rocketmq-console/data #set it false if you don't want use dashboard.default true rocketmq.config.enableDashBoardCollect=true
进入rocketmq-console目录
mvn clean package -Dmaven.test.skip=true
执行完成,会多出一个target目录。在target下生成了需要运行的jar包
开放指定端口
firewall-cmd --zone=public --add-port=8181/tcp --permanent
firewall-cmd --reload
nohup java -jar target/rocketmq-console-ng-1.0.0.jar >> rocketmq-console.log 2>&1 &
启动后访问http://ip:刚刚设置的端口