EdgeX Foundry - 导出数据到 HTTP 服务

2024-03-07 06:44

本文主要是介绍EdgeX Foundry - 导出数据到 HTTP 服务,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

文章目录

    • 一、概述
      • 1.安装说明
      • 2.HTTP 服务
    • 二、安装部署
      • 1.docker-comepse
      • 2.修改配置
      • 3.启动 EdgeX Foundry
      • 4.访问 UI
        • 4.1. consul
        • 4.2. EdgeX Console
      • 5.测试

  • EdgeX Foundry
# EdgeX Foundryhttps://iothub.org.cn/docs/edgex/
https://iothub.org.cn/docs/edgex/device/export-http/

一、概述

1.安装说明

安装方式:

  • 部署虚拟设备服务 ds-virtual 模拟设备
  • EdgeX 导出数据到 HTTP 服务
  • 使用 Spring Boot 开发 HTTP 服务,接收导出数据

2.HTTP 服务

Spring Boot 程序

@RestController
public class EdgexController {@RequestMapping("/income")public void edgexCallback(@RequestBody HashMap hashMap) {System.out.println(hashMap);}
}
# 导出数据接口
http://192.168.3.4:8888/income

在这里插入图片描述

二、安装部署

1.docker-comepse

# 1.克隆 edgex-compose
$ git clone git@github.com:edgexfoundry/edgex-compose.git 
$ git clone https://github.com/edgexfoundry/edgex-compose.git
$ cd edgex-compose 
$ git checkout v3.1# 2.生成 docker-compose.yml 文件(注意这包括 mqtt-broker)
$ cd compose-builder
$ make gen ds-virtual asc-http no-secty# 3.检查生成的文件
$ ls | grep 'docker-compose.yml'
docker-compose.yml
[root@edgex mqtt-device]# git clone https://github.com/edgexfoundry/edgex-compose.git
Cloning into 'edgex-compose'...
remote: Enumerating objects: 4779, done.
remote: Counting objects: 100% (2916/2916), done.
remote: Compressing objects: 100% (173/173), done.
remote: Total 4779 (delta 2831), reused 2804 (delta 2741), pack-reused 1863
Receiving objects: 100% (4779/4779), 1.22 MiB | 450.00 KiB/s, done.
Resolving deltas: 100% (4042/4042), done.[root@edgex mqtt-device]# ll
total 4
drwxr-xr-x. 6 root root 4096 Feb  1 04:10 edgex-compose[root@edgex mqtt-device]# cd edgex-compose/
[root@edgex edgex-compose]# git checkout v3.1
Note: checking out 'v3.1'.You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:git checkout -b new_branch_nameHEAD is now at 488a3fe... Merge pull request #424 from lenny-intel/device-mqtt-secure-mode-napa[root@edgex edgex-compose]# cd compose-builder/[root@edgex compose-builder]# make gen ds-virtual asc-http no-secty
echo MQTT_VERBOSE=
MQTT_VERBOSE=
docker compose  -p edgex -f docker-compose-base.yml -f add-device-virtual.yml -f add-asc-http-export.yml convert > docker-compose.yml
rm -rf ./gen_ext_compose[root@edgex compose-builder]# ls | grep 'docker-compose.yml'
docker-compose.yml
[root@edgex compose-builder]# vim docker-compose.yml name: edgex
services:app-http-export:container_name: edgex-app-http-exportdepends_on:consul:condition: service_startedrequired: truecore-data:condition: service_startedrequired: trueenvironment:EDGEX_PROFILE: http-exportEDGEX_SECURITY_SECRET_STORE: "false"SERVICE_HOST: edgex-app-http-exportWRITABLE_LOGLEVEL: INFOWRITABLE_PIPELINE_FUNCTIONS_HTTPEXPORT_PARAMETERS_URL: http://EXPORT_HOST_PLACE_HOLDER:7770hostname: edgex-app-http-exportimage: edgexfoundry/app-service-configurable:3.1.0networks:edgex-network: nullports:- mode: ingresshost_ip: 127.0.0.1target: 59704published: "59704"protocol: tcpread_only: truerestart: alwayssecurity_opt:- no-new-privileges:trueuser: 2002:2001volumes:- type: bindsource: /etc/localtimetarget: /etc/localtimeread_only: truebind:create_host_path: true......

2.修改配置

