Edge-home-orchestration-go: [DataStorage] 在缓存中找不到设备

创建于 2021-06-08  ·  10评论  ·  资料来源: lf-edge/edge-home-orchestration-go

描述错误
如果edge-orchestration 首次将设备配置注册到edgex,则edge-orchestration 在缓存中找不到设备。 它在重新启动后工作。

再现

  1. 清除redis数据库
  2. 使用 DataStorage 配置文件运行边缘编排
  3. 在上传 Int 值方面调用 API

来自边缘编排的日志

level=INFO ts=2021-06-08T11:09:41.747141457Z app=datastorage source=config.go:193 msg="Loaded configuration from ./res/configuration.toml"

level=INFO ts=2021-06-08T11:09:41.748290804Z app=datastorage source=config.go:304 msg="Using local configuration from file (0 envVars overrides applied)"
level=INFO ts=2021-06-08T11:09:41.748336679Z app=datastorage source=httpserver.go:99 msg="Web server starting (127.0.0.1:49986)"
level=INFO ts=2021-06-08T11:09:41.748393149Z app=datastorage source=init.go:144 msg="Check Metadata service's status by ping..."
level=INFO ts=2021-06-08T11:09:41.748528479Z app=datastorage source=init.go:144 msg="Check Data service's status by ping..."
level=INFO ts=2021-06-08T11:09:41.749614627Z app=datastorage source=init.go:68 msg="Service clients initialize successful."
level=INFO ts=2021-06-08T11:09:41.750747311Z app=datastorage source=service.go:207 msg="Addressable datastorage doesn't exist, creating a new one"
level=DEBUG ts=2021-06-08T11:09:41.751916563Z app=datastorage source=service.go:153 msg="Trying to find DeviceService: datastorage"
level=INFO ts=2021-06-08T11:09:41.752643978Z app=datastorage source=service.go:157 msg="DeviceService datastorage doesn't exist, creating a new one"
level=DEBUG ts=2021-06-08T11:09:41.754344754Z app=datastorage source=service.go:169 msg="New DeviceService Id: 6faac9ac-6ec1-41ee-8661-927954bb7ea1"
INFO[2021-06-08T11:09:41Z]storagedriver.go:43 Initialize [storagedriver] Device service intialize started
level=DEBUG ts=2021-06-08T11:09:41.75790956Z app=datastorage source=restrouter.go:119 route=/api/v1/resource/{deviceName}/{resourceName} methods=[POST] msg="Route added"
level=INFO ts=2021-06-08T11:09:41.757963324Z app=datastorage source=storagehandler.go:66 msg="Route /api/v1/resource/{deviceName}/{resourceName} added."
level=INFO ts=2021-06-08T11:09:41.759800964Z app=datastorage source=restrouter.go:75 msg="Registering v2 routes..."
level=DEBUG ts=2021-06-08T11:09:41.76021791Z app=datastorage source=profiles.go:47 msg="created absolute path for loading pre-defined Device Profiles: /edge-orchestration/res"
level=DEBUG ts=2021-06-08T11:09:41.76330122Z app=datastorage source=profiles.go:172 msg="Getting EnableValueDescriptorManagement configuration value from Core Metadata"
level=DEBUG ts=2021-06-08T11:09:41.763993203Z app=datastorage source=devices.go:29 msg="Loading pre-define Devices from configuration"
level=DEBUG ts=2021-06-08T11:09:41.764037017Z app=datastorage source=devices.go:35 msg="Device datastorage doesn't exist, creating a new one"
level=DEBUG ts=2021-06-08T11:09:41.764581907Z app=datastorage source=devices.go:75 msg="Adding Device: {\"origin\":1623150581764,\"description\":\"RESTful Device\",\"name\":\"datastorage\",\"adminState\":\"UNLOCKED\",\"operatingState\":\"ENABLED\",\"protocols\":{\"other\":{}},\"labels\":[\"rest\",\"json\"],\"service\":{\"origin\":1623150581751,\"id\":\"6faac9ac-6ec1-41ee-8661-927954bb7ea1\",\"name\":\"datastorage\",\"operatingState\":\"ENABLED\",\"addressable\":{\"origin\":1623150581749,\"id\":\"7b016ca7-5b53-4aa3-88e5-6f4a0b484271\",\"name\":\"datastorage\",\"protocol\":\"HTTP\",\"method\":\"POST\",\"address\":\"127.0.0.1\",\"port\":49986,\"path\":\"/api/v1/callback\",\"baseURL\":\"http://127.0.0.1:49986\",\"url\":\"http://127.0.0.1:49986/api/v1/callback\"},\"adminState\":\"UNLOCKED\"},\"profile\":{\"description\":\"REST Device\",\"id\":\"3b356db4-fe39-4dc4-bd25-8bebef5e15ce\",\"name\":\"datastorage\",\"manufacturer\":\"Home Edge\",\"model\":\"Home Edge\",\"labels\":[\"rest\",\"json\",\"numeric\",\"float\",\"int\"],\"deviceResources\":[{\"description\":\"json\",\"name\":\"json\",\"properties\":{\"value\":{\"type\":\"String\",\"readWrite\":\"RW\",\"mediaType\":\"application/json\"},\"units\":{\"type\":\"String\",\"readWrite\":\"R\"}}},{\"name\":\"int\",\"properties\":{\"value\":{\"type\":\"Int64\",\"readWrite\":\"RW\",\"mediaType\":\"text/plain\"},\"units\":{\"type\":\"String\",\"readWrite\":\"R\"}}},{\"description\":\"float\",\"name\":\"float\",\"properties\":{\"value\":{\"type\":\"Float64\",\"readWrite\":\"RW\",\"mediaType\":\"text/plain\"},\"units\":{\"type\":\"String\",\"readWrite\":\"R\"}}},{\"description\":\"jpeg\",\"name\":\"jpeg\",\"properties\":{\"value\":{\"type\":\"Binary\",\"readWrite\":\"RW\",\"mediaType\":\"image/jpeg\"},\"units\":{\"type\":\"String\",\"readWrite\":\"R\"}}},{\"description\":\"png\",\"name\":\"png\",\"properties\":{\"value\":{\"type\":\"Binary\",\"readWrite\":\"RW\",\"mediaType\":\"image/png\"},\"units\":{\"type\":\"String\",\"readWrite\":\"R\"}}},{\"description\":\"string\",\"name\":\"string\",\"properties\":{\"value\":{\"type\":\"String\",\"readWrite\":\"RW\",\"mediaType\":\"text/plain\"},\"units\":{\"type\":\"String\",\"readWrite\":\"R\"}}}]}}"
level=INFO ts=2021-06-08T11:09:41.766971106Z app=datastorage source=autodiscovery.go:32 msg="AutoDiscovery stopped: disabled by configuration"
level=INFO ts=2021-06-08T11:09:41.767031297Z app=datastorage source=autodiscovery.go:37 msg="AutoDiscovery stopped: interval error in configuration"
level=INFO ts=2021-06-08T11:09:41.76706353Z app=datastorage source=autodiscovery.go:41 msg="AutoDiscovery stopped: ProtocolDiscovery not implemented"
level=INFO ts=2021-06-08T11:09:41.767094873Z app=datastorage source=message.go:50 msg="Service dependencies resolved..."
level=INFO ts=2021-06-08T11:09:41.767156624Z app=datastorage source=message.go:51 msg="Starting datastorage to be replaced by makefile "
level=INFO ts=2021-06-08T11:09:41.767182718Z app=datastorage source=message.go:58 msg="Service started in: 20.913936ms"


