Using MapReduce with Counters

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Using MapReduce with Counters

João Machado
Hello,

Anyone tried to use MR with counters?

I'm trying with the following steps:

Increment the counter:

Confirm the actual value:
1

Execute mapreduce:
-> curl   -X POST -H "content-type: application/json" http://127.0.0.1:8098/mapred -d @map_red.js
{"error":"bad_utf8_character_code"}

Where the map_red.js is:

{
  "inputs":"BUCKET",
  "query":[
       {"map":{"language":"javascript","name":"Riak.mapValues"}}
       ,{"reduce":{"language":"javascript","name":"Riak.reduceSum"}}

]
}





[]'s


Ideais Tecnologia
João Machado[hidden email]Tel.: 55 21 3553 1301 R: 215Cel.: 55 21 8124 3531Site: www.ideais.com.br

_______________________________________________
riak-users mailing list
[hidden email]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
Reply | Threaded
Open this post in threaded view
|

Re: Using MapReduce with Counters

Sean Cribbs-2
Hi João,

You might want to try the steps shown in Sam Elliott's "cookbook": https://github.com/basho/riak_crdt_cookbook/blob/master/counters/README.md


On Fri, Aug 2, 2013 at 2:56 PM, João Machado <[hidden email]> wrote:
Hello,

Anyone tried to use MR with counters?

I'm trying with the following steps:

Increment the counter:

Confirm the actual value:
1

Execute mapreduce:
-> curl   -X POST -H "content-type: application/json" http://127.0.0.1:8098/mapred -d @map_red.js
{"error":"bad_utf8_character_code"}

Where the map_red.js is:

{
  "inputs":"BUCKET",
  "query":[
       {"map":{"language":"javascript","name":"Riak.mapValues"}}
       ,{"reduce":{"language":"javascript","name":"Riak.reduceSum"}}

]
}





[]'s


Ideais Tecnologia
João Machado[hidden email]Tel.: 55 21 3553 1301 R: 215Cel.: 55 21 8124 3531Site: www.ideais.com.br

_______________________________________________
riak-users mailing list
[hidden email]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com




--
Sean Cribbs <[hidden email]>
Software Engineer
Basho Technologies, Inc.

_______________________________________________
riak-users mailing list
[hidden email]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
Reply | Threaded
Open this post in threaded view
|

Re: Using MapReduce with Counters

João Machado
Hi Sean,

Thanks for your quick response. If I follow the steps from Sam, it works as expected. I tried the same steps but with my own bucket (and data) and it worked too. The difference between what I was trying and what Sam did was because I used JavaScript and Sam Erlang.

Is there any trick to use Javascript?


[]'s


Ideais Tecnologia
João Machado[hidden email]Tel.: 55 21 3553 1301 R: 215Cel.: 55 21 8124 3531Site: www.ideais.com.br


On Fri, Aug 2, 2013 at 5:09 PM, Sean Cribbs <[hidden email]> wrote:
Hi João,

You might want to try the steps shown in Sam Elliott's "cookbook": https://github.com/basho/riak_crdt_cookbook/blob/master/counters/README.md


On Fri, Aug 2, 2013 at 2:56 PM, João Machado <[hidden email]> wrote:
Hello,

Anyone tried to use MR with counters?

I'm trying with the following steps:

Increment the counter:

Confirm the actual value:
1

Execute mapreduce:
-> curl   -X POST -H "content-type: application/json" http://127.0.0.1:8098/mapred -d @map_red.js
{"error":"bad_utf8_character_code"}

Where the map_red.js is:

{
  "inputs":"BUCKET",
  "query":[
       {"map":{"language":"javascript","name":"Riak.mapValues"}}
       ,{"reduce":{"language":"javascript","name":"Riak.reduceSum"}}

]
}





[]'s


Ideais Tecnologia
João Machado[hidden email]Tel.: 55 <a href="tel:21%203553%201301" value="+12135531301" target="_blank">21 3553 1301 R: 215Cel.: 55 21 8124 3531Site: www.ideais.com.br

_______________________________________________
riak-users mailing list
[hidden email]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com




--
Sean Cribbs <[hidden email]>
Software Engineer
Basho Technologies, Inc.


_______________________________________________
riak-users mailing list
[hidden email]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
Reply | Threaded
Open this post in threaded view
|

Re: Using MapReduce with Counters

Russell Brown

On 2 Aug 2013, at 16:56, João Machado <[hidden email]> wrote:

> Hi Sean,
>
> Thanks for your quick response. If I follow the steps from Sam, it works as expected. I tried the same steps but with my own bucket (and data) and it worked too. The difference between what I was trying and what Sam did was because I used JavaScript and Sam Erlang.
>
> Is there any trick to use Javascript?
Hi João,

Not right now, sorry, the internal representation is a binary format stored in a regular riak_object, that requires the riak_kv_counter module to decode.

Russell

>
>
> []'s
>
>
>
> João Machado
> [hidden email]
> Tel.: 55 21 3553 1301 R: 215
> Cel.: 55 21 8124 3531
> Site: www.ideais.com.br
>
>
> On Fri, Aug 2, 2013 at 5:09 PM, Sean Cribbs <[hidden email]> wrote:
> Hi João,
>
> You might want to try the steps shown in Sam Elliott's "cookbook": https://github.com/basho/riak_crdt_cookbook/blob/master/counters/README.md
>
>
> On Fri, Aug 2, 2013 at 2:56 PM, João Machado <[hidden email]> wrote:
> Hello,
>
> Anyone tried to use MR with counters?
>
> I'm trying with the following steps:
>
> Increment the counter:
> -> curl -X POST http://localhost:8098/buckets/BUCKET/counters/MY_COUNTER -d 1
>
> Confirm the actual value:
> -> curl http://localhost:8098/buckets/BUCKET/counters/MY_COUNTER 
> 1
>
> Execute mapreduce:
> -> curl   -X POST -H "content-type: application/json" http://127.0.0.1:8098/mapred -d @map_red.js
> {"error":"bad_utf8_character_code"}
>
> Where the map_red.js is:
>
> {
>   "inputs":"BUCKET",
>   "query":[
>        {"map":{"language":"javascript","name":"Riak.mapValues"}}
>        ,{"reduce":{"language":"javascript","name":"Riak.reduceSum"}}
>
> ]
> }
>
>
>
>
>
> []'s
>
>
>
> João Machado
> [hidden email]
> Tel.: 55 21 3553 1301 R: 215
> Cel.: 55 21 8124 3531
> Site: www.ideais.com.br
>
> _______________________________________________
> riak-users mailing list
> [hidden email]
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>
>
>
>
> --
> Sean Cribbs <[hidden email]>
> Software Engineer
> Basho Technologies, Inc.
> http://basho.com/
>
> _______________________________________________
> riak-users mailing list
> [hidden email]
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com


_______________________________________________
riak-users mailing list
[hidden email]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com