Monthly Archives: March 2011

MongoDB – Replica Set

Here’s a good tutorial on Replica-Set on MongoDB website http://www.mongodb.org/display/DOCS/Replica+Set+Tutorial

In this tutorial, in “Replication” section tutorial asks to create a document on PRIMARY server.

db.messages.save({name: "ReplSet Tutorial"});

After creating a document on PRIMARY if you hit

db.messages.find()

in MongoDB shell the result is displayed. But if you switch to SECONDARY and execute same command to check if replication is working, you get following error.

uncaught exception: error: { "$err" : "not master and slaveok=false", "code" : 13435 }

The reason is stated here : http://www.mongodb.org/display/DOCS/Querying#Querying-slaveOk

So all you need to do is hit this command

db.getMongo().setSlaveOk();

That’s it. Now “db.messages.find()” should work on SECONDARY as well.

Enjoy!!!

ktorrent country flags

How to get country flags in Ktorrent

I love to see country flags in Ktorrents peers tab. Though the database is not much accurate, the flags look nice. 🙂

I upgraded the KDE few months back and came to know that flags are no more shown in Ktorrent. After some googling I found that one should have `kdebase-data` and `libgeoip1` packages installed. Also in Ktorrent ,`infowidget` plugin should be active.

I had both packages already installed and the plugin was also enabled, but still flags were not visible.

The reason behind this is mentioned in README.Debian provided with KTorrent package. So after reading it, I read README.Debian for libgeoip1 package and solved the problem. 🙂 Enjoy.

Install libgeoip1 package
# aptitude install libgeoip1

Create a directory
# mkdir /usr/share/GeoIP/

Run script provided with libgeoip1 package
# cd /usr/share/doc/libgeoip1/examples/
# ./geolitecountryv4.sh
# ./geolitecountryv6.sh

DONE!!!