MQTT服务器搭建非常详细流程(每一步都有,CMD窗口都有)

MQTT服务器搭建非常详细流程(每一步都有,CMD窗口都有)搭建过程想搭建一个MQTT服务器,刚好找到ApacheActiveMQArtemis支持,而且是基于Java开发的,那跨平台就很方便。以下是在Windows7(64位)系统下搭建:下载首先下载ApacheActiveMQArtemis,官方地址:https://activemq.apache.org/components/artemis/download/下载bin包就可以安装随便解压Z:\apache-artemis-2.9.0创建使用cmd命令行进入cd->Z:\apa

大家好,又见面了,我是你们的朋友全栈君。

搭建过程
想搭建一个MQTT服务器,刚好找到Apache ActiveMQ Artemis支持,而且是基于Java开发的,那跨平台就很方便。
以下是在Windows7(64位)系统下搭建:
下载
首先下载Apache ActiveMQ Artemis,官方地址: https://activemq.apache.org/components/artemis/download/

下载bin包就可以

安装
随便解压Z:\apache-artemis-2.9.0

创建
使用cmd命令行进入cd->Z:\apache-artemis-2.9.0\bin目录
执行: artemis create Z:\my_artemis 回车 (Z:\my_artemis是你需要搭建服务存放的路径)
创建过程中需要设置管理员帐号和密码
Bash
Z:\apache-artemis-2.9.0\bin>artemis create Z:\my_artemis

Warning: JAVA_HOME environment variable is not set.

Creating ActiveMQ Artemis instance at: Z:\my_artemis

–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 17.86 writes per millisecond, your journal-buffer-tim
eout will be 56000

You can now start the broker by executing:

“Z:\my_artemis\bin\artemis” run

Or you can setup the broker as Windows service and run it in the background:

“Z:\my_artemis\bin\artemis-service.exe” install
“Z:\my_artemis\bin\artemis-service.exe” start

To stop the windows service:
“Z:\my_artemis\bin\artemis-service.exe” stop

To uninstall the windows service
“Z:\my_artemis\bin\artemis-service.exe” uninstall

Z:\apache-artemis-2.9.0\bin> artemis-service install回车

启动
切换到你创建服务的bin目录cd->Z:\my_artemis\bin
执行
Bash
artemis run
Bash
Z:\my_artemis\bin>artemis run 回车

Warning: JAVA_HOME environment variable is not set.

 _        _               _
/ \  ____| |_  ___ __  __(_) _____

/ _ | _ \ |/ _ \ / | |/ /
/ ___ \ | / |/ / |/| | |_
/
/ _| __
|| |||/
/
Apache ActiveMQ Artemis 2.9.0

