/raftserver

A RPC Server implement base on Raft Paper in Golang

Primary LanguageGoApache License 2.0Apache-2.0

RaftServer: A RPC Server implement base on Raft Paper in Golang

GoDoc Build Status

What is Raft

Raft is a consensus algorithm that is designed to be easy to understand. It's equivalent to Paxos in fault-tolerance and performance. The difference is that it's decomposed into relatively independent subproblems, and it cleanly addresses all major pieces needed for practical systems. We hope Raft will make consensus available to a wider audience, and that this wider audience will be able to develop a variety of higher quality consensus-based systems than are available today. (quote from here)

Installation and Usage

Install

go get github.com/kkdai/raftserver

Usage

	//Start three raft servers
	srv1 := StartClusterServers("127.0.0.1:1230", 1, []string{"127.0.0.1:1231", "127.0.0.1:1232"})
	srv2 := StartClusterServers("127.0.0.1:1231", 2, []string{"127.0.0.1:1230", "127.0.0.1:1232"})
	srv3 := StartClusterServers("127.0.0.1:1232", 3, []string{"127.0.0.1:1231", "127.0.0.1:1230"})

	//Need sleep a while for leader election.
	time.Sleep(time.Second * 2)		
	

Inspired By

Project52

It is one of my project 52.

License

etcd is under the Apache 2.0 license. See the LICENSE file for details.