用于远程路由的Akka目标节点

时间:2019-03-04 12:24:52

标签: configuration akka remoting

我创建了一个远程环境来使用以下方法部署路由:

Routers with Remote Destinations

deployment {
  /router1 {
    router = round-robin-pool
    nr-of-instances = 7
    cluster {
      enabled = on
      allow-local-routees = off
      max-nr-of-instances-per-node = 3
      use-roles = ["backend"]
      target {
        nodes = ["akka.tcp://ClusterSystem@127.0.0.1:2560", "akka.tcp://ClusterSystem@127.0.0.1:2570"]
      }
    }
  }
}

这不起作用。最后,所有加入的新节点都将部署路由。我认为这种配置意味着将“仅”在目标节点上部署路由,而将其部署在“任何”新节点上。

这是如何工作的?如何使路由仅部署在特定节点上?一定有问题,否则添加“目标”配置绝对没有任何作用。

1 个答案:

答案 0 :(得分:1)

Akka documentation

中所述
akka.actor.deployment {
    /parent/remotePool {
        router = round-robin-pool
        nr-of-instances = 10
        target.nodes = ["akka.tcp://app@10.0.0.2:2552", "akka.tcp://app@10.0.0.3:2552"]
    }
}

以上配置将克隆Props remote pool10中的actor,并将其均匀分布在两个给定的目标节点上。

应用此配置

deployment {
    /router1 {
        router = round-robin-pool
        nr-of-instances = 7
        target {
            nodes = ["akka.tcp://ClusterSystem@127.0.0.1:2560","akka.tcp://ClusterSystem@127.0.0.1:2570"]
        }
    }
}

确保ClusterSystem处的127.0.0.1:2560ClusterSystem处的127.0.0.1:2570正在运行。