level=DEBUG ts=2021-06-08T11:09:51.973581107Z app=datastorage source=storagehandler.go:84 msg="Received POST for Device=datastorage Resource=int"
level=INFO ts=2021-06-08T11:09:51.973670443Z app=datastorage source=manageddevices.go:71 msg="Device datastorage cannot be found in cache"
level=ERROR ts=2021-06-08T11:09:51.973714012Z app=datastorage source=storagehandler.go:88 msg="Incoming reading ignored. Device 'datastorage' not found"

测试环境配置(请填写以下信息):

  • 固件版本:Ubuntu 20.04
  • 硬件:x86-64
  • Edge Orchestration 发布:Coconut
bug help wanted high priority

最有用的评论

.search-word {
背景颜色:#ffee94
}
P{
字体大小:10pt; 边距底部:5px; 字体家族:Arial,arial; 边距:5px
}
TD{
字体大小:10pt; 边距底部:5px; 字体家族:Arial,arial; 边距:5px
}
李{
字体大小:10pt; 边距底部:5px; 字体家族:Arial,arial; 边距:5px
}
身体 {
字体大小:10pt; 字体家族:Arial,arial
}

P{
字体大小:10pt; 边距底部:5px; 字体家族:Arial,arial; 边距:5px
}


你好,彼得,

