MongoDB:是否可以存储“数据目录"? (跨多个VM)在GlusterFS卷上运行,以便备用Mongo Server可以在需要时使用它? [英] MongoDB : Is it possible to store "Data Directory" on GlusterFS Volume (across Multiple VMs), so that standby Mongo Server can use it when required?

查看:93
本文介绍了MongoDB:是否可以存储“数据目录"? (跨多个VM)在GlusterFS卷上运行,以便备用Mongo Server可以在需要时使用它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是MongoDB中的新手.如果问题不够清楚,我感到抱歉.我的意思是:

I'm a newbie in MongoDB. And I'm sorry if the Question is not clear enough. What i mean is:

  • 我已经将 GlusterFS卷(在2个 CentOS 上配置)集群了.这意味着,可以从两个CentOS框中读取相同的数据目录:
  • 让我们打电话:CentOS-1CentOS-2
  • 我想在两个CentOS机器上安装MongoDB服务器mongod.但是只能启动(运行)一个. (CentOS-2上的另一个可能会被故意停止)
  • 然后,应用程序将连接到CentOS-1上的那个(当前处于活动状态).
  • I have clustered GlusterFS Volumes (configured on top of 2 CentOS). Which means, same data directory can be read from both CentOS boxes:
  • Lets call: CentOS-1 and CentOS-2
  • And i wanna install MongoDB Servers mongod on both CentOS boxes. But start (run) only one. (The other one on CentOS-2 might be purposely stopped)
  • Then the Applications will be connecting to that one (current Active) on CentOS-1.

这里是主要问题(请参考下图):

Here the main question comes in (please refer to the picture below):

  • 让我们说:如果CentOS-1服务器出现故障,我手动启动了另一个MongoDB服务器(在另一个框中的mongodCentOS-2上),然后让所有应用程序都连接到CentOS-2:
  • Let's say: if CentOS-1 Server goes down, and i manually start the another MongoDB Server (mongod on the another box CentOS-2), and let all the Applications to connect to CentOS-2:

(1)一切仍然可以正常工作吗?
(2)是否会像MySQL中那样出现锁定"问题?
(3)如果可行,是否意味着我们可以添加任意数量的MongoDB Server(以备用模式),并且只要它们摆动,就没有问题吗?

(1) Will everything be still working?
(2) Will there be 'lock' issues as in MySQL?
(3) If it works, does it mean, we can add any amount of MongoDB Servers (in stand-by mode), and whenever they swing, there's no problem?

注意:

感谢所有高级意见:)

推荐答案

可以.只要您计划使用相同版本的mongodb和相同的操作系统,就可以将数据文件移动到其他服务器上不会有任何问题.移动文件时,请确保删除mongodb.lock文件(如果它在数据目录中).

Yes you can. There won't be any problem in moving the data files to a different server as long as you plan to use the same version of mongodb and the same operating system. When you move the files make sure to delete the mongodb.lock file if it exists in data directory.

这篇关于MongoDB:是否可以存储“数据目录"? (跨多个VM)在GlusterFS卷上运行,以便备用Mongo Server可以在需要时使用它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