# 修改配置
注意WRITABLE_PIPELINE_FUNCTIONS_HTTPEXPORT_PARAMETERS_URL: http://192.168.10.131:8080/income这里配置了我们的导出端点,即http://192.168.10.131:8080/income,这里是我自定义的一个springboot应用WRITABLE_PIPELINE_FUNCTIONS_HTTPEXPORT_PARAMETERS_URL: http://192.168.3.4:8888/income[root@edgex compose-builder]# vim docker-compose.yml name: edgex
services:app-http-export:container_name: edgex-app-http-export
......environment:EDGEX_PROFILE: http-exportEDGEX_SECURITY_SECRET_STORE: "false"SERVICE_HOST: edgex-app-http-exportWRITABLE_LOGLEVEL: INFOWRITABLE_PIPELINE_FUNCTIONS_HTTPEXPORT_PARAMETERS_URL: http://192.168.3.4:8888/income

3.启动 EdgeX Foundry

使用以下命令部署 EdgeX:

$ cd edgex-compose/compose-builder
$ docker compose pull
$ docker compose up -d# 修改配置文件
替换IP地址 127.0.0.1 为 0.0.0.0# 修改 http接口
WRITABLE_PIPELINE_FUNCTIONS_HTTPEXPORT_PARAMETERS_URL: http://192.168.3.4:8888/income
# docker compose pull# docker compose up -d

在这里插入图片描述
在这里插入图片描述

4.访问 UI

4.1. consul
# 访问地址
http://192.168.202.233:8500

在这里插入图片描述

4.2. EdgeX Console
# 访问地址
http://192.168.202.233:4000/

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

5.测试

在这里插入图片描述

{profileName = Random - Boolean - Device, apiVersion = v3, readings = [{id = 638 d5e03 - 5 f65 - 4007 - 95 f6 - 856986e cf3b0,origin = 1708432044141665586,deviceName = Random - Boolean - Device,resourceName = Bool,profileName = Random - Boolean - Device,valueType = Bool,value = true}], origin = 1708432044141665586, id = 5 c05ac22 - 59e6 - 41e e - 8 f9b - c3973b0e17d6, sourceName = Bool, deviceName = Random - Boolean - Device
} {profileName = Random - Float - Device, apiVersion = v3, readings = [{id = 33e07 d1d - dc31 - 4e5 f - b4ca - 4 d2505da81cf,origin = 1708432044120816042,deviceName = Random - Float - Device,resourceName = Float64,profileName = Random - Float - Device,valueType = Float64,value = -1.669694e+308}], origin = 1708432044120816042, id = bc40b33a - 9270 - 40 a2 - 90 cb - 510995 d92a02, sourceName = Float64, deviceName = Random - Float - Device
} {profileName = Random - Integer - Device, apiVersion = v3, readings = [{id = 450 d2e8d - 057 d - 4e85 - a09e - d9165d97473c,origin = 1708432044127607940,deviceName = Random - Integer - Device,resourceName = Int8,profileName = Random - Integer - Device,valueType = Int8,value = 93}], origin = 1708432044127607940, id = 292 b0bd7 - 8e a1 - 4 aa4 - a903 - 462 df4361169, sourceName = Int8, deviceName = Random - Integer - Device
} {profileName = Random - UnsignedInteger - Device, apiVersion = v3, readings = [{id = 403e305 c - 300 d - 468 a - a057 - edc97a0b3cdf,origin = 1708432044131510252,deviceName = Random - UnsignedInteger - Device,resourceName = Uint8,profileName = Random - UnsignedInteger - Device,valueType = Uint8,value = 223}], origin = 1708432044131510252, id = f8ed3c1b - cdb6 - 4189 - bf76 - 3 b3d209bffd0, sourceName = Uint8, deviceName = Random - UnsignedInteger - Device
} ......
  • EdgeX Foundry
# EdgeX Foundryhttps://iothub.org.cn/docs/edgex/
https://iothub.org.cn/docs/edgex/device/export-http/

这篇关于EdgeX Foundry - 导出数据到 HTTP 服务的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/782661

相关文章

大模型研发全揭秘:客服工单数据标注的完整攻略

在人工智能(AI)领域,数据标注是模型训练过程中至关重要的一步。无论你是新手还是有经验的从业者,掌握数据标注的技术细节和常见问题的解决方案都能为你的AI项目增添不少价值。在电信运营商的客服系统中,工单数据是客户问题和解决方案的重要记录。通过对这些工单数据进行有效标注,不仅能够帮助提升客服自动化系统的智能化水平,还能优化客户服务流程,提高客户满意度。本文将详细介绍如何在电信运营商客服工单的背景下进行

基于MySQL Binlog的Elasticsearch数据同步实践

