我应该使用什么命令来更改安装在 linux 系统上的 MongoDB 的 dbPath
设置?默认设置位于 /etc/mongod.conf
storage:
dbPath: /var/lib/mongodb
journal:
enabled: true
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod.log
net:
port: 27017
bindIp: 127.0.0.1
最佳答案
您的意思是不使用编辑器更改 conf 文件吗?如果是,您可以使用“sed”
$ sed -i 's@/var/lib/mongodb@/your/new/directory/here@g' configfile
或者如果您只想更改 dbPath:
$ sed -i '/dbPath/s/:.*/: \/your\/new\/directory\/here' configfile
关于linux - 如何从 linux 命令行更改 MongoDB dbPath?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34635842/