web analytics

Monthly Archives March 2014

Sharding in MongoDB

Sharding refers to the process of distributing data across multiple servers which helps in retrieving it easily. When the data set is huge, it is said that sharding significantly improves the query response time.

Let us see how we can implement sharding. Sharding requires a  minimum of three servers for test purpose. In production scenario, sharding may require more servers.

Sharding is implemented through the following :-

1) Config Servers – These servers contain the metadata as to where the data belongs to. Means, it holds data as to which shard each data goes. A minimum of 2 config servers in a huge databases system is recommended.

2) Query Router Servers – These servers are the ones that communicate with the application directly...

Read More

Fatal error: Uncaught exception ‘MongoCursorTimeoutException’ with message ‘hostname:27017: Read timed out after reading 0 bytes, waited for 30.000000 seconds’

I was trying to insert a 7 lakh data into a collection and I got the following error.

Fatal error: Uncaught exception ‘MongoCursorTimeoutException’ with message ‘hostname:27017: Read timed out after reading 0 bytes, waited for 30.000000 seconds’

To fix this, add the following to the top of your PHP page.

MongoCursor::$timeout = -1;

 

Read More

Find the number of FTP connections along with the connected IP Addresses

You can use the following t o find which all IP Addresses are connected to server via FTP as well as the number of connections.

netstat -tpn | grep pure-ftpd | awk ‘{print $5}’ | cut -d”:” -f1 | sort | uniq -c | sort -nr

Read More

ERROR: Error creating index db.collection-101613_nno.csv: 16633 err: “text search not enabled”

I was trying to restore a database onto a new server, when I got the following error.

mongorestore -d db /backup/db

ERROR: Error creating index db.collection-101613_nno.csv: 16633 err: “text search not enabled”

In order to correct this, you need to enabled text search. Simply stop the mongo process and start it with text search enabled.

root@abc# /etc/rc.d/init.d/mongod stop

root@abc# /usr/bin/mongod -f /etc/mongod.conf –setParameter textSearchEnabled=true

Now try restoring again and it works.

Read More