Настройка кластера Akka для приложения Lagom в рабочем режиме - PullRequest
0 голосов
/ 29 октября 2019

Я пытаюсь запустить службу Lagom в производственном режиме в кластере Akka, который настроен через Akka Cluster Bootstrap, как описано в https://www.lagomframework.com/documentation/1.5.x/scala/Cluster.html. (я смог запустить приложение, указав начальные узлы вручную),Однако я не смог запустить сервис. У меня есть следующие настройки:

application.conf (only the cluster related configs)
akka.management.cluster.bootstrap {
  # example using kubernetes-api
  contact-point-discovery {
    discovery-method = akka.discovery
#    discovery-method = config
    service-name = "lagom-scala"
    required-contact-point-nr = 0
  }
}

Загрузчик приложения, загружающий AkkaDiscoveryComponents в производственном режиме, как описано здесь (https://www.lagomframework.com/documentation/1.5.x/scala/AkkaDiscoveryIntegration.html):

class LagomscalaLoader extends LagomApplicationLoader {

  override def load(context: LagomApplicationContext): LagomApplication =
    new LagomscalaApplication(context) with AkkaDiscoveryComponents

  override def loadDevMode(context: LagomApplicationContext): LagomApplication =
    new LagomscalaApplication(context) with LagomDevModeComponents

  override def describeService = Some(readDescriptor[LagomscalaService])
}

Я получаю следующие журналы, когдаrequired-contact-point-nr установлен на 0:

2019-10-28T23:48:54.867Z [info] akka.management.cluster.bootstrap.internal.BootstrapCoordinator [sourceThread=application-akka.actor.default-dispatcher-26, akkaTimestamp=23:48:54.867UTC, akkaSource=akka.tcp://application@192.168.0.34:2552/system/bootstrapCoordinator, sourceActorSystem=application] - Looking up [Lookup(lagom-scala,None,Some(tcp))]
2019-10-28T23:48:54.886Z [info] akka.management.cluster.bootstrap.internal.BootstrapCoordinator [sourceThread=application-akka.actor.default-dispatcher-22, akkaTimestamp=23:48:54.886UTC, akkaSource=akka.tcp://application@192.168.0.34:2552/system/bootstrapCoordinator, sourceActorSystem=application] - Located service members based on: [Lookup(lagom-scala,None,Some(tcp))]: [], filtered to []
2019-10-28T23:48:55.957Z [info] akka.management.cluster.bootstrap.LowestAddressJoinDecider [sourceThread=application-akka.actor.default-dispatcher-16, akkaTimestamp=23:48:55.957UTC, akkaSource=LowestAddressJoinDecider(akka://application), sourceActorSystem=application] - Exceeded stable margins without locating seed-nodes, however this node 192.168.0.34:8558 is NOT the lowest address out of the discovered endpoints in this deployment, thus NOT joining self. Expecting node [] (out of []) to perform the self-join and initiate the cluster.

Когда я устанавливаю required-contact-point-nr на 2 (по умолчанию), я получаю следующие журналы:

2019-10-29T00:15:57.846Z [info] akka.management.cluster.bootstrap.internal.BootstrapCoordinator [sourceThread=application-akka.actor.default-dispatcher-23, akkaTimestamp=00:15:57.846UTC, akkaSource=akka.tcp://application@192.168.0.34:2552/system/bootstrapCoordinator, sourceActorSystem=application] - Looking up [Lookup(lagom-scala,None,Some(tcp))]
2019-10-29T00:15:57.865Z [info] akka.management.cluster.bootstrap.internal.BootstrapCoordinator [sourceThread=application-akka.actor.default-dispatcher-4, akkaTimestamp=00:15:57.865UTC, akkaSource=akka.tcp://application@192.168.0.34:2552/system/bootstrapCoordinator, sourceActorSystem=application] - Located service members based on: [Lookup(lagom-scala,None,Some(tcp))]: [], filtered to []
2019-10-29T00:15:58.299Z [info] akka.management.cluster.bootstrap.LowestAddressJoinDecider [sourceThread=application-akka.actor.default-dispatcher-3, akkaTimestamp=00:15:58.299UTC, akkaSource=LowestAddressJoinDecider(akka://application), sourceActorSystem=application] - Discovered [0] contact points, confirmed [0], which is less than the required [2], retrying
2019-10-29T00:15:58.599Z [warn] akka.cluster.sharding.ShardRegion [sourceThread=application-akka.actor.default-dispatcher-4, akkaTimestamp=00:15:58.597UTC, akkaSource=akka.tcp://application@192.168.0.34:2552/system/sharding/kafkaProducer-greetings, sourceActorSystem=application] - kafkaProducer-greetings: No coordinator found to register. Probably, no seed-nodes configured and manual cluster join not performed? Total [1] buffered messages.

Я используюAkka 2.5.25 и конфигурации по умолчанию, за исключением указанных выше.Например, я вижу следующие журналы, которые могут иметь значение после запуска службы:

2019-10-29T00:15:44.987Z [info] akka.remote.Remoting [sourceThread=main, akkaTimestamp=00:15:44.987UTC, akkaSource=akka.remote.Remoting, sourceActorSystem=application] - Remoting now listens on addresses: [akka.tcp://application@192.168.0.34:2552]
2019-10-29T00:15:45.276Z [info] akka.cluster.Cluster(akka://application) [sourceThread=application-akka.actor.default-dispatcher-2, akkaSource=akka.cluster.Cluster(akka://application), sourceActorSystem=application, akkaTimestamp=00:15:45.275UTC] - Cluster Node [akka.tcp://application@192.168.0.34:2552] - No seed-nodes configured, manual cluster join required, see https://doc.akka.io/docs/akka/current/cluster-usage.html#joining-to-seed-nodes
2019-10-29T00:15:46.411Z [info] akka.management.cluster.bootstrap.ClusterBootstrap [sourceThread=main, akkaTimestamp=00:15:46.411UTC, akkaSource=ClusterBootstrap(akka://application), sourceActorSystem=application] - Using self contact point address: http://192.168.0.34:8558
2019-10-29T00:15:48.164Z [info] akka.management.scaladsl.AkkaManagement [sourceThread=application-akka.actor.default-dispatcher-24, akkaSource=AkkaManagement(akka://application), sourceActorSystem=application, akkaTimestamp=00:15:48.163UTC] - Bound Akka Management (HTTP) endpoint to: 192.168.0.34:8558
2019-10-29T00:15:48.286Z [info] akka.management.cluster.bootstrap.internal.BootstrapCoordinator [sourceThread=application-akka.actor.default-dispatcher-24, akkaSource=akka.tcp://application@192.168.0.34:2552/system/bootstrapCoordinator, sourceActorSystem=application, akkaTimestamp=00:15:48.285UTC] - Locating service members. Using discovery [akka.discovery.aggregate.AggregateServiceDiscovery], join decider [akka.management.cluster.bootstrap.LowestAddressJoinDecider]
2019-10-29T00:15:48.772Z [info] play.core.server.AkkaHttpServer [] - Listening for HTTP on /0:0:0:0:0:0:0:0:9000

Итак, я думаю, что существует несоответствие между портами, ноЯ не мог понять, как это исправить. Спасибо за вашу помощь.

1 Ответ

1 голос
/ 04 ноября 2019

Кажется, проблема была в отсутствии DNS-сервера в локальных настройках и в том, что сам Lagom не предоставляет DNS-сервер, как заявлено @ tim-moore на Lightbend forum .

...