一、下载 打开
[https://activemq.apache.org/](https://activemq.apache.org/)
, 点击下载最新版本
二、解压到你的任意一个盘
三、创建一个broker实例
需要cd进入你的bin目录下打开cmd,artemis create ../myboker1
,../myboker1 是创建的路径,当然你也可以下绝对路径/相对路径,myboker1是创建的文件夹的名字,你可以随便写,不过大家都是程序员想必大家都明白,最后别使用汉字空格全角符号这些东西当作文件夹名,否则各种神奇的bug让你痛不欲生。然后会让你输入账号密码,什么的按照提示来就行了,具体看下面:
D:\mqtt\apache-artemis-2.14.0\bin>artemis create ../myboker1
Creating ActiveMQ Artemis instance at: D:\mqtt\apache-artemis-2.14.0\myboker1
--user: is a mandatory property!
Please provide the default username:
admin
--password: is mandatory with this configuration:
Please provide the default password:
--allow-anonymous | --require-login: is a mandatory property!
Allow anonymous access?, valid values are Y,N,True,False
Y
Auto tuning journal ...
done! Your system can make 0.77 writes per millisecond, your journal-buffer-timeout will be 1296000
You can now start the broker by executing:
"D:\mqtt\apache-artemis-2.14.0\myboker1\bin\artemis" run
Or you can setup the broker as Windows service and run it in the background:
"D:\mqtt\apache-artemis-2.14.0\myboker1\bin\artemis-service.exe" install
"D:\mqtt\apache-artemis-2.14.0\myboker1\bin\artemis-service.exe" start
To stop the windows service:
"D:\mqtt\apache-artemis-2.14.0\myboker1\bin\artemis-service.exe" stop
To uninstall the windows service
"D:\mqtt\apache-artemis-2.14.0\myboker1\bin\artemis-service.exe" uninstall
D:\mqtt\apache-artemis-2.14.0\bin>
这样就是OK了,然后就多了一个myboker1的文件夹,当然在你自己指定的文件夹下,我的是指定到了bin的上级目录下
然后打开
etc
目录
这里面都是一些配置文件,相信大家从字面意思都能看出来是干啥的,不过也就看看就行了,没啥特殊需求千万不要自己手动改这些东西,改好了你也不牛X,改不好就是傻X了。
artemis-users.properties
里面放的就是你的账号密码
broker.xml
打开这个,大概就在150行那个样子,这里是你不同的协议的端口
四、启动服务
cmd 进入到你的myboker1/bin
下artemis run
,等启动成功
D:\mqtt\apache-artemis-2.14.0\myartemis\bin>artemis run
_ _ _
/ \ ____| |_ ___ __ __(_) _____
/ _ \| _ \ __|/ _ \ \/ | |/ __/
/ ___ \ | \/ |_/ __/ |\/| | |\___ \
/_/ \_\| \__\____|_| |_|_|/___ /
Apache ActiveMQ Artemis 2.14.0
2020-08-05 15:54:38,147 INFO [org.apache.activemq.artemis.integration.bootstrap] AMQ101000: Starting ActiveMQ Artemis Server
2020-08-05 15:54:38,180 INFO [org.apache.activemq.artemis.core.server] AMQ221000: live Message Broker is starting with configuration Broker Configuration (clustered=false,journalDirectory=data/journal,bindingsDirectory=data/bindings,largeMessagesDirectory=data/large-messages,pagingDirectory=data/paging)
2020-08-05 15:54:38,205 INFO [org.apache.activemq.artemis.core.server] AMQ221013: Using NIO Journal
2020-08-05 15:54:38,233 INFO [org.apache.activemq.artemis.core.server] AMQ221057: Global Max Size is being adjusted to 1/2 of the JVM max size (-Xmx). being defined as 536,870,912
2020-08-05 15:54:38,261 INFO [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-server]. Adding protocol support for: CORE
2020-08-05 15:54:38,261 INFO [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-amqp-protocol]. Adding protocol support for: AMQP
2020-08-05 15:54:38,262 INFO [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-hornetq-protocol]. Adding protocol support for: HORNETQ
2020-08-05 15:54:38,269 INFO [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-mqtt-protocol]. Adding protocol support for: MQTT
2020-08-05 15:54:38,270 INFO [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-openwire-protocol]. Adding protocol support for: OPENWIRE
2020-08-05 15:54:38,270 INFO [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-stomp-protocol]. Adding protocol support for: STOMP
2020-08-05 15:54:38,312 INFO [org.apache.activemq.artemis.core.server] AMQ221034: Waiting indefinitely to obtain live lock
2020-08-05 15:54:38,313 INFO [org.apache.activemq.artemis.core.server] AMQ221035: Live Server Obtained live lock
2020-08-05 15:54:39,263 INFO [org.apache.activemq.artemis.core.server] AMQ221080: Deploying address DLQ supporting [ANYCAST]
2020-08-05 15:54:39,264 INFO [org.apache.activemq.artemis.core.server] AMQ221003: Deploying ANYCAST queue DLQ on address DLQ
2020-08-05 15:54:39,270 INFO [org.apache.activemq.artemis.core.server] AMQ221080: Deploying address ExpiryQueue supporting [ANYCAST]
2020-08-05 15:54:39,270 INFO [org.apache.activemq.artemis.core.server] AMQ221003: Deploying ANYCAST queue ExpiryQueue on address ExpiryQueue
2020-08-05 15:54:40,220 INFO [org.apache.activemq.artemis.core.server] AMQ221020: Started NIO Acceptor at 0.0.0.0:61616 for protocols [CORE,MQTT,AMQP,STOMP,HORNETQ,OPENWIRE]
2020-08-05 15:54:40,229 INFO [org.apache.activemq.artemis.core.server] AMQ221020: Started NIO Acceptor at 0.0.0.0:5445 for protocols [HORNETQ,STOMP]
2020-08-05 15:54:40,238 INFO [org.apache.activemq.artemis.core.server] AMQ221020: Started NIO Acceptor at 0.0.0.0:5672 for protocols [AMQP]
2020-08-05 15:54:40,245 INFO [org.apache.activemq.artemis.core.server] AMQ221020: Started NIO Acceptor at 0.0.0.0:1883 for protocols [MQTT]
2020-08-05 15:54:40,253 INFO [org.apache.activemq.artemis.core.server] AMQ221020: Started NIO Acceptor at 0.0.0.0:61613 for protocols [STOMP]
2020-08-05 15:54:40,260 INFO [org.apache.activemq.artemis.core.server] AMQ221007: Server is now live
2020-08-05 15:54:40,261 INFO [org.apache.activemq.artemis.core.server] AMQ221001: Apache ActiveMQ Artemis Message Broker version 2.14.0 [0.0.0.0, nodeID=7c7c576c-d6cb-11ea-99f1-e454e8ca3ae2]
2020-08-05 15:54:40,463 INFO [org.apache.activemq.hawtio.branding.PluginContextListener] Initialized activemq-branding plugin
2020-08-05 15:54:40,525 INFO [org.apache.activemq.hawtio.plugin.PluginContextListener] Initialized artemis-plugin plugin
2020-08-05 15:54:41,315 INFO [io.hawt.HawtioContextListener] Initialising hawtio services
2020-08-05 15:54:41,328 INFO [io.hawt.system.ConfigManager] Configuration will be discovered via system properties
2020-08-05 15:54:41,329 INFO [io.hawt.jmx.JmxTreeWatcher] Welcome to hawtio 1.5.12 : http://hawt.io/ : Don't cha wish your console was hawt like me? ;-)
2020-08-05 15:54:41,331 INFO [io.hawt.jmx.UploadManager] Using file upload directory: D:\mqtt\apache-artemis-2.14.0\myartemis\tmp\uploads
2020-08-05 15:54:41,341 INFO [io.hawt.web.AuthenticationFilter] Starting hawtio authentication filter, JAAS realm: "activemq" authorized role(s): "amq" role principal classes: "org.apache.activemq.artemis.spi.core.security.jaas.RolePrincipal"
2020-08-05 15:54:41,359 INFO [io.hawt.web.JolokiaConfiguredAgentServlet] Jolokia overridden property: [key=policyLocation, value=file:/D:/mqtt/apache-artemis-2.14.0/bin/../myartemis/etc/\jolokia-access.xml]
2020-08-05 15:54:41,698 INFO [io.hawt.web.RBACMBeanInvoker] Using MBean [hawtio:type=security,area=jmx,rank=0,name=HawtioDummyJMXSecurity] for role based access control
2020-08-05 15:54:42,253 INFO [io.hawt.system.ProxyWhitelist] Initial proxy whitelist: [localhost, 127.0.0.1, 172.22.190.53, host.docker.internal, 192.168.30.209, DESKTOP-D3HC2F2.mshome.net, kubernetes.docker.internal]
2020-08-05 15:54:42,388 INFO [org.apache.activemq.artemis] AMQ241001: HTTP Server started at http://localhost:8161
2020-08-05 15:54:42,388 INFO [org.apache.activemq.artemis] AMQ241002: Artemis Jolokia REST API available at http://localhost:8161/console/jolokia
2020-08-05 15:54:42,389 INFO [org.apache.activemq.artemis] AMQ241004: Artemis Console available at http://localhost:8161/console
五、登录控制台
打开浏览器 http://localhost:8161/console,用你刚刚保存的账号密码登录。
六、测试mqtt
我用的是mqttbox测试工具测试的,你们可以去官网下载,或者使用其他工具
OK部署完成,后续文章会持续更新....