如何在Windows上更改mongodb数据目录 [英] How do I change mongodb data directory on windows
问题描述
我的MongoDB服务器运行良好,直到昨天.但是后来我遇到了这个错误:
My MongoDB server was running fine until yesterday. But then I encountered this error:
2020-03-31T10:21:25.981+0530 I CONTROL [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
2020-03-31T10:21:25.986+0530 I CONTROL [initandlisten] MongoDB starting : pid=7544 port=27017 dbpath=C:\data\db\ 64-bit host=DESKTOP-IP084D8
2020-03-31T10:21:25.987+0530 I CONTROL [initandlisten] targetMinOS: Windows 7/Windows Server 2008 R2
2020-03-31T10:21:25.987+0530 I CONTROL [initandlisten] db version v4.2.3
2020-03-31T10:21:25.987+0530 I CONTROL [initandlisten] git version: 6874650b362138df74be53d366bbefc321ea32d4
2020-03-31T10:21:25.987+0530 I CONTROL [initandlisten] allocator: tcmalloc
2020-03-31T10:21:25.987+0530 I CONTROL [initandlisten] modules: none
2020-03-31T10:21:25.987+0530 I CONTROL [initandlisten] build environment:
2020-03-31T10:21:25.987+0530 I CONTROL [initandlisten] distmod: 2012plus
2020-03-31T10:21:25.987+0530 I CONTROL [initandlisten] distarch: x86_64
2020-03-31T10:21:25.987+0530 I CONTROL [initandlisten] target_arch: x86_64
2020-03-31T10:21:25.988+0530 I CONTROL [initandlisten] options: {}
2020-03-31T10:21:25.990+0530 I STORAGE [initandlisten] exception in initAndListen: NonExistentPath: Data directory C:\data\db\ not found., terminating
2020-03-31T10:21:25.990+0530 I NETWORK [initandlisten] shutdown: going to close listening sockets...
2020-03-31T10:21:25.990+0530 I - [initandlisten] Stopping further Flow Control ticket acquisitions.
2020-03-31T10:21:25.990+0530 I CONTROL [initandlisten] now exiting
2020-03-31T10:21:25.991+0530 I CONTROL [initandlisten] shutting down with code:100
我不知道数据路径是如何改变的.我必须将MongoDB数据路径从 C:\ data \ db \
更改为 C:\ Program Files \ MongoDB \ Server \ 4.2 \ data
,所以我尝试更改它使用以下命令,但无法识别路径:
I do not know how the data path got changed. I have to change the MongoDB data path from C:\data\db\
to C:\Program Files\MongoDB\Server\4.2\data
, so I tried changing it using the following command, but it doesn't recognize the path:
mongod --dbpath C:\ Program Files \ MongoDB \ Server \ 4.2 \ data
在此处输入路径的格式应该是什么?
What should be the format of the path to be entered here?
推荐答案
使用CMD作为系统管理员,然后键入 mongod --dbpath C:\ myfolder \ myproj \ data \ db;
Use CMD as a system administrator and type mongod --dbpath C:\myfolder\myproj\data\db"
这篇关于如何在Windows上更改mongodb数据目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!