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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raft client reference implementation #394

Open
inge4pres opened this issue Mar 14, 2020 · 5 comments
Open

Raft client reference implementation #394

inge4pres opened this issue Mar 14, 2020 · 5 comments

Comments

@inge4pres
Copy link

Hello 馃槃
This is kind of related to #128, I have been working on an implementation of a cluster using this library and I'm now facing a difficulty: there is nowhere an example or an explanation of how to connect remotely to a cluster (either to the Leader or Follower) and send commands to it.
It should be possible, since the cluster members are talking to each other with Transport, but it's not so immediate to build.
Would it be ok to have an RPCClient reference implementation or some documentation on how to connect and send commands to a running Raft cluster?
I dug up a bit into Consul codebase ad could not really find it...
Thank you

@xuyang2
Copy link

xuyang2 commented Mar 24, 2020

@inge4pres It seems rqlite is using HTTP and HTTP redirection (to forward its requests to the leader)

@inge4pres
Copy link
Author

inge4pres commented Mar 24, 2020

Hello @xuyang2 thanks for the references 馃槃
I have implemented something similar with gRPC instead of HTTP; I'd rather avoid this in favour of connecting directly to the RPC service exposed by the raft nodes.
My take is: if nodes are communicating via a custom RPC protocol (which I think is briefly detailed in net_transport.go#L43), what do I need to have this same logic used by a client that wants to send some data to raft cluster? I'd probably need to call AppendEntries in the client to send some data to it?

If yes it would be great to have a reference implementation that can be used as part of the library here to build not only the server but also the client.

@stale
Copy link

stale bot commented May 23, 2020

Hey there,
We wanted to check in on this request since it has been inactive for at least 90 days.
Have you reviewed the latest godocs?
If you think this is still an important issue in the latest version of the Raft library or
its documentation please feel let us know and we'll keep it open for investigation.
If there is still no activity on this request in 30 days, we will go ahead and close it.
Thank you!

@stale stale bot added the waiting-reply label May 23, 2020
@inge4pres inge4pres changed the title Example of how to use a client after a Raft cluster is setup Raft client reference implementation May 23, 2020
@stale stale bot removed the waiting-reply label May 23, 2020
@inge4pres
Copy link
Author

This is still valid IMO, checked the docs and still no sign of the reference implementation

@Jille
Copy link
Contributor

Jille commented Sep 9, 2020

I'd probably need to call AppendEntries in the client to send some data to it?

That is an internal method and having clients call it is going to break your cluster.

I wrote some example code: https://github.com/Jille/raft-grpc-example - it includes a server and client.

It uses https://github.com/Jille/raft-grpc-leader-rpc to allow you to easily send RPCs to your leader. Clients connect to all Raft nodes and use health checks to figure out who the leader is. Add in some retries and you don't have to think about it anymore :)

Jille added a commit to Jille/raft that referenced this issue Sep 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants