** WARNING: Access control is not enabled for the database.

原因分析:新版本的MongDB增加了安全性设计,推荐用户创建使用数据库时进行验证。如果用户想建立简单连接,则会提示警示信息。

解决方案:
创建管理员并设置密码

>use admin
>db.createUser(
{
user: "admin", //用户名
pwd: "passwd", //密码
roles: [ { role: "userAdminAnyDatabase", db: "admin" } ] //设置权限
}
)

重启数据库服务器

mongod --auth --port 27017

“--auth”命令即表示访问数据库需要认证。此处可不指定端口,则默认为27017。

启动后即可看到不再提示报警信息。

** WARNING: You are running this process as the root user, which is not recommended.

groupadd mgdb
useradd -g mgdb mgdb
passwd mgdb
Automng_123

chown -R mgdb.mgdb /usr/local/mongodb/
chown -R mgdb.mgdb /data/db/
su - mgdb
export PATH=/usr/local/mongodb/bin:$PATH

mongod -auth --port 27017

** WARNING: This server is bound to localhost.
** Remote systems will be unable to connect to this server.
** Start the server with --bind_ip <address> to specify which IP
** addresses it should serve responses from, or with --bind_ip_all to
** bind to all interfaces. If this behavior is desired, start the
** server with --bind_ip 127.0.0.1 to disable this warning.

mongod -auth --port 27017 --bind_ip=192.168.56.82

** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
** We suggest setting it to 'never'

查看大页为零
$ grep Huge /proc/meminfo
AnonHugePages: 92160 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB

临时解决方案
echo never >> /sys/kernel/mm/transparent_hugepage/enabled
echo never >> /sys/kernel/mm/transparent_hugepage/defrag

永久修改参考请https://www.cnblogs.com/ywcz060/p/5543228.html

然后再次启动mongodb
$ mongod -auth --port 27017 --bind_ip=192.168.56.82
2018-07-19T14:46:06.610+0800 I CONTROL [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
2018-07-19T14:46:06.620+0800 I CONTROL [initandlisten] MongoDB starting : pid=2723 port=27017 dbpath=/data/db 64-bit host=red4.local
2018-07-19T14:46:06.620+0800 I CONTROL [initandlisten] db version v4.0.0
2018-07-19T14:46:06.620+0800 I CONTROL [initandlisten] git version: 3b07af3d4f471ae89e8186d33bbb1d5259597d51
2018-07-19T14:46:06.620+0800 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.1e-fips 11 Feb 2013
2018-07-19T14:46:06.620+0800 I CONTROL [initandlisten] allocator: tcmalloc
2018-07-19T14:46:06.620+0800 I CONTROL [initandlisten] modules: none
2018-07-19T14:46:06.620+0800 I CONTROL [initandlisten] build environment:
2018-07-19T14:46:06.620+0800 I CONTROL [initandlisten] distmod: rhel70
2018-07-19T14:46:06.620+0800 I CONTROL [initandlisten] distarch: x86_64
2018-07-19T14:46:06.620+0800 I CONTROL [initandlisten] target_arch: x86_64
2018-07-19T14:46:06.620+0800 I CONTROL [initandlisten] options: { net: { bindIp: "192.168.56.82", port: 27017 }, security: { authorization: "enabled" } }
2018-07-19T14:46:06.621+0800 I STORAGE [initandlisten] Detected data files in /data/db created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2018-07-19T14:46:06.621+0800 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=407M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),statistics_log=(wait=0),verbose=(recovery_progress),
2018-07-19T14:46:07.437+0800 I STORAGE [initandlisten] WiredTiger message [1531982767:437636][2723:0x7f161f9eab00], txn-recover: Main recovery loop: starting at 6/6144
2018-07-19T14:46:07.530+0800 I STORAGE [initandlisten] WiredTiger message [1531982767:530163][2723:0x7f161f9eab00], txn-recover: Recovering log 6 through 7
2018-07-19T14:46:07.594+0800 I STORAGE [initandlisten] WiredTiger message [1531982767:594159][2723:0x7f161f9eab00], txn-recover: Recovering log 7 through 7
2018-07-19T14:46:07.642+0800 I STORAGE [initandlisten] WiredTiger message [1531982767:642404][2723:0x7f161f9eab00], txn-recover: Set global recovery timestamp: 0
2018-07-19T14:46:07.680+0800 I RECOVERY [initandlisten] WiredTiger recoveryTimestamp. Ts: Timestamp(0, 0)
2018-07-19T14:46:07.713+0800 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory '/data/db/diagnostic.data'
2018-07-19T14:46:07.714+0800 I NETWORK [initandlisten] waiting for connections on port 27017

