Using MapReduce with Counters

2013-08-02 Thread João Machado
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


[image: Ideais Tecnologia]
*João Machado*joao.mach...@ideais.com.brTel.: 55 21 3553 1301 R: 215Cel.:
55 21 8124 3531Site: www.ideais.com.br
___
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com


Re: Using MapReduce with Counters

2013-08-02 Thread 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


[image: Ideais Tecnologia]
*João Machado*joao.mach...@ideais.com.brTel.: 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  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 
> 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
>>
>>
>> [image: Ideais Tecnologia]
>> *João Machado*joao.mach...@ideais.com.brTel.: 55 21 3553 1301 R: 215Cel.:
>> 55 21 8124 3531Site: www.ideais.com.br
>>
>> ___
>> riak-users mailing list
>> riak-users@lists.basho.com
>> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>>
>>
>
>
> --
> Sean Cribbs 
> Software Engineer
> Basho Technologies, Inc.
> http://basho.com/
>
___
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com


Data Replica algortihm

2013-08-19 Thread João Machado
Hi all,

Anyone knows how the algorithm responsible for choosing where the data
replica is stored works?

Is possible to customise (or configure) it to ensure that the data will be
in different physical nodes (or even physical racks) like Cassandra does?



[]'s


[image: Ideais Tecnologia]
*João Machado*joao.mach...@ideais.com.brTel.: 55 21 3553 1301 R: 215Cel.:
55 21 8124 3531Site: www.ideais.com.br
___
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com