Sameer Shaikh
Sameer Shaikh

Reputation: 265

How to have two instance of mongodb on same pc

I have mongo db 2.6.9 installed in my ubuntu machine.I want to have 2.6.10 also installed on the same machine and only run one at a time. I don't have much knowledge of mongodb. How can i do it?

Upvotes: 0

Views: 1182

Answers (2)

Okezie
Okezie

Reputation: 5108

Since you are already on ubuntu, install docker and create containers running as many mongo versions as you want in different containers. You will just have to bind them to different ports on the local machine.

Install docker

sudo apt-get update $ sudo apt-get install wget
wget -qO- https://get.docker.com/ | sh

Create mongodb container running mongo 2.6.9 and 2.6.10

docker run -p 27107:27107 -d mongo:2.6.9
docker run -p 27108:27107 -d mongo:2.6.10

Connect to mongodb version 2.6.9 using 127.0.0.1 on port 27107 Connect to mongodb version 2.6.10 using 127.0.0.1 on port 27108

Upvotes: 0

giannisapi
giannisapi

Reputation: 2751

Talking for linux, if you just install it twice in different paths (REMEMBER to change the port) i think they will run fine. the problem is that you will end up using the same log file for both instances. What I suggest you is you take a look at the two following linkes:

stack here

and also on mongo manual in order to see the run time configuration where you will see what paths you have to change for the second running installation here

Upvotes: 1

Related Questions