I have two servers:
Server1: 10.7.44.49 Server2: 10.7.44.71
and two actorSystems running on those servers:
akka://[email protected]:5555
akka://[email protected]:5555
I'm trying to deploy an actor from Server2 to Server1 remotely.
To achieve that, I set in the configuration of Server2:
deployment {
/simpleActor {
remote = "akka://[email protected]:5555"
}
But I get:
[WARN] [09/07/2022 13:36:53.156] [sbt-bg-threads-1] [akka.remote.RemoteActorRefProvider] Remote deploy of [akka://Test/user/simpleActor] is not allowed, falling back to local.
I also tried to achieve it programmatically:
val address = AddressFromURIString("akka://[email protected]:5555")
val actorRef = system.actorOf(Props[SimpleActor]().withDeploy(Deploy(scope = RemoteScope(address))))
But the result is the same.
Any clue on deploying an actor to another actorSystem running on a different machine?
Reference: https://doc.akka.io/docs/akka/current/remoting.html#programmatic-remote-deployment
CodePudding user response:
That is logged in the else
clause of this if
:
hasClusterOrUseUnsafe && shouldCreateRemoteActorRef(system, address)
hasClusterOrUseUnsafe
returns true if and only if one ofakka.actor.provider = cluster
orakka.remote.use-unsafe-remote-features-outside-cluster = true
in your configshouldCreateRemoteActorRef
is almost certainly going to be true (unless you're using a customRemoteActorRefProvider
, in which case you're basically on your own)
So setting one of
akka.actor.provider = cluster
akka.remote.use-unsafe-remote-features-outside-cluster = true