【MQTT】在Windows下搭建MQTT服务器
2017-07-01 10:03
337 查看
最近公司要让做一个消息推送APP ,PC 端进行消息互动,开始想了半天想用百度提供的接口来进行消息推送,但是百度到达的速度不稳定,自己有想了个办法就是在App,PC端来用线程来实现,但是有存在问题 这里用的是http http在请求服务器的时候会有头文件,虽然这些头文件很小,但是如果数量多了,那么对服务器负担比较重,而且这种方法不是很好的方式
MQTT,是IBM推出的一种针对移动终端设备的基于TCP/IP的发布/预订协议,可以连接大量的远程传感器和控制设备:
轻量级的消息订阅和发布(publish/subscribe)协议
建立在TCP/IP协议之上
物联网,MQTT在这方面应用较多
这里MQTT分
客户端
服务器端
网上的确有很多代码,但是服务器端的配置很少,而MQTT是通过TCP/IP协议连接的,MQTT是协议类型HTTP协议一样,也需要对应的服务器来运行
MQTT的官网:http://mqtt.org/
下面以服务器apache-apollo-1.7.1为例 下载地址http://activemq.apache.org/apollo/download.html
1、选择下载的电脑环境 如图
2、在这里下载Apollo服务器,下载后解压。如下图所示:
3、运行E:\apache-apollo-1.7.1\bin\apollo.cmd,输入create (名字)(名字任意取,这里是根据官网介绍的来取的)创建服务器实例,服务器实例包含了所有的配置,运行时数据等,并且和一个服务器进程关联。我这里是使用的是mytest
create 之后会在bin目录下生成对应文件夹 如图
4、打开cmd,运行E:\apache-apollo-1.7.1\bin\mybroker\bin\apollo-broker.cmd run 开启服务器,如下图:
5.可以在浏览器中输入http://127.0.0.1:61680/ 或者 http://127.0.0.1:61681 如图
这样就安装完成了,该登录的用户名和密码在E:\apache-apollo-1.7.1\bin\mybroker\etc\users.properties里,打开users.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.
## —————————————————————————
#
# The list of users that can login. This file supports both plain text or
# encrypted passwords. Here is an example what an encrypted password
# would look like:
#
# admin=ENC(Cf3Jf3tM+UrSOoaKU50od5CuBa8rxjoL)
#
admin=password
登录后台之后 如图
MQTT,是IBM推出的一种针对移动终端设备的基于TCP/IP的发布/预订协议,可以连接大量的远程传感器和控制设备:
轻量级的消息订阅和发布(publish/subscribe)协议
建立在TCP/IP协议之上
物联网,MQTT在这方面应用较多
这里MQTT分
客户端
服务器端
网上的确有很多代码,但是服务器端的配置很少,而MQTT是通过TCP/IP协议连接的,MQTT是协议类型HTTP协议一样,也需要对应的服务器来运行
MQTT的官网:http://mqtt.org/
下面以服务器apache-apollo-1.7.1为例 下载地址http://activemq.apache.org/apollo/download.html
1、选择下载的电脑环境 如图
2、在这里下载Apollo服务器,下载后解压。如下图所示:
3、运行E:\apache-apollo-1.7.1\bin\apollo.cmd,输入create (名字)(名字任意取,这里是根据官网介绍的来取的)创建服务器实例,服务器实例包含了所有的配置,运行时数据等,并且和一个服务器进程关联。我这里是使用的是mytest
create 之后会在bin目录下生成对应文件夹 如图
4、打开cmd,运行E:\apache-apollo-1.7.1\bin\mybroker\bin\apollo-broker.cmd run 开启服务器,如下图:
5.可以在浏览器中输入http://127.0.0.1:61680/ 或者 http://127.0.0.1:61681 如图
这样就安装完成了,该登录的用户名和密码在E:\apache-apollo-1.7.1\bin\mybroker\etc\users.properties里,打开users.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.
## —————————————————————————
#
# The list of users that can login. This file supports both plain text or
# encrypted passwords. Here is an example what an encrypted password
# would look like:
#
# admin=ENC(Cf3Jf3tM+UrSOoaKU50od5CuBa8rxjoL)
#
admin=password
登录后台之后 如图
<web_admin bind="http://127.0.0.1:61680"/> <web_admin bind="https://127.0.0.1:61681"/> <connector id="tcp" bind="tcp://0.0.0.0:61613" connection_limit="2000"/> <connector id="tls" bind="tls://0.0.0.0:61614" connection_limit="2000"/> <connector id="ws" bind="ws://0.0.0.0:61623" connection_limit="2000"/> <connector id="wss" bind="wss://0.0.0.0:61624" connection_limit="2000"/> <key_storage file="${apollo.base}/etc/keystore" password="password" key_password="password"/> 这里就可以看到 tcp/tls/ws/wss/对应端口 以及登录后台地址
相关文章推荐
- 【MQTT】在Windows下搭建MQTT服务器
- MQTT服务器的搭建(Windows平台)
- 【MQTT】在Windows下搭建MQTT服务器
- Esp8266进阶之路10 【小实战下篇】Windows系统搭建8266的本地Mqtt服务器,局域网点亮一盏LED灯。(带Demo)
- MQTT服务器的搭建(Windows平台)
- windows环境下搭建MQTT服务器
- windows下搭建MQTT服务器--Apollo--LG二进制
- 【MQTT】在Windows下搭建MQTT服务器
- Esp8266进阶之路⑨ 【小实战上篇】Windows系统搭建8266的本地Mqtt服务器,局域网点亮一盏LED灯。(带Demo)
- MQTT】在Windows下搭建MQTT服务器
- 【MQTT】在Windows下搭建MQTT服务器
- Windows下基于Apache服务器的PHP环境搭建
- WINDOWS下搭建SVN服务器:
- Windows下基于Apache服务器的PHP环境搭建
- WINDOWS下搭建LDAP服务器
- Windows 2003中搭建视频服务器-1
- 原创 WINDOWS下搭建LDAP服务器收藏
- Windows下搭建和配置Subversion服务器(CollabNetSubversion-server-1.5.4-1.win32.
- windows 下搭建Web服务器