Akka.Net cluster singleton - handover not occurs when current singleton node shutdown unexpectedly -
i'm trying akka.net cluster tools, in order use singleton behavior , seems work perfectly, when current singleton node "host" leaves cluster in gracefully way. if shutdown host node, handover not occur.
background
i'm building system composed 4 nodes (initially). 1 of nodes "workers coordinator" , responsible monitor data database and, when necessary, submit jobs other workers. thinking subscribe cluster events , use role leader changing event make actor (on leader node) become coordinator, think cluster singleton better choice in case.
working sample (but if gracefully leave cluster)
private void start() { console.title = "worker"; var section = (akkaconfigurationsection)configurationmanager.getsection("akka"); var config = section.akkaconfig; // create new actor system (a container actors) var system = actorsystem.create("singletonactorsystem", config); var cluster = cluster.get(system); cluster.registeronmemberremoved(() => memberremoved(system)); var settings = new clustersingletonmanagersettings("processorcoordinatorinstance", "worker", timespan.fromseconds(5), timespan.fromseconds(1)); var actor = system.actorof(clustersingletonmanager.props( singletonprops: props.create<processorcoordinatoractor>(), terminationmessage: poisonpill.instance, settings: settings), name: "processorcoordinator"); string line = console.readline(); if (line == "g") { //handover works cluster.leave(cluster.selfaddress); _leaveclusterevent.waitone(); system.shutdown(); } else { //doesn't work system.shutdown(); } } private async void memberremoved(actorsystem actorsystem) { await actorsystem.terminate(); _leaveclusterevent.set(); }
configuration
akka { suppress-json-serializer-warning = on actor { provider = "akka.cluster.clusteractorrefprovider, akka.cluster" } remote { helios.tcp { port = 0 hostname = localhost } } cluster { seed-nodes = ["akka.tcp://singletonactorsystem@127.0.0.1:4053"] roles = [worker] } }
thank @horusiath, answer totaly right! wasn't able find configuration in akka.net documentation, , didn't realize supposed take on akka documentation. thank much!
have tried set akka.cluster.auto-down-unreachable-after timeout (eg. 10 sec)? – horusiath aug 12 @ 11:27
Comments
Post a Comment