These are chat archives for atomix/atomix

16th
Jan 2018
Sander de Goeij
@sanderdg
Jan 16 2018 12:18 UTC
Hello everyone, I'm new to Atomix and I'm currently testing it. The situation I want to create is to have a single process running at a time which will always be on the leader node. But I encountered a strange situation regarding automatic leaving of the last running node in the cluster. After bootstrapping and joining a replica I join for e.g. 1 other replica to the cluster. Then I make the leader leave the cluster. However, the other replica also leaves the cluster automatically and another node seems to join again (I get a new id which I haven't seen before). Why is this happening? Because I haven't seen the id before I cannot determine whether the current node is the leader. Is there perhaps another way to determine if the current node is the leader? A dirty solution would be to count the members after going from 2 to 1 but I would prefer a cleaner solution. Any thoughts on this?
Johno Crawford
@johnou
Jan 16 2018 12:23 UTC
check the leader id against the current node id?
leader might be null if an election is in place
Sander de Goeij
@sanderdg
Jan 16 2018 13:21 UTC
Thanks, I can get the leader id but how to get the current node id if it has changed automatically when it's the last node?
Johno Crawford
@johnou
Jan 16 2018 13:37 UTC
which version of atomix are you using
Sander de Goeij
@sanderdg
Jan 16 2018 13:38 UTC
1.0.8
Johno Crawford
@johnou
Jan 16 2018 13:39 UTC
aha I am not familiar with 1.0.x, only worked with 2.1
Sander de Goeij
@sanderdg
Jan 16 2018 13:39 UTC
Ok
Johno Crawford
@johnou
Jan 16 2018 13:41 UTC
with 2.1 you can register an event listener and process LeadershipEvent events
Sander de Goeij
@sanderdg
Jan 16 2018 13:48 UTC
Sounds great! Which packages do I need to get started for a simple setup? There doesn't seem to be an atomix-all artifact for 2.x
Johno Crawford
@johnou
Jan 16 2018 13:49 UTC
it's still in beta, are you using maven, gradle or?
Sander de Goeij
@sanderdg
Jan 16 2018 13:57 UTC
I'm using maven and I've tried 2.1.0-beta1 but it seems I'm still missing packages (for e.g. io.atomix.AtomixReplica)
Johno Crawford
@johnou
Jan 16 2018 13:59 UTC
AtomixReplica doesn't exist in 2.1.x
Sander de Goeij
@sanderdg
Jan 16 2018 14:26 UTC
I'll check it out and give it a try, thanks!
Sander de Goeij
@sanderdg
Jan 16 2018 15:13 UTC
Unfortunately I don't get a really simple setup to work with this beta. I've followed the documentation (I understand it's under development) and this is the result: https://pastebin.com/3dbLWwzj It just hangs and I don't see any logging even though debug is enabled. Could you help me out a little?
Johno Crawford
@johnou
Jan 16 2018 15:23 UTC
it's waiting for you to create server2 and server3
try something like this
Sander de Goeij
@sanderdg
Jan 16 2018 16:00 UTC
Thanks! I'll look into this further later on but this is a good start point