使用用户认证后的登录方式

mongo --username=admin --password=passwd --host=192.168.56.82 --port=27017

补充说明,在测试过程中mongo启动占用内存约40M,这个值对于数据库来说,是非常小的。

mgo02_mongodb启动警告处理的更多相关文章

  1. Redis 启动警告错误解决[转]

    Redis 启动警告错误解决 启动错误 1.WARNING overcommit_memory is set to 0! Background save may fail under low memo ...

  2. Redis 启动警告解决【转】

    [root@centos224]# service redisd start :M Nov :: (it was originally set to ). _._ _.-``__ ''-._ _.-` ...

  3. Redis 启动警告解决

    Redis 启动警告解决[转] [root@centos224]# service redisd start 21985:M 24 Nov 04:07:20.376 * Increased maxim ...

  4. Redis启动警告错误解决

    启动错误 (1)WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxc ...

  5. Redis在CentOS7中的启动警告

    CentOS7安装Redis,启动时会出现如下图3个警告. 问题1:WARNING: The TCP backlog setting of 511 cannot be enforced because ...

  6. Redis 启动警告错误解决

    启动错误 1.WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. T ...

  7. redis启动警告解决

    vim /etc/rc.localecho never > /sys/kernel/mm/transparent_hugepage/enabled加入上面那句到/etc/rc.local,开机启 ...

  8. rails 5.2 启动警告 warning: previous definition of VERSION was here和bootsnap

    bootsnap依赖问题 You should add gem 'bootsnap' to your gemfile to install it or remove the line require ...

  9. spring boot 启动警告 WARN 15684 --- [ restartedMain] c.n.c.sources.URLConfigurationSource : No URLs will be polled as dynamic configuration sources. 解决

    添加一个配置文件config.properties ,即便是空的也是可以的

随机推荐

  1. C++面向对象类的实例题目七

    题目描述: 编写两个有意义的类,使一个类嵌套在另一个类中. 分析: 本题涉及两个类student和cdegree,前者为学生类,包含学生的学号(nubner),姓名(name)和成绩(degree), ...

  2. Data Mining: SSE,MSE,RMSE,R-square指标讲解

    转载自:http://blog.csdn.net/l18930738887/article/details/50629409 SSE(和方差.误差平方和):The sum of squares due ...

  3. RTX这种东西究竟有什么价值?

    我在第一家公司工作的时候,同事沟通用的就是RTX,第一感觉就是这么简单的软件也能卖钱? 这种东西有啥价值啊?不就是个没广告蓝色UI的qq吗? 还是那句话,当你已经习惯了一个东西之后,你不会感觉到他的价 ...

  4. 283E&EZOJ #89 Cow Tennis Tournament

    传送门 分析 我们考虑用所有的情况减去不合法的情况 不难想出所有情况为$C_n^3$ 于是我们考虑不合法的情况 我们知道对于一个不合法的三元组$(a,b,c)$一定是修改后$a<b,b>c ...

  5. Java中抽象类也能实例化.RP

    在Java中抽象类真的不能实例化么? 在学习的过程中,发现了一个问题,抽象类在没有实现所有的抽象方法前是不可以通过new来构建该对象的,但是抽象方法却是可以有自己的构造方法的.这样就把我搞糊涂了,既然 ...

  6. svn冲突问题详解 SVN版本冲突解决详解

    svn冲突问题详解 SVN版本冲突解决详解 (摘自西西软件园,原文链接http://www.cr173.com/html/46224_1.html) 解决版本冲突的命令.在冲突解决之后,需要使用svn ...

  7. Umbraco中获取UmbracoContext

    在Umbraco项目中,获取当前的UmbracoContext几乎是都需要用到的,我们一般通过一个静态方法来获取,代码如下 public class ContextHelpers { public s ...

  8. SpringMVC 配置式开发-HandlerMapping的执行流程(八)

    具体看这两块是怎么执行的 下图是实现了DispatcherServlet从HandleMapping获得处理器执行链的逻辑的源代码 下面是DispatcherServlet从HandleAdaptor ...

  9. 在Tomcat启动时直接创建servlet(二)

  10. shell脚本实现自动保留最近n次备份记录

    项目中出现的问题 某天上午服务器出现卡顿特别严重,页面加载速度奇慢,并且某些页面刷新出现404的问题,就连服务器的tab命令的自动提示都出现了问题,楼主费了九牛二虎之力,根据服务器排查发现,服务器数据 ...