Buckets and riak instances

Justin Sheehy justin at basho.com
Sun Oct 25 21:42:18 EDT 2009

Hi Tim,

On Sun, Oct 25, 2009 at 3:49 PM, Timothy Perrett
<timothy at getintheloop.eu> wrote:

> In the examples i've seen online, im not sure if a bucket semantically
> corresponds to a "table" or a "database" in RDBMS ways of thinking. I think
> its the former?

The closer analogy would be to a table, as a single running Riak
cluster can have any number of buckets, and the mere existence of a
bucket adds almost no overhead to the running system.

However, there is no perfect equivalence, since a bucket doesn't
(e.g.) inherently impose any schema or other constraints on the data
contained within.  Most people tend to use a separate bucket for each
form of document or object in their application just as you might use
a table, but you're not forced to do so.  You could put all of your
documents in one bucket if you chose, even if they had many different

A bucket really is just a namespace and the ability to set a few
parameters for all documents in that namespace:

n_val: the number of replicas of each document to be stored on separate nodes
allow_mult: whether or not to allow "sibling" objects
chash_keyfun: the hashing function that translates {Bucket,Key} into a
ring location
and a few tuning parameters that you probably don't want to touch

> If so, what is the best strategy for hosting multiple
> "databases" on a single cluster of machines? Would one need to create a
> whole bunch of separate Riak instances running on different ports?

Well, it depends on what you mean -- as I said, there is no precise
equivalent as Riak's clusters and buckets aren't quite the same as
your RDBMS's databases and tables.  However, Riak is fairly low
overhead, so it is easy to to as you say.  Just configure separate
riak.erlenv files with a different cookie, different nodenames,
storage locations, and so on.

> Sorry if these are n00b questions or i've missed the point somehow, but any
> advice would be most appreciated!

We love n00b questions, as they mean that more people are using Riak.



More information about the riak-users mailing list