2019-08-29 12:29:35,731 INFO [org.apache.activemq.artemis.integration.bootstrap
] AMQ101000: Starting ActiveMQ Artemis Server
2019-08-29 12:29:36,207 INFO [org.apache.activemq.artemis.core.server] AMQ22100
0: live Message Broker is starting with configuration Broker Configuration (clus
tered=false,journalDirectory=data/journal,bindingsDirectory=data/bindings,largeM
essagesDirectory=data/large-messages,pagingDirectory=data/paging)
2019-08-29 12:29:36,243 INFO [org.apache.activemq.artemis.core.server] AMQ22101
3: Using NIO Journal
2019-08-29 12:29:36,288 INFO [org.apache.activemq.artemis.core.server] AMQ22105
7: Global Max Size is being adjusted to 1/2 of the JVM max size (-Xmx). being de
fined as 536,870,912
2019-08-29 12:29:36,318 INFO [org.apache.activemq.artemis.core.server] AMQ22104
3: Protocol module found: [artemis-server]. Adding protocol support for: CORE
2019-08-29 12:29:36,319 INFO [org.apache.activemq.artemis.core.server] AMQ22104
3: Protocol module found: [artemis-amqp-protocol]. Adding protocol support for:
AMQP
2019-08-29 12:29:36,320 INFO [org.apache.activemq.artemis.core.server] AMQ22104
3: Protocol module found: [artemis-hornetq-protocol]. Adding protocol support fo
r: HORNETQ
2019-08-29 12:29:36,322 INFO [org.apache.activemq.artemis.core.server] AMQ22104
3: Protocol module found: [artemis-mqtt-protocol]. Adding protocol support for:
MQTT
2019-08-29 12:29:36,324 INFO [org.apache.activemq.artemis.core.server] AMQ22104
3: Protocol module found: [artemis-openwire-protocol]. Adding protocol support f
or: OPENWIRE
2019-08-29 12:29:36,325 INFO [org.apache.activemq.artemis.core.server] AMQ22104
3: Protocol module found: [artemis-stomp-protocol]. Adding protocol support for:
STOMP
2019-08-29 12:29:36,403 INFO [org.apache.activemq.artemis.core.server] AMQ22103
4: Waiting indefinitely to obtain live lock
2019-08-29 12:29:36,404 INFO [org.apache.activemq.artemis.core.server] AMQ22103
5: Live Server Obtained live lock
2019-08-29 12:29:36,533 INFO [org.apache.activemq.artemis.core.server] AMQ22108
0: Deploying address DLQ supporting [ANYCAST]
2019-08-29 12:29:36,546 INFO [org.apache.activemq.artemis.core.server] AMQ22100
3: Deploying ANYCAST queue DLQ on address DLQ
2019-08-29 12:29:36,612 INFO [org.apache.activemq.artemis.core.server] AMQ22108
0: Deploying address ExpiryQueue supporting [ANYCAST]
2019-08-29 12:29:36,614 INFO [org.apache.activemq.artemis.core.server] AMQ22100
3: Deploying ANYCAST queue ExpiryQueue on address ExpiryQueue
2019-08-29 12:29:37,239 INFO [org.apache.activemq.artemis.core.server] AMQ22102
0: Started NIO Acceptor at 0.0.0.0:61616 for protocols [CORE,MQTT,AMQP,STOMP,HOR
NETQ,OPENWIRE]
2019-08-29 12:29:37,254 INFO [org.apache.activemq.artemis.core.server] AMQ22102
0: Started NIO Acceptor at 0.0.0.0:5445 for protocols [HORNETQ,STOMP]
2019-08-29 12:29:37,268 INFO [org.apache.activemq.artemis.core.server] AMQ22102
0: Started NIO Acceptor at 0.0.0.0:5672 for protocols [AMQP]
2019-08-29 12:29:37,282 INFO [org.apache.activemq.artemis.core.server] AMQ22102
0: Started NIO Acceptor at 0.0.0.0:1883 for protocols [MQTT]
2019-08-29 12:29:37,296 INFO [org.apache.activemq.artemis.core.server] AMQ22102
0: Started NIO Acceptor at 0.0.0.0:61613 for protocols [STOMP]
2019-08-29 12:29:37,297 INFO [org.apache.activemq.artemis.core.server] AMQ22100
7: Server is now live
2019-08-29 12:29:37,298 INFO [org.apache.activemq.artemis.core.server] AMQ22100
1: Apache ActiveMQ Artemis Message Broker version 2.9.0 [0.0.0.0, nodeID=9b68041
2-ca15-11e9-8d81-0a0027000010]
2019-08-29 12:29:37,675 INFO [org.apache.activemq.hawtio.branding.PluginContext
Listener] Initialized activemq-branding plugin
2019-08-29 12:29:37,814 INFO [org.apache.activemq.hawtio.plugin.PluginContextLi
stener] Initialized artemis-plugin plugin
2019-08-29 12:29:39,125 INFO [io.hawt.HawtioContextListener] Initialising hawti
o services
2019-08-29 12:29:39,151 INFO [io.hawt.system.ConfigManager] Configuration will
be discovered via system properties
2019-08-29 12:29:39,156 INFO [io.hawt.jmx.JmxTreeWatcher] Welcome to hawtio 1.5
.5 : http://hawt.io/ : Don’t cha wish your console was hawt like me? ?
2019-08-29 12:29:39,161 INFO [io.hawt.jmx.UploadManager] Using file upload dire
ctory: Z:\my_artemis\tmp\uploads
2019-08-29 12:29:39,195 INFO [io.hawt.web.AuthenticationFilter] Starting hawtio
authentication filter, JAAS realm: “activemq” authorized role(s): “amq” role pr
incipal classes: “org.apache.activemq.artemis.spi.core.security.jaas.RolePrincip
al”
2019-08-29 12:29:39,263 INFO [io.hawt.web.JolokiaConfiguredAgentServlet] Joloki
a overridden property: [key=policyLocation, value=file:/Z:/my_artemis/etc/\jolok
ia-access.xml]
2019-08-29 12:29:39,442 INFO [io.hawt.web.RBACMBeanInvoker] Using MBean [hawtio
:type=security,area=jmx,rank=0,name=HawtioDummyJMXSecurity] for role based acces
s control
2019-08-29 12:29:39,903 INFO [io.hawt.system.ProxyWhitelist] Initial proxy whit
elist: [localhost, 127.0.0.1, 192.168.5.12, zhong-pc, 192.168.56.1]
2019-08-29 12:29:40,428 INFO [org.apache.activemq.artemis] AMQ241001: HTTP Serv
er started at http://localhost:8161
2019-08-29 12:29:40,429 INFO [org.apache.activemq.artemis] AMQ241002: Artemis J
olokia REST API available at http://localhost:8161/console/jolokia
2019-08-29 12:29:40,430 INFO [org.apache.activemq.artemis] AMQ241004: Artemis C
onsole available at http://localhost:8161/console

