####Nodes
# Cluster1, Node1
10.224.13.24
# Cluster1, Node2
10.249.9.198
# Cluster2, Node1
10.224.8.208
basho-ninja:damp dkerrigan$ gradle clean run_local | |
No overrides found | |
:server:clean | |
:server:bootstrap:clean | |
:server:core:clean | |
:server:endpoint:clean | |
:server:persist:clean | |
:server:router:clean | |
:server:service:clean | |
:server:endpoint:rest:clean |
####Nodes
# Cluster1, Node1
10.224.13.24
# Cluster1, Node2
10.249.9.198
# Cluster2, Node1
10.224.8.208
var cluster = require('cluster'); | |
var riak = require('nodiak').getClient('http', 'localhost', 9098); | |
var numObjects = 1000; | |
if (cluster.isMaster) { | |
var worker = cluster.fork(); | |
} else { | |
for(var i = 0; i <= numObjects; i++) { | |
var robj = riak.bucket("test_bucket").object.new(null, {message: "hello, this is a test"}); | |
robj.addToIndex("someindex", "something_" + i); |
require 'bundler/setup' | |
require('riak') | |
require('riak_crdts') | |
require('./riak_hosts') | |
require('./models/zombie') | |
def load_data(filename) | |
logname = "load_progress.txt" | |
client = RiakHosts.new.get_riak_connection | |
zip3 = RiakCrdts::InvertedIndex.new(client, 'zip3_inv') |
def add_index(index, value) | |
@robject.indexes[index] << value | |
end |
get '/query/zip3/:zip' do | |
zip = params[:zip] | |
zip3 = zip[0, 3] | |
zips = zip3_idx.get_index(zip3) | |
results = zips.members.to_a | |
if zip.length > 3 | |
results = results.select { |item| item.start_with? zip } |
def fetch_with_pagination(keys, start = 1, count = 50) | |
zombies = [] | |
keys = [] unless keys | |
result_count = 1 | |
keys.each_with_index do |zombie_key, i| | |
break if result_count > count | |
next if (i + 1) < start | |
data = @client['zombies'].get(zombie_key).data |
gimme_a_client_from(Context) when Context#ctx.client == undefined -> | |
{ok, Client} = riakc_pb_socket:start_link(?RIAK_NAME, ?RIAK_PB_PORT)}, | |
Context#ctx{client = Client}; | |
gimme_a_client_from(Context) -> Context. |
Download and build
wget https://github.com/basho/riak/archive/riak-2.0.0pre2.tar.gz
tar -zxvf riak-2.0.0pre2.tar.gz
cd riak-riak-2.0.0pre2
make rel
cd rel/riak
####Converts JSON of the format
[
{
"target": "target1",
"datapoints": [
[val1,timestamp1],
...
[valN,timestampN]]