Documentation ¶
Index ¶
- func CreateETCDClient(conf conf.DiscoverConf) (client.KeysAPI, error)
- func GetDokerLogInInstance(ctx context.Context, serviceID string) (string, error)
- func SaveDockerLogInInstance(ctx context.Context, serviceID, instanceID string) error
- type EtcdDiscoverManager
- func (d *EtcdDiscoverManager) CancellationInstance(instance *Instance)
- func (d *EtcdDiscoverManager) GetCurrentInstance() Instance
- func (d *EtcdDiscoverManager) GetInstance(id string) *Instance
- func (d *EtcdDiscoverManager) InstanceCheckHealth(instanceID string) string
- func (d *EtcdDiscoverManager) MonitorAddInstances() chan *Instance
- func (d *EtcdDiscoverManager) MonitorDelInstances() chan *Instance
- func (d *EtcdDiscoverManager) MonitorUpdateInstances() chan *Instance
- func (d *EtcdDiscoverManager) RegisteredInstance(host string, port int, stopRegister *bool) *Instance
- func (d *EtcdDiscoverManager) Run() error
- func (d *EtcdDiscoverManager) Scrape(ch chan<- prometheus.Metric, namespace, exporter string) error
- func (d *EtcdDiscoverManager) Stop()
- func (d *EtcdDiscoverManager) UpdateInstance(instance *Instance)
- type Instance
- type Manager
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 ¶
GetDokerLogInInstance 获取应用日志接收节点
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) Scrape ¶
func (d *EtcdDiscoverManager) Scrape(ch chan<- prometheus.Metric, namespace, exporter string) error
Scrape prometheus monitor metrics
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 ¶
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 节点动态发现管理器
Click to show internal directories.
Click to hide internal directories.