安装为系统服务方式
Bash

服务安装

artemis-service install

服务启动

artemis-service start

服务卸载

sc delete <服务名>

管理:
主页:http://localhost:8161
管理地址:http://localhost:8161/console
登录用户名密码则是在上方创建时用户自己设置的用户名和密码

测试方法:

mqtt.fx的安装和使用
MQTT.fx 是目前主流的mqtt客户端,可以快速验证是否可以与IoT Hub 服务交流发布或订阅消息。设备将当前所处的状态作为MQTT主题发送给IoT Hub,每个MQTT主题topic具有不同等级的名称,如“建筑/楼层/温度。” MQTT代理服务器将接收到的主题topic发送给给所有订阅的客户端。
目前最新版下载地址(支持windows,linux,mac)
http://www.jensd.de/apps/mqttfx/1.5.0/

mqtt.fx的使用
打开软件,打开时会提示有更新,最好别点击yes,会报错,然后用不了。

想更新就从上面的网址查看是否有新版本
打开配置,首先配置MQTT 代理

接着回到主界面,点击connect连接到MQTT 代理服务器上,就可以进行订阅和发布消息测试了。

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/146100.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • LoadLibrary failed with error 1114:动态链接库(DLL)初始化例程失败 解决方法「建议收藏」

    LoadLibrary failed with error 1114:动态链接库(DLL)初始化例程失败 解决方法「建议收藏」LoadLibraryfailedwitherror1114:动态链接库(DLL)初始化例程失败解决方法

    2022年8月30日
    3
  • JS后退, JS返回上一页, JS返回下一页

    JS后退, JS返回上一页, JS返回下一页
    Javascript返回上一页:
    1. history.go(-1),返回两个页面:history.go(-2);
    2. history.back(). 
    3. window.history.forward()返回下一页
    4. window.history.go(返回第几页,也可以使用访问过的URL)  
     例:
    向上一页 
    respons

    2022年7月25日
    9
  • RJ45 网线接口介绍

    RJ45接口通常用于数据传输,最常见的应用为网卡接口。  RJ45是各种不同接头的一种类型(例如:RJ11也是接头的一种类型,不过它是电话上用的);RJ45头根据线的排序不同,分为有两种,一种是橙白、橙、绿白、蓝、蓝白、绿、棕白、棕;另一种是绿白、绿、橙白、蓝、蓝白、橙、棕白、棕;因此使用RJ45接头的线也有两种即:直通线、交叉线。RJ45型网卡接口  10100basetxRJ

    2022年4月9日
    52
  • zip文件后缀改成什么可以用_zip格式转rar格式

    zip文件后缀改成什么可以用_zip格式转rar格式案例2,批量修改文件扩展名\后缀名1上面介绍的是只修改某一类的后缀名,那么如果我整个文件夹下面的所有类型的文件都要修改怎么办呢?如下图什么类型的文件都有呢【强烈推荐】如何批量修改文件后缀名?超详细2其实也很简单,只需要修改一个参数就好了。如下图找到刚刚那个bat文件,右键编辑–或者用记事本打开。(注意:在*之前有一个英文的空格把命令改成,ren.*.gif  格式 ren空格星点星空格星点文件后缀名【强烈推荐】如何批量修改文件后缀名?超详细【强烈推荐】如何批

    2022年10月12日
    2
  • RBF神经网络理论与实现「建议收藏」

    RBF神经网络理论与实现「建议收藏」前言最近发现有挺多人喜欢径向基函数(RadialBasisFunction,RBF)神经网络,其实它就是将RBF作为神经网络层间的一种连接方式而已。这里做一个简单的描述和找了个代码解读。之前也写过一篇,不过排版不好看,可以戳这里跳转国际惯例,参考博客:维基百科径向基函数《模式识别与智能计算——matlab技术实现第三版》第6.3章节《matlab神经网络43个案例分析》第7章节tensorflow2.0实现RBF理论基本思想用RBF作为隐单元的“基”构成隐藏层空间

    2025年8月1日
    2
  • golang激活(在线激活)「建议收藏」

    golang激活(在线激活),https://javaforall.net/100143.html。详细ieda激活码不妨到全栈程序员必看教程网一起来了解一下吧!

    2022年3月14日
    64

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号