好吧,重启可以使用stop和start命令,但我似乎无法使用--auth选项执行mongodb命令.
root@random:/home/random/public_html# mongodb stop
root@random:/home/random/public_html# start mongodb --auth
start: invalid option: --auth
root@random:/home/random/public_html# start mongodb
mongodb start/running, process 29473
root@random:/home/random/public_html#
Run Code Online (Sandbox Code Playgroud)
如何使用--auth选项启动mongodb?
Sco*_*dez 64
编辑/etc/mongod.conf并添加如下所示的行:
auth=true
Run Code Online (Sandbox Code Playgroud)
然后:
service mongod restart
Run Code Online (Sandbox Code Playgroud)
有关更多配置选项,请参阅此页面:http://www.mongodb.org/display/DOCS/File+Based+Configuration
对于MongoDB最新版本3.x以上代码不能正常工作,如果你使用mongodb 3.x,请在mongod.conf中的代码下面
security:
authorization: enabled
Run Code Online (Sandbox Code Playgroud)
Chi*_*edo 60
如果您使用的是MongoDB 3,则设置auth = true无法正常工作.您需要在/etc/mongod.conf中使用以下内容
security:
authorization: enabled
Run Code Online (Sandbox Code Playgroud)
Aka*_*ija 16
对于mongodb 3.2版
这是正确的配置
security:
authorization: "enabled"
Run Code Online (Sandbox Code Playgroud)
以String格式
小智 5
只想补充答案.对于MongoDB 3,/ etc/mongod.conf已更改.以下任一项都启用MondgoDB授权选项(--auth):
安全性:keyFile:[密钥文件的路径]
- 要么 -
安全性:授权:启用
| 归档时间: |
|
| 查看次数: |
26311 次 |
| 最近记录: |