问题描述
我在不同的地方有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 mongod
process you provide an argument to it --dbpath /directory
which is how it knows where the data folder is.
您需要做的只是:
- 停止旧计算机上的
mongod
进程.等到它退出. - 将整个/data/db目录复制到新计算机 在新计算机上
- 启动
mongod
进程并为其提供--dbpath /newdirectory
自变量.
- stop the
mongod
process on the old computer. wait till it exits. - copy the entire /data/db directory to the new computer
- 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的数据文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!