[英]How to change mongodb data directory ubuntu
I want to change my mongodb data directory to my external media.我想将我的 mongodb 数据目录更改为我的外部媒体。 I have done a lot of search and tried many ways, but could not achieve it.
我做了很多搜索并尝试了很多方法,但无法实现。 The problem is that when I change data dir to my media (other than home dir), it does not work, but it works for home dir:
问题是,当我将数据目录更改为我的媒体(主目录除外)时,它不起作用,但它适用于主目录:
I follow these steps:我遵循以下步骤:
sudo nano /etc/mongodb.conf
Then, changed:然后,改变了:
# Where and how to store data.
storage:
dbPath: /home/nimashiri/mongodb
# engine:
# wiredTiger:
Then:然后:
sudo chown mongodb:mongodb /home/nimashiri/mongodb
When I try for my disk dir, it gives the following error:当我尝试我的磁盘目录时,出现以下错误:
● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2022-11-22 12:46:57 EST; 3s ago
Docs: https://docs.mongodb.org/manual
Process: 144014 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=100)
Main PID: 144014 (code=exited, status=100)
Nov 22 12:46:57 nimashiri-G5-5000 systemd[1]: Started MongoDB Database Server.
Nov 22 12:46:57 nimashiri-G5-5000 systemd[1]: mongod.service: Main process exited, code=exited, status=100/n/a
Nov 22 12:46:57 nimashiri-G5-5000 systemd[1]: mongod.service: Failed with result 'exit-code'.
Any idea?任何的想法?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.