一台linux部署多个数据库,linux – 在同一台服务器上安装多个mongoDB版本

看一下

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>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值