Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cluster模式,如果某个进程挂了,没有通知到master unregister,再重新启动这个进程,这个进程就会一直等待register返回,而master的cluster已经有该进程 #67

Open
rezonegames opened this issue Nov 16, 2020 · 12 comments

Comments

@rezonegames
Copy link

1.master做状态检查,每隔一段时间对进程做状态检查,如果发现状态有问题,自动unregister操作
2.每次注册,如果master包含该server信息,直接返回正确
image

@lonng
Copy link
Owner

lonng commented Nov 19, 2020

你有兴趣修改一下吗?

@rezonegames
Copy link
Author

rezonegames commented Nov 20, 2020

你有兴趣修改一下吗?

现在还不行,刚开始学go~~

还有一个问题,登陆负载均衡,分配到最适合对gate
如果同时在线人数特别多,对gate做平行扩展,可以在注册将clientAddr上传到master,也就是在memberInfo中将clientAddr这个地址加到member中。在login服,可以动态获取每个gate的地址。

想到了另一个方式,在master服务里管理也行
image

@lonng
Copy link
Owner

lonng commented Nov 20, 2020

Master 节点可以加一个接口来获取所有的 Gate 服务器。

@rezonegames
Copy link
Author

我觉得clientAddr还是放到MemberInfo里比较好,要么还要维护一套服务的register和unregister。
在Cluster 加一个回调func,Master服务启动时在option里注册这个函数。register后,如果发现有这个回调就调用一次,获取所有服务。

@lonng
Copy link
Owner

lonng commented Nov 20, 2020

也可以

@rezonegames
Copy link
Author

也可以

这样就要改nano库~~

@lonng
Copy link
Owner

lonng commented Nov 20, 2020

欢迎提交 PR,如果有兴趣,我们可以拉一个群讨论,继续完善 Nano

@rezonegames
Copy link
Author

有群吗,可以拉我进来

@lonng
Copy link
Owner

lonng commented Nov 22, 2020

加我微信 oss_lonng

@rezonegames
Copy link
Author

ok

@lwelcom
Copy link

lwelcom commented Aug 20, 2021

// Register implements the MasterServer gRPC service
func (c *cluster) Register(_ context.Context, req *clusterpb.RegisterRequest) (*clusterpb.RegisterResponse, error) {
if req.MemberInfo == nil {
return nil, ErrInvalidRegisterReq
}

resp := &clusterpb.RegisterResponse{}
for k, m := range c.members {
	if m.memberInfo.ServiceAddr == req.MemberInfo.ServiceAddr {
		c.members = append(c.members[:k], c.members[k+1:]...)
		break
		//return nil, fmt.Errorf("address %s has registered", req.MemberInfo.ServiceAddr)
	}
}

@lonng cluster模式,如果某个进程关闭了再也重连不上问题:我修改为每次master存在就移除重新注册,帮忙看下这样修改合理吗?

@lonng
Copy link
Owner

lonng commented Aug 28, 2021

可以的,提一个 PR 吧

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants