Website • Google Group • Javadoc • Atomix
Copycat is a feature complete, fully asynchronous implementation of the Raft consensus algorithm in Java 8 designed for use in Atomix. The implementation provides a fully featured client and server and includes:
- Pre-vote election protocol (§4.2.3)
- Session-based linearizable writes (§6.3)
- Lease-based reads from leaders (§6.4.1)
- Serializable reads from followers (§6.4.1)
- Session-based state machine events (§6.3)
- Membership changes (§4.3)
- Log compaction via cleaning (§5.3)
Additionally, this implementation has undergone Jepsen testing to verify it maintains linearizability in a number of different failure scenarios.
For more information on the Raft implementation itself, see Raft internals
Additionally, the Atomix project contains a multitude of examples of Copycat state machines, including collections, leader elections, locks, group membership, and more.
Copycat consists of two separate projects: the Copycat client and server. The server is a standalone Raft server implementation through which users can define and manage arbitrary replicated state machines, and the client is a Raft client designed specifically to interact with the Copycat server to maintain strong consistency constraints.
A snapshot of Copycat is deployed on every push to the master
branch. There is no official release of Copycat in
Maven Central yet, but there will in the coming weeks. In the meantime:
To add the Copycat server to your project, add a dependency on the copycat-server
project:
<dependency>
<groupId>io.atomix.copycat</groupId>
<artifactId>copycat-server</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
Similarly, to add the Copycat client to your project, add a dependency on the copycat-client
project:
<dependency>
<groupId>io.atomix.copycat</groupId>
<artifactId>copycat-client</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
Alternatively, you can build the Jars using Maven:
git clone --branch master git@github.com:atomix/copycat.git
cd copycat
mvn install
For documentation on how to use the Raft client and server, please visit the website.