- 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.
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
cp /etc/mongod.conf /u/username/mongodb/mongod.conf
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:
mongod --config /u/username/mongodb/mongod.conf
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 SoIC policy. Please see the MongoDB Security Checklist for more information.