EdgeX-foundry架构的学习

架构的基本认识

总架构如下图:

一、Core Services:

Configuration and Registry server

配置和注册的server都在consul的docker服务中。

每一个微服务启动后 都会通过restful api的形式将自己的配置注册到到consul的微服务中,保存形式如下图:

配置数据都会以key/value的形式存在,key值用过/来划分作用域,所有的配置都会存在/config目录下。/config/application/下的配置对所有的微服务都生效,而/config/testApp/只对testApp的微服务生效。

每个服务起来时都会将自己的信息注册到注册服务器中,当一个服务器要和另外一个服务器通讯时,首先要先将目标服务器中的配置从注册服务器中拿出来,然后在通过API的形式去访问。

Core data server:

主要是收集设备和sensor的数据

metaData微服务:

主要是记录如何和设备或sensor进行通讯、通讯时的数据格式。

command微服务

主要时首先从metaData微服务中拿到某一个设备的能力和api,然后通过这个微服务和设备、sensor进行通讯

二、Supporting Services Microservices

 Alerts & Notifications:如下图

logging:

收集所有的微服务的logging,提供了restful api来获得相关的logging内容。

特点:

1 无阻塞

2 支持logging level包括debug, info, warn, error, fatal, and so forth.

3

rules engine:

rules engine微服务的核心是使用了Drools技术 介绍https://www.jianshu.com/p/697b756b7453

1、rules engine微服务自身是一个export service client,当启动时 会将自动注册成为一个接收core data的server.

2、也可以直接将rules engine server连接到core data。如下图:

ZeroMQ时一个消息队列库https://www.cnblogs.com/rainbowzc/p/3357594.html

必须改一下配置

export.client=true # this is normally false by default and is the indication to the Rules Engine micro service to register itself with the Export Services export.zeromq.port=5563 # this port is set to 5566 when connecting to the ZeroMQ pipe out of Export Services. export.zeromq.host=tcp://[core data host] # this is set to the export distro host when connecting to the ZeroMQ pipe out of Export Services

3、rules engine 微服务里面自带有api server ,因此可以通过api 来实现添加和删除rule.

4 rules 的定义:

A rule is defined in 4 parts:

1.name: unique name

2.log entry:当满足条件时输出log

3. condition: 参数必须形成一个方程式,当满足条件时就会触发action.

参数:

parameter: temperature operand1: Integer.parseInt(value) operation: > operand2: 724. action.

exp: {"name":"motortoofastsignal", "condition": {"device":"562114e9e4b0385849b96cd8","checks":[ {"parameter":"RPM", "operand1":"Integer.parseInt(value)", "operation":">","operand2":"1200" } ] }, "action" : {"device":"56325f7ee4b05eaae5a89ce1","command":"56325f6de4b05eaae5a89cdc","body":"{\\\"value\\\":\\\"3\\\"}"},"log":"Patlite warning triggered for engine speed too high" }

场景:

比如当温度高于35度时空调自动启动,当温度低于28度时空调自动关闭。

传感器 设备都连接device server。

三、System management

1. 开始、关闭、重启微服务。

2.监控每个微服务的性能。

3.得到EdgeX微服务的配置。

四、export Services Microserver:

1. client registration(registry server)

2.distribution (distro server)

client registration: 允许客户注册自己感兴趣的数据

distro server: 根据需要将过滤后的数据传递给用户,所以又叫发行版服务

五、device services Microserver

1.virtual device

2.device service SDK

3.device profile

virtual device: 主要是在没有设备的情况下用来虚拟出来一个设备。

device service SDK

实现一个可以和device 通讯的server。然后配置一个自己的device profile.

六、security

1、security store

2、api geteway

security store:通过使用vault来管理和保存一些秘钥.

api geteway: 做为一个api访问时的认证层,主要用到 JWT或OAuth2 Authentication。

猜你喜欢

转载自blog.csdn.net/margin_0px/article/details/87873520