移动MongoDB的数据文件夹? [英] Moving MongoDB's data folder?

查看:130
本文介绍了移动MongoDB的数据文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在不同的地方有2台计算机(因此无法使用相同的wifi网络). 其中一个包含约50GB的数据(MongoDB文件),我想移至第二个,它具有更多的计算能力以进行分析.但是如何使第二台计算机上的MongoDB识别该文件夹?

I have 2 computers in different places (so it's impossible to use the same wifi network). One contains about 50GBs of data (MongoDB files) that I want to move to the second one which has much more computation power for analysis. But how can I make MongoDB on the second machine recognize that folder?

推荐答案

在启动mongod进程时,将为其提供一个参数--dbpath /directory,从而可以知道数据文件夹的位置.

When you start mongodprocess you provide an argument to it --dbpath /directory which is how it knows where the data folder is.

您需要做的只是:

  1. 停止旧计算机上的mongod进程.等到它退出.
  2. 将整个/data/db目录复制到新计算机
  3. 在新计算机上
  4. 启动mongod进程并为其提供--dbpath /newdirectory自变量.
  1. stop the mongod process on the old computer. wait till it exits.
  2. copy the entire /data/db directory to the new computer
  3. start mongod process on the new computer giving it --dbpath /newdirectory argument.

新计算机上的mongod将使用--dbpath指示的文件夹.无需识别",因为该文件夹中没有特定于计算机的机器,而只是数据.

The mongod on the new machine will use the folder you indicate with --dbpath. There is no need to "recognize" as there is nothing machine specific in that folder, it's just data.

这篇关于移动MongoDB的数据文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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