我正在研究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
以下是部署模板中的代码段:
"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/"
}
}
}
},
答案 0 :(得分:0)
我遵循了相同的文档,并且能够避免在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)重新启动Raspberry Pi 3,以确保授予访问权限生效。
答案 1 :(得分:0)
从1.0.9版开始,存在一个问题,即除非更新其image标签,否则edgeAgent的配置不会更新。您当前状态的两个选择:
在图像设置中使用特定标签(始终建议)。例如。 mcr.microsoft.com/azureiotedge-agent:1.0.9
删除设备上的edgeAgent容器:docker rm -f edgeAgent
。它将在30秒内重新启动,并且将提取新的storageFolder
环境变量。
在更新容器后再次运行“ iotedge检查”,此警告应消失。