首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >持久化edgeAgent存储的正确配置是什么?

持久化edgeAgent存储的正确配置是什么?
EN

Stack Overflow用户
提问于 2020-04-24 20:27:12
回答 2查看 1.6K关注 0票数 0

我正在从事一个Azure IoT边缘项目。目前,我正在通过生产准备清单。我按照文档介绍了使用主机文件系统上的存储中的edgeAgent和edgeHub模块。

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

代码语言:javascript
复制
‼ 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

下面是来自部署模板的片段:

代码语言:javascript
复制
"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/"
      }
    }
  }
},
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2020-04-25 03:11:40

在1.0.9版中,edgeAgent的配置不更新,除非它的图像标记被更新,这是一个问题。来自当前状态的两个选项:

  • 在图像设置中使用特定的标记(总是推荐的)。例如mcr.microsoft.com/azureiotedge-agent:1.0.9
  • 删除设备上的edgeAgent容器:docker rm -f edgeAgent。它将在30秒内重新启动,并将获取新的storageFolder env。

在更新容器后再次运行“iotedge检查”,此警告将消失。

票数 1
EN

Stack Overflow用户

发布于 2020-04-24 21:16:41

我遵循了相同的文档,并能够避免在我的Raspberry Pi 3的生产准备清单警告。

1)我按照文档链接模块存储到设备存储配置了“绑定”

代码语言:javascript
复制
"Binds":["/etc/iotedge/storage/:/iotedge/storage/"]

2)从SSH终端为用户提供了HostStoragePath上的用户访问。

代码语言:javascript
复制
sudo chown 1000 /etc/iotedge/storage/
sudo chmod 700 /etc/iotedge/storage/

3)重新启动Raspberry Pi 3,以确保授权访问生效。

  • 确保您的边缘设备上有可用的主机存储文件夹。
  • 确保为用户提供对这些文件夹的完全访问。
  • 尝试使用更新的清单进行部署,它可能会工作。
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61416917

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档