I am trying to use akka-management and akka-boostrap to boostrap a cluster. But I’m unable to understand where I’m going wrong after having consulted the documentation several times, most likely I am missing something very obvious.
To start off - my akka-management and boostrap config looks something like this,
#discovery
akka.discovery {
config.services = {
local-cluster = {
endpoints = [
{
host = "10.42.105.131"
post = 2550
}
{
host = "10.42.105.131"
port = 2551
},
{
host = "10.42.105.131"
port = 2552
}
]
}
}
}
#discovery
#bootstrap
akka.management {
cluster.bootstrap {
contact-point-discovery {
service-name = "local-cluster"
discovery-method = config
required-contact-point-nr = 1
}
}
}
#bootstrap
Since I am testing locally, the host I assume will be the same, my intention is to start three processes which find each other and form a cluster. As opposed to the static config, my understanding is that the boostrap does not have a “strong leader”, meaning any node can be started up and any node can become leader.
In the main class of my application I have this -
ActorSystem<SpawnProtocol.Command> system = ActorSystem.create(getRootBehavior(), "local-cluster", config);
AkkaManagement.get(system).start();
ClusterBootstrap.get(system).start();
log.info("Created actor system {}", system.address());
// Create singleton actors
createSingletonActors(system, config);
// Log cluster state from this node
Cluster cluster = Cluster.get(system);
private static Behavior<SpawnProtocol.Command> getRootBehavior() {
return Behaviors.setup(context -> {
// Create an actor that handles cluster domain events
context.spawn(ClusterListener.create(), "ClusterListener");
return SpawnProtocol.create();
});
}
In the logs I see this -
Node 1
[] Using self contact point address: http://10.42.105.131:8558
[] Including HTTP management routes for HealthCheckRoutes
[] Initiating bootstrap procedure using config method...
[] Bootstrap using `akka.discovery` method: config
[] Bound Akka Management (HTTP) endpoint to: 10.42.105.131:8558
.
.
.
Located service members based on: [Lookup(local-cluster,None,Some(tcp))]: [ResolvedTarget(10.42.105.131,None,None), ResolvedTarget(10.42.105.131,Some(2551),None), ResolvedTarget(10.42.105.131,Some(2552),None)], filtered to []
[] Discovered [0] contact points, confirmed [0], which is less than the required [1], retrying
Almost the exact is printed in Node 2, but there is an exception in binding the Akka Management port -
[] Bind failed for TCP channel on endpoint [/10.42.105.131:8558]
Does each node need to have a separate AkkaManagement port? How do I handle this if I’m starting the nodes on the same machine - not sure if this is the reason why bootstrap is failing