简介
本文档介绍如何对CloudCenter Orchestrator(CCO)上的“MongoDB无法启动”错误进行故障排除。
先决条件
要求
Cisco 建议您了解以下主题:
使用的组件
本文档中的信息基于CloudCenter 4.7.x/4.8.x版。
本文档中的信息都是基于特定实验室环境中的设备编写的。本文档中使用的所有设备最初均采用原始(默认)配置。如果您使用的是真实网络,请确保您已经了解所有命令的潜在影响。
问题:遇到错误“MongoDB无法启动”
为CCO配置MongoDB后,当它无法与MongoDB正确连接时,它可能会失败。此问题可能由多种因素引起。但是,上述场景在CCO上没有足够的硬盘空间来启动MongoDB。
要排除此问题,始终建议查看日志文件并检查错误的实际原因。
从CCO渗透日志中,您可以发现此错误。
INFO policy.GatewayPolicyServiceImpl Inject Context id org.springframework.web.context.WebApplicationContext: ,name Root WebApplicationContext
2017-05-22 06:58:17,077 ERROR context.ContextLoader [localhost-startStop-1] - Context initialization failed
com.mongodb.MongoTimeoutException: Timed out after 30000 ms while waiting for a server that matches ReadPreferenceServerSelector
. Client view of cluster state is {type=UNKNOWN, servers=[{address=localhost:27017, type=UNKNOWN, state=CONNECTING, exception=
{com.mongodb.MongoSocketOpenException: Exception opening socket}
尝试启动MongoDB服务后,它会引发此错误。
service mongod start
错误是
Job for mongod.service failed. See "systemctl status mongod.service" and "journalctl -xe" for details.
现在,当您运行时:
sudo systemctl status mongod.service
您可能会遇到以下错误:
[root@localhost ~]# systemctl status mongod.service
● mongod.service - SYSV: Mongo is a scalable, document-oriented database.
Loaded: loaded (/etc/rc.d/init.d/mongod; bad; vendor preset: disabled)
Active: failed (Result: exit-code) since Fri 2017-06-23 06:07:56 UTC; 19h ago
Docs: man:systemd-sysv-generator(8)
Process: 2547 ExecStop=/etc/rc.d/init.d/mongod stop (code=exited, status=0/SUCCESS)
Process: 2588 ExecStart=/etc/rc.d/init.d/mongod start (code=exited, status=1/FAILURE)
Main PID: 2350 (code=exited, status=0/SUCCESS)
Jun 23 06:07:56 localhost.localdomain systemd[1]: Starting SYSV: Mongo is a scalable, document-oriented database....
Jun 23 06:07:56 localhost.localdomain runuser[2597]: pam_unix(runuser:session): session opened for user mongod by (uid=0)
Jun 23 06:07:56 localhost.localdomain mongod[2588]: Starting mongod: [FAILED]
Jun 23 06:07:56 localhost.localdomain systemd[1]: mongod.service: control process exited, code=exited status=1
Jun 23 06:07:56 localhost.localdomain systemd[1]: Failed to start SYSV: Mongo is a scalable, document-oriented database..
Jun 23 06:07:56 localhost.localdomain systemd[1]: Unit mongod.service entered failed state.
Jun 23 06:07:56 localhost.localdomain systemd[1]: mongod.service failed.
解决方案
尝试启动MongoDB服务并检查MongoDB日志,您可能会在日志/var/log/mongodb/mongod.log上找到这些错误。
2017-06-23T06:07:56.763+0000 [initandlisten] recover : no journal files present, no recovery needed
2017-06-23T06:07:56.763+0000 [initandlisten]
2017-06-23T06:07:56.763+0000 [initandlisten] ERROR: Insufficient free space for journal files
2017-06-23T06:07:56.764+0000 [initandlisten] Please make at least 3379MB available in /var/lib/mongo/journal or use --smallfiles
2017-06-23T06:07:56.764+0000 [initandlisten]
2017-06-23T06:07:56.809+0000 [initandlisten] exception in initAndListen: 15926 Insufficient free space for journals, terminating
2017-06-23T06:07:56.809+0000 [initandlisten] dbexit:
2017-06-23T06:07:56.809+0000 [initandlisten] shutdown: going to close listening sockets...
Mongo需要3gb硬盘可用空间才能开始使用。在启动实例之前,您必须确保硬盘有足够的空间,而MongoDB是否需要重新启动系统?自动启动。