windows下RocketMQ安装部署
一.预备环境
1.系统
Windows
- 环境
JDK1.8、Maven、Git
二. RocketMQ部署
1.下载
1.1地址:http://rocketmq.apache.org/release_notes/
http://rocketmq.apache.org/release_notes/
1.2选择一个稳定版本的 ‘Binary’进行下载
1.3解压已下载工程
rocketmq-all-4.9.1-bin-release
配置环境变量 – 变量名:ROCKETMQ_HOME – 变量值:MQ解压路径
- 启动
3.1 启动NAMESERVER
进入至‘MQ文件夹\bin’下,然后执行‘ mqnamesrv.cmd’,启动NAMESERVER。成功后会弹出提示框,此框勿关闭。
3.2 启动BROKER
cmd 进入至‘MQ文件夹\bin’下,然后执行‘ start mqbroker.cmd -n localhost:9876 autoCreateTopicEnable=true & ’,启动BROKER。成功后会弹出提示框,此框勿关闭。
使用RocketMQ进行发消息时,必须要指定topic,对于topic的设置有一个开关autoCreateTopicEnable,一般在开发测试环境中会使用默认设置autoCreateTopicEnable = true,但是这样就会导致topic的设置不容易规范管理,没有统一的审核等等,所以在正式环境中会在Broker启动时设置参数autoCreateTopicEnable = false。这样当需要增加topic时就需要在web管理界面上添加即可。
可以调节一下配置
三. RocketMQ插件部署
- 下载
地址:https://github.com/apache/rocketmq-externals.git
旧版本有console目录
新版本已没有console目录
但项目readme文后面有这么一句
Incubator Projects
RocketMQ Dashboard
Notice: Console has renamed to dashboard and transfered the new repo, it will graduate in the near future, and welcome you to fill in the user due diligence.
之前的rocket-console已经不在这个仓库了,已经创建了一个独立的仓库并命名为RocketMQ Dashboard。新版本前台页面地址为https://github.com/apache/rocketmq-dashboard
下载完成之后,进入‘rocketmq-externals\rocketmq-console\src\main\resources’,或者
rocketmq-dashboard\src\main\resources文件夹
打开‘application.properties’进行配置。
#
# 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.
#
server.address=127.0.0.1
server.port=22222
### SSL setting
#server.ssl.key-store=classpath:rmqcngkeystore.jks
#server.ssl.key-store-password=rocketmq
#server.ssl.keyStoreType=PKCS12
#server.ssl.keyAlias=rmqcngkey
#spring.application.index=true
spring.application.name=rocketmq-dashboard
spring.http.encoding.charset=UTF-8
spring.http.encoding.enabled=true
spring.http.encoding.force=true
logging.level.root=INFO
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=127.0.0.1:9876
#if you use rocketmq version < 3.5.8, rocketmq.config.isVIPChannel should be false.default true
rocketmq.config.isVIPChannel=
#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
#set the message track trace topic if you don't want use the default one
rocketmq.config.msgTrackTopicName=
rocketmq.config.ticketKey=ticket
#Must create userInfo file: ${rocketmq.config.dataPath}/users.properties if the login is required
rocketmq.config.loginRequired=false
#set the accessKey and secretKey if you used acl
#rocketmq.config.accessKey=
#rocketmq.config.secretKey=
rocketmq.config.useTLS=false
我们可以将“server.port=8080” 这个端口配置修改一下,修改成22222.
其次需要注意这里的“rocketmq.config.namesrvAddr=”配置,即需要设置自己的rocketmq的name服务的地址和端口号。默认端口号是9876。
rocketmq.config.namesrvAddr=127.0.0.1:9876
- 编译启动
maven环境变量:
变量名:MAVEN_HOME
变量值:MAVEN路径bin上一级类似java
变量名:Path
变量值:;%MAVEN_HOME%\bin
cmd控制台查看查看maven是否配置成功
进入‘\rocketmq-externals\rocketmq-console’或者‘rocketmq-dashboard’文件夹,执行‘mvn clean package -Dmaven.test.skip=true’,编译生成。
编译成功之后,Cmd进入‘target’文件夹,执行‘java -jar rocketmq-console-ng-1.0.0.jar’,或者‘‘java -jar rocketmq-dashboard-2.0.0.jar’ 启动‘rocketmq-console-ng-1.0.0.jar’或者‘rocketmq-dashboard-2.0.0.jar’。
3.测试
浏览器中输入‘127.0.0.1:配置端口’,成功后即可查看。