Azure Edge Agent在docker中保持失败 [英] Azure Edge Agent keep failing in docker
问题描述
我正在尝试运行azure edge并将IoT设备中的流量通过边缘发送到IoT Hub。我可以直接从我的物联网设备发送消息到IoT Hub,没有任何问题。但是当我尝试集成Edge时,会出现以下错误。我已完成以下步骤。
1。我在这里构建了docker镜像(https://github.com/Azure/iotedgedev/tree/master/docker/runtime)并通过运行"./ run-container.sh"启动它。我已导出边缘设备的连接字符串(IOT_DEVICE_CONNSTR)
2。当我运行它时,我得到以下输出
=>检测IP
=>创建config.yaml
配置:
source:" manual"
device_connection_string:"< MY_CONN_STRING>"
代理商:
名称:" edgeAgent"
类型:" docker"
env:{}
config:
image:" mcr.microsoft.com/azureiotedge-agent:1.0"
auth:{}
hostname:" edgehub"
connect:
management_uri:" http://host.docker.internal:15580"
workload_uri:" http://host.docker.internal:15581"
listen:
management_uri:" http://172.17.0.2:15580"
workload_uri:" http://172.17.0.2:15581"
homedir:" / var / lib / iotedge"
moby_runtime:
docker_uri:" /var/run/docker.sock"
network:"azure-iot-edge"
=>运行iotedge守护程序
3。我修改了IoT设备中的连接字符串并附加了以下内容。
; GatewayHostName = 172.17.0.2
4。当我运行物联网设备时,我在设备中收到以下错误
错误:时间:星期二2月28日18:03:10 2019文件:/ home / nuwan / projects / Azure / azure-iot-sdk-python / c / c-utility / adapters / socketio_berkeley.c Func:wait_for_connection线路:380故障:连接失败111.
错误:时间:2月28日星期四2019年18:03:10文件:/home/nuwan/projects/Azure/azure-iot-sdk-python/c/c-utility/adapters/socketio_berkeley.c Func:socketio_open行:764 wait_for_connection failed
错误:时间:周二2月28日18:03:10 2019文件:/home/nuwan/projects/Azure/azure-iot-sdk-python/c/c-utility/adapters/tlsio_openssl.c Func:on_underlying_io_open_complete行:760 tlsio_state无效。预期状态为TLSIO_STATE_OPENING_UNDERLYING_IO。
错误:时间:2月28日星期四18:03:10 2019文件:/home/nuwan/projects/Azure/azure-iot-sdk-python/c/c-utility/adapters/tlsio_openssl.c Func:tlsio_openssl_open行:1258打开基础I / O失败。
错误:时间:2月28日星期四18:03:10 2019文件:/home/nuwan/projects/Azure/azure-iot-sdk-python/c/umqtt/src/mqtt_client.c Func:mqtt_client_connect Line: 1001错误:io_open失败
错误:时间:2月28日星期四18:03:10 2019文件:/home/nuwan/projects/Azure/azure-iot-sdk-python/c/iothub_client/src/iothubtransport_mqtt_common.c Func:SendMqttConnectMsg Line:2151连接到地址172.17.0.2失败。
错误:时间:2月28日星期四18:03:11 2019文件:/home/nuwan/projects/Azure/azure-iot-sdk-python/c/c-utility/adapters/socketio_berkeley.c Func:wait_for_connection行:380失败:连接失败111.
错误:时间:2月28日星期四18:03:11 2019文件:/ home / nuwan / projects / Azure / azure-iot-sdk-python / c / c-utility /adapters/socketio_berkeley.c Func:socketio_open行:764 wait_for_connection failed
错误:时间:星期二2月28日18:03:11 2019文件:/ home / nuwan / projects / Azure / azure-iot-sdk-python / c / c-utility / adapters / tlsio_openssl.c Func:on_underlying_io_open_complete行:760 tlsio_state无效。预期状态为TLSIO_STATE_OPENING_UNDERLYING_IO。
5。在边缘日志中,我可以看到以下连续错误
< 6> 2019-02-28T06: 59:21Z [INFO] - 检查边缘运行时状态
< 6> 2019-02-28T06:59:21Z [INFO] - 边缘运行时状态失败,现在启动模块...
< 6> 2019-02-28T06:59:21Z [INFO] - 启动模块edgeAgent ...
< 6> 2019-02-28T06:59:21Z [INFO] - 已成功启动模块edgeAgent
< 6>发电机状态
< 6>现在......
< 6> 2019-02-28T07:00:21Z [INFO] - 启动模块edgeAgent ...
< 6> 2019-02-28T07:00:21Z [INFO ] - 已成功启动模块edgeAgent
< 6> 2019-02-28T07:01:21Z [INFO] - 检查边缘运行时状态
< 6> 2019-02-28T07:01:21Z [INFO ] - 边缘运行时状态失败,现在启动模块...
< 6> 2019-02-28T07:01:21Z [INFO] - 启动模块e dgeAgent ...
< 6> 2019-02-28T07:01:21Z [INFO] - 已成功启动模块edgeAgent
< 6> 2019-02-28T07:02:21Z [INFO] - 检查边缘运行时状态
6。当我运行"sudo docker logs -f edgeAgent"时我连续看到以下错误
2019-02-28 07:05:21.822 +00:00 [INF] - 边缘代理尝试连接到IoT Hub通过Amqp_Tcp_Only ...
2019-02-28 07:05:22.309 +00:00 [INF] - 在/ tmp / edgeAgent创建持久性商店
2019-02-28 07:05: 22.496 +00:00 [FTL] - 致命错误启动代理。
System.Net.Http.HttpRequestException:没有这样的设备或地址---> System.Net.Sockets.SocketException:在System.Net.Http.ConnectHelper.ConnectAsync(String host,Int32 port,CancellationToken cancellationToken)中没有这样的设备或地址
---内部异常堆栈跟踪结束---
在System.Net.Http.ConnectHelper.ConnectAsync(String host,Int32 port,CancellationToken cancellationToken)
at System.Threading.Tasks.ValueTask`1.get_Result()
at System.Net.Http.HttpConnectionPool.CreateConnectionAsync(HttpRequestMessage request,CancellationToken cancellationToken)
at System.Threading.Tasks.ValueTask`1.get_Result()
at System.Net.Http.HttpConnectionPool.WaitForCreatedConnectionAsync(ValueTask `1 creationTask)
at System.Threading.Tasks.ValueTask`1.get_Result()
at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request,Boolean doRequestAuth,CancellationToken cancellationToken)
在System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage请求,Cancellat ionToken cancellationToken)
at System.Net.Http.HttpClient.FinishSendAsyncUnbuffered(Task`1 sendTask,HttpRequestMessage request,CancellationTokenSource cts,Boolean disposeCts)
at Microsoft.Azure.Devices.Edge.Agent.Edgelet.GeneratedCode /hletletHttpClient.GetSystemInfoAsync(String api_version,CancellationToken cancellationToken)/home/vsts/work/1/s/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Edgelet/generatedCode/EdgeletHttpClient.cs:line 173
at Microsoft.Azure.Devices.Edge.Agent.Edgelet.ModuleManagementHttpClient.Execute [T](Func`1 func,String operation)
at Microsoft.Azure.Devices.Edge.Agent.Edgelet.ModuleManagementHttpClient。 GetHystemInfoAsync()位于/home/vsts/work/1/s/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Edgelet/ModuleManagementHttpClient.cs:line 120
at Microsoft.Azure.Devices。 /home/vsts/work/1/s/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Edgelet/RuntimeIn中的Edge.Agent.Edgelet.RuntimeInfoProvider`1.GetSystemInfo() foProvider.cs:第33行
,位于/ home / vsts / work / 1 / s /中的Microsoft.Azure.Devices.Edge.Agent.Docker.DockerEnvironmentProvider.CreateAsync(IRuntimeInfoProvider runtimeInfoProvider,IEntityStore`2 store,IRestartPolicyManager restartPolicyManager) edge-agent / src / Microsoft.Azure.Devices.Edge.Agent.Docker / DockerEnvironmentProvider.cs:第39行
at Microsoft.Azure.Devices.Edge.Agent.Service.Modules.EdgeletModule。<> c 。<<<> b__10_6> d.MoveNext()/home/vsts/work/1/s/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Service/modules/EdgeletModule.cs:第113行
---抛出异常的前一个位置的堆栈跟踪结束--- Microsoft.Azure.Devices.Edge.Agent.Service.Modules.AgentModule上的
。<> c。 <<<> b__13_14> d.MoveNext()/home/vsts/work/1/s/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Service/modules/AgentModule.cs:line 249
---从抛出异常的上一个位置开始的堆栈跟踪结束---在Microsof上
/home/vsts/work/1/s/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Service/Program中的t.Azure.Devices.Edge.Agent.Service.Program.MainAsync(IConfiguration配置) .cs:160行
2019-02-28 07:05:22.514 +00:00 [INF] - 请求终止,启动关闭。
2019-02-28 07:05:22.514 +00:00 [INF] - 等待清理完成
2019-02-28 07:05:22.514 +00:00 [INF] - 完成清理。关闭。
7. 当运行"openssl s_client -connect mygateway.local:8883"时它给出
connect:连接拒绝
connect:errno = 111
我也在门户中添加了以下路由到边缘设备。
{
" routes":{
" route" :"FROM / * INTO $ upstream"
}
}
任何线索?
您好Nuwan,
您能否成功完成官方文档中的快速入门?:
如果使用Windows : https://docs.microsoft.com/en-us/azure/iot-edge / quickstart
如果使用Linux: https://docs.microsoft.com/en-us/azure/iot-edge/quickstart-linux
谢谢!
Hi,
I'm trying to run azure edge and send my traffic in IoT device via edge to IoT Hub. I can directly send messages from my IoT device to IoT Hub without any issue. But When I try to integrate Edge it gives following errors. I have done the following steps.
1. I built the docker image in here (https://github.com/Azure/iotedgedev/tree/master/docker/runtime) and started it by running "./run-container.sh". I have exported the connection string of the edge device (IOT_DEVICE_CONNSTR)
2. When I run it I get the following output
=> detecting IP => creating config.yaml provisioning: source: "manual" device_connection_string: "<MY_CONN_STRING>" agent: name: "edgeAgent" type: "docker" env: {} config: image: "mcr.microsoft.com/azureiotedge-agent:1.0" auth: {} hostname: "edgehub" connect: management_uri: "http://host.docker.internal:15580" workload_uri: "http://host.docker.internal:15581" listen: management_uri: "http://172.17.0.2:15580" workload_uri: "http://172.17.0.2:15581" homedir: "/var/lib/iotedge" moby_runtime: docker_uri: "/var/run/docker.sock" network: "azure-iot-edge" => running iotedge daemon
3. I modified the connection string in my IoT device and appended following.
;GatewayHostName=172.17.0.2
4. When I run the IoT device I get the following error in device
Error: Time:Thu Feb 28 18:03:10 2019 File:/home/nuwan/projects/Azure/azure-iot-sdk-python/c/c-utility/adapters/socketio_berkeley.c Func:wait_for_connection Line:380 Failure: connect failure 111. Error: Time:Thu Feb 28 18:03:10 2019 File:/home/nuwan/projects/Azure/azure-iot-sdk-python/c/c-utility/adapters/socketio_berkeley.c Func:socketio_open Line:764 wait_for_connection failed Error: Time:Thu Feb 28 18:03:10 2019 File:/home/nuwan/projects/Azure/azure-iot-sdk-python/c/c-utility/adapters/tlsio_openssl.c Func:on_underlying_io_open_complete Line:760 Invalid tlsio_state. Expected state is TLSIO_STATE_OPENING_UNDERLYING_IO. Error: Time:Thu Feb 28 18:03:10 2019 File:/home/nuwan/projects/Azure/azure-iot-sdk-python/c/c-utility/adapters/tlsio_openssl.c Func:tlsio_openssl_open Line:1258 Failed opening the underlying I/O. Error: Time:Thu Feb 28 18:03:10 2019 File:/home/nuwan/projects/Azure/azure-iot-sdk-python/c/umqtt/src/mqtt_client.c Func:mqtt_client_connect Line:1001 Error: io_open failed Error: Time:Thu Feb 28 18:03:10 2019 File:/home/nuwan/projects/Azure/azure-iot-sdk-python/c/iothub_client/src/iothubtransport_mqtt_common.c Func:SendMqttConnectMsg Line:2151 failure connecting to address 172.17.0.2. Error: Time:Thu Feb 28 18:03:11 2019 File:/home/nuwan/projects/Azure/azure-iot-sdk-python/c/c-utility/adapters/socketio_berkeley.c Func:wait_for_connection Line:380 Failure: connect failure 111. Error: Time:Thu Feb 28 18:03:11 2019 File:/home/nuwan/projects/Azure/azure-iot-sdk-python/c/c-utility/adapters/socketio_berkeley.c Func:socketio_open Line:764 wait_for_connection failed Error: Time:Thu Feb 28 18:03:11 2019 File:/home/nuwan/projects/Azure/azure-iot-sdk-python/c/c-utility/adapters/tlsio_openssl.c Func:on_underlying_io_open_complete Line:760 Invalid tlsio_state. Expected state is TLSIO_STATE_OPENING_UNDERLYING_IO.
5. In the edge logs I can see following error continuously
<6>2019-02-28T06:59:21Z [INFO] - Checking edge runtime status <6>2019-02-28T06:59:21Z [INFO] - Edge runtime status is failed, starting module now... <6>2019-02-28T06:59:21Z [INFO] - Starting module edgeAgent... <6>2019-02-28T06:59:21Z [INFO] - Successfully started module edgeAgent <6>2019-02-28T07:00:21Z [INFO] - Checking edge runtime status <6>2019-02-28T07:00:21Z [INFO] - Edge runtime status is failed, starting module now... <6>2019-02-28T07:00:21Z [INFO] - Starting module edgeAgent... <6>2019-02-28T07:00:21Z [INFO] - Successfully started module edgeAgent <6>2019-02-28T07:01:21Z [INFO] - Checking edge runtime status <6>2019-02-28T07:01:21Z [INFO] - Edge runtime status is failed, starting module now... <6>2019-02-28T07:01:21Z [INFO] - Starting module edgeAgent... <6>2019-02-28T07:01:21Z [INFO] - Successfully started module edgeAgent <6>2019-02-28T07:02:21Z [INFO] - Checking edge runtime status
6. When I run "sudo docker logs -f edgeAgent" I see the following error continuously
2019-02-28 07:05:21.822 +00:00 [INF] - Edge agent attempting to connect to IoT Hub via Amqp_Tcp_Only... 2019-02-28 07:05:22.309 +00:00 [INF] - Created persistent store at /tmp/edgeAgent 2019-02-28 07:05:22.496 +00:00 [FTL] - Fatal error starting Agent. System.Net.Http.HttpRequestException: No such device or address ---> System.Net.Sockets.SocketException: No such device or address at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken) --- End of inner exception stack trace --- at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken) at System.Threading.Tasks.ValueTask`1.get_Result() at System.Net.Http.HttpConnectionPool.CreateConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken) at System.Threading.Tasks.ValueTask`1.get_Result() at System.Net.Http.HttpConnectionPool.WaitForCreatedConnectionAsync(ValueTask`1 creationTask) at System.Threading.Tasks.ValueTask`1.get_Result() at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken) at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) at System.Net.Http.HttpClient.FinishSendAsyncUnbuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts) at Microsoft.Azure.Devices.Edge.Agent.Edgelet.GeneratedCode.EdgeletHttpClient.GetSystemInfoAsync(String api_version, CancellationToken cancellationToken) in /home/vsts/work/1/s/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Edgelet/generatedCode/EdgeletHttpClient.cs:line 173 at Microsoft.Azure.Devices.Edge.Agent.Edgelet.ModuleManagementHttpClient.Execute[T](Func`1 func, String operation) at Microsoft.Azure.Devices.Edge.Agent.Edgelet.ModuleManagementHttpClient.GetSystemInfoAsync() in /home/vsts/work/1/s/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Edgelet/ModuleManagementHttpClient.cs:line 120 at Microsoft.Azure.Devices.Edge.Agent.Edgelet.RuntimeInfoProvider`1.GetSystemInfo() in /home/vsts/work/1/s/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Edgelet/RuntimeInfoProvider.cs:line 33 at Microsoft.Azure.Devices.Edge.Agent.Docker.DockerEnvironmentProvider.CreateAsync(IRuntimeInfoProvider runtimeInfoProvider, IEntityStore`2 store, IRestartPolicyManager restartPolicyManager) in /home/vsts/work/1/s/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Docker/DockerEnvironmentProvider.cs:line 39 at Microsoft.Azure.Devices.Edge.Agent.Service.Modules.EdgeletModule.<>c.<<Load>b__10_6>d.MoveNext() in /home/vsts/work/1/s/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Service/modules/EdgeletModule.cs:line 113 --- End of stack trace from previous location where exception was thrown --- at Microsoft.Azure.Devices.Edge.Agent.Service.Modules.AgentModule.<>c.<<Load>b__13_14>d.MoveNext() in /home/vsts/work/1/s/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Service/modules/AgentModule.cs:line 249 --- End of stack trace from previous location where exception was thrown --- at Microsoft.Azure.Devices.Edge.Agent.Service.Program.MainAsync(IConfiguration configuration) in /home/vsts/work/1/s/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Service/Program.cs:line 160 2019-02-28 07:05:22.514 +00:00 [INF] - Termination requested, initiating shutdown. 2019-02-28 07:05:22.514 +00:00 [INF] - Waiting for cleanup to finish 2019-02-28 07:05:22.514 +00:00 [INF] - Done with cleanup. Shutting down.
7. When run "openssl s_client -connect mygateway.local:8883" it gives
connect: Connection refused connect:errno=111
I have added following route to the edge device in the portal as well.
{ "routes": { "route":"FROM /* INTO $upstream" } }
Any clues?
Hi Nuwan,
Can you successfully complete the Quickstart from the official documentation?:
If using Windows: https://docs.microsoft.com/en-us/azure/iot-edge/quickstart
If using Linux: https://docs.microsoft.com/en-us/azure/iot-edge/quickstart-linux
Thank you!
这篇关于Azure Edge Agent在docker中保持失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!