Child pages
  • Running MongoDB on the SoIC Unified Linux Systems

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Log into the burrow server (burrow.soic.indiana.edu, aka silo.soic.indiana.edu) using ssh, PuTTY, or some other SSH client.  All of the following steps must be done while logged into the burrow server.
  2. Create a directory in your homedir to save the needed files.  In this example we will use a mongodb directory.

    Code Block
    mkdir /u/username/mongodb
    
  3. Copy in the default mondod configuration file into this directory

    Code Block
    cp /etc/mongod.conf /u/username/mongodb/mongod.conf
  4. Edit the /u/username/mongodb/mongodb.conf file, making the following changes:

     

    • Change the paths for pidfilepath, logpath, unixSocketPrefix, and dbpath from things like /var/run/mongodb/mongodb.pid to /u/username/mongodb/mongodb.pid.  You must make sure that you have no paths that point into /var/...
    • Change Uncomment the port line and change the port number from the default (27017) to some other random port that must be greater than 10,000.  You can use the checkport command to check if a port is available.  For example, if you wanted to use port 12233 then run "checkport 12233" to verify that it is available.

  5. Start the daemon with:

    Code Block
    mongod --config /u/username/mongodb/mongod.conf
  6. Connect to the database server:

    Code Block
    mongo localhost:12345

    You must replace 12345 with the unique port number you assigned in the mongodb.conf file (from step 4)

  7. The default configuration will only allow connections from silo itself via what is called localhost.  If you need to make remote connections (say, from a cgi or php script) then you will need to make a change to your mongod.conf file.  You will have to change the line "bind_ip=127.0.0.1" to "bind_ip=0.0.0.0" and restart your server.  Then, you can use a server connect string like the following:

    Code Block
    mongodb://silo.soic.indiana.edu:12345

    As above, you will need to replace 12345 with the proper port number.

    Warning

    If you configure mongodb to listen on the network, you must configure authentication.  Leaving a mongodb server up on the network with no authentication is leaving the service ripe for abuse and is against IU and SoIC policy.  Please see the MongoDB Security Checklist for more information.

If you have any trouble with these steps, you can request assistance as explained in How do I ask for help with a technology or facilities issue?

...