raft
by
hashicorp

Description: Golang implementation of the Raft consensus protocol

View on GitHub ↗

Summary Information

Updated 2 hours ago
Added to GitGenius on April 8th, 2021
Created on November 5th, 2013
Open Issues & Pull Requests: 47 (+0)
Number of forks: 1,074
Total Stargazers: 9,052 (+0)
Total Subscribers: 395 (+0)

Issue Activity (beta)

Open issues: 19
New in 7 days: 0
Closed in 7 days: 0
Avg open age: 757 days
Stale 30+ days: 19
Stale 90+ days: 13

Recent activity

Opened in 7 days: 0
Closed in 7 days: 0
Comments in 7 days: 0
Events in 7 days: 0

Top labels

  • enhancement (5)
  • bug (3)
  • docs (1)
  • flaky-test (1)

Most active issues this week

No issue events were indexed in the last 7 days.

Repository Insights (GitGenius)

Median issue/PR response: 6.4 hours
Mean response time: 89.5 days
90th percentile: 366.2 days
Tracked items: 35

Most active contributors

Detailed Description

The hashicorp/raft repository is a Go library that implements the Raft consensus algorithm, enabling the management of replicated logs and replicated state machines across distributed systems. The library provides the core infrastructure needed to build consistent, partition-tolerant systems with fault tolerance capabilities, making it suitable for applications requiring consensus across multiple nodes.

At its core, raft manages a replicated log that can be paired with a finite state machine to maintain replicated state across a cluster. The implementation is based on the academic paper "Raft: In Search of an Understandable Consensus Algorithm" and provides mechanisms for leader election, log replication, and state machine application. The library abstracts away the complexity of the Raft protocol, allowing developers to focus on implementing their application-specific finite state machine logic through a provided interface.

The Raft protocol implementation in this library operates through three node states: follower, candidate, and leader. Nodes begin as followers and can be promoted to candidates if they do not receive log entries within a timeout period. Candidates request votes from peers, and upon receiving a quorum of votes, are promoted to leaders. Leaders accept new log entries from clients, replicate them to followers, and apply committed entries to the state machine. The library handles automatic log compaction through snapshotting to prevent unbounded disk usage and minimize log replay time.

The repository supports dynamic peer set updates, allowing clusters to add or remove nodes as long as a quorum remains available. The library recommends running either three or five Raft servers to balance availability and performance, with three-node clusters tolerating one failure and five-node clusters tolerating two failures. Performance characteristics are comparable to Paxos, with committed log entries requiring a single round trip to half the cluster under stable leadership.

Storage flexibility is provided through separate backend implementations. The primary MDBStore backend is maintained in the raft-mdb repository to avoid cgo complications, while a pure Go alternative using Bbolt is available in raft-boltdb. Both can serve as LogStore and StableStore implementations.

The library requires Go version 1.16 or later for building. It is licensed under the Mozilla Public License 2.0 and maintains tagged releases to indicate major version updates. Version 0.1.0 represents the original stable release used by Consul prior to version 0.7.0, while version 1.0.0 introduced breaking API changes including UUID-based server identity management, protocol versioning, non-voting server support, and improved snapshot resilience.

According to GitGenius activity tracking, the repository shows a median issue and pull request response latency of 6.4 hours across 35 tracked items, indicating active maintenance. The most frequently addressed issue categories are enhancements, bugs, and flaky tests. Primary contributors tracked by GitGenius include otoolep with 32 events, tgross with 31 events, and banks with 24 events. The repository shares contributors with hashicorp/nomad, influxdata/influxdb, and kubeedge/kubeedge, indicating its use across multiple significant distributed systems projects.

The library supports metrics emission through configurable build tags, allowing integration with either armon/go-metrics or hashicorp/go-metrics. The armon/go-metrics backend is officially deprecated in favor of hashicorp/go-metrics, with migration guidance provided for applications transitioning between the two metrics libraries.

raft
by
hashicorphashicorp/raft

Repository Details

Fetching additional details & charts...