Contents

Introduction

Prerequisites

Requirements

Components Used

Problem: Error "MongoDB not able to start" is Encountered

Solution

Introduction

This document describes how to troubleshoot "MongoDB not able to start" error on CloudCenter Orchestrator (CCO).

Prerequisites

Requirements

Cisco recommends that you have knowledge of these topics:

- MongoDB

- Virtual Machine Environments

Components Used

The information in this document is based on CloudCenter version 4.7.x/4.8.x .

The information in this document was created from the devices in a specific lab environment. All of the devices used in this document started with a cleared (default) configuration. If your network is live, make sure that you understand the potential impact of any command.

Problem: Error "MongoDB not able to start" is Encountered

After you configure the MongoDB for CCO, it is likely to fail when it is not able to connect properly with MongoDB. This issue can arise due to many factors. However, the mentioned scenario is with the no sufficient hard disk space on CCO for launching MongoDB.

For troubleshooting this issue, it is always advisable to look the log files and check the actual cause of the error.

From CCO osmosix log you can find this error.

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}

Once you trying to start MongoDB service it throws this error.

service mongod start

And the error is

Job for mongod.service failed. See "systemctl status mongod.service" and "journalctl -xe" for details.

Now when you run:

sudo systemctl status mongod.service

you can get this error:

[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.

Solution

Try to start MongoDB service and check MongoDB logs you may find these errors on the log  /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 requires 3gb hard disk free space to get started. You have to ensure that the hard disk has sufficient space before launching an instance and a system restart would be needed for MongoDB to start automatically.