rainbond: github.com/goodrain/rainbond/eventlog/cluster/discover Index | Files

package discover

import "github.com/goodrain/rainbond/eventlog/cluster/discover"

Index

Package Files

etcdManager.go instance.go manager.go

func CreateETCDClient Uses

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

CreateETCDClient 创建etcd api

func GetDokerLogInInstance Uses

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

GetDokerLogInInstance 获取应用日志接收节点

func SaveDockerLogInInstance Uses

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

SaveDockerLogInInstance 存储service和node 的对应关系

type EtcdDiscoverManager Uses

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

EtcdDiscoverManager 基于ETCD自动发现

func (*EtcdDiscoverManager) CancellationInstance Uses

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

CancellationInstance 注销实例

func (*EtcdDiscoverManager) GetCurrentInstance Uses

func (d *EtcdDiscoverManager) GetCurrentInstance() Instance

GetCurrentInstance 获取当前节点

func (*EtcdDiscoverManager) GetInstance Uses

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

GetInstance 获取实例

func (*EtcdDiscoverManager) InstanceCheckHealth Uses

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

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

func (*EtcdDiscoverManager) MonitorAddInstances Uses

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

MonitorAddInstances 实例通知

func (*EtcdDiscoverManager) MonitorDelInstances Uses

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

MonitorDelInstances 实例通知

func (*EtcdDiscoverManager) MonitorUpdateInstances Uses

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

MonitorUpdateInstances 实例通知

func (*EtcdDiscoverManager) RegisteredInstance Uses

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

RegisteredInstance 注册实例

func (*EtcdDiscoverManager) Run Uses

func (d *EtcdDiscoverManager) Run() error

Run 启动

func (*EtcdDiscoverManager) Scrape Uses

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

Scrape prometheus monitor metrics

func (*EtcdDiscoverManager) Stop Uses

func (d *EtcdDiscoverManager) Stop()

Stop 停止

func (*EtcdDiscoverManager) UpdateInstance Uses

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

UpdateInstance 更新实例

type Instance Uses

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 Uses

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

DeleteSlice 从数组中删除某元素

type Manager Uses

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 Uses

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

New 创建

Package discover imports 16 packages (graph) and is imported by 4 packages. Updated 2019-03-16. Refresh now. Tools for package owners.