部署在Kubernetes自包含单节点上时Lagom App错误

时间:2018-07-18 22:19:31

标签: kubernetes akka lagom

吊舱正在运行,但在下面一遍又一遍地发出警告。

使用sbt runAll时,一切正常。不会部署在Kubernetes上(使用RP生成的资源)。

我正在使用:

rp generate-kubernetes-resources "xrates-list-impl:1.0.1"
--generate-all --registry-use-local --pod-controller-replicas 3 --external-service "kafka_native=_broker._tcp.kafka.default.svc.cluster.local"
--external-service "cas_native=_server._tcp.cassandra.default.svc.cluster.local" --env JAVA_OPTS="-Dplay.http.secret.key=****" > xrates-list-resource.yaml

有人可以指出我应该调查哪个方向吗?

2018-07-18T22:07:03.890Z [warn] akka.cluster.sharding.ShardRegion [sourceThread=application-akka.actor.default-dispatcher-2, akkaTimestamp=22:07:03.890UTC, akkaSource=akka.tcp://application@192.168.55.137:10001/system/sharding/kafkaProducer-xrateslist, sourceActorSystem=application] - Trying to register to coordinator at [ActorSelection[Anchor(akka.tcp://application@192.168.55.134:10001/), Path(/system/sharding/kafkaProducer-xrateslistCoordinator/singleton/coordinator)]], but no acknowledgement. Total [46] buffered messages. [Coordinator [Member(address = akka.tcp://application@192.168.55.134:10001, status = Up)] is reachable.]
2018-07-18T22:07:04.680Z [warn] akka.cluster.sharding.ShardRegion [sourceThread=application-akka.actor.default-dispatcher-5, akkaTimestamp=22:07:04.680UTC, akkaSource=akka.tcp://application@192.168.55.137:10001/system/sharding/XRatesListProcessor, sourceActorSystem=application] - Trying to register to coordinator at [ActorSelection[Anchor(akka.tcp://application@192.168.55.134:10001/), Path(/system/sharding/XRatesListProcessorCoordinator/singleton/coordinator)]], but no acknowledgement. Total [46] buffered messages. [Coordinator [Member(address = akka.tcp://application@192.168.55.134:10001, status = Up)] is reachable.]
2018-07-18T22:07:05.879Z [warn] akka.cluster.sharding.ShardRegion [sourceThread=application-akka.actor.default-dispatcher-6, akkaTimestamp=22:07:05.879UTC, akkaSource=akka.tcp://application@192.168.55.137:10001/system/sharding/kafkaProducer-xrateslist, sourceActorSystem=application] - Trying to register to coordinator at [ActorSelection[Anchor(akka.tcp://application@192.168.55.134:10001/), Path(/system/sharding/kafkaProducer-xrateslistCoordinator/singleton/coordinator)]], but no acknowledgement. Total [46] buffered messages. [Coordinator [Member(address = akka.tcp://application@192.168.55.134:10001, status = Up)] is reachable.]
2018-07-18T22:07:06.679Z [warn] akka.cluster.sharding.ShardRegion [sourceThread=application-akka.actor.default-dispatcher-4, akkaTimestamp=22:07:06.679UTC, akkaSource=akka.tcp://application@192.168.55.137:10001/system/sharding/XRatesListProcessor, sourceActorSystem=application] - Trying to register to coordinator at [ActorSelection[Anchor(akka.tcp://application@192.168.55.134:10001/), Path(/system/sharding/XRatesListProcessorCoordinator/singleton/coordinator)]], but no acknowledgement. Total [47] buffered messages. [Coordinator [Member(address = akka.tcp://application@192.168.55.134:10001, status = Up)] is reachable.]
2018-07-18T22:07:07.889Z [warn] akka.cluster.sharding.ShardRegion [sourceThread=application-akka.actor.default-dispatcher-4, akkaTimestamp=22:07:07.889UTC, akkaSource=akka.tcp://application@192.168.55.137:10001/system/sharding/kafkaProducer-xrateslist, sourceActorSystem=application] - Trying to register to coordinator at [ActorSelection[Anchor(akka.tcp://application@192.168.55.134:10001/), Path(/system/sharding/kafkaProducer-xrateslistCoordinator/singleton/coordinator)]], but no acknowledgement. Total [47] buffered messages. [Coordinator [Member(address = akka.tcp://application@192.168.55.134:10001, status = Up)] is reachable.]
2018-07-18T22:07:08.679Z [warn] akka.cluster.sharding.ShardRegion [sourceThread=application-akka.actor.default-dispatcher-4, akkaTimestamp=22:07:08.679UTC, akkaSource=akka.tcp://application@192.168.55.137:10001/system/sharding/XRatesListProcessor, sourceActorSystem=application] - Trying to register to coordinator at [ActorSelection[Anchor(akka.tcp://application@192.168.55.134:10001/), Path(/system/sharding/XRatesListProcessorCoordinator/singleton/coordinator)]], but no acknowledgement. Total [47] buffered messages. [Coordinator [Member(address = akka.tcp://application@192.168.55.134:10001, status = Up)] is reachable.]

在James Roper回答后添加

RP生成一个Kubernetes部署,该部署配置为使用akka.discovery.method = kubernetes-api

据我了解,吊舱也已正确加入集群,但随后尝试:

Trying to register to coordinator at  [ActorSelection[Anchor(akka://application/), Path(/system/sharding/XRatesListProcessorCoordinator/singleton/coordinator)]], but no acknowledgemen t.

请参阅以下日志:

2018-07-19T08:21:50.627Z [info] akka.management.cluster.bootstrap.contactpoint.HttpClusterBootstrapRoutes [sourceThread=application-akka.actor.default-dispatcher-20, akkaTimestamp=08:21:50.627UTC, akkaSource=HttpClusterBootstrap
Routes(akka://application), sourceActorSystem=application] - Bootstrap request from 192.168.55.181:52210: Contact Point returning 1 seed-nodes ([Set(ClusterMember(akka.tcp://application@192.168.55.130:10001,-609640290,Up,Set(dc-default
)))])
2018-07-19T08:21:50.788Z [info] akka.cluster.Cluster(akka://application) [sourceThread=application-akka.actor.default-dispatcher-20, akkaTimestamp=08:21:50.788UTC, akkaSource=akka.cluster.Cluster(akka://application), sourceActor
System=application] - Cluster Node [akka.tcp://application@192.168.55.130:10001] - Received InitJoin message from [Actor[akka.tcp://application@192.168.55.181:10001/system/cluster/core/daemon/joinSeedNodeProcess-1#1697915162]] to [akka
.tcp://application@192.168.55.130:10001]
2018-07-19T08:21:50.788Z [info] akka.cluster.Cluster(akka://application) [sourceThread=application-akka.actor.default-dispatcher-20, akkaTimestamp=08:21:50.788UTC, akkaSource=akka.cluster.Cluster(akka://application), sourceActor
System=application] - Cluster Node [akka.tcp://application@192.168.55.130:10001] - Sending InitJoinAck message from node [akka.tcp://application@192.168.55.130:10001] to [Actor[akka.tcp://application@192.168.55.181:10001/system/cluster
/core/daemon/joinSeedNodeProcess-1#1697915162]]
2018-07-19T08:21:50.831Z [info] akka.cluster.singleton.ClusterSingletonProxy [sourceThread=application-akka.actor.default-dispatcher-6, akkaTimestamp=08:21:50.830UTC, akkaSource=akka.tcp://application@192.168.55.130:10001/user/c
assandraOffsetStorePrepare-singletonProxy, sourceActorSystem=application] - Singleton identified at [akka://application/user/cassandraOffsetStorePrepare-singleton/singleton]
2018-07-19T08:21:50.834Z [info] akka.cluster.singleton.ClusterSingletonProxy [sourceThread=application-akka.actor.default-dispatcher-4, akkaTimestamp=08:21:50.834UTC, akkaSource=akka.tcp://application@192.168.55.130:10001/user/r
eadSideGlobalPrepare-XRatesListProcessor-singletonProxy, sourceActorSystem=application] - Singleton identified at [akka://application/user/readSideGlobalPrepare-XRatesListProcessor-singleton/singleton]
2018-07-19T08:21:50.957Z [info] akka.cluster.Cluster(akka://application) [sourceThread=application-akka.actor.default-dispatcher-4, akkaTimestamp=08:21:50.957UTC, akkaSource=akka.cluster.Cluster(akka://application), sourceActorS
ystem=application] - Cluster Node [akka.tcp://application@192.168.55.130:10001] - Node [akka.tcp://application@192.168.55.181:10001] is JOINING, roles [dc-default]
2018-07-19T08:21:50.974Z [info] akka.management.cluster.bootstrap.contactpoint.HttpClusterBootstrapRoutes [sourceThread=application-akka.actor.default-dispatcher-4, akkaTimestamp=08:21:50.973UTC, akkaSource=HttpClusterBootstrapR
outes(akka://application), sourceActorSystem=application] - Bootstrap request from 192.168.55.142:45738: Contact Point returning 2 seed-nodes ([Set(ClusterMember(akka.tcp://application@192.168.55.130:10001,-609640290,Up,Set(dc-default)
), ClusterMember(akka.tcp://application@192.168.55.181:10001,152184767,Joining,Set(dc-default)))])
2018-07-19T08:21:51.151Z [info] akka.cluster.Cluster(akka://application) [sourceThread=application-akka.actor.default-dispatcher-5, akkaTimestamp=08:21:51.150UTC, akkaSource=akka.cluster.Cluster(akka://application), sourceActorS
ystem=application] - Cluster Node [akka.tcp://application@192.168.55.130:10001] - Leader is moving node [akka.tcp://application@192.168.55.181:10001] to [Up]
2018-07-19T08:21:51.258Z [info] akka.cluster.Cluster(akka://application) [sourceThread=application-akka.actor.default-dispatcher-5, akkaTimestamp=08:21:51.258UTC, akkaSource=akka.cluster.Cluster(akka://application), sourceActorS
ystem=application] - Cluster Node [akka.tcp://application@192.168.55.130:10001] - Received InitJoin message from [Actor[akka.tcp://application@192.168.55.142:10001/system/cluster/core/daemon/joinSeedNodeProcess-1#1126318041]] to [akka.
tcp://application@192.168.55.130:10001]
2018-07-19T08:21:51.259Z [info] akka.cluster.Cluster(akka://application) [sourceThread=application-akka.actor.default-dispatcher-5, akkaTimestamp=08:21:51.259UTC, akkaSource=akka.cluster.Cluster(akka://application), sourceActorS
ystem=application] - Cluster Node [akka.tcp://application@192.168.55.130:10001] - Sending InitJoinAck message from node [akka.tcp://application@192.168.55.130:10001] to [Actor[akka.tcp://application@192.168.55.142:10001/system/cluster/
core/daemon/joinSeedNodeProcess-1#1126318041]]
2018-07-19T08:21:51.443Z [info] akka.cluster.Cluster(akka://application) [sourceThread=application-akka.actor.default-dispatcher-22, akkaTimestamp=08:21:51.442UTC, akkaSource=akka.cluster.Cluster(akka://application), sourceActor
System=application] - Cluster Node [akka.tcp://application@192.168.55.130:10001] - Node [akka.tcp://application@192.168.55.142:10001] is JOINING, roles [dc-default]
2018-07-19T08:21:52.150Z [info] akka.cluster.Cluster(akka://application) [sourceThread=application-akka.actor.default-dispatcher-5, akkaTimestamp=08:21:52.149UTC, akkaSource=akka.cluster.Cluster(akka://application), sourceActorS
ystem=application] - Cluster Node [akka.tcp://application@192.168.55.130:10001] - Leader is moving node [akka.tcp://application@192.168.55.142:10001] to [Up]
2018-07-19T08:21:54.811Z [warn] akka.cluster.sharding.ShardRegion [sourceThread=application-akka.actor.default-dispatcher-7, akkaTimestamp=08:21:54.810UTC, akkaSource=akka.tcp://application@192.168.55.130:10001/system/sharding/X
RatesListProcessor, sourceActorSystem=application] - Trying to register to coordinator at [ActorSelection[Anchor(akka://application/), Path(/system/sharding/XRatesListProcessorCoordinator/singleton/coordinator)]], but no acknowledgemen
t. Total [1] buffered messages. [Coordinator [Member(address = akka.tcp://application@192.168.55.130:10001, status = Up)] is reachable.]
2018-07-19T08:21:54.925Z [error] akka.cluster.sharding.PersistentShardCoordinator [sourceThread=application-akka.actor.default-dispatcher-6, akkaTimestamp=08:21:54.922UTC, akkaSource=akka.tcp://application@192.168.55.130:10001/s
ystem/sharding/XRatesListEntityCoordinator/singleton/coordinator, sourceActorSystem=application] - Persistence failure when replaying events for persistenceId [/sharding/XRatesListEntityCoordinator]. Last known sequence number [0]
java.util.concurrent.CompletionException: akka.pattern.AskTimeoutException: Ask timed out on [Actor[akka://application/system/IO-DNS#1459575867]] after [5000 ms]. Sender[null] sent message of type "akka.io.Dns$Resolve".
        at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:292)

1 个答案:

答案 0 :(得分:0)

这些错误消息的最可能原因是您的节点尚未形成/加入集群,因此拒绝执行任何可能会进行集群操作(例如确定应在哪个节点上启动持久性实体分片的集群操作)。不安全。

顺便说一句,要了解为什么它拒绝执行任何操作,当节点启动时,它需要确保在执行任何操作之前,它已加入集群。如果它没有加入集群,那么就有可能已经存在一个未知的集群。忽略此结果并像平常一样开始的结果是,持久性实体可能最终一次在多个节点上运行,这将破坏它们的一致性,因此可能在一个节点上执行命令,导致进入特定状态,但是如果由于如果有多个集群,则同一实体也正在另一个节点上运行,该节点将不会意识到先前的命令和随后的状态更改。然后,它可能会接受另一条命令,由于另一节点的状态更改,该命令将无效,但允许它。因此,当节点启动时,如果它找不到要加入的集群,则由于一时兴致就决定立即形成一个新集群是非常危险的(实践中最常见的问题是当您没有集群时,可以一次启动多个节点。由于它们都是启动的,因此它们可能不会彼此发现,并且有可能全部决定形成自己的集群。相反,您需要某种机制能够权威地或至少在某种程度上可靠地知道不存在集群,以便在这种情况下可以形成新集群。这不会自动发生,您需要使用下面描述的一种机制。

在Kubernetes上引导集群的最佳,最简单的方法是使用Akka集群引导程序:

https://developer.lightbend.com/docs/akka-management/current/bootstrap.html

这使用DNS查找其他联系点,并可靠地确定创建新群集是否安全。这并不完美,您可以在文档中了解一些极端情况。另一种方法是使用Kubernetes有状态集:

https://developer.lightbend.com/guides/akka-cluster-kubernetes-k8s-deploy/

由于您需要创建有状态集,因此需要进行更多配置,但是据我了解,它并没有出现可能失败的相同情况。