If you have an account on the SICE burrow systems (burrow.sice.indiana.edu, aka. silo.sice.indiana.edu) you can run a mongodb server under your own account with no intervention needed by the systems staff. This page presents a cookbook example of how you can do this. In these steps, you will need to replace "username" with your actual IU username.
- Log into the burrow server (burrow.sice.indiana.edu, aka silo.sice.indiana.edu) using ssh, PuTTY, or some other SSH client. All of the following steps must be done while logged into the burrow server.
Create a directory in your homedir to save the needed files. In this example we will use a mongodb directory.
Copy in the default mondod configuration file into this directory
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/...
- 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.
Start the daemon with:
We have a newer mongo 3.2 installed that you can use. If you want to use this version instead of the default, just run ". /opt/rh/rh-mongodb32/enable" (that's a '.' followed by the filename) before you start mongod. You can run "which mongod" to confirm which version you are running.
Connect to the database server:
You must replace 12345 with the unique port number you assigned in the mongodb.conf file (from step 4)
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:
As above, you will need to replace 12345 with the proper port number.
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 SICE 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 SICE technology or facilities issue?