获取 riak 存储桶中密钥计数的优化方法是什么?
我有一个包含 3 台服务器的 riak 集群。我可以查看 bitcask 来确定该集群当前使用了多少磁盘空间,但我还想了解集群中当前存储了多少项目。
该集群用于存储图像,这意味着二进制数据是根据一组存储桶中的键存储的。我尝试对 HTTP 接口使用映射归约函数,以返回存储桶中的项目数,但它们已超时。
从特定存储桶中获取键数量的最时间优化方法是什么?
I have a riak cluster set up with 3 servers. I can look at the bitcask to establish how much disk space this cluster is currently using but I'd also like to find out how many items are currently being stored in the cluster.
The cluster is being used to store images, meaning that binary data is being stored against a key in a set of buckets. I have tried to use map reduce functions against the HTTP interface in order to return the number of items in the bucket however they have timed out.
What is the most time optimised way to get the count of the number of keys from a specific bucket?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
即使使用 MapReduce 函数,计算 Riak 集群上存储桶中键的数量也不是很有效。
我发现计算项目数量的最有效方法是通过流 API 在客户端上进行计算。以下示例使用 Node-js 来执行此操作。
首先安装 riak-js 客户端,
然后在命令行上运行以下命令以获取计数。
Counting the number of keys in a bucket on the Riak cluster is not very efficient, even with the use of the MapReduce functions.
The most efficient way I have found to count the number of items is to do it on the client through the streaming API. The following example uses node-js to do this.
First install the riak-js client
Then run the following on the command line to give you your count.
这对我有用 - 将其放入控制台,无需进一步安装:
Here is what worked for me - put it into console, no further installs:
features.basho.com 上也有一个开放请求,以使这变得更容易(因为,正如 bennettweb 指出的那样,这不是最简单的任务)。
http://features.basho.com/entries/20721603 -高效计数桶中的密钥
鼓励点赞、评论等。
标记
There is also a open request on features.basho.com to make this easier (because, as bennettweb pointed out, it's not the most straightforward task).
http://features.basho.com/entries/20721603-efficiently-count-keys-in-a-bucket
Upvotes, comments, etc., are encouraged.
Mark
http://docs.basho.com/riak/latest/dev/using/ 2i/
段落“通过$bucket Index对Bucket对象进行计数”
reduce索引优于mapreduce数据
http://docs.basho.com/riak/latest/dev/using/2i/
paragraph "Count Bucket Objects via $bucket Index"
reduce index is better than mapreduce data