Akka remote actor server discovery

流过昼夜 提交于 2019-12-03 02:52:36

A while ago I created a prototype that's intended to solve your problem (feel free to reuse the code and/or contribute).

A few words on how does it work. It starts a remote actor for each actor registry (=node). RegistryActor holds links to all the other registries running in a distributed setup. When a new node is added to the system, it needs to know about at least one other node (ActorRegistry) and notify it. ActorRegistry than lets all other nodes know about the new one (thus, any RegistryActor has links to all other RegistryActor's), and starts a process of exchanging links to actors - at the end of it, all the actor registries have links to all actors (either local or remote) running in a system.

For more details, please refer this blogpost.

Take a look at jgroups.

http://jgroups.org/

It meets all of your criteria - it is lightweight, open source and very mature, stable product.

You can easily configure it for automatic group management and discovery based on your requirements - it supports almost any network configuration - you can use multicast, shared file, or unicast for group member discovery.

Unless all nodes share some common knowledge, I think your solution would have to rely on IP broadcast. Broadcasting is defined as sending a packet to all network nodes on a subnet, so if your master node does that while all worker nodes listen for it, you should be able to connect them all without knowing the IP addresses a priori.

I haven't coded this in Scala, but here's a fairly readable example of how to broadcast messages in java: http://download.oracle.com/javase/tutorial/networking/datagrams/broadcasting.html. It should be straightforward to adapt it to Scala using the same classes.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!