I am working with 2 projects using 2 different versions of mongodb. One is using 3.2.10 and the other using 2.6. My current system has the latest version, and this is incompatible with the old project. Is there a way to install & use both version of Mongo?
Asked
Active
Viewed 851 times
0
-
Yes you can , find here [http://stackoverflow.com/a/31042510/3057302] – Anish Agarwal Dec 09 '16 at 06:16
-
Possible duplicate of [How can I install two versions of mongodb parallely in Ubuntu 12.04 ?](http://stackoverflow.com/questions/31042407/how-can-i-install-two-versions-of-mongodb-parallely-in-ubuntu-12-04) – RaR Dec 09 '16 at 09:13
1 Answers
1
Yes. You can download two archives and extract them into two different bin directories. You will need to register each instance as a separate service to allow them to be ran in the background. Also configure each one to listen on different port. Obviously each project will need to be configured with correct port.
By default mongod listens on port 27017. You can use any other ports that are not used by other applications. Here is the example of how you can start two mongo services manually. Ports below are chosen arbitrarily.
~/installFolder1/mongod --dbpath /pathToDatabase/database1 --port 27010
~/installFolder2/mongod --dbpath /pathToDatabase/database2 --port 27011

Dmitri Sandler
- 1,123
- 6
- 17