English 中文(简体)
采用何种优化方法,将钥匙算成一桶?
原标题:What is the optimised way to get a count of keys in a riak bucket?

我有一个配备3台服务器的里亚克组。 我可以看一下借方设法确定这一组群目前使用多少磁盘空间,但我也想确定该组目前储存的物品有多少。

正在使用该组储存图像,这意味着双轨数据正用一套桶中的钥匙储存。 我试图利用地图来减少对吉大港山区交界的功能,以便把布塔中的物品数目退回,尽管这些物品已经过时。

从特定桶中抽取关键数的最佳方式是什么?

最佳回答

在Rik集群上用桶标出的钥匙数,即便是利用“地图”功能,也并非非常有效。

我发现,从数量上看,最有效的方法是通过滚动的APIC来使客户受益。 下面的事例是利用 no子这样做。

第一安装Ariak-js客户

npm install riak-js@latest

然后,在指挥线上排下以下一段话,以给你计票。

node -e "require( riak-js ).getClient({ host:  hostname , port: 8098 }).count( bucket );"
问题回答

Here is what worked for me - put it into console, no further installs:

curl -XPOST http://localhost:8098/mapred -H  Content-Type: application/json  -d  
{"inputs":"THE_BUKET",
 "query":[{"map":{"language":"javascript",
                  "keep":false,
                  "source":"function(riakobj) {return [1]; }"}},
          {"reduce":{"language":"javascript",
                     "keep":true,
                     "name":"Riak.reduceSum"}}]} 

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://docs.basho.com/riak/latest/dev/using/2i/

第2款 “Co”

$ curl -XPOST http://localhost:8098/mapred
  -H  Content-Type: application/json 
  -d  {"inputs":{
           "bucket":"mybucket",
           "index":"$bucket",
           "key":"mybucket"
       },
       "query":[{"reduce":{"language":"erlang",
                           "module":"riak_kv_mapreduce",
                           "function":"reduce_count_inputs",
                           "arg":{"reduce_phase_batch_size":1000}
                          }
               }]
       } 
EOF

减少指数比预测数据要好





相关问题
Error in Hadoop MapReduce

When I run a mapreduce program using Hadoop, I get the following error. 10/01/18 10:52:48 INFO mapred.JobClient: Task Id : attempt_201001181020_0002_m_000014_0, Status : FAILED java.io.IOException:...

Error in using Hadoop MapReduce in Eclipse

When I executed a MapReduce program in Eclipse using Hadoop, I got the below error. It has to be some change in path, but I m not able to figure it out. Any idea? 16:35:39 INFO mapred.JobClient: Task ...

Is MapReduce right for me?

I am working on a project that deals with analyzing a very large amount of data, so I discovered MapReduce fairly recently, and before i dive any further into it, i would like to make sure my ...

Hadoop or Hadoop Streaming for MapReduce on AWS

I m about to start a mapreduce project which will run on AWS and I am presented with a choice, to either use Java or C++. I understand that writing the project in Java would make more functionality ...

What default reducers are available in Elastic MapReduce?

I hope I m asking this in the right way. I m learning my way around Elastic MapReduce and I ve seen numerous references to the "Aggregate" reducer that can be used with "Streaming" job flows. In ...

Displaying access log analysis

I m doing some work to analyse the access logs from a Catalyst web application. The data is from the load balancers in front of the web farm and totals about 35Gb per day. It s stored in a Hadoop HDFS ...

热门标签