Пример #1
0
func (self *Inspector) MeetNode(node *topo.Node) {
	for _, seed := range meta.Seeds() {
		if seed.Ip == node.Ip && seed.Port == node.Port {
			continue
		}
		_, err := redis.ClusterMeet(seed.Addr(), node.Ip, node.Port)
		if err == nil {
			break
		}
	}
}
Пример #2
0
func (self *MeetNodeCommand) Execute(c *cc.Controller) (cc.Result, error) {
	cs := c.ClusterState
	target := cs.FindNode(self.NodeId)
	if target == nil {
		return nil, ErrNodeNotExist
	}
	if target.Fail {
		return nil, ErrNodeIsDead
	}
	if target.Free == false {
		return nil, ErrNodeNotFree
	}
	var err error
	for _, ns := range cs.AllNodeStates() {
		_, err = redis.ClusterMeet(ns.Addr(), target.Ip, target.Port)
		if err == nil {
			log.Eventf(target.Addr(), "Meet.")
			return nil, nil
		}
	}
	return nil, err
}