Skip to content
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

Dynamically changing user context #559

Open
as51340 opened this issue Dec 21, 2024 · 1 comment
Open

Dynamically changing user context #559

as51340 opened this issue Dec 21, 2024 · 1 comment

Comments

@as51340
Copy link

as51340 commented Dec 21, 2024

Hi,

I am using NuRaft within Kubernetes. Each of my servers get ClusterIP DNS entry which I use to start raft servers. Additionally to that, each of my servers need to be accessible from outside K8s cluster. Because of that, I wanted to make use of user_ctx. The hard part is that I will find out external IP of each server when I add it to the cluster. Is this a good use-case for user_ctx? Do you have some other recommendation for what I should use for storing a config related to each server. aux of srv_config seems to be immutable so I cannot use that. I also thought about adding my custom log in which additional information about each server would be written but not sure if this is a good pattern to have in custom logs written something that's very connected to cluster configuration.

Thanks for the help

@greensky00
Copy link
Contributor

srv_config::aux_ is actually mutable, similar to priority_, but currently there is no external interface to modify it once a server is added. The only way to modify it is removing and re-adding server with new aux_ context. I think this is not what you want.

You can use user_ctx for that (storing additional IP for each server) purpose; define your own data structure (like a map from server ID to each server's context), and serialize it to binary (string) and put it into user_ctx.

Please note that, even though there is an API to modify aux_ for each server, the outcome is the same as user_ctx_. The leader will replicate the new cluster config with either new aux_ or user_ctx_. So there is no need for concern.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants