一、安装环境
系统:Ubuntu14.04 64位
参考:http://emqtt.io/docs/v2/install.html
安装包:链接: http://pan.baidu.com/s/1qYH6tsS 密码: v9e5
工具:MQTT Lens 链接: http://pan.baidu.com/s/1skBOxKL 密码: 9e4z
二、安装
1.下载Ubuntu的emqttd二进制包(与上面的安装包相同)
执行:wget http://emqtt.io/downloads/latest/ubuntu
结果:在当前目录下下载名为Ubuntu的压缩包
2.解压缩
执行:unzip ubuntu
结果:名为emqtt的目录被解压缩出来
3.以console模式启动emqttd
执行:cd emqttd && ./bin/emqttd console
结果:
starting emqttd on node 'emqttd@127.0.0.1'
emqttd ctl is starting...[ok]
emqttd hook is starting...[ok]
emqttd router is starting...[ok]
emqttd pubsub is starting...[ok]
emqttd stats is starting...[ok]
emqttd metrics is starting...[ok]
emqttd retainer is starting...[ok]
emqttd pooler is starting...[ok]
emqttd trace is starting...[ok]
emqttd client manager is starting...[ok]
emqttd session manager is starting...[ok]
emqttd session supervisor is starting...[ok]
emqttd wsclient supervisor is starting...[ok]
emqttd broker is starting...[ok]
emqttd alarm is starting...[ok]
emqttd mod supervisor is starting...[ok]
emqttd bridge supervisor is starting...[ok]
emqttd access control is starting...[ok]
emqttd system monitor is starting...[ok]
dashboard listen on 0.0.0.0:18083 with 4 acceptors.
mqtt listen on 0.0.0.0:1883 with 16 acceptors.
mqtts listen on 0.0.0.0:8883 with 4 acceptors.
http listen on 0.0.0.0:8083 with 4 acceptors.
Erlang MQTT Broker 2.0 is running now
Eshell V7.3 (abort with ^G)
4. 退出console模式,后台启动
执行:Ctrol+C,a 退出console
执行:./bin/emqttd start 后台启动emqttd
执行:./bin/emqttd_ctl status 检查启动状态
结果:
Node 'emqttd@127.0.0.1' is started
emqttd 2.0 is running
三、测试
使用MQTTLens进行发布订阅
1. 新建连接
2. 添加订阅
3. 发布消息