EDGEX FOUNDRY配置参数 --- Export-Client

export-client是主要是EDGEX系统数据转发的注册服务,export-client使用介绍如下,他有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

export-client的配置文件

Writable 

Clients  

Databases

Logging  

Registry 

Service  


export-client的配置文件

[Writable]
LogLevel = 'INFO'

[Service]
BootTimeout = 30000
ClientMonitor = 15000
CheckInterval = '10s'
Host = 'localhost'
Port = 48071
Protocol = 'http'
ReadMaxLimit = 100
StartupMsg = 'This is the Export Client Microservice'
Timeout = 5000

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

[Logging]
EnableRemote = false
File = './logs/edgex-export-client.log'

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

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

[Databases]
  [Databases.Primary]
  Host = 'localhost'
  Name = 'exportclient'
  Password = ''
  Port = 27017
  Username = ''
  Timeout = 5000
  Type = 'mongodb'

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

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

Writable 

type WritableInfo struct {
	LogLevel string
}
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

export-client运行时需要使用其他微服务提供的功能,Client便是连接其他微服务所必须的参数,这是一个map参数,key值便是其他微服务的名字,value便是client的具体参数信息, export-client正常运行一般需要使用logging和export-distro两个微服务。

Databases

type DatabaseInfo struct {
	Type     string
	Timeout  int
	Host     string
	Port     int
	Username string
	Password string
	Name     string
}
Type     数据库类型,目前仅支持 mongodb
Timeout  数据库连接超时,单位:s
Host     数据库地址
Port     数据库端口
Username 数据库登录用户名
Password 数据库登录密码
Name     数据库名字

export-client当前支持两种Primary数据库mongodb和redisdb。


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

猜你喜欢

转载自blog.csdn.net/keyoushide/article/details/89603102