Remote java akka clustering with play card

I am creating a cluster computer system with multiple nodes. There is a node wizard that must schedule a task for several nodes in a cluster. nodes are separate PCs connected to a node master via network cables. It is expected that the entire system will be implemented using the java akka platform and the play framework. is there any way to implement this with akka remote clustering with a playback platform.

I know about distance calculator tutorials, but it seems to work with the SBT platform, but I will be glad to know if there are similar tutorials with a playback platform.

Or any link that will help me with my project

Thank you

+4
source share
1 answer

Sample game! The framework application can connect to a remote Akka node (i.e. your node wizard) using a simple configuration.

There are two ways:

  • override the default action system
  • define a new acting system

I suggest you use the second one. In this case, you need to add something like to application.conf

master { akka { actor { provider = "akka.remote.RemoteActorRefProvider" } remote { transport = "akka.remote.netty.NettyRemoteTransport" netty { hostname = "your-master-host-name" port = 0 } } } } 

Then in your game! app, you can connect to the remote node wizard this way

  ActorSystem system = ActorSystem.create("master", ConfigFactory.load().getConfig("master")) ActorRef master = system.actorFor("akka:// master@your-master-host-name :your-master-port/user/master") 

If you prefer to redefine your current Play Akque acting system by default. Here is the reference configuration: http://www.playframework.org/documentation/2.0.3/AkkaCore

For the nodes of the main and computing clusters, I suggest you use the architecture and code described here: http://letitcrash.com/post/29044669086/balancing-workload-across-nodes-with-akka-2

If your wizard and compute nodes do not need a web interface or a REST interface, you can implement them as a simple Java program.

In the cited article, nodes are not displayed remotely. To do this, simply add application.conf to the master node app:

 master { akka { actor { provider = "akka.remote.RemoteActorRefProvider" } remote { transport = "akka.remote.netty.NettyRemoteTransport" netty { hostname = "your-master-host-name" port = your-master-port } } } } 

And create it using actorOf method

 ActorSystem system = ActorSystem.create("master", ConfigFactory.load().getConfig("master")) ActorRef master = system.actorOf(new Props(Master.class), "master") 

Compute nodes must be configured in the same way as in Play! node.

Note that only the node wizard has a TCP-IP port. Non-master nodes use port 0, which configure Akka to select an arbitrary free port for them. This is correct because the only known host: the port address you need is the main one, where each node, when it starts, should point to.

+9
source

Source: https://habr.com/ru/post/1434973/


All Articles