【问题标题】:Akka target nodes for remote routing用于远程路由的 Akka 目标节点
【发布时间】:2019-03-04 12:24:52
【问题描述】:

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

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"]
      }
    }
  }
}

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

它是这样工作的吗?如何使路由仅部署在特定节点上?一定有问题,否则添加“目标”配置绝对不会做任何事情。

【问题讨论】:

    标签: configuration akka remoting


    【解决方案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中定义的actorremote pool10次,并将其均匀分布在两个给定的目标节点上。

    应用此配置

    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"]
            }
        }
    }
    

    确保127.0.0.1:2560 上的ClusterSystem127.0.0.1:2570 上的ClusterSystem 正在运行。

    【讨论】:

    • 非常感谢,只是配置的位置。此外,无法将集群感知路由器与远程部署的路由器一起使用,它不会构建。但是现在远程部署的路由器还有另一个问题,每当我使用“target.nodes”时,在“target.nodes”上设置的节点都需要在启动集群之前启动。但是,如果我注释掉“target.nodes”,无论我在种子节点之前还是之后启动节点,它都会起作用,这真的很令人困惑,文档对此只字未提。
    猜你喜欢
    • 1970-01-01
    • 2014-02-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-04-25
    相关资源
    最近更新 更多