This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo "Data load start time: $(date +%s)" | |
for i in {1..100} | |
do | |
curl -XPOST http://localhost:8098/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:8098/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}}]}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module(custom_gen). | |
-export([key/1, | |
value/1, | |
key_from_arg/2, | |
value_from_arg/2 | |
]). | |
key(_Id) -> | |
fun() -> <<"custom_key">> end. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{mode, max}. | |
{duration, infinity}. | |
{concurrent, 50}. | |
{driver, basho_bench_driver_riakc_pb}. | |
{key_generator, {int_to_str, {partitioned_sequential_int, 1000000}}}. | |
{value_generator, {fixed_bin, 1024}}. | |
{operations, [{put, 1}]}. | |
{riakc_pb_ips, [{127,0,0,1}]}. | |
{riakc_pb_port, 8081}. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'github/markup' | |
require 'sinatra' | |
unless ARGV[0] && File.exists?(@@file = ARGV[0]) | |
puts "Please specify a file to preview\n" | |
exit! 1 | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Vagrant::Config.run do |config| | |
(1..1).each do |index| | |
config.vm.define "riak#{index}".to_sym do |cfg| | |
ip = "33.33.33.1#{index}" | |
cfg.vm.box_url = "http://files.vagrantup.com/lucid32.box" | |
cfg.vm.box = "lucid32" | |
cfg.vm.network(ip) | |
cfg.vm.forward_port("ssh", 22, "222#{index}".to_i) | |
cfg.vm.customize do |vm| | |
vm.name = "riak#{index}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find data/bitcask -size 0 -print0 | xargs -0 rm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from riak import RiakClient | |
from riak import RiakPbcTransport | |
ip = '127.0.0.1' | |
port = 8087 | |
def store_file(filename): | |
with open(filename, 'r') as f: | |
data = f.read() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{sys, [ | |
{lib_dirs, []}, | |
{rel, "mysample", "1", | |
[ | |
kernel, | |
stdlib, | |
sasl | |
]}, | |
{rel, "start_clean", "", | |
[ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// log the structure of the value passed to the function | |
precommitHook: function(value) { | |
ejsLog("log/js.log", value.toSource()); | |
return value; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Fun = fun(Nodes) -> | |
{ok, LocalRing} = riak_core_ring_manager:get_my_ring(), | |
LocalOwners = riak_core_ring:all_owners(LocalRing), | |
case (catch lists:foldl(fun(Node, _) -> | |
{ok, R} = rpc:call(Node, riak_core_ring_manager, get_my_ring, []), | |
true = riak_core_ring:all_owners(R) =:= LocalOwners | |
end, | |
true, | |
Nodes)) of | |
true -> true; |