문제

The problem i have is that i can create the system on another slave machine. But i cant figure out how to distribute parts onto different machines. IE master, slave1 and slave2 all end up on same machine rather than ip 101,102 and 103 respectively.

I am using a master server to essentially manage a workflow of messages through several servers. So the master starts up creates the master server actor which then does the following:

  • Master:
    1. sends a start message to slave 1
    2. takes a success message from slave 1 and passes a message to slave 2
    3. takes a success message from slave 2 then shuts down the system
  • Slave1: takes a message from server and replies to master with success
  • Slave2: takes a message from server and replies to master with success

Later i want to scale each of these horizontally - however hit a problem before that. All the remote stuff will only run on 1 machine.

I am using remote so that part of the config looks like this:

akka {
  actor {
    provider = "akka.remote.RemoteActorRefProvider"
    deployment {
      "/masterCreatorActor/*" {
        remote = "akka.tcp://RemoteActorSystem@192.168.56.101:2552"
      }
      "/slave1Actor/*" {
        remote = "akka.tcp://RemoteActorSystem@192.168.56.102:2552"
      }
      "/slave2Actor/*" {
        remote = "akka.tcp://RemoteActorSystem@192.168.56.103:2552"
      }
    }
  }

The code to create the actorSystem and master actor

val config = ConfigFactory.load("remotecreation")
val system = ActorSystem("PromoAnalysisSystem", config)
def act = system.actorOf(Props(classOf[MasterCreatorActor],OnFinished _),
                   name = "masterCreatorActor" )

then inside the master actor I use slave1 by doing this when it receives a message:

val slave1 = context.actorOf(Props[Slave1Actor],name = "slave1Actor")
slave1 ! slave1StartMessage  

So I can host the system all on 1 machine. I can also start it on 1 machine and have it all run on another remote machine. But i cannot get each of the actors in the config to run on different machines.

I am being stupid but cant see in what way! ;)

도움이 되었습니까?

해결책

akka {
  actor {
    provider = "akka.remote.RemoteActorRefProvider"
    deployment {
      "/masterCreatorActor/*" {
        remote = "akka.tcp://RemoteActorSystem@192.168.56.101:2552"
      }
      "/*/slave1Actor/*" {
        remote = "akka.tcp://RemoteActorSystem@192.168.56.102:2552"
      }
      "/*/slave2Actor/*" {
        remote = "akka.tcp://RemoteActorSystem@192.168.56.103:2552"
      }
    }
  }
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top