How to deactivate or delete a bucket type in Riak?

耗尽温柔 提交于 2019-12-09 17:21:35

问题


/home/khorkak> sudo riak-admin bucket-type
Usage: riak-admin bucket-type <command>

The follow commands can be used to manage bucket types for the cluster:

   list                           List all bucket types and their activation status
   status <type>                  Display the status and properties of a type
   activate <type>                Activate a type
   create <type> <json>           Create or modify a type before activation
   update <type> <json>           Update a type after activation
/home/khorkak>

Well I have a set of bucket types I created while trying some things out that I no longer want around - can I get rid of these without reinstalling Riak?


回答1:


Unfortunately there is no documented way within Riak currently to delete unused bucket types.

If you don't mind deleting all of the data in Riak you can stop Riak, delete the contents of the data directory, and then restart Riak. (If you have more than one node you will need to to stop each node and delete the data directory on each before restarting the nodes back up.)

If you only delete the data within Bitcask or LevelDB data directories the bucket type metadata will still exist in the ring.




回答2:


You can delete a single bucket in Riak by iterating over all the keys in the bucket (or just all keys) and issuing a delete operation for all the keys. This is prohibitively expensive for production use, and slow in general.

Depending on which back-end you are using, you can delete keys directly in the back-end instead. I have done this successfully with leveldb in a production system. This means that Riak has to be stopped, but that's usually not a problem since deletions can be done per node, so only one node has to be stopped at any time.

In our case, this was quite fast as well (compared to deleting keys one by one). It's not supported by Basho or official in any way, but we didn't have much choice. My contact info is available on my profile if you need more information.



来源:https://stackoverflow.com/questions/27567451/how-to-deactivate-or-delete-a-bucket-type-in-riak

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!