«

»

Mar 26

MongoDB Series, Part 1: Installation and Configuration

With the surging popularity of NoSQL options, Geographic Database Consulting will take a deeper look at utilizing MongoDB with ArcGIS. This chapter will focus on the installation and configuration of MongoDB on an Oracle/RedHat linux server.

Create a YUM Repository

The easiest method of installing MongoDB on Oracle/RedHat Linux is via the 10Gen YUM repository. Create a file under /etc/yum.repos.d/10gen.repo.

For 64-bit linux, add the following lines to the repo file:

[10gen]

name=10gen Repository

baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64

gpgcheck=0

enabled=1

 

For 32-bit linux, add the following lines to the repo file:

[10gen]

name=10gen Repository

baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/i686

gpgcheck=0

enabled=1

 

Installing MongoDB

With your YUM repository set up, installing MongoDB is as easy as:

yum install mongo-10gen mongo-10gen-server

 

Upgrading MongoDB

If you’ve installed an older version, and are ready to upgrade to the latest stable release of MongoDB, you can use the following command:

yum update mongo-10gen mongo-10gen-server

Configuring MongoDB

Once installed, MongoDB is configured using the file /etc/mongod.conf. In this file, you can specify what parameters the MongoDB server uses at runtime. The basic parameters you will want to consider changing for testing purposes will be:

logpath  — specifies the path to your mongod.log file;

dbpath   — specifies the path to the Mongodb data storage;

There are several other parameters available, and in a production system you will want to learn more about them. They are beyond the scope of this blog post.

 

Starting and Stopping MongoDB

You can start MongoDB manually with the following command:

service mongod start

Similarly, you can stop MongoDB manually with:

service mongod stop

To start/stop MongoDB automatically on system reboots, use:

chkconfig mongod on

Using MongoDB

From a linux command prompt, enter the command:

mongo

Some basic Mongo shell commands:

show databases       — list all available databases

use arcgis           — use a database called arcgis, or create one.

db.stats()           — Show basic stats about the current database;

db.collection.find() — Run a query against the current db/collection

 

For a full reference of the Mongo shell JavaScript commands, please visit: http://docs.mongodb.org/manual/reference/javascript/

Part 2 of the Geographic Database Consulting series on MongoDB will focus on integrating MongoDB with ArcGIS…

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>