加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

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

发布时间:2020-12-13 18:15:21 所属栏目:Linux 来源:网络整理
导读:我已经安装了2.4 mongoDB版本,我想与最近发布的2.6版本进行比较. 我想知道是否有可能做一个干净的新安装,而不是更新,看看这两个版本是否可以在同一台服务器中共存. 我现在正在使用Linux red-hat发行版. 谢谢. 解决方法 看一下 mlaunch tool到 Thomas Rueckst
我已经安装了2.4 mongoDB版本,我想与最近发布的2.6版本进行比较.

我想知道是否有可能做一个干净的新安装,而不是更新,看看这两个版本是否可以在同一台服务器中共存.

我现在正在使用Linux red-hat发行版.

谢谢.

解决方法

看一下 mlaunch tool到 Thomas Rueckstiess.一旦你按照评论中的建议从 download page下载不同版本的二进制文件(并将它们放在你的系统上有意义的地方),你就可以使用mlaunch通过指定来启动相同的测试配置不同的 binary path(和 data directory,port等,如果并行运行多个).

如果你没有找到额外的工具,你可以使用MongoDB提供的内部测试命令获得类似的结果,但请注意,这些命令目前被认为是内部用于测试目的,没有记录,可以更改(或停止工作) )在任何时候(我最近测试过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>

根据需要重复并重复使用您想要的任何版本,关闭它,简单地说Ctrl-C原始shell(希望仍然记录的东西).

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

// 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>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读