动态服务器发现列表
我想创建一个 Web 服务,应用程序服务器可以联系该服务将其自身添加到实现该应用程序的服务器列表中。然后,客户端可以联系该服务以获取服务器列表。类似于minecraft 的心跳工作将您的服务器添加到主服务器列表中。
我可以很容易地自己实现它,但我希望有人已经创建了这样的东西。
高级功能会很有用。例如:
- 允许客户端对特定于应用程序的属性执行查询,例如当前连接到服务器的用户数量
- 将服务器列表分布到多台计算机上
- 如果服务器在时间内未发送心跳,则对列表中的服务器条目进行超时处理 有人知道
这样的服务吗?我知道有开放协议和服务器用于进行本地 LAN 服务发现,但这将是 WAN 服务。
I'd like to create a web service that an application server can contact to add itself to a list of servers implementing the application. Clients could then contact the service to get a list of servers. Something similar to how minecraft's heartbeats work for adding your server to the main server list.
I could implement it myself pretty easily, but I'm hoping someone has already created something like this.
Advanced features would be useful. Things like:
- Allowing a client to perform queries on application-specific properties like the number of users currently connected to the server
- Distributing the server list across more than one machine
- Timing out a server's entry in the list if it hasn't sent a heartbeat within some amount of time
Does anyone know of a service like this? I know there are open protocols and servers for doing local-LAN service discovery, but this would be a WAN service.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我可以找到与您的预期应用程序相关的协议如下:
XRDS 文档很晦涩,但您也许能够以 XML 格式推送服务描述。服务类型规范可能是通用的,但我因试图破译委员会的讲话而感到头疼。
XMPP 服务发现协议(以前称为 Jabber 的协议的一部分)看起来也很有前途,但似乎即使您可以推送您的服务描述,他们也希望它成为上面提到的服务之一此列表。扩展它会使其变得不标准。
最后,我找到了一个叫做seap(服务公告协议)。它很旧,摇摇欲坠,来源可能是正当的,它是用 C 和 Perl 编写的,它是一个拼凑的东西,但它似乎可以做你想做的事,有点。
似乎推动服务公告脉冲是一个特定于应用程序的微不足道的问题,几乎没有人考虑过解决一般情况。
我的建议?阅读上面提到的协议和来源以获得灵感(我将从 Seap 开始),然后自己编写、实现和发布通用(可能基于 xml)协议。所有现有的似乎要么是特定于应用程序的、难以理解的,要么是拼凑的。
The protocols I could find that had any relevance to your intended application are these:
The XRDS documentation is obtuse, but you may be able to push service descriptions in XML format. The service type specification might be generic, but I get a headache from trying to decipher committee-speak.
The XMPP Service Discovery protocol (part of the protocol Formerly Known As Jabber) also looked promising, but it seems that even though you could push your service description, they expect it to be one of the services mentioned on this list. Extending it would make it nonstandard.
Finally, I found something called seap (SErvice Announcement Protocol). It's old, it's rickety, the source may be propriety, it's written in C and Perl, it's a kludge, but it seems to do what you want, kind-of.
It seems like pushing a service announcement pulse is such an application-specific and trivial problem, that almost nobody has considered solving the general case.
My advice? Read the protocols and sources mentioned above for inspiration (I'd start with seap), and then write, implement, and publish a generic (probably xml-based) protocol yourself. All the existing ones seem to be either application-specific, incomprehensible, or a kludge.
基本上,你可以自己写,尽管我不知道是否有人有一个公开的(我十多年前写过一个,但是为一家公司)。
http://?svr_name=XYZ&svr_ip=PQRS)
发送heartbeat 输出,您只需要发送一个 http:// 调用,在 Linux 上使用 wget* 和 crontab,在 Windows 上使用 wget.exe 和任务调度程序。
它是特定于应用程序的,因此即使您自己编写了一个,其他人也无法在不修改源代码的情况下使用它。
Basically, you can write it yourself though I am not aware if anyone has one for public (I wrote one over 10 yrs ago, but for a company).
http://<you-app.com>?svr_name=XYZ&svr_ip=P.Q.R.S
)To send a heartbeat out, you only need to send a http:// call, on Linux use wget* with crontab, on windows use wget.exe with task scheduler.
It is application specific, so even if you wrote one yourself, others can't use it without modifying the source code.