Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

A simple explanation of Rings in Riak?

Tags:

erlang

riak

I'm trying to understand what the "rings" in Riak are, but I can't seem to find a clear explanation (please don't just link me to a web site, I have already read what is on the web). As far as I understand a node in Riak is a partition in a ring. Is that correct?

like image 660
yazz.com Avatar asked Feb 09 '10 15:02

yazz.com


People also ask

Are responsible for claiming a partition in the Riak ring?

Vnodes, or “virtual nodes,” are responsible for claiming a partition in the Riak Ring, and they coordinate requests for these partitions.

What is a Riak cluster?

Riak's default mode of operation is to work as a cluster consisting of multiple nodes, i.e. multiple well-connected data hosts. Each host in the cluster runs a single instance of Riak, referred to as a Riak node.

What is the default number of partitions in a Riak cluster?

The default number of partitions in a Riak cluster is 64.


1 Answers

I know you've said you read everything on the web already, but for others also reading this question, I'd like to post two resources that discuss Riak's "ring":

http://riak.basho.com/arch.html

http://riak.basho.com/edoc/architecture.txt

With that out of the way, Riak uses the word "ring" in two places. The first is to describe the hash space that is used for determining where to store data. The reason Riak calls that space a ring is that the last value in the space (2^160-1) is thought of as being adjacent to the first value in the space (0). Replicas of data are stored in the "next N partitions" of the hash space, following the partition to which the key hashes. Considering the hash space as a ring gives a convenient definition for the "next parition after the final partition."

The other use of the word "ring" is related to, but not exactly the same as the former. I mentioned partitions: each node claims several segments of the hash space, called partitions. Knowledge about which node has claimed which partition is stored in a structure that Riak calls the "ring state", or sometimes just the "ring." Other cluster metadata may also be kept in the ring state, because it's a conveniently shared piece of data throughout the cluster.

In general usage, an application shouldn't need to think about the ring much.

Does that answer your question? I'd encourage you to post questions like this to the riak-users mailing list ( http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com ). I'm sure other members of that list are interested in these answers, and we (the Riak developers) tend to be more attentive to that feed than this one.

like image 138
Bryan Avatar answered Sep 19 '22 13:09

Bryan