Skip to content

Instantly share code, notes, and snippets.

@farshidce
Created May 23, 2012 06:05
Show Gist options
  • Save farshidce/2773497 to your computer and use it in GitHub Desktop.
Save farshidce/2773497 to your computer and use it in GitHub Desktop.
manualmove
instructions:
find out which vbuckets are active on node X by running
opt/couchbase/bin/cbstats localhost:11210 checkpoint | grep active
vb_10:state: active
vb_11:state: active
vb_12:state: active
vb_13:state: active
then run the manualmove script to move one vbucket at a time
cd /opt/couchbase/lib/python
wget https://raw.github.com/gist/2773443/6fcccf54648986e33dc4e20cc91911f69ce3b3a7/manualmove.py
manualmove -c {cluster} -s {source} -d {destination} -v {vbucket} -b something --sasl=password
optional params ( hopefully we dont need these ): --dont-stop-orchestrator and --dont-restart-orchestrator
the script will stop the orchestrator , move the vbucket if it succeeds it updates the vbucket map and then restarts the orchestrator.
if you specify multiple vbuckets it will move all those vbuckets and restart the orchestrator after moving all those vbuckets. ( -v 1,2,3 )
I advise that we only move one vbucket at a time and at least wait a minute before running the script again.
for playdom we should move 50 of the vbuckets to node .14 and the other half to node .168 .
-c {cluster_ip} ( could be any node )
-s {source} ( should be .166 )
-d {destination} ( should be .14 or .168)
-v {vbucketid}
when script runs successfully you should see these lines :
in this example : we are moving vbucket "1" from 32->35 . after vbucket takeover node 35 is the active.
root@ubu-0102:/opt/couchbase/lib/python# python manualmove.py -c 10.1.2.32 -s 10.1.2.32 -d 10.1.2.35 -v 1
[email protected] 11210
[email protected] 11210
1
None
None
stop orchestrator
M = mb_master:master_node(), ok = supervisor:terminate_child({mb_master_sup, M}, ns_orchestrator), ok = supervisor:delete_child({mb_master_sup, M}, ns_orchestrator).
/diag/eval : status : True content : ok
PATH=/opt/couchbase/bin:$PATH /opt/couchbase/bin/ebucketmigrator -h 10.1.2.32:11210 -A -V -t -b 1 -d 10.1.2.35:11210
Ignoring "-A" flag
Ignoring "-t" flag
=INFO REPORT==== 22-May-2012::23:01:41 ===
nonode@nohost:<0.30.0>:ebucketmigrator_srv:136: CheckpointIdsDict:
{dict,170,34,64,32,170,102,
{[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]},
{{[[0|1],[64|1],[192|1]],
[[51|1],[115|1],[179|1],[243|1]],
[[6|1],[38|1],[70|1],[198|1],[230|1]],
[[25|1],[57|1],[121|1],[185|1],[217|1],[249|1]],
[[12|1],[44|1],[172|1],[204|1],[236|1]],
[[31|1],[63|1],[127|1],[191|1],[223|1],[255|1]],
[[18|1],[50|1],[114|1],[178|1],[210|1],[242|1]],
[[5|1],[37|1],[69|1],[197|1],[229|1]],
[[24|1],[56|1],[120|1],[184|1],[216|1],[248|1]],
[[11|1],[43|1],[171|1],[203|1],[235|1]],
[[30|1],[62|1],[126|1],[190|1],[222|1],[254|1]],
[[17|1],[49|1],[113|1],[177|1],[209|1],[241|1]],
[[4|1],[36|1],[68|1],[196|1],[228|1]],
[[23|1],[55|1],[119|1],[183|1],[215|1],[247|1]],
[[10|1],[42|1],[202|1],[234|1]],
[[29|1],[61|1],[125|1],[189|1],[221|1],[253|1]]},
{[[16|1],[48|1],[176|1],[208|1],[240|1]],
[[3|1],[35|1],[67|1],[195|1],[227|1]],
[[22|1],[54|1],[118|1],[182|1],[214|1],[246|1]],
[[9|1],[41|1],[201|1],[233|1]],
[[28|1],[60|1],[124|1],[188|1],[220|1],[252|1]],
[[15|1],[47|1],[175|1],[207|1],[239|1]],
[[2|1],[34|1],[66|1],[194|1],[226|1]],
[[21|1],[53|1],[85|1],[117|1],[181|1],[245|1]],
[[8|1],[40|1],[200|1],[232|1]],
[[27|1],[59|1],[123|1],[187|1],[219|1],[251|1]],
[[14|1],[46|1],[174|1],[206|1],[238|1]],
[[1|1],[33|1],[65|1],[193|1],[225|1]],
[[20|1],[52|1],[116|1],[180|1],[244|1]],
[[7|1],[39|1],[199|1],[231|1]],
[[26|1],[58|1],[122|1],[186|1],[218|1],[250|1]],
[[13|1],[45|1],[173|1],[205|1],[237|1]]},
{[[32|1],[224|1]],
[[19|1],[211|1]],
[],[],[],[],[],[],[],[],[],[],[],[],[],[]},
{[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]}}}
=INFO REPORT==== 22-May-2012::23:01:41 ===
nonode@nohost:<0.30.0>:ebucketmigrator_srv:166: Starting tap stream:
[{vbuckets,[1]},{checkpoints,[{1,0}]},{name,"rebalance_1"},{takeover,true}]
=INFO REPORT==== 22-May-2012::23:01:41 ===
nonode@nohost:<0.30.0>:ebucketmigrator_srv:175: upstream_sender pid: <0.34.0>
=INFO REPORT==== 22-May-2012::23:01:41 ===
nonode@nohost:<0.30.0>:ebucketmigrator_srv:224: Skipping close ack for successfull takover
{ok, C} = ns_bucket:get_bucket("default"), V = 1, M = proplists:get_value(map, C), Chain = lists:nth(V+1, M), NewChain = ['[email protected]' | tl(Chain)], NewMap = erlang:tuple_to_list(erlang:setelement(V+1, erlang:list_to_tuple(M), NewChain)), ns_bucket:update_bucket_props("default", [{map, NewMap}]).
/diag/eval : status : True content : ok
start orchestrator
M = mb_master:master_node(), rpc:call(M, erlang,apply, [fun () -> exit(whereis(mb_master), kill) end, []]).
/diag/eval : status : True content : true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment