Quantcast

Ben McCann

Co-founder at Connectifier.
ex-Googler. CMU alum.

Ben McCann on LinkedIn Ben McCann on AngelList Ben McCann on Twitter

Datastores

Migrating from MongoDB to TokuMX

05/13/2014

First be sure to install the latest version of TokuMX on the target machines, which is currently 1.4.2. Also, for all long-running commands, you’ll want to run them in a tmux session. You can create a new tmux session with tmux new, attach to the default session with tmux attach -d, and quit a tmux Read More

Finding the size of all MongoDB collections

04/28/2014

Here’s a helpful script for finding the size of every table in MongoDB in MB: var collNames = db.getCollectionNames(); for (var i = 0; i < collNames.length; i++) { var coll = db.getCollection(collNames[i]); var stats = coll.stats(1024 * 1024); print(stats.ns, stats.storageSize); }

Resyncing a very stale MongoDB Replica

08/22/2012

I logged into the primary member of the replica set and ran rs.status() which showed me that the replica was too stale (“error RS102 too stale to catch up”): { “_id” : 4, “name” : “55.55.55.55:27017”, “health” : 1, “state” : 3, “stateStr” : “RECOVERING”, “uptime” : 502511, “optime” : { “t” : 1340841938000, “i” Read More

Backing Up MySQL with Percona Xtrabackup

05/25/2012

You can create a MySQL backup with Percona Xtrabackup by running: $ innobackupex –user=DBUSER –password=DBUSERPASS /path/to/BACKUP-DIR/ You can then restore the backup with: $ xtrabackup –prepare –datadir=/var/lib/mysql –target-dir=/path/to/BACKUP-DIR/ $ sudo service mysql stop $ sudo mv /var/lib/mysql ~/dbbackup $ sudo mv /path/to/BACKUP-DIR /var/lib/mysql $ sudo chown -R mysql:mysql /var/lib/mysql $ sudo service mysql start $ Read More

Setting up the RockMongo GUI on Ubuntu

04/17/2012

The easiest way to get started is to install Apache and PHP: $ sudo apt-get install apache2 php5 php-pear If you need to edit the Apache ports because you already have another server running on port 80 then edit /etc/apache2/ports.conf. You’ll need to install the PHP Mongo connector: sudo pecl install php_mongo Add “extension=mongo.so” to Read More

Brewer’s CAP Theorem Explained

03/24/2012

When dealing with distributed systems, Brewer’s CAP theorem is often brought up when discussing how a system will behave in certain error conditions. The CAP theorem means that you can only have two of: consistency, availability, and partition tolerance. Here’s what you’ll be giving up for each of the three that you may sacrifice: C: Read More

Migrating from MySQL to Percona Server

12/11/2011

Percona Server is just MySQL with a few extra options added in by Percona. It’s backwards compatible and based off the same code base. If you’re not familiar with Percona, they are the world’s leading MySQL consultants. The main reason I switched is because Ubuntu uses an old version of MySQL. Ubuntu is about a Read More

MySQL Commands Cheatsheet

01/22/2011

Install SQL Buddy sudo apt-get install apache2 libapache2-mod-php5 php5-mysql sudo /etc/init.d/apache2 restart Download SQL Buddy, unzip, and move to /var/www Allow connections from a remote server: Set the bind address in /etc/mysql/my.cnf to your ip address Open the port in the firewall by running “/sbin/iptables -A INPUT -i eth0 -p tcp –destination-port 3306 -j ACCEPT” Read More