MongoDB:服务器有启动警告 [英] MongoDB: Server has startup warnings

查看:67
本文介绍了MongoDB:服务器有启动警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我今天首先安装了MongoDB 3.2.5.但是,当我启动它并使用MongoDB shell时,它在下面给了我这些警告:

I firstly installed MongoDB 3.2.5 today. But when I start it and use MongoDB shell, it gave me these warnings below:

C:\Windows\system32>mongo
MongoDB shell version: 3.2.5
connecting to: test
Server has startup warnings:
2016-04-16T11:06:17.943+0800 I CONTROL  [initandlisten]
2016-04-16T11:06:17.943+0800 I CONTROL  [initandlisten] ** WARNING: Insecure configuration, access control is not enabled and no --bind_ip has been specified.
2016-04-16T11:06:17.943+0800 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted,
2016-04-16T11:06:17.943+0800 I CONTROL  [initandlisten] **          and the server listens on all available network interfaces.
2016-04-16T11:06:17.943+0800 I CONTROL  [initandlisten]
>

我的操作系统是Microsoft Windows [version 10.0.10586].

my OS is Microsoft Windows [version 10.0.10586].

推荐答案

您尚未在Mongodb中配置安全功能,例如授权和身份验证.使用此链接了解更多细节.如果您要学习Mongodb,则可以忽略这一点.但是当产品要达到生产水平时.你应该关心他们. 您可以使用mongod --auth启用访问控制.

You haven't configure the security features in Mongodb like authorization and authentication. Use this link for more details. You can ignore this if you are going to learn Mongodb. But when the product is going to production level. you should concern them. You can enable access control by using mongod --auth.

例如,您可以运行mongod --auth --port 27017 --dbpath /data/db1.之后,您可以使用用户名和密码保护数据库.

For example you can run mongod --auth --port 27017 --dbpath /data/db1. After that you can secure your database with username and password.

您可以使用以下命令在数据库中添加用户.

you can add user in database using following command.

use admin
db.auth("myUserAdmin", "abc123" )

之后,您可以使用mongo --port 27017 -u "myUserAdmin" -p "abc123" --authenticationDatabase "admin"连接到数据库.

After that you can use mongo --port 27017 -u "myUserAdmin" -p "abc123" --authenticationDatabase "admin" to connect to the database.

您可以按如下所示在mongod.conf中添加bind_ip

You can add bind_ip in mongod.conf as follows,

`bind_ip = 127.0.0.1,192.168.161.100` 

如果需要,您可以定义许多.此bind_ip选项告诉MongoDB接受来自哪个本地网络接口的连接,而不是哪个远程IP地址"的连接. 并运行mongod --config <file path to your mongod.conf> 您总共可以运行mongod --auth --port 27017 --dbpath /data/db1 --config <file path to your mongod.conf>

You can define many if you need. This bind_ip option tells MongoDB to accept connections from which local network interfaces, not which "remote IP address". And run mongod --config <file path to your mongod.conf> Altogether you can run mongod --auth --port 27017 --dbpath /data/db1 --config <file path to your mongod.conf>

这篇关于MongoDB:服务器有启动警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