This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function (doc, meta) { | |
if (meta.type != "json") return; | |
var stringToUtf8Bytes = function (str) { | |
var utf8 = unescape(encodeURIComponent(str)); | |
var bytes = []; | |
for (var i = 0; i < str.length; ++i) { | |
bytes.push(str.charCodeAt(i)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"customer_contacts": "n/a", | |
"account_type": "n/a", | |
"name": "xyz", | |
"sales_rep": "[email protected]", | |
"note": "", | |
"customer_type": "customer", | |
"type": "customer", | |
"sla": "n/a" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Virtual Host": { | |
"status": "INFO", | |
"description": "Xen 3.4.3.amazon (preserve-AD)" | |
}, | |
"OS Name": { | |
"status": "INFO", | |
"description": "Linux 2.6.32-358.14.1.el6.x86_64" | |
}, | |
"Installed CPUs": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "xyz_3", | |
"sdk_version": "n/a", | |
"cluster_id": "0095a9cfef8dc3ac1fe6de12affe5745", | |
"couchbase_version": "2.5.1-1083-rel-enterprise", | |
"node_count": "2 - Recommend at least 3 nodes", | |
"customer_id": "xyz", | |
"type": "cluster" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib2 | |
import json | |
import subprocess | |
import sys | |
def main(): | |
cluster_ip = sys.argv[1] | |
bucket = sys.argv[2] | |
bucket_map_url = "http://" + cluster_ip + \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
import gevent | |
from gevent.subprocess import Popen | |
vbucket_count = 1024 | |
backup_script = "/opt/couchbase/bin/cbbackup" | |
parser = argparse.ArgumentParser(description="cbbackup wrapper to back up vbuckets in batches") | |
parser.add_argument('-b', action='store', dest='batch_size', type=int, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::io::{Read, Write}; | |
use std::net::{TcpListener, TcpStream}; | |
use std::str; | |
use std::thread; | |
fn handle_client(mut stream: TcpStream) { | |
match stream.peer_addr() { | |
Err(_) => (), | |
Ok(pn) => println!("Received connection from: [{}]", pn), | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from couchbase import Couchbase | |
from couchbase import FMT_JSON | |
from couchbase.views.params import Query | |
from couchbase.views.iterator import View | |
import datetime | |
import json | |
from operator import itemgetter | |
import random |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Set test key to cluster | |
client.set("test-key", "couchbase!").get(); | |
// Grab cas value | |
CASValue<Object> lock = client.gets("test-key"); | |
long cas_id = lock.getCas(); | |
client.cas("test-key", cas_id, "test-value"); | |
System.out.println((String) client.get("test-key")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.couchbase.client.CouchbaseClient; | |
//import net.spy.memcached.transcoders.SerializingTranscoder; | |
import java.util.Random; | |
import java.net.URI; | |
import java.util.*; | |
import java.lang.*; | |
import java.util.concurrent.TimeUnit; |