EdgeX Foundry - 导出数据到 HTTP 服务

news/2024/7/27 10:34:02/文章来源:https://blog.csdn.net/iiothub/article/details/136496936

文章目录

    • 一、概述
      • 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/

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.luyixian.cn/news_show_997088.aspx

如若内容造成侵权/违法违规/事实不符,请联系dt猫网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

20240304-使用VS2022编译blender3.6.2源代码

20240304-使用VS2022编译blender3.6.2源代码 一、软件环境 Win10 x64 22h2 JuneVS2022 v17.9.0CMake v3.24.4SVN v1.14.3GIT v2.29.2标签:win10 22h2 vs2022 blender 63335分栏:C 二、硬件环境 Win10 x64的PC台式机 三、获取源码 方法一 网盘下载…

Java并发编程-实现多线程的四种方式

创建线程的四种方式 创建线程的四种方式包括使用继承 Thread 类、实现 Runnable 接口、使用 Callable 和 Future 接口以及利用线程池。每种方式都有其特定的优势和适用场景。通过继承 Thread 类或实现 Runnable 接口,可以定义线程要执行的任务,并通过调用…

VUE前端问题

一、图表内容不显示 watch: {chartData3: {handler() {this.init();},},timeData3: {handler() {this.init();},},}, 添加上面代码可以动态监控数据,实现图表的展示。 二、背景图片报错显示不出来 解决方法: background: url(~/assets/login/e.png) …

go语言基础 -- 文件操作