问题不是来自 EdgeX 方面。 在与 Cloud Tsai 讨论后,我了解到它使用了错误的 IP 地址,因此 coredata 无法调用回调,因此缓存不会更新。 对于本地机器,我测试时使用 docker0 IP 地址解决了该问题。
但现在的问题是,Taewan 很好地提到了 EdgeX 在一个设备上独立运行,而 Edge-Orchestration 在另一个连接到网络的设备上运行的场景。 因此,无论缓存问题如何,都必须对此进行测试。 我正在尝试进行类似的设置。 虽然我用普通的 ping docker (alpine) 测试了类似的场景,并且能够使用覆盖网络设置通信。 现在我需要尝试边缘编排。

感谢和问候
尼图

- - - - - 原始信息 - - - - -
发件人:Peter Moonki @>日期 : 2021-09-07 07:46 (GMT+5:30)标题 : Re: [lf-edge/edge-home-orchestration-go] [DataStorage] 在缓存中找不到设备 (#312)至:* @ >
抄送:Nitu Sajjanlal @>, @ .* >

@nitu-s-gupta 你如何看待从 HomeEdge 解决这个问题而不是在 EdgeX 上请求它,因为在我看来,我们请求的基本原理与 EdgeX 上现有的 device-sdk-go 冲突?
— 您收到此邮件是因为有人提及您。直接回复此电子邮件、在 GitHub 上查看或取消订阅。使用 iOS 或 Android 版 GitHub Mobile 随时随地进行分类通知。

所有10条评论

@t25kim

我复制了这个错误。 每当我们尝试添加新设备时都会发生这种情况。

例子 :

  1. 如果我们编辑 YAML 配置文件的名称
  2. 编辑配置文件中的设备名称

在我们第二次构建之前不会发现这个设备。 我尝试了多次,这个问题似乎是一致的。 我正在检查这是否是 Hanoi 版本的问题,或者是否需要从我们这边完成。

@t25kim

我复制了这个错误。 每当我们尝试添加新设备时都会发生这种情况。

例子 :

  1. 如果我们编辑 YAML 配置文件的名称
  2. 编辑配置文件中的设备名称

在我们第二次构建之前不会发现这个设备。 我尝试了多次,这个问题似乎是一致的。 我正在检查这是否是 Hanoi 版本的问题,或者是否需要从我们这边完成。

谢谢@sun-sharma。
我在 EdgeX v2.0.0 上遇到了同样的问题。 请使用 PR #326 进行测试。

这个问题来自 EdgeX 端,当服务启动时,元数据中已经存在的设备会加载到缓存中。 但是添加的设备不会添加到缓存中。 因此,重新启动后不会发生这种情况。 我已经尝试过使用 device-rest.go。 观察到相同的行为。 edgex 代工厂的 device-sdk 需要更改。 如果 edgexfoundry,我检查了设备 sdk 的文件 (/internal/provision/devices.go)。 这在设备启动时调用。

这个问题来自 EdgeX 端,当服务启动时,元数据中已经存在的设备会加载到缓存中。 但是添加的设备不会添加到缓存中。 因此,重新启动后不会发生这种情况。 我已经尝试过使用 device-rest.go。 观察到相同的行为。 edgex 代工厂的 device-sdk 需要更改。 如果 edgexfoundry,我检查了设备 sdk 的文件 (/internal/provision/devices.go)。 这在设备启动时调用。

@nitu-s-gupta 和我一起接近 EdgeX 并尝试解决这个问题怎么样? 😄

这个问题来自 EdgeX 端,当服务启动时,元数据中已经存在的设备会加载到缓存中。 但是添加的设备不会添加到缓存中。 因此,重新启动后不会发生这种情况。 我已经尝试过使用 device-rest.go。 观察到相同的行为。 edgex 代工厂的 device-sdk 需要更改。 如果 edgexfoundry,我检查了设备 sdk 的文件 (/internal/provision/devices.go)。 这在设备启动时调用。

谢谢你的努力!
让我更详细地解释一下,edgex-metadata 应该向服务发送更新缓存的请求(指南不正确)。 但是 edgex-metadata 不会这样做。
当我将该 REST API 调用到数据存储时,缓存已更新。

edgex-元数据数据

curl http://localhost:48081/api/v1/device
[{"created":1629351516733,"modified":1629351516733,"origin":1629351516731,"description":"RESTful Device","id":"774deba4-5469-4c38-8c2a-93a0f3c08252","name":"edge-orchestration-c1b23cc6-0767-400a-9cf0-36e1b3902da2",

卷曲请求

$ curl -X 'POST' ' http://localhost :49986/api/v1/callback' -H 'accept: / ' -H 'Content-Type: application/json' -d '{"type":"DEVICE ","id":"774deba4-5469-4c38-8c2a-93a0f3c08252"}'

边缘编排日志

INFO[2021-08-19T06:01:36Z]discovery.go:577 func1
level=INFO ts=2021-08-19T06:02:25.506828567Z app=datastorage source=device.go:72 msg="Added device: edge-orchestration-c1b23cc6-0767-400a-9cf0-36e1b3902da2"
INFO[2021-08-19T06:02:25Z]storagedriver.go:73 AddDevice [storagedriver] Device has been successfully added!!!!!! edge-orchestration-c1b23cc6-0767-400a-9cf0-36e1b3902da2
level=DEBUG ts=2021-08-19T06:02:25.50692288Z app=datastorage source=device.go:82 msg="Invoked driver.AddDevice callback for edge-orchestration-c1b23cc6-0767-400a-9cf0-36e1b3902da2"
level=DEBUG ts=2021-08-19T06:02:25.50693632Z app=datastorage source=device.go:89 msg="Handler - starting AutoEvents for device edge-orchestration-c1b23cc6-0767-400a-9cf0-36e1b3902da2"

我认为 edgex 将被修复,或者我们可以向数据存储添加一些解决方法代码。
你喜欢哪个? (将此问题分享给 edgex 有利于开源协作

@t25kim如何在设备 sdk 的 edgex github 中提出问题?,以便它可以更新。 解决方法可以像调用 API 一样完成。 但我注意到的另一件事是我们有回调的存储驱动程序,这些回调应该在添加设备时调用。 但这也没有被调用,因为工作 aorund 步骤将包含在那里

这个问题来自 EdgeX 端,当服务启动时,元数据中已经存在的设备会加载到缓存中。 但是添加的设备不会添加到缓存中。 因此,重新启动后不会发生这种情况。 我已经尝试过使用 device-rest.go。 观察到相同的行为。 edgex 代工厂的 device-sdk 需要更改。 如果 edgexfoundry,我检查了设备 sdk 的文件 (/internal/provision/devices.go)。 这在设备启动时调用。

谢谢你的努力!
让我更详细地解释一下,edgex-metadata 应该向服务发送更新缓存的请求(指南不正确)。 但是 edgex-metadata 不会这样做。
当我将该 REST API 调用到数据存储时,缓存已更新。

edgex-元数据数据

curl http://localhost:48081/api/v1/device
[{"created":1629351516733,"modified":1629351516733,"origin":1629351516731,"description":"RESTful Device","id":"774deba4-5469-4c38-8c2a-93a0f3c08252","name":"edge-orchestration-c1b23cc6-0767-400a-9cf0-36e1b3902da2",

卷曲请求

$ curl -X 'POST' ' http://localhost :49986/api/v1/callback' -H 'accept: _/_' -H 'Content-Type: application/json' -d '{"type": "设备","id":"774deba4-5469-4c38-8c2a-93a0f3c08252"}'

边缘编排日志

INFO[2021-08-19T06:01:36Z]discovery.go:577 func1
level=INFO ts=2021-08-19T06:02:25.506828567Z app=datastorage source=device.go:72 msg="Added device: edge-orchestration-c1b23cc6-0767-400a-9cf0-36e1b3902da2"
INFO[2021-08-19T06:02:25Z]storagedriver.go:73 AddDevice [storagedriver] Device has been successfully added!!!!!! edge-orchestration-c1b23cc6-0767-400a-9cf0-36e1b3902da2
level=DEBUG ts=2021-08-19T06:02:25.50692288Z app=datastorage source=device.go:82 msg="Invoked driver.AddDevice callback for edge-orchestration-c1b23cc6-0767-400a-9cf0-36e1b3902da2"
level=DEBUG ts=2021-08-19T06:02:25.50693632Z app=datastorage source=device.go:89 msg="Handler - starting AutoEvents for device edge-orchestration-c1b23cc6-0767-400a-9cf0-36e1b3902da2"

我认为 edgex 将被修复,或者我们可以向数据存储添加一些解决方法代码。
你喜欢哪个? (将此问题分享给 edgex 有利于开源协作

@jpwhitemn嗨,我们遇到了与 EdgeX Foundry 相关的数据存储问题。 您能否向我们介绍 EdgeX 社区中合适的人来讨论和/或解决此主题? 😄

如何在设备sdk的edgex github中提出问题?,以便它可以更新。 解决方法可以像调用 API 一样完成。 但我注意到的另一件事是我们有回调的存储驱动程序,这些回调应该在添加设备时调用。 但这也没有被调用,因为工作 aorund 步骤将包含在那里

我同意与 edgex 分享这个问题。 但是,如果在 home edge d-release 之前没有在 edgex 上实施补丁,让我们在 Edge Orchestration 上修复它。

.search-word {
背景颜色:#ffee94
}
P{
字体大小:10pt; 边距底部:5px; 字体家族:Arial,arial; 边距:5px
}
TD{
字体大小:10pt; 边距底部:5px; 字体家族:Arial,arial; 边距:5px
}
李{
字体大小:10pt; 边距底部:5px; 字体家族:Arial,arial; 边距:5px
}
身体 {
字体大小:10pt; 字体家族:Arial,arial
}

P{
字体大小:10pt; 边距底部:5px; 字体家族:Arial,arial; 边距:5px
}


你好,彼得,

问题不是来自 EdgeX 方面。 在与 Cloud Tsai 讨论后,我了解到它使用了错误的 IP 地址,因此 coredata 无法调用回调,因此缓存不会更新。 对于本地机器,我测试时使用 docker0 IP 地址解决了该问题。
但现在的问题是,Taewan 很好地提到了 EdgeX 在一个设备上独立运行,而 Edge-Orchestration 在另一个连接到网络的设备上运行的场景。 因此,无论缓存问题如何,都必须对此进行测试。 我正在尝试进行类似的设置。 虽然我用普通的 ping docker (alpine) 测试了类似的场景,并且能够使用覆盖网络设置通信。 现在我需要尝试边缘编排。

感谢和问候
尼图

- - - - - 原始信息 - - - - -
发件人:Peter Moonki @>日期 : 2021-09-07 07:46 (GMT+5:30)标题 : Re: [lf-edge/edge-home-orchestration-go] [DataStorage] 在缓存中找不到设备 (#312)至:* @ >
抄送:Nitu Sajjanlal @>, @ .* >

@nitu-s-gupta 你如何看待从 HomeEdge 解决这个问题而不是在 EdgeX 上请求它,因为在我看来,我们请求的基本原理与 EdgeX 上现有的 device-sdk-go 冲突?
— 您收到此邮件是因为有人提及您。直接回复此电子邮件、在 GitHub 上查看或取消订阅。使用 iOS 或 Android 版 GitHub Mobile 随时随地进行分类通知。

谢谢你的澄清,@nitu-s-gupta 😄

此页面是否有帮助?
0 / 5 - 0 等级

相关问题

MoonkiHong picture MoonkiHong  ·  6评论

t25kim picture t25kim  ·  5评论

t25kim picture t25kim  ·  3评论

t25kim picture t25kim  ·  5评论

t25kim picture t25kim  ·  3评论