Posts

Showing posts from October, 2018

Running two MongoDB instances on one server

Introduction As I am presently learning about MongoDB, I wanted to get some practice with the sharding and replication features of the database, which would require access to at least two running instances of MongoDB. Rather than running two seperate machines or doing something with virtualization, I wanted to keep it simple and get two instances running locally on my Fedora laptop. Here are the steps that I followed to get this working. Note that this tutorial assumes you already have one instance of MongoDB already installed, see my guide here for instructions on that. 1. Make a copy of the MongoDB config file for the second instance $ cp /etc/mongod.conf /etc/mongod2.conf 2. Edit the second file to have different paths and port $ nano /etc/mongod2.conf You should change the file paths for the database storage directory, the log directory, and the port on which the second instance of MongoDB will run, to ensure it does not interfere with the first instance. 3. Copy the...