基础的文件操作方法 go里面的文件操作封装在os包里面的File结构体中,要用的时候最好去查下官方文档,这里介绍下基本的文件操作。 打开关闭文件 import("os" ) func main() {// Open返回*File指针,后续的操作都通过*File对象操作…

分类预测 | Matlab基于GWO-RBF灰狼算法优化径向基神经网络的分类预测

分类预测 | Matlab基于GWO-RBF灰狼算法优化径向基神经网络的分类预测 目录 分类预测 | Matlab基于GWO-RBF灰狼算法优化径向基神经网络的分类预测分类效果基本介绍程序设计参考资料 分类效果 基本介绍 Matlab基于GWO-RBF灰狼算法优化径向基神经网络的分类预测。基于灰狼算法(GWO…

经典语义分割(二)医学图像分割模型UNet

经典语义分割(二)医学图像分割模型UNet 我们之前介绍了全卷积神经网络( FCN) ,FCN是基于深度学习的语义分割算法的开山之作。 今天我们介绍另一个语义分割的经典模型—UNet,它兼具轻量化与高性能,通常作为语义分割任务的基线测试模型&#x…

蓝桥杯-排序

数组排序 Arrays.sort(int[] a) 这种形式是对一个数组的所有元素进行排序,并且时按从小到大的顺序。 package Work;import java.util.*;public class Imcomplete {public static void main(String args[]) {int arr[]new int [] {1,324,4,5,7,2};Arrays.sort(arr)…

ctf_show笔记篇(web入门---文件包含)

目录 文件包含 78-79:最基础的文件包含,使用伪协议,大小写绕过或者通配符绕过,再或者使用其他方法 ​编辑80-81:可采用日志文件绕过或者大小写绕过(81只能日志文件绕过) ####80-86&#xff1…

网络编程:数据库实现增删改

1.数据库实现增删改 程序代码&#xff1a; 1 #include<myhead.h>2 //定义添加数据函数3 int do_add(sqlite3*ppDb)4 {5 //准备sql语句6 int add_numb;//工号7 char add_name[20];//姓名8 double add_salary;9 printf("请输入要添加的工号:&quo…

【C++】priority_queue和仿函数

priority_queue翻译过来就是优先队列&#xff0c;其实就是我们数据结构中的堆。堆这个东西之前也说过&#xff0c;它分为大根堆和小根堆&#xff0c;它的底层是一个类似数组的连续的空间&#xff0c;逻辑结构是一个完全二叉树&#xff0c;这个完全二叉树如果是小根堆的话父亲小…

数字孪生10个技术栈:数据采集的八种方式

大家好&#xff0c;我是贝格前端工场&#xff0c;上期讲了数字孪生10个技术栈&#xff08;总括&#xff09;:概念扫盲和总体介绍&#xff0c;获得了大家的热捧&#xff0c;本期继续分享技术栈&#xff0c;大家如有数字孪生或者数据可视化的需求&#xff0c;可以联络我们。 一、…

20240307-2-前端开发校招面试问题整理HTML

前端开发校招面试问题整理【2】——HTML 1、HTML 元素&#xff08;element&#xff09; Q&#xff1a;简单介绍下常用的 HTML 元素&#xff1f; 块状标签&#xff1a;元素独占一行&#xff0c;可指定宽、高。 常用的块状元素有&#xff1a; <div>、<p>、<h1&…

MySQL 备份方案

优质博文&#xff1a;IT-BLOG-CN 一、为什么要备份 【1】容灾恢复&#xff1a;硬件故障、不经意的 Bug 导致数据损坏&#xff0c;或者服务器及其数据由于某些原因不可获取或无法使用等&#xff08;例如&#xff1a;机房大楼烧毁&#xff0c;恶意的黑客攻击或 Mysql 的 Bug 等&…

Leetcode : 147. 对链表进行插入排序

给定单个链表的头 head &#xff0c;使用 插入排序 对链表进行排序&#xff0c;并返回 排序后链表的头 。 插入排序 算法的步骤: 插入排序是迭代的&#xff0c;每次只移动一个元素&#xff0c;直到所有元素可以形成一个有序的输出列表。 每次迭代中&#xff0c;插入排序只从输…

Java多线程——wait和notify方法作用,线程的状态

目录 引出wait和notify方法作用线程的状态创建线程有几种方式&#xff1f;方式1&#xff1a;继承Thread创建线程方式2&#xff1a;通过Runnable方式3&#xff1a;通过Callable创建线程方式4&#xff1a;通过线程池概述ThreadPoolExecutor API代码实现源码分析工作原理&#xff…

力扣刷题Days7第二题--242.有效的字母异位词(js)

目录 1&#xff0c;题目 2&#xff0c;代码 2.1 我思考完成的-初版--哈希表思想 2.2略改进 2.3排序思想 3&#xff0c;学习与总结 3.1 判断数组元素是否都为0 3.2总结 1&#xff0c;题目 给定两个字符串 s 和 t &#xff0c;编写一个函数来判断 t 是否是 s 的字母异位词…

okHttp MediaType MIME格式详解

一、介绍 我们在做数据上传时&#xff0c;经常会用到Okhttp的开源库&#xff0c;okhttp开源库也遵循html提交的MIME数据格式。 所以我们经常会看到applicaiton/json这样的格式在传。 但是如果涉及到其他文件等就需要详细的数据格式&#xff0c;否则服务端无法解析 二、okHt…

重学SpringBoot3-@EnableConfigurationProperties注解

重学SpringBoot3-EnableConfigurationProperties注解 1. 引言2. EnableConfigurationProperties 的作用3. 使用示例4. 总结 1. 引言 Spring Boot 提供了一种便捷的方式来管理和校验应用程序的配置&#xff0c;即通过类型安全的配置属性。EnableConfigurationProperties 注解在…

光谱整形1

华为张德江&#xff1a;下一代光传送网将走向400G80波WDM系统_通信世界网 (cww.net.cn) 张德江指出&#xff0c;400G WDM系统具有三大基本特征&#xff1a;支持400G80波&#xff0c;单纤32T超大容量&#xff0c;传输距离与100G相当&#xff1b;支持32维以上的光交叉&#xff1…

搜维尔科技:3D Systems Geomagic Design X 逆向工程软件

产品概述 3D Systems Geomagic Design X 是全面的逆向工程软件 GeomagicoDesign XTM是全面的逆向工程软件&#xff0c;它结合了基于特征的CAD数模与三维扫描数据处理&#xff0c;使您能创建出可编辑、基于特征的CAD数模&#xff0c;并与您现有的CAD软件兼容。 拓展您的设计能…