Mosquitto搭建Android推送服務番外篇一:各種報錯解決

來源:互聯網
上載者:User

標籤:rar   div   設定檔   進程   sof   str   png   code   lib   

文章鋼要:

目前筆者在開發搭建Mosquitto伺服器,在此期間遇到很多實際問題,所以走了很多彎路,在這裡寫出來為大家提供一些協助。

 

1、安裝完成後啟動Mosquitto報錯

執行mosquitto用戶端程式時出現找不到動態庫:libmosquitto.so.1

./mosquitto_sub: error while loading shared libraries: libmosquitto.so.1: cannot open shared object file: No such file or directory

解決方案:

執行命令

sudo ln -s /usr/local/lib/libmosquitto.so.1 /usr/lib/libmosquitto.so.1

ldconfig

即可

2、啟動Mosquitto伺服器時設定檔報錯

Invalid user ‘mosquitto‘.

[[email protected] src]# ./mosquitto  1437558553: Error: Invalid user ‘mosquitto‘. 

這是因為設定檔裡沒有目前使用者,有2中解決方案:

1.修改設定檔:mosquitto.conf ,增加登入的使用者,例如當前登入使用者為root。

2.執行命令增加目前使用者: adduser mosquitto

 

3、重啟Mosquitto

筆者在網上找了很多資料都沒有提起怎樣重啟伺服器,並且在官網上也沒有相應命令提示。

所以我們使用Liunx終止進程命令,強行退出。

先kill掉,再重啟:
[[email protected] ~]# ps -A | grep mosquitto21674 ?        00:02:38 mosquitto[[email protected] ~]# kill -9 21674

4、串連無響應

伺服器正常開啟,但是遠程發布資訊的時候會有如下提示:

no route to host這時遠程伺服器上防火牆將資訊串連,所以執行下面命令問題解決[[email protected] ~]$ sudo iptables -F 

 

Mosquitto搭建Android推送服務番外篇一:各種報錯解決

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.