简体   繁体   中英

Akka - Remote cluster discovery

I am setting up an Akka cluster to be able to connect to other nodes using Artery remoting. I followed the following tutorial to set up a couple of local nodes to simulate this effect ( https://developer.lightbend.com/docs/akka-management/current/bootstrap/local-config.html ), and it works. Here is my config file:

akka {
  loglevel = INFO

  actor {
    provider = "cluster"
  }

  remote {
    artery {
      enabled = on
      transport = tcp
      hostname = "MY_PUBLIC_IP_ADDRESS(130.231.......)"
      canonical.port = 2551
    }
  }


}

#coorindated-shutdown
akka.cluster.shutdown-after-unsuccessful-join-seed-nodes = 30s
akka.coordinated-shutdown.exit-jvm = on
#coorindated-shutdown

#discovery
akka.discovery {
  config.services = {
    local-cluster = {
      endpoints = [
        {
          host = "127.0.0.2"
          port = 8558
        },
        {
          host = "127.0.0.3"
          port = 8558
        }
      ]
    }
  }
}
#discovery

#health
akka.management.health-checks {
  readiness-path = "health/ready"
  liveness-path = "health/alive"
}
#health

akka.management.http {
  route-providers-read-only = false
}

#bootstrap
akka.management {
  cluster.bootstrap {
    contact-point-discovery {
      service-name = "local-cluster"
      discovery-method = config
    }
  }
}
#bootstrap

Now when I launch the exact same instance of the program on another machine with another IP address and I provide that IP address in the akka.discovery.config.services.local-cluster.endpoints , the bootstrap completely fails (it doesn't even manage to discover the previously working 127.0.0.2 addresses anymore), giving me Connection refused by peer error messages.

Any idea what other setup I am missing to make this work in a full remote situation? Thanks !

我对此的解决方法最终是切换到种子节点设置(不再进行发现),并以以下格式对IP进行硬编码: akka://{CLUSTER_NAME}@{REMOTE_IP}:{PORT}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM