首页 > 解决方案 > OPC Publisher 模块没有在我的 Ubuntu VM 上作为边缘模块启动

问题描述

OPC Publisher 市场映像作为独立容器成功运行(尽管存在服务器连接问题)。但我无法将其部署为边缘模块,尤其是在更改容器创建选项之后。

背景:在我的主机笔记本电脑中,我永远无法启动模块,因此我创建了一个 Ubuntu VM。当我尝试使用默认容器创建选项在 VM 中部署边缘模块时,该模块确实在 iotedge 模块列表中显示为“正在运行”。我想设置“--op”选项来设置发布速率,所以我使用门户“设置模块”选项卡在创建选项中更改了它。由于没有更新按钮,我使用创建按钮来“重新创建”模块。在此之后,该模块没有出现。

之后,OPC 发布者模块不会出现在边缘 VM 上。我正在关注Microsoft 教程

以下是命令:

sudo docker run -v /iiotedge:/appdata mcr.microsoft.com/iotedge/opc-publisher:latest --aa --pf=/appdata/publishednodes.json --c="HostName=<iot hub name>.azure-devices.net;DeviceId=iothubowner;SharedAccessKey=<hub primary key>" --dc="HostName=<edge device id/name>.azure-devices.net;DeviceId=<edge device id/name>;SharedAccessKey=<edge primary key>" --op=10000

容器创建选项:

{
    "Hostname": "opcpublisher",
    "Cmd": [
        "--pf=/appdata/publishednodes.json",
        "--aa",
        "--op=10000"
    ],
    "HostConfig": {
        "Binds": [
            "/iiotedge:/appdata"
        ]
    }
}

我没有明确指定连接字符串,因为Microsoft的文档确保运行时会自动传递它们。

相关的 iotedge journalctl 日志在这里。

Oct 06 19:36:05 shreesha-VirtualBox iotedged[9622]: 2021-10-06T14:06:05Z [INFO] - Pulling image mcr.microsoft.com/iotedge/opc-publisher:latest...
Oct 06 19:36:08 shreesha-VirtualBox iotedged[9622]: 2021-10-06T14:06:08Z [INFO] - Successfully pulled image mcr.microsoft.com/iotedge/opc-publisher:latest
Oct 06 19:36:08 shreesha-VirtualBox iotedged[9622]: 2021-10-06T14:06:08Z [INFO] - Creating module OPCPublisher...
Oct 06 19:36:08 shreesha-VirtualBox iotedged[9622]: 2021-10-06T14:06:08Z [INFO] - Starting new listener for module OPCPublisher
Oct 06 19:36:08 shreesha-VirtualBox iotedged[9622]: 2021-10-06T14:06:08Z [ERR!] - Internal server error: Could not create module OPCPublisher
Oct 06 19:36:08 shreesha-VirtualBox iotedged[9622]:         caused by: Could not get module OPCPublisher

iotedge 本身的日志并没有多大用处。无论如何在下面找到。

~$ iotedge logs OPCPublisher
A module runtime error occurred

我也尝试过 docker container prune 以确保它没有帮助。

同样奇怪的是,当我尝试从故障排除页面重新启动模块时,在 Azure 门户中它会引发错误“在当前环境中找不到模块”

Azure 门户模块错误

有人可以帮我解决这个问题吗?如果需要,我很乐意分享更多细节。

标签: linuxazureopc-uaazure-iot-edge

解决方案


我在 Azure 门户中提出了支持查询。在发送支持包并尝试各种建议(如删除 DNS 配置、将绑定路径更改为非 sudo 位置等)后,团队将注意力集中在边缘版本不匹配上。

重新阅读文档后,我卸载了早期的 iotedge 包并安装了 aziot-edge并解决了问题!

团队在这里提出了一个 github issue 用于公共跟踪:

https://github.com/Azure/Industrial-IoT/issues/1425

@asergaz也指出了正确的方向,但没有注意到,因为它来得晚了一点


推荐阅读