azure - 持久化 edgeAgent 存储的正确配置是什么?
问题描述
我正在开发一个 Azure IoT Edge 项目。目前我正在检查生产准备清单。我按照文档将主机文件系统上的存储用于 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
这是部署模板的一个片段:
"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/"
}
}
}
},
解决方案
从 1.0.9 版开始,存在一个问题,即 edgeAgent 的配置不会更新,除非其图像标签已更新。您当前状态的两个选项:
在图像设置中使用特定标签(始终推荐)。例如
mcr.microsoft.com/azureiotedge-agent:1.0.9
删除设备上的 edgeAgent 容器:
docker rm -f edgeAgent
。它将在 30 秒内重新启动,并且将获取新的storageFolder
env var。
更新容器后再次运行“iotedge check”,此警告应该会消失。
推荐阅读
- c++ - 可变参数模板的正确语法
- javascript - 使用 vue.js 和 laravel 从 chiled 向 parent 发送数据
- xaml - Xamarin Forms 中包含 Grid 的堆栈布局之间的间距
- amazon-web-services - 无法增长分区 ubuntu EC2
- vue.js - Vue.js:如何在名称输入属性中绑定键
- python - Allure ModuleNotFoundError 但仅在包的某些功能上
- java - Spring 教程 - 用于发布 JSON 数据的 CURL 命令不起作用
- swift - 国家选择器索引超出范围
- java - Java中的循环While和Break
- c# - 如何为屏幕的一部分设置图形?- 团结