Difference between revisions of "MongoDB"

From ArchWiki
Jump to: navigation, search
(Add category. Fix style. See Help:Style.)
(6 intermediate revisions by 6 users not shown)
Line 1: Line 1:
 
[[Category:Database management systems]]
 
[[Category:Database management systems]]
MongoDB (from "humongous") is a scalable, high-performance, open source NoSQL database.
+
MongoDB (from hu'''mongo'''us) is an open source document-oriented database system developed and supported by [http://www.mongodb.com/ MongoDB Inc. (formerly 10gen)]. It is part of the NoSQL family of database systems. Instead of storing data in tables as is done in a "classical" relational database, MongoDB stores structured data as JSON-like documents with dynamic schemas (MongoDB calls the format [http://bsonspec.org/ BSON]), making the integration of data in certain types of applications easier and faster.
  
 
==Installing MongoDB==
 
==Installing MongoDB==
Line 15: Line 15:
  
 
==Troubleshooting==
 
==Troubleshooting==
===MongoDB won't more to start===
+
===MongoDB won't start===
Check for the lock file
+
Check if the lock file exists
 
  # ls  -lisa /var/lib/mongodb
 
  # ls  -lisa /var/lib/mongodb
If the are there stop the mongodb daemon delete the file after it star the daemon again
+
 
 +
If it does, stop the mongodb service, and delete the file. Then start the service again.
 
  # rm /var/lib/mongodb/mongod.lock
 
  # rm /var/lib/mongodb/mongod.lock
  
If still problems are there please check with the repair parameter (/var/lib/mongodb/ is the default --dbpath from Arch Linux)
+
If it still won't start, run a repair on the database, specifying the dbpath (/var/lib/mongodb/ is the default --dbpath in Arch Linux)
 
  # mongod --dbpath /var/lib/mongodb/ --repair
 
  # mongod --dbpath /var/lib/mongodb/ --repair
 +
 +
After running the repair as root, the files got chowned to root, whilst Arch Linux runs it under a different user. You then need to chown
 +
back the files. [http://earlz.net/view/2011/03/11/0015/mongodb-and-arch-linux Further reference]
 +
 +
# cd /var/log/mongodb
 +
# sudo chown -R mongodb:mongodb .
 +
# cd /var/lib/mongodb
 +
# sudo chown -R mongodb:mongodb .
 +
 +
Check that the boost-libs package is up to date. MongoDB requires a specific version, however, the package does not restrict the version of this dependency.

Revision as of 02:30, 8 October 2013

MongoDB (from humongous) is an open source document-oriented database system developed and supported by MongoDB Inc. (formerly 10gen). It is part of the NoSQL family of database systems. Instead of storing data in tables as is done in a "classical" relational database, MongoDB stores structured data as JSON-like documents with dynamic schemas (MongoDB calls the format BSON), making the integration of data in certain types of applications easier and faster.

Installing MongoDB

Install mongodb

# pacman -S mongodb

Start MongoDB

# systemctl start mongodb

(Optional) Add MongoDB to the list of daemons that start on system startup

# systemctl enable mongodb

Access the database shell

To access the Database shell you have type in your terminal

# mongo

Troubleshooting

MongoDB won't start

Check if the lock file exists

# ls  -lisa /var/lib/mongodb

If it does, stop the mongodb service, and delete the file. Then start the service again.

# rm /var/lib/mongodb/mongod.lock

If it still won't start, run a repair on the database, specifying the dbpath (/var/lib/mongodb/ is the default --dbpath in Arch Linux)

# mongod --dbpath /var/lib/mongodb/ --repair

After running the repair as root, the files got chowned to root, whilst Arch Linux runs it under a different user. You then need to chown back the files. Further reference

# cd /var/log/mongodb
# sudo chown -R mongodb:mongodb .
# cd /var/lib/mongodb
# sudo chown -R mongodb:mongodb .

Check that the boost-libs package is up to date. MongoDB requires a specific version, however, the package does not restrict the version of this dependency.