1
+ ## <WARNING >
2
+ Rafter is not production ready. It hasn't been tested or run in any production environments.
3
+ Furthermore, the log is entirely my own creation. It's possible that it isn't as safe or efficient
4
+ as many other log structured backends like leveldb or rocksdb. The protocol is solid and
5
+ well tested, and it works as expected in most cases. However, support is not fully guaranteed as I
6
+ don't have a current use case for rafter and am not actively developing it. I will however do my
7
+ best to respond to reports and fix bugs in an efficient manner.
8
+
1
9
### Introduction
2
10
Rafter is more than just an erlang implementation of the [ raft consensus
3
11
protocol] ( https://ramcloud.stanford.edu/wiki/download/attachments/11370504/raft.pdf ) .
@@ -13,7 +21,7 @@ local setup and ```{Name, Node}``` tuples when using distributed erlang.
13
21
Configuration is dynamic and reconfiguration can be achieved without taking the
14
22
system down.
15
23
16
- #### Distributed consensus with a replicated log
24
+ #### Distributed consensus with a replicated log
17
25
For use cases such as implementing distributed databases, a replicated log can
18
26
be used internally to provide strong consistency. Operations are serialized and
19
27
written to log files in the same order on each node. Once the operation is
@@ -76,10 +84,10 @@ the following:
76
84
77
85
cd rafter
78
86
bin/start-node peerX
79
-
87
+
80
88
The above starts up an erlang VM with appropriate cookie and code path, and
81
89
starts a rafter peer utilizing the `` rafter_ets_backend `` . The node name, in
82
- this case PeerX (X=1|2|3), should be unique for each node.
90
+ this case PeerX (X=1|2|3), should be unique for each node.
83
91
84
92
These three nodes can now be operated on by the rafter client API. They all have
85
93
empty logs at this point and no configuration. Note that all operations on
@@ -92,7 +100,7 @@ they start out blank and the first entry in any log must be a configuration
92
100
entry which you set at initial cluster start time. Note that the operation will
93
101
fail with a timeout if a majority of nodes are not reachable. However, once
94
102
those peers become reachable, the command will be replicated and the cluster
95
- will be configured.
103
+ will be configured.
96
104
97
105
Go to the first erlang shell, where peer1 is running. We're just arbitrarily
98
106
choosing a node to be the first leader here. Ensure it is running with
@@ -133,8 +141,8 @@ don't need to use the fully qualified name when talking to it via the shell on
133
141
peer1.
134
142
135
143
``` erlang
136
- Peers = [{peer1 , 'peer1@127.0.0.1' },
137
- {peer2 , 'peer2@127.0.0.1' },
144
+ Peers = [{peer1 , 'peer1@127.0.0.1' },
145
+ {peer2 , 'peer2@127.0.0.1' },
138
146
{peer3 , 'peer3@127.0.0.1' }],
139
147
rafter :set_config (peer1 , Peers ).
140
148
```
@@ -148,7 +156,7 @@ ets backend is in use. It is anticipated that this API will grow to include
148
156
multi-key and potentially global transactions.
149
157
150
158
``` erlang
151
- % % Create a new ets table
159
+ % % Create a new ets table
152
160
rafter :op (peer1 , {new , sometable }).
153
161
154
162
% % Store an erlang term in that table
@@ -178,7 +186,7 @@ backend. The ets backend provides the following read operations.
178
186
```
179
187
180
188
### Show the current state of the log for a peer
181
-
189
+
182
190
rr(rafter_log),
183
191
sys:get_state(peer1_log).
184
192
@@ -196,11 +204,11 @@ Tests require [erlang quickcheck](http://quviq-licencer.com/trial.html) currentl
196
204
* start with snapshotting assuming data is ``` small ``` as described in
197
205
section 2 [ here] ( https://ramcloud.stanford.edu/wiki/download/attachments/12386595/compaction.pdf?version=1&modificationDate=1367123151531 )
198
206
* Client interface
199
- * Client Sequence number for idempotent counters?
207
+ * Client Sequence number for idempotent counters?
200
208
* Redis like text-based interface ?
201
209
* HTTP ?
202
210
* parallel eqc tests
203
- * Anti-Entropy
211
+ * Anti-Entropy
204
212
* Write AAE info into snapshot file during snapshotting
205
213
206
214
### License
0 commit comments