简体   繁体   English

同一台服务器上运行的2个MongoDB实例可以指向同一数据文件夹吗?

[英]Can 2 MongoDB instances running on the same server point to the same data folder ?

I am in the process of upgrading my MongoDB replica set from 2.6 to 3.2. 我正在将MongoDB副本集从2.6升级到3.2。 We are planning to create another replica set on the same set of machines as an option to fallback in case something goes wrong. 我们计划在同一台计算机上创建另一个副本集,以备不时之需以备不时之需。 In this context, I am trying to find out if the new mongod instance that i would install (on each of these servers to form a replica set) can point to the already existing data files folder being used by the live mongod instance ? 在这种情况下,我试图确定我将安装的新mongod实例(在这些服务器中的每一个上以形成副本集)是否可以指向该活动mongod实例正在使用的现有数据文件文件夹? Or do i have to take a dump and restore via mongodump/mongorestore ? 还是我必须转储并通过mongodump / mongorestore恢复?

Thank you !! 谢谢 !!

Yes, you can do that if you are planning to upgrade your instance to 3.2 without upgrading to WiredTiger engine. 是的,如果您打算将实例升级到3.2而无需升级到WiredTiger引擎,则可以这样做。 If upgrading to WiredTiger enine, than you need to reindex your data as MMAP and Wiredtiger engines are not compatible. 如果升级到WiredTiger引擎,则需要重新索引数据,因为MMAP和Wiredtiger引擎不兼容。

To run two instances of mongoDB using same data: 要使用相同的数据运行两个mongoDB实例:

  1. create a directory for your second instance. 为您的第二个实例创建目录。
  2. soft link all data from first instance directory except lock files. 软链接来自第一个实例目录的所有数据(锁定文件除外)。
  3. run your second instance with --dbpath argument pointing to second instance directory. 使用指向第二个实例目录的--dbpath参数运行第二个实例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Jetty Web服务器实例是否共享相同的JVM? - Will the Jetty web server instances share the same JVM? 运行同一脚本 NodeJS 的多个实例 - 子进程 - Running multiple instances of the same script NodeJS - Child Processes 同时运行一个jar的多个实例:内存问题 - Running multiple instances of a jar at the same time: memory issue 如何检查Shell脚本中的两个变量是否指向同一文件夹? - How to check if two variables in a shell script point to the same folder? 如何让多个keepalived实例在同一服务器上运行? - How to let multiple keepalived instances run in same server? 在同一台服务器上运行Tomcat和JBoss是否有陷阱? - Is there any pitfalls running Tomcat and JBoss on the same server? 从服务器运行程序并将其连接到同一客户端 - Running a program from Server and connecting this to the same client 如何解压同一个文件夹中的一堆相同的包? - How can I untar a bunch of same packages inside a same folder? 使用40个不同的“标识” VS运行同一程序。 运行该程序的40个实例。 优点和缺点? - Running the same program with 40 different 'identities' Vs. running 40 instances of the program. Pros and Cons? 如何保护我的应用程序数据免受同一用户上运行的其他应用程序的侵害? - What can I do to protect my application's data from other applications running on the same user?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM