Skip to content

Instantly share code, notes, and snippets.

@binarytemple
Forked from dreverri/gist:1597401
Last active August 29, 2015 14:07
Show Gist options
  • Select an option

  • Save binarytemple/4ddbe49aed4902dc6382 to your computer and use it in GitHub Desktop.

Select an option

Save binarytemple/4ddbe49aed4902dc6382 to your computer and use it in GitHub Desktop.
echo "Data load start time: $(date +%s)"
for i in {1..100}
do
curl -XPOST http://localhost:10018/riak/some_bucket -d "$RANDOM" -H "X-Riak-Index-Timestamp_int: $(date +%s)" -H "Content-Type: text/plain"
sleep 0.5
done
echo "Data load end time: $(date +%s)"
echo "Running MapReduce"
curl -XPOST http://localhost:10018/mapred -H "Content-Type: application/json" -d '
{"inputs":{"bucket":"some_bucket","index":"Timestamp_int", "start":"$(($(date +%s) - 10))",
"end":"$(date +%s)"},
"query":[
{"map":{"language":"erlang","module":"riak_kv_mapreduce","function":"map_object_value","keep":false}},
{"reduce":{"language":"erlang","module":"riak_kv_mapreduce","function":"reduce_string_to_integer","keep":false}},
{"reduce":{"language":"erlang","module":"riak_kv_mapreduce","function":"reduce_sum","keep":true}}]}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment