Posts List

Gitosis with wildcard support

Tweet At OpenSky I wanted a way to put config files into git. I started using gitosis for the git server. This was all great but for each new server I had to add the following `Tweet At OpenSky I wanted a way to put config files into git. I started using gitosis for the git server. This was all great but for each new server I had to add the following

Setup DRBD for master/master

Tweet At my job at OpenSky we have a common NFS share that is failed over to a slave nfs node if the master dies. It was setup so that the slave would just rsync from the master. This was done to save time. Not that I have some time, I decided to finally setup drbd on the two nodes to keep the files always in sync. So below are my nodes with hostnames/ips and drive information

Find the real MongoDB command for pyMongo

Tweet I am in the middle of writing a MongoDB plugin for cacti using pymongo and ran into a little issue. In the Mongo shell this works > db.stats() { "collections" : 19, "objects" : 145971, "dataSize" : 64785380, "storageSize" : 129544960, "numExtents" : 75, "indexes" : 69, "indexSize" : 25403392, "ok" : 1 } So in pymongo I tried info = db.command("stats") Then I got the following traceback

Bash: Turn a string into an array

Tweet I needed to turn a string into an array to loop through it. It is pretty simple SOLR_CORES="core1,core2,core3" declare -a CORES CORES=(`echo $SOLR_CORES | tr ',' ' '`) for CORE in ${CORES[@]} do stuff here done

MySQL to MongoDB Migration Example

Tweet There’s a lot of buzz right no for noSQL solutions and one of the big ones is MongoDB. I was lucky enough to be sent to MongoNYC conference a month or so ago and it opened my eyes to why noSQL is the way to go for most web applications. As the web is more and more based on user contributions our databases are getting more writes put into them which doesn’t scale well in MySQL.

MongoDB Nagios plugin created

Tweet I have created a MongoDB plugin for Nagios. I also put it in a GitHub project so if you want to make changes you can easily fork the project and push changes right to my project http://github.com/mzupan/nagios-plugin-mongodb

Simulate network latency

Tweet I’ve been creating Nagios plugins for MongoDB and I needed to stimulate some network latency for testing my connect test. I wanted to simulate a 2 second connection lag so I ran the following command tc qdisc add dev eth0 root netem delay 1000ms When you are done you can delete it like tc qdisc del root dev eth0 I am sure there is a better tc command you can run to get better results but this worked.

Setup MongoDB master/slave replication

Tweet I am recently getting into MongoDB. Thanks to my company (OpenSky) sending me to MongoNYC event. I am also tasked with setting up infrastructure to run MongoDB. So we are starting off with a simple master/slave MongoDB setup. I always thought MySQL was easy to setup replication on but MongoDB proves it just gets easier. This will expect you are using the official MongoDB provided RPMs from their repository.

Django fix for ‘User’ object has no attribute ‘backend

Tweet I was trying to auto login a user if I had their user object and was getting this error when I just called something like login(request, user) Well this is due to Django wanting to make sure you auth the user first. If you want to bypass this you can just use the following before login user.backend = 'django.contrib.auth.backends.ModelBackend' This might not be the best solution but it works

MySQL Database size

Tweet I found a nice query on the mysql mailing list for getting the total size of each database. SELECT table_schema "Data Base Name", sum( data_length + index_length ) / 1024 / 1024 "Data Base Size in MB", sum( data_free )/ 1024 / 1024 "Free Space in MB" FROM information_schema.TABLES GROUP BY table_schema;