simo
simo

Reputation: 24568

What is Bucket in Riak? what its used for

What is bucket in Riak ? I tried to check documentation, but I was referred to buckets types, but could not grasp the concept of bucket in Riak.

Any explanation? what it is, and why its used?

Upvotes: 1

Views: 1109

Answers (2)

Amitesh Bharti
Amitesh Bharti

Reputation: 15713

Bucket : In certain respects, buckets can be compared to tables in relational databases or folders in filesystems

Bucket Types

  1. In Riak 2.0 its new feature
  2. Bucket types allow groups of buckets to share configuration details. This allows Riak users, and administrators, to manage bucket properties more efficiently than in the older configuration systems that were based on bucket properties

Lets dive little more :

The Using Bucket Types documentation covers the implementation, usage, and configuration of Bucket Types in great detail. Throughout the documentation there are code samples (e.g. Using Data Types) including code for creating the bucket types associated with each individual Riak Data Types.

Bucket types are a major improvement over the older system of bucket configuration. The ability to define a bucket configuration, and then change the configuration if necessary, for entire group of buckets, is a powerful new way to consider data modeling. In addition, bucket types are more reliable as buckets that have a given type (or configuration) only have their properties change when the type is changed. Previously, it was possible to change the properties of a bucket only through client requests.

In prior versions of Riak, bucket properties were altered by clients interacting with Riak…in contrast, bucket types are an operational concept. The riak-admin bucket-type interface enables Riak users to manage bucket configurations at an operational level, without recourse to the Riak clients.

In versions of Riak prior to 2.0, all queries were made to a bucket/key pair as in the following example:

curl http://localhost:8098/buckets/my_bucket/keys/my_key

Now in Riak 2.0 with the addition of bucket types, there is an additional namespace on top of buckets and keys. The same bucket name can be associated with completely different data if it is used in accordance with a different bucket type.

curl http://localhost:8098/types/type1/buckets/my_bucket/keys/my_key
curl http://localhost:8098/types/type2/buckets/my_bucket/keys/my_key

If a request is made to a bucket/key pair without a specified bucket type, default will be used in place of a bucket type. The following request are identical.

curl http://localhost:8098/buckets/my_bucket/keys/my_key
curl http://localhost:8098/types/default/my_bucket/keys/my_key

Upvotes: 0

Łukasz Rogalski
Łukasz Rogalski

Reputation: 23223

I don't think there is much more to it than "bucket is a grouping mechanism for data with some configuration assigned to it.

Quoting official docs (emphasis mine):

Buckets are used to define a virtual keyspace for storing Riak objects. They enable you to define non-default configurations over that keyspace concerning replication properties and other parameters.

In certain respects, buckets can be compared to tables in relational databases or folders in filesystems, respectively. From the standpoint of performance, buckets with default configurations are essentially “free,” while non-default configurations, defined using bucket types, will be gossiped around [the ring][glossary read rep] using Riak’s cluster metadata subsystem.

And from Bucket Types:

Buckets are essentially a flat namespace in Riak. They allow the same key name to exist in multiple buckets and enable you to apply configurations across keys.

Upvotes: 1

Related Questions