Skip to content

Instantly share code, notes, and snippets.

View ingenthr's full-sized avatar

Matt Ingenthron ingenthr

View GitHub Profile
@ingenthr
ingenthr / gist:2777410
Created May 23, 2012 19:59
Finding and restarting the master node (not what you think it is) in Couchbase Server
wget -O- --user=Administator --password=asdasd --post-data="M = mb_master:master_node(), rpc:call(M, erlang,apply, [fun () -> exit(whereis(mb_master), kill) end, []])." http://lh:8091/diag/eval
ingenthr-mbp:~ ingenthr$ ssh -v cbgw
OpenSSH_5.2p1, OpenSSL 0.9.8r 8 Feb 2011
debug1: Reading configuration data /Users/ingenthr/.ssh/config
debug1: Applying options for cbgw
debug1: Reading configuration data /etc/ssh_config
debug1: Connecting to 12.218.209.71 [12.218.209.71] port 22.
debug1: Connection established.
debug1: identity file /Users/ingenthr/.ssh/id_dsa-northscale type 2
debug1: Remote protocol version 2.0, remote software version OpenSSH_4.3
debug1: match: OpenSSH_4.3 pat OpenSSH_4*
@ingenthr
ingenthr / StoreHandler.java
Created March 29, 2012 03:19
Sample of exponential backoff on a set with Couchbase Server
package com.couchbase.sample.dataloader;
import com.couchbase.client.CouchbaseClient;
import java.io.IOException;
import java.net.URI;
import java.util.List;
import net.spy.memcached.internal.OperationFuture;
import net.spy.memcached.ops.OperationStatus;
/**
@ingenthr
ingenthr / urlcheck.text
Created February 20, 2012 19:32
URL check
For URL: http://www.couchbase.com/agreement/community
HTTP/1.1 200 OK
For URL: http://www.couchbase.com/agreement/free-license
HTTP/1.1 200 OK
For URL: http://www.couchbase.com/agreement/services
HTTP/1.1 200 OK
@ingenthr
ingenthr / Main.java
Created February 8, 2012 18:41
Couchbase Server Java example of iterating over document results
View view = cbc.getView("$dev_testing", "atest");
Query myQuery = new Query();
myQuery.setRange("M", "N");
ViewResponse queryResults = cbc.query(view, myQuery);
Iterator<ViewRow> walkthrough = queryResults.iterator();
System.err.println("Found " + queryResults.size() + " docs.");
while (walkthrough.hasNext()) {
ViewRow next = walkthrough.next();
System.err.println(next.getDocument());
@ingenthr
ingenthr / App.java
Created February 8, 2012 18:18
Showing the basics of CAS
package com.couchbase.sample.showingcas;
import com.couchbase.client.CouchbaseClient;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.List;
import net.spy.memcached.CASResponse;
import net.spy.memcached.CASValue;
@ingenthr
ingenthr / iqTimeout.java
Created February 8, 2012 01:12
example of capping input queue and blocking with timeout
List<URI> baselist = new ArrayList<URI>();
baselist.add(new URI("http://localhost:8091/pools"));
CouchbaseConnectionFactoryBuilder cfb = new CouchbaseConnectionFactoryBuilder();
cfb.setOpTimeout(10000); // wait up to 10 seconds for an operation to succeed
cfb.setOpQueueMaxBlockTime(5000); // wait up to 5 seconds when trying to enqueue an operation
CouchbaseClient myclient = new CouchbaseClient(cfb.buildCouchbaseConnection(baselist, "default", "default", ""));
@ingenthr
ingenthr / example.java
Created February 7, 2012 23:56
turning off optimization with CouchbaseClient
List<URI> baselist = new ArrayList<URI>();
baselist.add(new URI("http://localhost:8091/pools"));
CouchbaseConnectionFactoryBuilder cfb = new CouchbaseConnectionFactoryBuilder();
cfb.setShouldOptimize(false);
CouchbaseClient myclient = new CouchbaseClient(cfb.buildCouchbaseConnection(baselist, "default", "default", ""));
@ingenthr
ingenthr / output
Created January 23, 2012 09:46
URL check
http://www.couchbase.com/agreement/community
HTTP/1.1 200 OK
http://www.couchbase.com/agreement/free-license
HTTP/1.1 200 OK
http://www.couchbase.com/agreement/services
HTTP/1.1 200 OK
http://www.couchbase.com/agreement/subscription
HTTP/1.1 200 OK
http://www.couchbase.com/case-studies/adaction
HTTP/1.1 200 OK
@ingenthr
ingenthr / Makefile
Created January 21, 2012 00:17
Updating toolchain on CentOS
#
# This makefile set up all of the build dependencies we need for building
# the membase server on RedHat Linux
#
# For questions please contact [email protected]
#
# Copyright (c) 2010, Membase, Inc.
# All rights reserved.
#
# Set your path to /opt/local/bin:$PATH, then run make build-compile-env