解決 在docker環境中 mosquitto 無法啟動 報錯等問題


報錯內容

1592979788: Error: Unable to open log file /Users/bigbird/mqttconfig/mosquitto/log/mosquitto.log for writing.

  • 解決方法

    1.查看你的 mosquitto.conf 文件,路徑是否正確!!! 這里的路徑為 docker 的路徑,千萬別寫成自己的路徑!!!

      persistence true
      persistence_location /mosquitto/data
      log_dest file /mosquitto/log/mosquitto.log
    
      port 1883
      listener 9001
      protocol websockets
    
      # 關閉匿名模式
      allow_anonymous false
    
      # 指定密碼文件
      password_file /mosquitto/config/pwfile.conf
    
      #備注:這里千萬注意路徑,指向的是 docker 的路徑!!!(直接復制我的內容即可)
    

    2.文件權限問題, 對 mosquitto/log 賦予最高權限

      sudo chmod -R 777 mosquitto/log
    


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM