Akka 集群不起作用
Akka Clustering is not working
我正在尝试按照提供的教程学习 Akka 集群 here
我已经创建了应用程序,repo 是 here。
如教程中所述,我已经启动了 FrontEndApp
> runMain TransformationFrontendApp
[info] Running TransformationFrontendApp
[INFO] [10/31/2017 17:28:05.293] [run-main-0] [akka.remote.Remoting] Starting remoting
[INFO] [10/31/2017 17:28:05.543] [run-main-0] [akka.remote.Remoting] Remoting started; listening on addresses :[akka.tcp://ClusterSystem@localhost:54746]
[INFO] [10/31/2017 17:28:05.556] [run-main-0]
[akka.cluster.Cluster(akka://ClusterSystem)] Cluster Node
[akka.tcp://ClusterSystem@localhost:54746] - Starting up...
[INFO] [10/31/2017 17:28:05.648] [run-main-0]
[akka.cluster.Cluster(akka://ClusterSystem)] Cluster Node
[akka.tcp://ClusterSystem@localhost:54746] - Registered cluster JMX MBean
[akka:type=Cluster]
[INFO] [10/31/2017 17:28:05.648] [run-main-0]
[akka.cluster.Cluster(akka://ClusterSystem)] Cluster Node
[akka.tcp://ClusterSystem@localhost:54746] - Started up successfully
[WARN] [10/31/2017 17:28:05.683] [ClusterSystem-akka.actor.default-dispatcher-2]
[WARN] [10/31/2017 17:28:05.748] [New I/O boss #3]
[NettyTransport(akka://ClusterSystem)] Remote connection to [null] failed with java.net.ConnectException: Connection refused: /127.0.0.1:2551
[WARN] [10/31/2017 17:28:05.750] [New I/O boss #3]
[NettyTransport(akka://ClusterSystem)] Remote connection to [null] failed with java.net.ConnectException: Connection refused: /127.0.0.1:2552
[WARN] [10/31/2017 17:28:05.751] [ClusterSystem-akka.remote.default-remote-dispatcher-12] [akka.tcp://ClusterSystem@localhost:54746/system/endpointManager/reliableEndpointWriter-akka.tcp%3A%2F%2FClusterSystem%40127.0.0.1%3A2551-0] Association with remote system [akka.tcp://ClusterSystem@127.0.0.1:2551] has failed, address is now gated for [5000] ms. Reason: [Association failed with [akka.tcp://ClusterSystem@127.0.0.1:2551]] Caused by: [Connection refused: /127.0.0.1:2551]
即使在 2551 和 2552 上启动后端应用程序后,上述警告消息仍不断重复。
在2551上启动后端actor的终端日志。
> runMain TransformationBackendApp 2551
[info] Running TransformationBackendApp 2551
[INFO] [10/31/2017 17:28:50.867] [run-main-0] [akka.remote.Remoting] Starting remoting
[INFO] [10/31/2017 17:28:51.122] [run-main-0] [akka.remote.Remoting] Remoting started; listening on addresses :[akka.tcp://ClusterSystem@localhost:2551]
[INFO] [10/31/2017 17:28:51.134] [run-main-0] [akka.cluster.Cluster(akka://ClusterSystem)] Cluster Node [akka.tcp://ClusterSystem@localhost:2551] - Starting up...
[INFO] [10/31/2017 17:28:51.228] [run-main-0] [akka.cluster.Cluster(akka://ClusterSystem)] Cluster Node [akka.tcp://ClusterSystem@localhost:2551] - Registered cluster JMX MBean [akka:type=Cluster]
[INFO] [10/31/2017 17:28:51.228] [run-main-0] [akka.cluster.Cluster(akka://ClusterSystem)] Cluster Node [akka.tcp://ClusterSystem@localhost:2551] - Started up successfully
[WARN] [10/31/2017 17:28:51.259] [ClusterSystem-akka.actor.default-dispatcher-3] [akka.tcp://ClusterSystem@localhost:2551/system/cluster/core/daemon/downingProvider] Don't use auto-down feature of Akka Cluster in production. See 'Auto-downing (DO NOT USE)' section of Akka Cluster documentation.
[ ERROR] [10/31/2017 17:28:51.382] [ClusterSystem-akka.remote.default-remote-dispatcher-5] [akka://ClusterSystem/system/endpointManager/reliableEndpointWriter-akka.tcp%3A%2F%2FClusterSystem%40localhost%3A2551-2/endpointWriter] dropping message [class akka.actor.ActorSelectionMessage] for non-local recipient [Actor[akka.tcp://ClusterSystem@127.0.0.1:2551/]] arriving at [akka.tcp://ClusterSystem@127.0.0.1:2551] inbound addresses are [akka.tcp://ClusterSystem@localhost:2551]
最后一个 [Error]
日志不断重复。
在2552上启动后端actor的终端日志。
> runMain TransformationBackendApp 2552
[info] Running TransformationBackendApp 2552
[INFO] [10/31/2017 17:28:25.451] [run-main-0] [akka.remote.Remoting] Starting remoting
[INFO] [10/31/2017 17:28:25.689] [run-main-0] [akka.remote.Remoting] Remoting started; listening on addresses :[akka.tcp://ClusterSystem@localhost:2552]
[INFO] [10/31/2017 17:28:25.706] [run-main-0] [akka.cluster.Cluster(akka://ClusterSystem)] Cluster Node [akka.tcp://ClusterSystem@localhost:2552] - Starting up...
[INFO] [10/31/2017 17:28:25.803] [run-main-0] [akka.cluster.Cluster(akka://ClusterSystem)] Cluster Node [akka.tcp://ClusterSystem@localhost:2552] - Registered cluster JMX MBean [akka:type=Cluster]
[INFO] [10/31/2017 17:28:25.803] [run-main-0] [akka.cluster.Cluster(akka://ClusterSystem)] Cluster Node [akka.tcp://ClusterSystem@localhost:2552] - Started up successfully
[WARN] [10/31/2017 17:28:25.836] [ClusterSystem-akka.actor.default-dispatcher-2] [akka.tcp://ClusterSystem@localhost:2552/system/cluster/core/daemon/downingProvider] Don't use auto-down feature of Akka Cluster in production. See 'Auto-downing (DO NOT USE)' section of Akka Cluster documentation.
[WARN] [10/31/2017 17:28:25.909] [New I/O boss #3] [NettyTransport(akka://ClusterSystem)] Remote connection to [null] failed with java.net.ConnectException: Connection refused: /127.0.0.1:2551
[WARN] [10/31/2017 17:28:25.910] [ClusterSystem-akka.remote.default-remote-dispatcher-13] [akka.tcp://ClusterSystem@localhost:2552/system/endpointManager/reliableEndpointWriter-akka.tcp%3A%2F%2FClusterSystem%40127.0.0.1%3A2551-0] Association with remote system [akka.tcp://ClusterSystem@127.0.0.1:2551] has failed, address is now gated for [5000] ms. Reason: [Association failed with [akka.tcp://ClusterSystem@127.0.0.1:2551]] Caused by: [Connection refused: /127.0.0.1:2551]
[INFO] [10/31/2017 17:28:25.914] [ClusterSystem-akka.actor.default-dispatcher-4] [akka://ClusterSystem/deadLetters] Message [akka.cluster.InternalClusterAction$InitJoin$] from Actor[akka://ClusterSystem/system/cluster/core/daemon/joinSeedNodeProcess-1#-937368711] to Actor[akka://ClusterSystem/deadLetters] was not delivered. [1] dead letters encountered. This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'.
[ERROR] [10/31/2017 17:28:25.958] [ClusterSystem-akka.remote.default-remote-dispatcher-17] [akka://ClusterSystem/system/endpointManager/reliableEndpointWriter-akka.tcp%3A%2F%2FClusterSystem%40localhost%3A2552-2/endpointWriter] dropping message [class akka.actor.ActorSelectionMessage] for non-local recipient [Actor[akka.tcp://ClusterSystem@127.0.0.1:2552/]] arriving at [akka.tcp://ClusterSystem@127.0.0.1:2552] inbound addresses are [akka.tcp://ClusterSystem@localhost:2552]
不确定是什么原因 backend
集群节点无法相互检测和 frontend
带有后端的 actor 节点。
我是否遗漏了任何设置?
问题出在您的 application.conf 上。您有 akka.remote.netty.tcp.hostname = "localhost" 和 akka.cluster.seed-nodes=["akka.tcp://ClusterSystem@127.0.0.1:2551", "akka.tcp://ClusterSystem@127.0.0.1:2552"]。您必须使用 localhost 或 127.0.0.1,不能同时使用:
akka {
actor {
provider = "akka.cluster.ClusterActorRefProvider"
}
remote {
log-remote-lifecycle-events = off
netty.tcp {
hostname = "localhost"
port = 0
}
}
cluster {
seed-nodes = ["akka.tcp://ClusterSystem@localhost:2551", "akka.tcp://ClusterSystem@localhost:2552"]
auto-down-unreachable-after = 10s
}
}
我正在尝试按照提供的教程学习 Akka 集群 here
我已经创建了应用程序,repo 是 here。
如教程中所述,我已经启动了 FrontEndApp
> runMain TransformationFrontendApp
[info] Running TransformationFrontendApp
[INFO] [10/31/2017 17:28:05.293] [run-main-0] [akka.remote.Remoting] Starting remoting
[INFO] [10/31/2017 17:28:05.543] [run-main-0] [akka.remote.Remoting] Remoting started; listening on addresses :[akka.tcp://ClusterSystem@localhost:54746]
[INFO] [10/31/2017 17:28:05.556] [run-main-0]
[akka.cluster.Cluster(akka://ClusterSystem)] Cluster Node
[akka.tcp://ClusterSystem@localhost:54746] - Starting up...
[INFO] [10/31/2017 17:28:05.648] [run-main-0]
[akka.cluster.Cluster(akka://ClusterSystem)] Cluster Node
[akka.tcp://ClusterSystem@localhost:54746] - Registered cluster JMX MBean
[akka:type=Cluster]
[INFO] [10/31/2017 17:28:05.648] [run-main-0]
[akka.cluster.Cluster(akka://ClusterSystem)] Cluster Node
[akka.tcp://ClusterSystem@localhost:54746] - Started up successfully
[WARN] [10/31/2017 17:28:05.683] [ClusterSystem-akka.actor.default-dispatcher-2]
[WARN] [10/31/2017 17:28:05.748] [New I/O boss #3]
[NettyTransport(akka://ClusterSystem)] Remote connection to [null] failed with java.net.ConnectException: Connection refused: /127.0.0.1:2551
[WARN] [10/31/2017 17:28:05.750] [New I/O boss #3]
[NettyTransport(akka://ClusterSystem)] Remote connection to [null] failed with java.net.ConnectException: Connection refused: /127.0.0.1:2552
[WARN] [10/31/2017 17:28:05.751] [ClusterSystem-akka.remote.default-remote-dispatcher-12] [akka.tcp://ClusterSystem@localhost:54746/system/endpointManager/reliableEndpointWriter-akka.tcp%3A%2F%2FClusterSystem%40127.0.0.1%3A2551-0] Association with remote system [akka.tcp://ClusterSystem@127.0.0.1:2551] has failed, address is now gated for [5000] ms. Reason: [Association failed with [akka.tcp://ClusterSystem@127.0.0.1:2551]] Caused by: [Connection refused: /127.0.0.1:2551]
即使在 2551 和 2552 上启动后端应用程序后,上述警告消息仍不断重复。
在2551上启动后端actor的终端日志。
> runMain TransformationBackendApp 2551
[info] Running TransformationBackendApp 2551
[INFO] [10/31/2017 17:28:50.867] [run-main-0] [akka.remote.Remoting] Starting remoting
[INFO] [10/31/2017 17:28:51.122] [run-main-0] [akka.remote.Remoting] Remoting started; listening on addresses :[akka.tcp://ClusterSystem@localhost:2551]
[INFO] [10/31/2017 17:28:51.134] [run-main-0] [akka.cluster.Cluster(akka://ClusterSystem)] Cluster Node [akka.tcp://ClusterSystem@localhost:2551] - Starting up...
[INFO] [10/31/2017 17:28:51.228] [run-main-0] [akka.cluster.Cluster(akka://ClusterSystem)] Cluster Node [akka.tcp://ClusterSystem@localhost:2551] - Registered cluster JMX MBean [akka:type=Cluster]
[INFO] [10/31/2017 17:28:51.228] [run-main-0] [akka.cluster.Cluster(akka://ClusterSystem)] Cluster Node [akka.tcp://ClusterSystem@localhost:2551] - Started up successfully
[WARN] [10/31/2017 17:28:51.259] [ClusterSystem-akka.actor.default-dispatcher-3] [akka.tcp://ClusterSystem@localhost:2551/system/cluster/core/daemon/downingProvider] Don't use auto-down feature of Akka Cluster in production. See 'Auto-downing (DO NOT USE)' section of Akka Cluster documentation.
[ ERROR] [10/31/2017 17:28:51.382] [ClusterSystem-akka.remote.default-remote-dispatcher-5] [akka://ClusterSystem/system/endpointManager/reliableEndpointWriter-akka.tcp%3A%2F%2FClusterSystem%40localhost%3A2551-2/endpointWriter] dropping message [class akka.actor.ActorSelectionMessage] for non-local recipient [Actor[akka.tcp://ClusterSystem@127.0.0.1:2551/]] arriving at [akka.tcp://ClusterSystem@127.0.0.1:2551] inbound addresses are [akka.tcp://ClusterSystem@localhost:2551]
最后一个 [Error]
日志不断重复。
在2552上启动后端actor的终端日志。
> runMain TransformationBackendApp 2552
[info] Running TransformationBackendApp 2552
[INFO] [10/31/2017 17:28:25.451] [run-main-0] [akka.remote.Remoting] Starting remoting
[INFO] [10/31/2017 17:28:25.689] [run-main-0] [akka.remote.Remoting] Remoting started; listening on addresses :[akka.tcp://ClusterSystem@localhost:2552]
[INFO] [10/31/2017 17:28:25.706] [run-main-0] [akka.cluster.Cluster(akka://ClusterSystem)] Cluster Node [akka.tcp://ClusterSystem@localhost:2552] - Starting up...
[INFO] [10/31/2017 17:28:25.803] [run-main-0] [akka.cluster.Cluster(akka://ClusterSystem)] Cluster Node [akka.tcp://ClusterSystem@localhost:2552] - Registered cluster JMX MBean [akka:type=Cluster]
[INFO] [10/31/2017 17:28:25.803] [run-main-0] [akka.cluster.Cluster(akka://ClusterSystem)] Cluster Node [akka.tcp://ClusterSystem@localhost:2552] - Started up successfully
[WARN] [10/31/2017 17:28:25.836] [ClusterSystem-akka.actor.default-dispatcher-2] [akka.tcp://ClusterSystem@localhost:2552/system/cluster/core/daemon/downingProvider] Don't use auto-down feature of Akka Cluster in production. See 'Auto-downing (DO NOT USE)' section of Akka Cluster documentation.
[WARN] [10/31/2017 17:28:25.909] [New I/O boss #3] [NettyTransport(akka://ClusterSystem)] Remote connection to [null] failed with java.net.ConnectException: Connection refused: /127.0.0.1:2551
[WARN] [10/31/2017 17:28:25.910] [ClusterSystem-akka.remote.default-remote-dispatcher-13] [akka.tcp://ClusterSystem@localhost:2552/system/endpointManager/reliableEndpointWriter-akka.tcp%3A%2F%2FClusterSystem%40127.0.0.1%3A2551-0] Association with remote system [akka.tcp://ClusterSystem@127.0.0.1:2551] has failed, address is now gated for [5000] ms. Reason: [Association failed with [akka.tcp://ClusterSystem@127.0.0.1:2551]] Caused by: [Connection refused: /127.0.0.1:2551]
[INFO] [10/31/2017 17:28:25.914] [ClusterSystem-akka.actor.default-dispatcher-4] [akka://ClusterSystem/deadLetters] Message [akka.cluster.InternalClusterAction$InitJoin$] from Actor[akka://ClusterSystem/system/cluster/core/daemon/joinSeedNodeProcess-1#-937368711] to Actor[akka://ClusterSystem/deadLetters] was not delivered. [1] dead letters encountered. This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'.
[ERROR] [10/31/2017 17:28:25.958] [ClusterSystem-akka.remote.default-remote-dispatcher-17] [akka://ClusterSystem/system/endpointManager/reliableEndpointWriter-akka.tcp%3A%2F%2FClusterSystem%40localhost%3A2552-2/endpointWriter] dropping message [class akka.actor.ActorSelectionMessage] for non-local recipient [Actor[akka.tcp://ClusterSystem@127.0.0.1:2552/]] arriving at [akka.tcp://ClusterSystem@127.0.0.1:2552] inbound addresses are [akka.tcp://ClusterSystem@localhost:2552]
不确定是什么原因 backend
集群节点无法相互检测和 frontend
带有后端的 actor 节点。
我是否遗漏了任何设置?
问题出在您的 application.conf 上。您有 akka.remote.netty.tcp.hostname = "localhost" 和 akka.cluster.seed-nodes=["akka.tcp://ClusterSystem@127.0.0.1:2551", "akka.tcp://ClusterSystem@127.0.0.1:2552"]。您必须使用 localhost 或 127.0.0.1,不能同时使用:
akka {
actor {
provider = "akka.cluster.ClusterActorRefProvider"
}
remote {
log-remote-lifecycle-events = off
netty.tcp {
hostname = "localhost"
port = 0
}
}
cluster {
seed-nodes = ["akka.tcp://ClusterSystem@localhost:2551", "akka.tcp://ClusterSystem@localhost:2552"]
auto-down-unreachable-after = 10s
}
}