This works, simple fold left string accumulator
5: lists:foldl(fun(_X, Count) ->
lists:append(Count, _X)
end,
"",
["ac","cu","m","ul","at","e"])
-> "accumulate"
This works, simple fold left string accumulator
5: lists:foldl(fun(_X, Count) ->
lists:append(Count, _X)
end,
"",
["ac","cu","m","ul","at","e"])
-> "accumulate"
| List all buckets to a file | |
| ``` | |
| file:write_file("/tmp/buckets.txt", | |
| io_lib:format("~p.~n", [ | |
| [ riak_core_bucket:get_bucket(X) || X <- [riak_core_ring:get_buckets(element(2,riak_core_ring_manager:get_my_ring()))] ] | |
| ]) | |
| ). |
17> io_lib:write("1").
[91,["49"],93]
18>
18>
18> io_lib:write("1") ++ io_lib:write(2).
[91,["49"],93,50]
19> io_lib:write("1") ++ io_lib:write(2) ++ "".
[91,["49"],93,50]
| 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 ' |
(dev1@127.0.0.1)45> lists:foldl(fun(A,B)-> Ret = A + B, io:format("intermediate=~p~n",[Ret]),Ret end, 0, [1,2,3]).
intermediate=1
intermediate=3
intermediate=6
6
(dev1@127.0.0.1)46> lists:foldr(fun(A,B)-> Ret = A + B, io:format("intermediate=~p~n",[Ret]),Ret end, 0, [1,2,3]).
| storage_backend = multi | |
| multi_backend.bitcask_multi.storage_backend = bitcask | |
| multi_backend.bitcask_multi.bitcask.data_root = "./data/bitcask_multi" | |
| multi_backend.leveldb_multi.storage_backend = leveldb | |
| multi_backend.leveldb_multi.leveldb.data_root = "./data/leveldb_multi" | |
| multi_backend.default = bitcask_multi |
dev/dev3/bin/riak-admin cluster join dev1@127.0.0.1
dev/dev2/bin/riak-admin cluster join dev3@127.0.0.1
dev/dev1/bin/riak-admin cluster join dev2@127.0.0.1
dev/dev1/bin/riak-admin cluster join dev3@127.0.0.1
dev/dev3/bin/riak-admin cluster join dev2@127.0.0.1
dev/dev3/bin/riak-admin cluster plan
dev/dev3/bin/riak-admin cluster commit
dev/dev4/bin/riak-admin cluster join dev5@127.0.0.1
dev/dev6/bin/riak-admin cluster join dev4@127.0.0.1
sudo yum install R
./basho_bench ./examples/riakc_pb.devrel.config
sudo make results
sudo make results
ec2-metadata | grep public-hostname
| import scala.concurrent.duration._ | |
| import scala.concurrent.ExecutionContext | |
| import scala.concurrent.Future | |
| import akka.pattern.after | |
| import akka.actor.Scheduler | |
| /** | |
| * Given an operation that produces a T, returns a Future containing the result of T, unless an exception is thrown, | |
| * in which case the operation will be retried after _delay_ time, if there are more possible retries, which is configured through | |
| * the _retries_ parameter. If the operation does not succeed and there is no retries left, the resulting Future will contain the last failure. |