18. Which of the following choices is the preferred method for stopping a running mongod process from the command line? Assume mongod was run without the --fork flag. Choose the best answer:
题目选项
- A.running killall mongod or taskkill mongod from the terminal
- B.running db.shutdownServer() from the mongo shell
- C.pushing ctrl + break or ctrl + c from the terminal where mongod is running
- D.running db.dropDatabase() from the mongo shell
- E.closing the terminal the mongod is running in
答案置信度:高
正确答案:B
解析语言:中文
未使用 --fork 时,推荐在 mongo shell 里执行 db.shutdownServer()(即 admin 库的 shutdown 命令),它会让 mongod 干净地刷盘并退出。killall、关终端、ctrl+c 都属于强制或非正常终止,dropDatabase 只是删库,都不是停服手段。