Open source Java implementation for Raft consensus protocol.

What is Apache Ratis™?

Apache Ratis is a highly customizable Raft protocol implementation in Java.

Raft is a easily understandable consensus algorithm to manage replicated state.

Apache Ratis could be used in any Java application where state should be replicated between multiple instances.

Features

Pluggable transport

Ratis provides a pluggable transport layer. By default gRPC, Netty+Protobuf and Apache Hadoop RPC based transports are provided.

Pluggable state machine

Ratis supports a log and state machine. State machine typically contains the data that you want to make highly available. Ratis makes it easy to use your own state machine.

Pluggable raft log

RAFT log is also pluggable, users can provide their own log implementation. The default implementation stores log in local files.

Application can define the policies of how to write data and where it should be written easily.

Pluggable metrics

Ratis provides a pluggable observation layer. By default (ratis-metrics-default), it uses the shaded Dropwizard 4 provided by ratis-thirdparty. Another implementation can be found in ratis-metrics-dropwizard3. Users can provide their own metrics implementations.

Log Service

Ratis provides a log service recipe provides StateMachines to implement a distributed log service with a focused client API. For more information, please read the LogService documentation.

Latest news

Posts 2024 Jan 9

Getting started

Ratis is a Raft protocol library in Java. It’s not a standalone server application like Zookeeper or Consul.

Examples

To demonstrate how to use Ratis from the code, Please look at the following examples.

  • Arithmetic example: This is a simple distributed calculator that replicates the values defined and allows user to perform arithmetic operations on these replicated values.

  • FileStore example: This is an example of using Ratis for reading and writing files.

The source code of the examples could be found in the ratis-examples sub-project.

Maven usage

To use in our project you can access the latest binaries from maven central:

<dependency>
   <artifactId>ratis-server</artifactId>
   <groupId>org.apache.ratis</groupId>
</dependency>

You also need to include one of the transports:

<dependency>
   <artifactId>ratis-grpc</artifactId>
   <groupId>org.apache.ratis</groupId>
</dependency>
 <dependency>
   <artifactId>ratis-netty</artifactId>
   <groupId>org.apache.ratis</groupId>
</dependency>
<dependency>
   <artifactId>ratis-hadoop</artifactId>
   <groupId>org.apache.ratis</groupId>
</dependency>

Please note that Apache Hadoop dependencies are shaded, so it’s safe to use hadoop transport with different versions of Hadoop.

Community

Mailing list

Developers

If you’d like to contribute to Apache Ratis, please subscribe to the Ratis developer mailing list.

The Ratis developer mailing list is: dev@ratis.apache.org.

User

The user@ mailing list is the preferred mailing list for end-user questions and discussion.

Please use dev mailing list to address developers on a specific technical question.

The Ratis user mailing list is: user@ratis.apache.org.

To post to the list, it is necessary to subscribe to it.

Commits

If you’d like to see changes made in the Ratis version control system, please subscribe to the Ratis commits mailing list.

The Ratis commits mailing list is: commits@ratis.apache.org.

Issues

If you’d like to see changes made in the Ratis issue tracking system, please subscribe to the Ratis issues mailing list.

The Ratis issues mailing list is: issues@ratis.apache.org.

Slack

You can join the #ratis channel in Apache slack workspace http://s.apache.org/slack-invite for any discussions.

JIRA Issue Tracker

The JIRA issue tracker for Ratis is at https://issues.apache.org/jira/projects/RATIS/ .

Source

Source code is part of every release, you can download the source bundles from download section and build the project according to the included instructions.

The versioned source code history is available from the Apache git repository or from the github mirror. It is only for development and not intended for use by the general public. Only the source code from the released artifacts are checked by the Project Management Committee.

Resources

Are you interested in learning more about Apache Ratis? Excellent! Here are some resources.