解决 在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
    

猜你喜欢

转载自www.cnblogs.com/sjie/p/13189215.html