Raft
A Clojure library that implements the Raft distributed consensus algorithm.
Install / Use
/learn @saebyn/RaftREADME
raft-clj
A Clojure library that implements the Raft consensus algorithm.
See In Search of an Understandable Consensus Algorithm [PDF] by Diego Ongaro and John Ousterhout for more information.
This is a work in progress.
It doesn't work yet. I'm happy to review pull requests and I am likely to accept those with passing tests and that have some style.
See doc/intro.md for some additional notes.
TODO
-
For demo
-
Add send command command
-
Add cluster config commands (add/remove nodes)
-
-
Implement configuration change mechanism (major missing capability)
-
More/better documentation
-
Use tools.trace rather than the ugly things I'm doing now in various places to log out what's happening (but still using tools.logging for output).
-
Refactor raft.leader and raft.log functions
-
Poorly documented
-
Overly long
-
Usage
Requires Leiningen.
You can run the demo with Leiningen:
$ lein run start
You can run the demo with multiple nodes:
$ lein run -- start -A tcp://localhost:2104 -X tcp://localhost:2105 tcp://localhost:2106 tcp://localhost:2108
$ lein run -- start -A tcp://localhost:2106 -X tcp://localhost:2107 tcp://localhost:2104 tcp://localhost:2108
$ lein run -- start -A tcp://localhost:2108 -X tcp://localhost:2109 tcp://localhost:2104 tcp://localhost:2106
You can send an :is-leader command to a node:
First start two nodes:
$ lein run -- start -A tcp://localhost:2104 -X tcp://localhost:2105 tcp://localhost:2106
$ lein run -- start -A tcp://localhost:2106 -X tcp://localhost:2107 tcp://localhost:2104
Then send the command:
$ lein run -- send tcp://localhost:2104 :is-leader
(Coming soon) You can send other commands to a node:
$ lein run -- send tcp://localhost:2105 my_command
You can see some information about command-line arguments:
$ lein run -- --help
You can run the test suite using Leiningen:
$ lein midje
License
Copyright © 2013-2014 John Weaver
Distributed under the Eclipse Public License, the same as Clojure.
Related Skills
node-connect
342.5kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
85.3kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
342.5kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
342.5kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
