discover

package
v5.1.11-release+incomp... Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 11, 2020 License: LGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateETCDClient

func CreateETCDClient(conf conf.DiscoverConf) (client.KeysAPI, error)

CreateETCDClient 创建etcd api

func GetDokerLogInInstance

func GetDokerLogInInstance(ctx context.Context, serviceID string) (string, error)

GetDokerLogInInstance 获取应用日志接收节点

func SaveDockerLogInInstance

func SaveDockerLogInInstance(ctx context.Context, serviceID, instanceID string) error

SaveDockerLogInInstance 存储service和node 的对应关系

Types

type EtcdDiscoverManager

type EtcdDiscoverManager struct {
	// contains filtered or unexported fields
}

EtcdDiscoverManager 基于ETCD自动发现

func (*EtcdDiscoverManager) CancellationInstance

func (d *EtcdDiscoverManager) CancellationInstance(instance *Instance)

CancellationInstance 注销实例

func (*EtcdDiscoverManager) GetCurrentInstance

func (d *EtcdDiscoverManager) GetCurrentInstance() Instance

GetCurrentInstance 获取当前节点

func (*EtcdDiscoverManager) GetInstance

func (d *EtcdDiscoverManager) GetInstance(id string) *Instance

GetInstance 获取实例

func (*EtcdDiscoverManager) InstanceCheckHealth

func (d *EtcdDiscoverManager) InstanceCheckHealth(instanceID string) string

InstanceCheckHealth 将由distribution调用,当发现节点不正常时 此处检查,如果节点已经下线,返回 delete 如果节点未下线标记为异常,返回 abnormal 如果节点被集群判断为故障,返回 delete

func (*EtcdDiscoverManager) MonitorAddInstances

func (d *EtcdDiscoverManager) MonitorAddInstances() chan *Instance

MonitorAddInstances 实例通知

func (*EtcdDiscoverManager) MonitorDelInstances

func (d *EtcdDiscoverManager) MonitorDelInstances() chan *Instance

MonitorDelInstances 实例通知

func (*EtcdDiscoverManager) MonitorUpdateInstances

func (d *EtcdDiscoverManager) MonitorUpdateInstances() chan *Instance

MonitorUpdateInstances 实例通知

func (*EtcdDiscoverManager) RegisteredInstance

func (d *EtcdDiscoverManager) RegisteredInstance(host string, port int, stopRegister *bool) *Instance

RegisteredInstance 注册实例

func (*EtcdDiscoverManager) Run

func (d *EtcdDiscoverManager) Run() error

Run 启动

func (*EtcdDiscoverManager) Scrape

func (d *EtcdDiscoverManager) Scrape(ch chan<- prometheus.Metric, namespace, exporter string) error

Scrape prometheus monitor metrics

func (*EtcdDiscoverManager) Stop

func (d *EtcdDiscoverManager) Stop()

Stop 停止

func (*EtcdDiscoverManager) UpdateInstance

func (d *EtcdDiscoverManager) UpdateInstance(instance *Instance)

UpdateInstance 更新实例

type Instance

type Instance struct {
	HostID          string
	HostIP          net.IP
	PubPort         int
	DockerLogPort   int
	WebPort         int
	HostName        string
	Status          string
	TagNumber       int //当TagNumber大于集群总数的一半,则下线此节点
	LastHealthCheck time.Time
}

Instance 实例

func DeleteSlice

func DeleteSlice(source []*Instance, index int) []*Instance

DeleteSlice 从数组中删除某元素

type Manager

type Manager interface {
	RegisteredInstance(host string, port int, stopRegister *bool) *Instance
	CancellationInstance(instance *Instance)
	MonitorAddInstances() chan *Instance
	MonitorDelInstances() chan *Instance
	MonitorUpdateInstances() chan *Instance
	GetInstance(string) *Instance
	InstanceCheckHealth(string) string
	Run() error
	GetCurrentInstance() Instance
	Stop()
	Scrape(ch chan<- prometheus.Metric, namespace, exporter string) error
}

Manager 节点动态发现管理器

func New

func New(conf conf.DiscoverConf, log *logrus.Entry) Manager

New 创建

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL