【问题标题】:What is the proper configuration to persist edgeAgent storage?持久化 edgeAgent 存储的正确配置是什么?
【发布时间】:2020-04-25 11:11:40
【问题描述】:

我正在开发一个 Azure IoT Edge 项目。目前我正在通过production readiness checklist。我按照文档到 use storage on the host filesystem 获取 edgeAgent 和 edgeHub 模块。

当我运行sudo iotedge check 时,edgeHub 还可以,但 edgeAgent 会发出警告:

‼ production readiness: Edge Agent's storage directory is persisted on the host filesystem - Warning
    The edgeAgent module is not configured to persist its /tmp/edgeAgent directory on the host filesystem.
    Data might be lost if the module is deleted or updated.
    Please see https://aka.ms/iotedge-storage-host for best practices.
√ production readiness: Edge Hub's storage directory is persisted on the host filesystem - OK

这是部署模板中的一个 sn-p:

"systemModules": {
  "edgeAgent": {
    "type": "docker",
    "settings": {
      "image": "mcr.microsoft.com/azureiotedge-agent:1.0",
      "createOptions": {
        "HostConfig": {
          "Binds": [
            "/home/pi/iotedge/edgeAgent/storage/:/iotedge/storage/"
          ]
        }
      }
    },
    "env": {
      "storageFolder": {
        "value": "/iotedge/storage/"
      }
    }
  },
  "edgeHub": {
    "type": "docker",
    "status": "running",
    "restartPolicy": "always",
    "settings": {
      "image": "mcr.microsoft.com/azureiotedge-hub:1.0",
      "createOptions": {
        "HostConfig": {
          "Binds": [
            "/home/pi/iotedge/edgeHub/storage:/iotedge/storage/"
          ],
          "PortBindings": {
            "5671/tcp": [
              {
                "HostPort": "5671"
              }
            ],
            "8883/tcp": [
              {
                "HostPort": "8883"
              }
            ],
            "443/tcp": [
              {
                "HostPort": "443"
              }
            ]
          }
        }
      }
    },
    "env": {
      "storageFolder": {
        "value": "/iotedge/storage/"
      }
    }
  }
},

【问题讨论】:

    标签: azure azure-iot-hub azure-iot-edge


    【解决方案1】:

    从 1.0.9 版开始,存在一个问题,即除非更新其图像标签,否则 edgeAgent 的配置不会更新。您当前状态的两个选项:

    • 在图像设置中使用特定标签(始终推荐)。例如。 mcr.microsoft.com/azureiotedge-agent:1.0.9

    • 删除设备上的 edgeAgent 容器:docker rm -f edgeAgent。它将在 30 秒内重新启动,并且将获取新的 storageFolder 环境变量。

    容器更新后再次运行“iotedge check”,此警告应该会消失。

    【讨论】:

      【解决方案2】:

      我遵循了相同的文档,并且能够避免在我的 Raspberry Pi 3 上出现生产就绪清单警告。

      1) 我已经按照文档Link module storage to device storage配置了“绑定”

      "Binds":["/etc/iotedge/storage/:/iotedge/storage/"]
      

      2) 我已经为用户提供了从 SSH 终端访问 HostStoragePath 的权限。

      sudo chown 1000 /etc/iotedge/storage/
      sudo chmod 700 /etc/iotedge/storage/
      

      3) 重启树莓派 3,确保授权访问生效。

      • 确保您的边缘设备上有可用的主机存储文件夹。
      • 确保为用户提供对这些文件夹的完全访问权限。
      • 尝试使用更新后的清单进行部署,它应该可以工作。

      【讨论】:

        猜你喜欢
        • 2011-08-11
        • 2019-11-13
        • 2016-06-08
        • 2021-06-24
        • 2017-08-21
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多