如果安裝的3.1版本,請參考
If you download version 3.1 of MQTT
如果自己下載的3.1版本的MQTT,
Installation step reference
安裝步驟參考
https://developer.emqx.io/docs/emq/v3/cn/install.html
The first way to configure username and password is to use HTTP
配置用戶名和密碼第一種是用http
https://github.com/emqx/emqx-auth-username/blob/master/README.md 我沒有測試 I didn't test it
The second sends commands
第二種命令行發送命令
You can execute emqx_ctl View all commands
可以執行個emqx_ctl 可以查看所有的命令
安裝emqtt
Copy files to data disks connected to the cloud
記得把文件拷貝到上一節配置的和雲端共享的那個盤里面,好拷貝文件到雲服務器
if you use linux look here
如果用linux安裝,看這篇
https://www.cnblogs.com/yangfengwu/p/10463724.html
把以下文件放到自己的雲端
Login to the cloud
登錄到雲平台
Install package unzip
把文件夾里面的emqtt安裝包解壓到C盤
復制一下以下路徑
Using the command into ....
打開命令提示符
進入到上面復制的bin 目錄
cd XXXXX 路徑根據自己的修改
然后回車
Console mode starts Notice: if Console closed the MQTT is closed
咱先以控制台的模式啟動哈,關掉控制台,MQTT也就關了
鍵入指令 emqttd console
Just copy this file the 32bit
據我使用,無論是32位的還是64位的系統,只拷貝32位補丁就可以
execute emqttd console look below
重新弄一下
鍵入指令 emqttd console
MQTT軟件本身就是個TCP 服務器,支持各種連接方式
各種連接的端口號不一樣
普通TCP連接 -- IP:雲服務器IP 端口號:1883
TCP+SSL(加密)-- IP:雲服務器IP 端口號:8883
WebSocket(網頁)-- IP:雲服務器IP 端口號: 8083
WebSocket+SSL-- IP:雲服務器IP 端口號:8084
登錄控制台: 瀏覽器輸入 http://服務器IP/18083
Test MQTT
測試通信
IP地址填寫自己的服務器的IP地址
如果要測試通信,需要打開兩個客戶端
第一個客戶端的配置
端口號:1883 (該客戶端為TCP連接方式的客戶端,所以填寫1883)
ClientID:可以不用填寫,內部默認自動生成唯一碼
用戶名:yang (MQTT安裝的時候可以設置用戶名,如果沒有設置,可隨意填寫)
密碼:11223344 (MQTT安裝的時候可以設置密碼,如果沒有設置,可隨意填寫)
發布的主題:aaaaa
訂閱的主題:bbbbb
先點擊連接,然后點擊訂閱
第二個客戶端的配置
發布的主題:bbbbb
訂閱的主題:aaaaa
先點擊連接,然后點擊訂閱
然后測試一下兩個客戶端通信
注:這個客戶端軟件是我自己寫的
為了方便大家測試,
顯示的數據加了時間,主題,還有消息(字符串格式消息,和16進制格式)
修改MQTT的用戶名和密碼
Change the username and password to connect to the MQTT server
修改用戶名和密碼
Closed Console
退出控制台
Into File
找到下列文件 修改 為 false
Change it to what you want
自己修改成自己想設置的用戶名和密碼
This is my modification
Console mode starts
啟動控制台
鍵入指令 emqttd console
瀏覽器輸入,根據自己的服務器哈, Browser access http://you IP:18083
http://服務器IP地址:18083
Default username and password for login admin public
Click on the Plugins
Select LOOK Click on the Start
Testing
測試
用戶名或者密碼不正確的時候連接不上
Turn off the console
Another way to start
把MQTT注冊為Windows服務,隨着系統的啟動而啟動
安裝好了 installed OK
Other commands
其它命令