Search code examples
riak

How to change the storage backend of an existing bucket type in Riak?


I have a Riak server and have recently created and activated a new bucket type:

$ riak-admin bucket-type create sso_tokens
$ riak-admin bucket-type activate sso_tokens

Based on my default configuration, the storage backend was set to leveldb.

After that, I realised that I needed the buckets to be able to expire old keys. In other words, I needed to change the storage backend to be either bitcask or memory. I decided that bitcask would suit me best.

Now my question is: how can I change the storage backend for the existing sso_tokens bucket type? After reading the documentation, it's not clear that I can do that. I have found, though, how to set the storage backend when creating the bucket type (see command below).

$ riak-admin bucket-type create new_sso_tokens '{"props":{"backend":"bitcask"}}'

Thanks.


Solution

  • Void you cannot change the back end on just a single bucket type currently. If you want you can change the backend for the whole cluster if it is monolithic (i.e. all Bitcask or all LevelDB). It isn't currently something that is documented on http://docs.basho.com/riak/kv/ however the following Github issue for the docs describes one method for changing the backend:

    https://github.com/basho/basho_docs/issues/1605

    You can set the backend at the bucket type but only if you are using the multi-backend feature (as described here: http://docs.basho.com/riak/kv/2.2.0/setup/planning/backend/multi/) and you cannot change the bucket type this way once it has been set.

    You might be interested to know that Riak 2.2 added support for global expiry in LevelDB as documented here: http://docs.basho.com/riak/kv/latest/configuring/global-object-expiration/.