Skip to content

Instantly share code, notes, and snippets.

View bsparrow435's full-sized avatar

Brian Sparrow bsparrow435

View GitHub Profile
@bsparrow435
bsparrow435 / gist:3493647
Created August 28, 2012 00:11
Clone a cluster

#How To: Clone A Cluster

##Summary This gist will walk through the procedure of altering a secondary cluster using the ring configuration of a primary cluster. This configuration allows partitions to be transferred between clusters using any file transfer utility.

##Restrictions

  1. Supported Riak Versions: 1.2

  2. Both clusters must have same ring size and node count.

@bsparrow435
bsparrow435 / gist:3493730
Created August 28, 2012 00:20
Clone a cluster

#How To: Clone A Cluster

##Summary This gist will walk through the procedure of altering a secondary cluster using the ring configuration of a primary cluster. This configuration allows partitions to be transferred between clusters using any file transfer utility.

##Restrictions

  1. Supported Riak Versions: 1.2

  2. Both clusters must have same ring size and node count.

`2012-08-24 00:24:20.747 [error] emulator Error in process <0.24573.185> on node 'riak@10.1.46.45' with exit value: {badarg,[{erlang,binary_to_term,[<<30438 bytes>>],[]},{mi_segment,iterate_all_bytes,2,[{file,"src/mi_segment.erl"},{line,164}]},{mi_server,'-group_iterator/2-fun-1-',2,[{file,"src/mi_server.erl"},{line,723}]},{mi_server,'-group_iterator/2-fun-0-'...

2012-08-24 00:24:20.747 [error] <0.1057.0>@mi_scheduler:worker_loop:141 Failed to compact <0.4184.0>: {badarg,[{erlang,binary_to_term,[<<131,109,0,0,246,224,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,



2012-08-24 00:24:20.747 [error] emulator Error in process <0.24573.185> on node 'riak@10.1.46.45' with exit value: {badarg,[{erlang,binary_to_term,[<<30438 bytes>>],[]},{mi_segment,iterate_all_bytes,2,[{file,"src/mi_segment.erl"},{line,164}]},{mi_server,'-group_iterator/2-fun-1-',2,[{file,"src/mi_server.erl"},{line,723}]},{mi_server,'-group_iterator/2-fun-0-'... 


2012-08-24 00:24:20.747 [error] <0.1057.0>@mi_scheduler:worker_loop:141 Failed to compact <0.4184.0>: {badarg,[{erlang,binary_to_term,[<<131,109,0,0,246,224,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,6
```
2012-08-30 22:04:01.135 [info] <0.22219.0>@riak_core_handoff_sender:start_fold:126 Starting ownership_handoff transfer of riak_kv_vnode from 'kvs@d-kvs-01.tradecard.com' 11417981541647679048466287755595961091061972992 to 'kvs@d-kvs-03.tradecard.com' 11417981541647679048466287755595961091061972992
2012-08-30 22:04:03.658 [info] <0.198.0>@riak_core_handoff_manager:handle_info:271 An outbound handoff of partition riak_kv_vnode 0 was terminated for reason: {shutdown,max_concurrency}
2012-08-30 22:04:10.079 [info] <0.22254.0>@riak_core_handoff_sender:start_fold:126 Starting ownership_handoff transfer of riak_kv_vnode from 'kvs@d-kvs-01.tradecard.com' 0 to 'kvs@d-kvs-02.tradecard.com' 0
2012-08-30 22:04:32.449 [error] <0.1729.0> gen_fsm <0.1729.0> in state active terminated with reason: {timeout,{gen_server,call,[riak_core_handoff_manager,{add_outbound,riak_kv_vnode,11417981541647679048466287755595961091061972992,'kvs@d-kvs-03.tradecard.com',<0.1729.0>}]}}
2012-08-30 22:04:36.755 [error] <0.1729.0> CRASH REPORT
[root@d-kvs-01 riak]# riak version 
Attempting to restart script through sudo -H -u riak 
riak-ee (1.2.0-92bc3fa0 2012-08-27) RedHat x86_64 
[root@d-kvs-01 ~]# riak-admin cluster leave 
Attempting to restart script through sudo -H -u riak 
Success: staged leave request for 'kvs@d-kvs-01.tradecard.com' 
[root@d-kvs-01 ~]# riak-admin cluster plan 
Attempting to restart script through sudo -H -u riak 
=============================== Staged Changes ================================ 
@bsparrow435
bsparrow435 / gist:3558713
Created August 31, 2012 20:42
Configuration Tweaks

#Add to vm.args

## Increase number of concurrent ports/sockets
-env ERL_MAX_PORTS 65536

## Use more Erlang processes (128K rather than default of 64K)
+P 131072

## Use a larger distributed erlang message buffer size to avoid (most) disterl busy port issues
REPO ?= riak
.PHONY: rel stagedevrel deps
all: deps compile
compile:
./rebar compile
deps:
#!/usr/bin/env escript
%% -*- erlang -*-
-include_lib("kernel/include/file.hrl").
-compile(export_all).
-define(LOG(S), io:format(S)).
-define(LOG(S,A), io:format(S,A)).
main(Dirs) ->
CodePath = case os:getenv("RIAK_LIB") of
-module(extract_bitcask).
main([Dir, Output]) ->
{ok, Fh} = file:open(Output,[write]),
io:format("Dumping bucket/keys for partition: ~p to output file: ~p\n", [Dir,Output]),
F = fun(Entry, _Acc) ->
case Entry of
{bitcask_entry, Key, _S, _T, _F, _U} ->
{B, K} = binary_to_term(Key),
erlang:put(extraction_counter, erlang:get(extraction_counter) + 1) ,