-
Notifications
You must be signed in to change notification settings - Fork 240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to make cluster config persistent? #103
Comments
Hi @felipeasf NuRaft/examples/in_memory_state_mgr.hxx Line 51 in 89d7bd3
you need to implement save_config and load_config , as well as save_state and read_state . Once those APIs are working, Raft server will automatically call them and reconstruct the last cluster info.
|
Thanks for the answer @greensky00 ! |
You can register a callback function for hooking up a few events: NuRaft/include/libnuraft/context.hxx Line 58 in 972f02d
The event for becoming a leader is defined here: NuRaft/include/libnuraft/callback.hxx Line 53 in 972f02d
|
To register this callback I need the current context, right? As the context is created when the launcher.init function is called, how can I get the current context in order to set the callback? |
And now I realized that if someone uses Seems to me the API that setting the callback function should be exposed outside. Will fix that soon. Thanks. |
I wrote my own init function and is all good now! |
Hello, how can I make the cluster config persistent? For example, if I have 3 servers instances online that are already part a cluster and all of them get offline at the same time. There is a way to make them reconnect to the same cluster? The first one to reconnect become master, and the others followers?
To achieve that, the only thing I need to do is implement the in_memory state_mgr.hxx file to save to the disk instead of use memory?
The text was updated successfully, but these errors were encountered: