在同一台服务器上安装多个mongoDB版本

我已经安装了一个2.4 mongoDB版本,我想和最近发布的2.6版本进行比较。

我想知道如果可能做一个干净的新安装,而不是更新,看看这两个版本可以共存于同一台服务器。

此刻我正在使用Linux红帽发行版。

谢谢。

看一下Thomas Rueckstiess的mlaunch工具 。 一旦你从注释中build议的下载页面下载不同版本的二进制文件(并把它们放在你的系统上有意义的地方),你可以使用mlaunch通过指定不同的二进制path (和数据目录 ,如果并行运行多个端口等)。

如果额外的工具不是你正在寻找的,你可以使用MongoDB提供的内部testing命令来获得类似的结果,但请注意,这些命令目前被认为是内部testing用途,没有logging,可以改变(或停止工作) (我最近已经testing过2.4和2.6版本,并且可以确认它们在写这个答案时适用于这些版本)。

例如,如果要设置2个分片群集,其中每个分片都是副本集,则可以执行以下操作:

 // start a shell from the command line, do not connect to a database ./mongo --nodb // using that shell start a new 2 shard cluster (this will take a while) cluster = new ShardingTest({shards : 2, rs : true}); // once that is finished, start a new shell and connect to the mongos (leave previous shell running to monitor logs etc.) ./mongo --port 30999 MongoDB shell version: 2.6.0 connecting to: 127.0.0.1:30999/test mongos> 

根据需要重复使用你想要的任何版本,closures它,只需Ctrl-C原来的shell(希望仍然可以logging的地方)。

同样,如果您只想要一个副本集来testing:

 // start a shell from the command line, do not connect to a database ./mongo --nodb var rst = new ReplSetTest({ name: 'testSet', nodes: 3}); rst.startSet(); // this next line can be hard to type with logging scrolling by, so copy & paste is your friend if you have trouble rst.initiate(); // start a new shell and connect to the set ./mongo --port 31000 MongoDB shell version: 2.4.9 connecting to: 127.0.0.1:31000/test testSet:PRIMARY> 

这些命令可以用来下载mongodb rpm并提取文件。 解压缩包内容后,可以直接使用二进制文件。

 yum install yum-plugin-downloadonly yum install --downloadonly --downloaddir=/tmp mongodb-org-server mkdir /usr/local/mongo2 cd /usr/local/mongo2 rpm2cpio /tmp/mongodb-org-server-2.6.4-1.x86_64.rpm | cpio -idmv 

现在,新的mongod可以被调用:

 /usr/local/mongo2/usr/bin/mongod