I'm trying to build a small AKka.NET Cluster Application but I'm having problems since I keep getting the following error:
[WARNING][7/14/2022 10:42:06 AM][Thread 0011][akka.tcp://accountsystem@localhost:57959/system/cluster/core/daemon/joinSeedNodeProcess-1] Couldn't join seed nodes after [2] attempts, will try again. seed-nodes=[akka.tcp://accountsystem@localhost:2551]
This is my docker-compose file for my lighthouse service:
version: '3'
services:
accountsystem.lighthouse:
image: petabridge/lighthouse:latest
hostname: accountsystem.lighthouse
ports:
- '2551:2551'
environment:
ACTORSYSTEM: "accountsystem"
CLUSTER_PORT: 2551
CLUSTER_IP: "accountsystem.lighthouse"
CLUSTER_SEEDS: "akka.tcp://accountsystem@accountsystem.lighthouse:2551"
And this is my AKka.NET configuration:
<![CDATA[
akka {
actor {
provider = cluster
}
remote {
log-remote-lifecycle-events = DEBUG
dot-netty.tcp {
hostname = "localhost"
port = 0
}
}
cluster {
seed-nodes = [
"akka.tcp://accountsystem@localhost:2551"]
#auto-down-unreachable-after = 30s
}
}
]]>
Also I am sharing my code setup for my AKkaService
:
public Task StartAsync(CancellationToken cancellationToken)
{
var akkaConfig = (AkkaConfigurationSection) System.Configuration.ConfigurationManager.GetSection("akka");
var bootstrap = BootstrapSetup.Create()
.WithConfig(akkaConfig.AkkaConfig)
.WithActorRefProvider(ProviderSelection.Cluster.Instance); // launch Akka.Cluster
// enable DI support inside this ActorSystem, if needed
var diSetup = DependencyResolverSetup.Create(_serviceProvider);
// merge this setup (and any others) together into ActorSystemSetup
var actorSystemSetup = bootstrap.And(diSetup);
// start ActorSystem
_actorSystem = ActorSystem.Create("accountsystem", actorSystemSetup);
var props = DependencyResolver.For(_actorSystem).Props<AccountRouterActor>();
_actorRef = _actorSystem.ActorOf(props, "account");
_actorSystem.WhenTerminated.ContinueWith(tr => {
_applicationLifetime.StopApplication();
});
return Task.CompletedTask;
}
I have been reading about actor system and server mismatch, but I think the name is correct which would be accountsystem
. I am also sharing my console after starting up my docker compose file with all the messages. Maybe that will help.
docker-compose up
WARNING: Found orphan containers (accountpoc_mssql_1, mysql) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up.
Starting accountpoc_accountsystem.lighthouse_1 ... done
Attaching to accountpoc_accountsystem.lighthouse_1
accountsystem.lighthouse_1 | [Docker-Bootstrap] IP=accountsystem.lighthouse
accountsystem.lighthouse_1 | [Docker-Bootstrap] PORT=2551
accountsystem.lighthouse_1 | [Docker-Bootstrap] SEEDS=["akka.tcp://accountsystem@accountsystem.lighthouse:2551"]
accountsystem.lighthouse_1 | [Lighthouse] ActorSystem: accountsystem; IP: accountsystem.lighthouse; PORT: 2551
accountsystem.lighthouse_1 | [Lighthouse] Performing pre-boot sanity check. Should be able to parse address [akka.tcp://accountsystem@accountsystem.lighthouse:2551]
accountsystem.lighthouse_1 | [Lighthouse] Parse successful.
accountsystem.lighthouse_1 | [INFO][07/14/2022 10:52:48][Thread 0001][remoting (akka://accountsystem)] Starting remoting
accountsystem.lighthouse_1 | [INFO][07/14/2022 10:52:48][Thread 0001][remoting (akka://accountsystem)] Remoting started; listening on addresses : [akka.tcp://accountsystem@accountsystem.lighthouse:2551]
accountsystem.lighthouse_1 | [INFO][07/14/2022 10:52:48][Thread 0001][remoting (akka://accountsystem)] Remoting now listens on addresses: [akka.tcp://accountsystem@accountsystem.lighthouse:2551]
accountsystem.lighthouse_1 | [INFO][07/14/2022 10:52:48][Thread 0001][Cluster (akka://accountsystem)] Cluster Node [akka.tcp://accountsystem@accountsystem.lighthouse:2551] - Starting up...
accountsystem.lighthouse_1 | [INFO][07/14/2022 10:52:48][Thread 0001][Cluster (akka://accountsystem)] Cluster Node [1.6.2] - Node [akka.tcp://accountsystem@accountsystem.lighthouse:2551] is JOINING itself (with roles [lighthouse], version [1.6.2]) and forming a new cluster
accountsystem.lighthouse_1 | [INFO][07/14/2022 10:52:48][Thread 0001][Cluster (akka://accountsystem)] Cluster Node [akka.tcp://accountsystem@accountsystem.lighthouse:2551] - is the new leader among reachable nodes (more leaders may exist)
accountsystem.lighthouse_1 | [INFO][07/14/2022 10:52:48][Thread 0001][Cluster (akka://accountsystem)] Cluster Node [akka.tcp://accountsystem@accountsystem.lighthouse:2551] - Leader is moving node [akka.tcp://accountsystem@accountsystem.lighthouse:2551] to [Up]
accountsystem.lighthouse_1 | [INFO][07/14/2022 10:52:49][Thread 0001][Cluster (akka://accountsystem)] Cluster Node [akka.tcp://accountsystem@accountsystem.lighthouse:2551] - Started up successfully
accountsystem.lighthouse_1 | [INFO][07/14/2022 10:52:49][Thread 0001][akka.tcp://accountsystem@accountsystem.lighthouse:2551/user/petabridge.cmd] petabridge.cmd host bound to [0.0.0.0:9110]
accountsystem.lighthouse_1 | [ERROR][07/14/2022 10:52:58][Thread 0008][akka.tcp://accountsystem@accountsystem.lighthouse:2551/system/endpointManager/reliableEndpointWriter-akka.tcp%3A%2F%2Faccountsystem%40localhost%3A59968-1/endpointWriter] Dropping message [Akka.Actor.ActorSelectionMessage] for non-local recipient [[akka.tcp://accountsystem@localhost:2551/]] arriving at [akka.tcp://accountsystem@localhost:2551] inbound addresses [akka.tcp://accountsystem@accountsystem.lighthouse:2551]
accountsystem.lighthouse_1 | [ERROR][07/14/2022 10:53:02][Thread 0008][akka.tcp://accountsystem@accountsystem.lighthouse:2551/system/endpointManager/reliableEndpointWriter-akka.tcp%3A%2F%2Faccountsystem%40localhost%3A59968-1/endpointWriter] Dropping message [Akka.Actor.ActorSelectionMessage] for non-local recipient [[akka.tcp://accountsystem@localhost:2551/]] arriving at [akka.tcp://accountsystem@localhost:2551] inbound addresses [akka.tcp://accountsystem@accountsystem.lighthouse:2551]
accountsystem.lighthouse_1 | [ERROR][07/14/2022 10:53:08][Thread 0008][akka.tcp://accountsystem@accountsystem.lighthouse:2551/system/endpointManager/reliableEndpointWriter-akka.tcp%3A%2F%2Faccountsystem%40localhost%3A59968-1/endpointWriter] Dropping message [Akka.Actor.ActorSelectionMessage] for non-local recipient [[akka.tcp://accountsystem@localhost:2551/]] arriving at [akka.tcp://accountsystem@localhost:2551] inbound addresses [akka.tcp://accountsystem@accountsystem.lighthouse:2551]
accountsystem.lighthouse_1 | [WARNING][07/14/2022 10:53:10][Thread 0008][akka.tcp://accountsystem@accountsystem.lighthouse:2551/system/endpointManager/reliableEndpointWriter-akka.tcp%3A%2F%2Faccountsystem%40localhost%3A59968-1] Association with remote system akka.tcp://accountsystem@localhost:59968 has failed; address is now gated for 5000 ms. Reason is: [Akka.Remote.EndpointDisassociatedException: Disassociated
accountsystem.lighthouse_1 | at Akka.Remote.EndpointWriter.PublishAndThrow(Exception reason, LogLevel level, Boolean needToThrow)
accountsystem.lighthouse_1 | at Akka.Remote.EndpointWriter.Unhandled(Object message)
accountsystem.lighthouse_1 | at Akka.Actor.UntypedActor.Receive(Object message)
accountsystem.lighthouse_1 | at Akka.Actor.ActorBase.AroundReceive(Receive receive, Object message)
accountsystem.lighthouse_1 | at Akka.Actor.ActorCell.ReceiveMessage(Object message)
accountsystem.lighthouse_1 | at Akka.Actor.ActorCell.ReceivedTerminated(Terminated t)
accountsystem.lighthouse_1 | at Akka.Actor.ActorCell.AutoReceiveMessage(Envelope envelope)
accountsystem.lighthouse_1 | at Akka.Actor.ActorCell.Invoke(Envelope envelope)]
accountsystem.lighthouse_1 | [ERROR][07/14/2022 10:53:10][Thread 0008][akka://accountsystem/system/endpointManager/reliableEndpointWriter-akka.tcp%3A%2F%2Faccountsystem%40localhost%3A59968-1/endpointWriter] Disassociated
accountsystem.lighthouse_1 | Cause: Akka.Remote.EndpointDisassociatedException: Disassociated
accountsystem.lighthouse_1 | at Akka.Remote.EndpointWriter.PublishAndThrow(Exception reason, LogLevel level, Boolean needToThrow)
accountsystem.lighthouse_1 | at Akka.Remote.EndpointWriter.Unhandled(Object message)
accountsystem.lighthouse_1 | at Akka.Actor.UntypedActor.Receive(Object message)
accountsystem.lighthouse_1 | at Akka.Actor.ActorBase.AroundReceive(Receive receive, Object message)
accountsystem.lighthouse_1 | at Akka.Actor.ActorCell.ReceiveMessage(Object message)
accountsystem.lighthouse_1 | at Akka.Actor.ActorCell.ReceivedTerminated(Terminated t)
accountsystem.lighthouse_1 | at Akka.Actor.ActorCell.AutoReceiveMessage(Envelope envelope)
accountsystem.lighthouse_1 | at Akka.Actor.ActorCell.Invoke(Envelope envelope)
Well, I just had to change the hocon configuration to the following:
<![CDATA[
akka {
actor {
provider = cluster
}
remote {
log-remote-lifecycle-events = DEBUG
dot-netty.tcp {
hostname = "localhost"
port = 2551
}
}
cluster {
seed-nodes = [
"akka.tcp://accountsystem@localhost:2551"]
#auto-down-unreachable-after = 30s
}
}
]]>