EDGEX FOUNDRY配置参数 --- sys-mgmt-agent

sys-mgmt-agent是EDGEX系统中提供其他微服务生命周期管理的一个微服务,它主要提供3个功能:start,stop,restart其他微服务,获取微服务的配置参数,获取微服务运行时的metric指标。sys-mgmt-agent使用介绍如下,他有2个启动参数可以配置:

  • registry是一个bool量,True表示export-client的配置参数是从consul拉取,False表示从本地配置文件载入。
  • profile本地配置文件的路径, 即便registry=True, 该参数也必须要指明一个配置文件,因为连接consul服务所需的host,port等参数必须从本地的配置文件中获取。
Usage: %s [options]
Server Options:
    -r, --registry                  Indicates service should use Registry
    -p, --profile <name>            Indicate configuration profile other than default
Common Options:
    -h, --help                      Show this message

Table of Contents

sys-mgmt-agent的配置文件

Writable 

Clients  

ExecutorPath

FormatSpecifier

Logging  

Registry 

Service  


sys-mgmt-agent的配置文件

# This TOML file now incorporates a now-defunct manifest file, which had specified the services managed by the SMA.
# The SMA needs the details provided in this TOML to stop/start/restart each service that the SMA manages.
# What about specifying the edgexsecurity service to use?
# Different versions of this manifest may exist depending on how/where EdgeX is deployed (Docker v. Snappy, Windows v. Linux, etc.).
# In the first release of the SMA, the manifest will be static.
# In the future, the manifest may be more dynamic or even provided by some 3rd party orchestrator.

ExecutorPath = '/path/to/the/file'

[Writable]
ResendLimit = 2
LogLevel = 'INFO'

[Service]
BootTimeout = 30000
ClientMonitor = 15000
CheckInterval = '10s'
Host = 'localhost'
Port = 48090
Protocol = 'http'
ReadMaxLimit = 100
StartupMsg = 'This is the System Management Agent Service'
Timeout = 5000
FormatSpecifier = '%(\\d+\\$)?([-#+ 0(\\<]*)?(\\d+)?(\\.\\d+)?([tT])?([a-zA-Z%])'

[Registry]
Host = 'localhost'
Port = 8500
Type = 'consul'

[Logging]
EnableRemote = false
File = './logs/edgex-sys-mgmt-agent.log'

[Clients]
  [Clients.Notifications]
  Protocol = 'http'
  Host = 'localhost'
  Port = 48060

  [Clients.Command]
  Protocol = 'http'
  Host = 'localhost'
  Port = 48082

  [Clients.Metadata]
  Protocol = 'http'
  Host = 'localhost'
  Port = 48081

  [Clients.Logging]
  Protocol = 'http'
  Host = 'localhost'
  Port = 48061

  [Clients.CoreData]
  Protocol = 'http'
  Host = 'localhost'
  Port = 48080

  [Clients.Scheduler]
  Protocol = 'http'
  Host = 'localhost'
  Port = 48085

  [Clients.Export]
  Protocol = 'http'
  Host = 'localhost'
  Port = 48071

  [Clients.Distro]
  Protocol = 'http'
  Host = 'localhost'
  Port = 48070

 如上是项目自带的sys-mgmt-agent的配置文件 ,主要分7部分,sys-mgmt-agent启动后会将配置文件的信息导入如下结构中,若registry=True则根据Registry中的信息连接consul并拉取相应的配置信息覆盖之前从本地配置文件中读取到的信息。

type ConfigurationStruct struct {
	Writable        WritableInfo
	Clients         map[string]config.ClientInfo
	Service         config.ServiceInfo
	ExecutorPath    string
	Registry        config.RegistryInfo
	Logging         config.LoggingInfo
	FormatSpecifier string
}

 

Writable 

type WritableInfo struct {
	ResendLimit int
	LogLevel    string
}

 

ResendLimit
LogLevel                日志等级

Clients  

// ClientInfo provides the host and port of another service in the eco-system.
type ClientInfo struct {
	// Host is the hostname or IP address of a service.
	Host string
	// Port defines the port on which to access a given service
	Port int
	// Protocol indicates the protocol to use when accessing a given service
	Protocol string
}
Host 微服务的地址
Port 微服务的端口
Protocol 微服务所使用的协议,目前仅支持http

sys-mgmt-agent运行时需要使用其他微服务提供的功能,Client便是连接其他微服务所必须的参数,这是一个map参数,key值便是其他微服务的名字,value便是client的具体参数信息, sys-mgmt-agent正常运行一般会使用其他所有的微服务,因为需要从其他微服务拉取配置信息和metric数据。

ExecutorPath

ExecutorPath   sys-mgmt-executor可执行文件的路径,sys-mgmt-executor在源码中和微服务源码处于同一级目录下,但他并不是一个微服务程序,仅仅是一个简单的可执行程序用于管理微服务的start,restart,stop...  sys-mgmt-executor不不直接启功微服务的可执行文件,而是启动或停止其对应的docker容器,因此必须保证对应微服务的docker image是存在并有效的。

FormatSpecifier

FormatSpecifier 正则表达式,暂未找到使用它的地方;core-data中有使用类似功能匹配ValueDescriptor,但是用的是硬编码的方式。

Logging  

// LoggingInfo provides basic parameters related to where logs should be written.
type LoggingInfo struct {
	EnableRemote bool
	File         string
}
   EnableRemote True: log于support-logging微服务持久化(support-logging的连接参数由Clients字段提供), False:log于本地文件持久化
   File         log本地持久化时日志文件的路径


Registry 

// RegistryInfo defines the type and location (via host/port) of the desired service registry (e.g. Consul, Eureka)
type RegistryInfo struct {
	Host string
	Port int
	Type string
}

consul连接参数 


Service  

同support-logging

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值