一、为什么要做 随着马蜂窝的逐渐发展,我们的业务数据越来越多,单纯使用 MySQL 已经不能满足我们的数据查询需求,例如对于商品、订单等数据的多维度检索。 使用 Elasticsearch 存储业务数据可以很好的解决我们业务中的搜索需求。而数据进行异构存储后,随之而来的就是数据同步的问题。 二、现有方法及问题 对于数据同步,我们目前的解决方案是建立数据中间表。把需要检索的业务数据,统一放到一张M

关于数据埋点,你需要了解这些基本知识

产品汪每天都在和数据打交道,你知道数据来自哪里吗? 移动app端内的用户行为数据大多来自埋点,了解一些埋点知识,能和数据分析师、技术侃大山,参与到前期的数据采集,更重要是让最终的埋点数据能为我所用,否则可怜巴巴等上几个月是常有的事。   埋点类型 根据埋点方式,可以区分为: 手动埋点半自动埋点全自动埋点 秉承“任何事物都有两面性”的道理:自动程度高的,能解决通用统计,便于统一化管理,但个性化定

使用SecondaryNameNode恢复NameNode的数据

1)需求: NameNode进程挂了并且存储的数据也丢失了,如何恢复NameNode 此种方式恢复的数据可能存在小部分数据的丢失。 2)故障模拟 (1)kill -9 NameNode进程 [lytfly@hadoop102 current]$ kill -9 19886 (2)删除NameNode存储的数据(/opt/module/hadoop-3.1.4/data/tmp/dfs/na

异构存储(冷热数据分离)

异构存储主要解决不同的数据,存储在不同类型的硬盘中,达到最佳性能的问题。 异构存储Shell操作 (1)查看当前有哪些存储策略可以用 [lytfly@hadoop102 hadoop-3.1.4]$ hdfs storagepolicies -listPolicies (2)为指定路径(数据存储目录)设置指定的存储策略 hdfs storagepolicies -setStoragePo

Hadoop集群数据均衡之磁盘间数据均衡

生产环境,由于硬盘空间不足,往往需要增加一块硬盘。刚加载的硬盘没有数据时,可以执行磁盘数据均衡命令。(Hadoop3.x新特性) plan后面带的节点的名字必须是已经存在的,并且是需要均衡的节点。 如果节点不存在,会报如下错误: 如果节点只有一个硬盘的话,不会创建均衡计划: (1)生成均衡计划 hdfs diskbalancer -plan hadoop102 (2)执行均衡计划 hd

【Prometheus】PromQL向量匹配实现不同标签的向量数据进行运算

✨✨ 欢迎大家来到景天科技苑✨✨ 🎈🎈 养成好习惯,先赞后看哦~🎈🎈 🏆 作者简介:景天科技苑 🏆《头衔》:大厂架构师,华为云开发者社区专家博主,阿里云开发者社区专家博主,CSDN全栈领域优质创作者,掘金优秀博主,51CTO博客专家等。 🏆《博客》:Python全栈,前后端开发,小程序开发,人工智能,js逆向,App逆向,网络系统安全,数据分析,Django,fastapi

【区块链 + 人才服务】可信教育区块链治理系统 | FISCO BCOS应用案例

伴随着区块链技术的不断完善,其在教育信息化中的应用也在持续发展。利用区块链数据共识、不可篡改的特性, 将与教育相关的数据要素在区块链上进行存证确权,在确保数据可信的前提下,促进教育的公平、透明、开放,为教育教学质量提升赋能,实现教育数据的安全共享、高等教育体系的智慧治理。 可信教育区块链治理系统的顶层治理架构由教育部、高校、企业、学生等多方角色共同参与建设、维护,支撑教育资源共享、教学质量评估、

烟火目标检测数据集 7800张 烟火检测 带标注 voc yolo

一个包含7800张带标注图像的数据集,专门用于烟火目标检测,是一个非常有价值的资源,尤其对于那些致力于公共安全、事件管理和烟花表演监控等领域的人士而言。下面是对此数据集的一个详细介绍: 数据集名称:烟火目标检测数据集 数据集规模: 图片数量:7800张类别:主要包含烟火类目标,可能还包括其他相关类别,如烟火发射装置、背景等。格式:图像文件通常为JPEG或PNG格式;标注文件可能为X

pandas数据过滤

Pandas 数据过滤方法 Pandas 提供了多种方法来过滤数据,可以根据不同的条件进行筛选。以下是一些常见的 Pandas 数据过滤方法,结合实例进行讲解,希望能帮你快速理解。 1. 基于条件筛选行 可以使用布尔索引来根据条件过滤行。 import pandas as pd# 创建示例数据data = {'Name': ['Alice', 'Bob', 'Charlie', 'Dav