Skip to content

Instantly share code, notes, and snippets.

View farshidce's full-sized avatar

Farshid Ghods farshidce

  • LinkedIn
  • San Francisco
View GitHub Profile
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
import os
import sys
import getopt
import exceptions
import struct
from optparse import OptionParser
from couchbase.rest_client import RestConnection
parser = OptionParser()
@farshidce
farshidce / gist:2432350
Created April 20, 2012 22:33
recreating dead partition
#!/bin/sh
vgcreate VolGroup01 /dev/sdb
lvcreate --extents 100%VG --name Data VolGroup01
mkfs -t ext3 -m 0 /dev/VolGroup01/Data
#echo "/dev/VolGroup01/Data /data ext3 defaults 0 0" >> /etc/fstab
mkdir -p /data
mount /data
@farshidce
farshidce / ios202manifest
Created March 20, 2012 00:41
ios 2.0.2 manifest
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<remote fetch="git://github.com/couchbase/" name="couchbase" review="review.couchbase.org"/>
<remote fetch="git://github.com/couchbaselabs/" name="couchbaselabs" review="review.couchbase.org"/>
<default remote="couchbase" revision="master"/>
<project name="CouchCocoa" remote="couchbaselabs" revision="7041bfdd6b16ba600a5c6c3d6529d4f710928ba8"/>
<project name="couchdb" path="vendor/couchdb" revision="312b1528b7e5fb143ccc2cbd81f7388a728d211a"/>
<project name="geocouch" path="vendor/geocouch" revision="1cc3251fecd75ffaae32c509716f9415fb6c5a0d"/>
@farshidce
farshidce / vbmap-bef-fo-1
Created March 19, 2012 13:09
vbmap-bef-fo-1
{"name":"default","bucketType":"membase","authType":"sasl","saslPassword":"","proxyPort":0,"uri":"/pools/default/buckets/default","streamingUri":"/pools/default/bucketsStreaming/default","flushCacheUri":"/pools/default/buckets/default/controller/doFlush","nodes":[{"systemStats":{"cpu_utilization_rate":0.5414410662224073,"swap_total":11814912000.0,"swap_used":0},"interestingStats":{"curr_items":11177939,"curr_items_tot":22368795,"vb_replica_curr_items":11190856},"uptime":"194492","memoryTotal":67545075712.0,"memoryFree":1611206656,"mcdMemoryReserved":51532,"mcdMemoryAllocated":51532,"replication":1.0,"clusterMembership":"active","status":"healthy","hostname":"10.80.72.238:8091","clusterCompatibility":1,"version":"1.8.0r-55-g80f24f2-enterprise","os":"x86_64-unknown-linux-gnu","ports":{"proxy":11211,"direct":11210}},{"systemStats":{"cpu_utilization_rate":0.41649312786339027,"swap_total":11814912000.0,"swap_used":0},"interestingStats":{"curr_items":11190748,"curr_items_tot":22386216,"vb_replica_curr_items":111954
@farshidce
farshidce / rename-rel
Created January 6, 2012 16:56
rename rel files
import os
find = "1.8.0r-55-g80f24f2"
replace = "1.8.0"
files = os.listdir(".")
for f in files:
if f.index(find) != -1:
newf = f.replace(find,replace)
print newf
os.rename(f,newf)
@farshidce
farshidce / gist:1571422
Created January 6, 2012 16:55
clean build machine
make do-hard-clean-xfd-couchdb
make do-hard-clean-xfd-ep_engine
make do-hard-clean-xfd-ep-engine
make do-hard-clean-xfd-ns-server
make do-hard-clean-xfd-ns_server
make do-hard-clean-xfd-memcached
make do-hard-clean-xfd-libmemcched
make do-hard-clean-xfd-libmemcached
make do-hard-clean-xfd-bucket_engine
make do-hard-clean-xfd-membase-cli
rm -rf ~/capture.out
while [ 1 ]
do
date >> ~/capture.out
./sqlite3_analyzer /mnt/ebs/default-data/default-1.mb >> ~/capture.out
sleep 1800
done
for 1 hr change sleep to 3600
rm -rf ~/capture.out
while [ 1 ]
do
date >> ~/capture.out
/opt/couchbase/bin/cbstats localhost:11210 timings >> ~/capture.out
sleep 1800
done
for 1 hr change sleep to 3600
tapcheckpointstats-umami-201111232025/checkpointstats.umami.201111232025.txt: vb_225:num_checkpoints: 3
tapcheckpointstats-umami-201111232025/checkpointstats.umami.201111232025.txt: vb_496:num_checkpoints: 3
tapcheckpointstats-umami-201111232025/checkpointstats.umami.201111232025.txt: vb_497:num_checkpoints: 3
tapcheckpointstats-umami-201111232025/checkpointstats.umami.201111232025.txt: vb_124:num_checkpoints: 3
tapcheckpointstats-umami-201111232025/checkpointstats.umami.201111232025.txt: vb_309:num_checkpoints: 3
tapcheckpointstats-umami-201111232025/checkpointstats.umami.201111232025.txt: vb_380:num_checkpoints: 3
tapcheckpointstats-umami-201111232025/checkpointstats.umami.201111232025.txt: vb_381:num_checkpoints: 3
tapcheckpointstats-umami-201111232025/checkpointstats.umami.201111232025.txt: vb_412:num_checkpoints: 3
tapcheckpointstats-umami-201111232025/checkpointstats.umami.201111232025.txt: vb_490:num_checkpoints: 3
tapchec