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

相关文章

Python将博客内容html导出为Markdown格式

《Python将博客内容html导出为Markdown格式》Python将博客内容html导出为Markdown格式,通过博客url地址抓取文章,分析并提取出文章标题和内容,将内容构建成html,再转... 目录一、为什么要搞?二、准备如何搞?三、说搞咱就搞!抓取文章提取内容构建html转存markdown

Python获取中国节假日数据记录入JSON文件

《Python获取中国节假日数据记录入JSON文件》项目系统内置的日历应用为了提升用户体验,特别设置了在调休日期显示“休”的UI图标功能,那么问题是这些调休数据从哪里来呢?我尝试一种更为智能的方法:P... 目录节假日数据获取存入jsON文件节假日数据读取封装完整代码项目系统内置的日历应用为了提升用户体验,

vue使用docxtemplater导出word

《vue使用docxtemplater导出word》docxtemplater是一种邮件合并工具,以编程方式使用并处理条件、循环,并且可以扩展以插入任何内容,下面我们来看看如何使用docxtempl... 目录docxtemplatervue使用docxtemplater导出word安装常用语法 封装导出方

使用Python实现快速搭建本地HTTP服务器

《使用Python实现快速搭建本地HTTP服务器》:本文主要介绍如何使用Python快速搭建本地HTTP服务器,轻松实现一键HTTP文件共享,同时结合二维码技术,让访问更简单,感兴趣的小伙伴可以了... 目录1. 概述2. 快速搭建 HTTP 文件共享服务2.1 核心思路2.2 代码实现2.3 代码解读3.

Java利用JSONPath操作JSON数据的技术指南

《Java利用JSONPath操作JSON数据的技术指南》JSONPath是一种强大的工具,用于查询和操作JSON数据,类似于SQL的语法,它为处理复杂的JSON数据结构提供了简单且高效... 目录1、简述2、什么是 jsONPath?3、Java 示例3.1 基本查询3.2 过滤查询3.3 递归搜索3.4

java中使用POI生成Excel并导出过程

《java中使用POI生成Excel并导出过程》:本文主要介绍java中使用POI生成Excel并导出过程,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录需求说明及实现方式需求完成通用代码版本1版本2结果展示type参数为atype参数为b总结注:本文章中代码均为

MySQL大表数据的分区与分库分表的实现

《MySQL大表数据的分区与分库分表的实现》数据库的分区和分库分表是两种常用的技术方案,本文主要介绍了MySQL大表数据的分区与分库分表的实现,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有... 目录1. mysql大表数据的分区1.1 什么是分区?1.2 分区的类型1.3 分区的优点1.4 分

Mysql删除几亿条数据表中的部分数据的方法实现

《Mysql删除几亿条数据表中的部分数据的方法实现》在MySQL中删除一个大表中的数据时,需要特别注意操作的性能和对系统的影响,本文主要介绍了Mysql删除几亿条数据表中的部分数据的方法实现,具有一定... 目录1、需求2、方案1. 使用 DELETE 语句分批删除2. 使用 INPLACE ALTER T

Python Dash框架在数据可视化仪表板中的应用与实践记录

《PythonDash框架在数据可视化仪表板中的应用与实践记录》Python的PlotlyDash库提供了一种简便且强大的方式来构建和展示互动式数据仪表板,本篇文章将深入探讨如何使用Dash设计一... 目录python Dash框架在数据可视化仪表板中的应用与实践1. 什么是Plotly Dash?1.1

Redis 中的热点键和数据倾斜示例详解

《Redis中的热点键和数据倾斜示例详解》热点键是指在Redis中被频繁访问的特定键,这些键由于其高访问频率,可能导致Redis服务器的性能问题,尤其是在高并发场景下,本文给大家介绍Redis中的热... 目录Redis 中的热点键和数据倾斜热点键(Hot Key)定义特点应对策略示例数据倾斜(Data S