diff --git a/cmd/node/server/server.go b/cmd/node/server/server.go index 5da4c4059..95e84d563 100644 --- a/cmd/node/server/server.go +++ b/cmd/node/server/server.go @@ -87,7 +87,9 @@ func Run(c *option.Conf) error { logrus.Errorf(err.Error()) return err } - getInfoForMaster(s) + if !s.HostNode.Role.HasRule("compute"){ + getInfoForMaster(s) + } ms.Cluster.UpdateNode(s.HostNode) if err := ms.Start(); err != nil { logrus.Errorf(err.Error()) diff --git a/pkg/api/region/node.go b/pkg/api/region/node.go index b6e4b648e..cf4268b6e 100644 --- a/pkg/api/region/node.go +++ b/pkg/api/region/node.go @@ -395,7 +395,7 @@ func (r *RNodeClient) handleErrAndCode(err error, code int) *util.APIHandleError return util.CreateAPIHandleError(code, err) } if code != 200 { - return util.CreateAPIHandleError(code, fmt.Errorf("error with code %d", code)) + return util.CreateAPIHandleError(code, fmt.Errorf("error with code %d,details %s", code,err.Error())) } return nil } diff --git a/pkg/node/masterserver/node/nodecluster.go b/pkg/node/masterserver/node/nodecluster.go index 9a631b6c9..23d2a4e90 100644 --- a/pkg/node/masterserver/node/nodecluster.go +++ b/pkg/node/masterserver/node/nodecluster.go @@ -196,6 +196,7 @@ func (n *NodeCluster) loadAndWatchNodes() error { if !node.Alived { node.Alived = true node.UpTime = time.Now() + n.UpdateNode(node) } } } @@ -226,15 +227,16 @@ func (n *NodeCluster) loadAndWatchNodes() error { if node := n.getNodeFromKey(string(ev.Kv.Key)); node != nil { node.Alived = true node.UpTime = time.Now() - RegToHost(node, "add") + //getInfoForMaster(node) n.UpdateNode(node) + RegToHost(node, "add") } case ev.Type == client.EventTypeDelete: if node := n.getNodeFromKey(string(ev.Kv.Key)); node != nil { node.Alived = false node.DownTime = time.Now() - RegToHost(node, "del") n.UpdateNode(node) + RegToHost(node, "del") } } }