持久化 edgeAgent 存储的正确配置是什么?
What is the proper configuration to persist edgeAgent storage?
我正在处理 Azure IoT Edge 项目。目前我正在浏览 edgeAgent 和 edgeHub 模块的 production readiness checklist. I followed the documentation to use storage on the host filesystem。
当我 运行 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/"
}
}
}
},
我遵循了相同的文档,并且能够避免我的 Raspberry Pi 3 上的生产准备清单警告。
1) 我已经根据文档 Link module storage to device storage
配置了 "Binds"
"Binds":["/etc/iotedge/storage/:/iotedge/storage/"]
2) 我已经从 SSH 终端提供了 HostStoragePath 上的用户访问权限。
sudo chown 1000 /etc/iotedge/storage/
sudo chmod 700 /etc/iotedge/storage/
3) 重启Raspberry Pi 3、确保授权生效。
- 确保您的边缘设备上有可用的主机存储文件夹。
- 确保向用户提供这些文件夹的完全访问权限。
- 尝试使用更新后的清单进行部署,它应该可以工作。
从 1.0.9 版开始,存在一个问题,即 edgeAgent 的配置不会更新,除非更新其图像标签。您当前状态的两个选项:
在图像设置中使用特定标签(始终推荐)。例如。 mcr.microsoft.com/azureiotedge-agent:1.0.9
删除设备上的 edgeAgent 容器:docker rm -f edgeAgent
。它将在 30 秒内重新启动,新的 storageFolder
env var 将被拾取。
运行 'iotedge check' 在容器更新后再次出现,这个警告应该会消失。
我正在处理 Azure IoT Edge 项目。目前我正在浏览 edgeAgent 和 edgeHub 模块的 production readiness checklist. I followed the documentation to use storage on the host filesystem。
当我 运行 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/"
}
}
}
},
我遵循了相同的文档,并且能够避免我的 Raspberry Pi 3 上的生产准备清单警告。
1) 我已经根据文档 Link module storage to device storage
配置了 "Binds""Binds":["/etc/iotedge/storage/:/iotedge/storage/"]
2) 我已经从 SSH 终端提供了 HostStoragePath 上的用户访问权限。
sudo chown 1000 /etc/iotedge/storage/
sudo chmod 700 /etc/iotedge/storage/
3) 重启Raspberry Pi 3、确保授权生效。
- 确保您的边缘设备上有可用的主机存储文件夹。
- 确保向用户提供这些文件夹的完全访问权限。
- 尝试使用更新后的清单进行部署,它应该可以工作。
从 1.0.9 版开始,存在一个问题,即 edgeAgent 的配置不会更新,除非更新其图像标签。您当前状态的两个选项:
在图像设置中使用特定标签(始终推荐)。例如。
mcr.microsoft.com/azureiotedge-agent:1.0.9
删除设备上的 edgeAgent 容器:
docker rm -f edgeAgent
。它将在 30 秒内重新启动,新的storageFolder
env var 将被拾取。
运行 'iotedge check' 在容器更新后再次出现,这个警告应该会消失。