MongoDB service on AWS not starting

Keywords: MongoDB - AWS - Technical issue - Services (Apache, MariaDB, MySQL…)

bndiagnostic ID: 0d5a5d42-4ce0-abc2-4062-97e24602dce4

bndiagnostic output:

? Connectivity: Found possible issues
? Processes: Found possible issues
https://docs.bitnami.com/general/faq/administration/use-firewall/

bndiagnostic failure reason: The suggested guides are not related with my issue

Description:
Hi,
My MongoDB service did not start automatically on System reboot from AWS console. To figure out the issue I logged in to the EC2 instance and following are the result of various commands. Still MongoDB is not starting. I am really stuck here.

1.sudo /opt/bitnami/ctlscript.sh status

Cannot find any running daemon to contact. If it is running, make sure you are pointing to the right pid file (/var/run/gonit.pid)

After above error I ran following command:

2: sudo /opt/bitnami/ctlscript.sh start

Starting services…
Job for bitnami.service failed because the control process exited with error code.
See “systemctl status bitnami.service” and “journalctl -xe” for details.

  1. systemctl status bitnami.service

lines 1-15/15 (END)…skipping…
● bitnami.service - LSB: bitnami init script
Loaded: loaded (/etc/init.d/bitnami; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sun 2022-01-16 21:35:57 UTC; 47s ago
Process: 816 ExecStart=/etc/init.d/bitnami start (code=exited, status=1/FAILURE)

Jan 16 21:35:57 ip-172-31-29-196 bitnami[816]: mongodb 21:35:57.85 ERROR ==> An error occurred when starting mongodb
Jan 16 21:35:57 ip-172-31-29-196 bitnami[816]: 2022-01-16T21:35:57.863Z - error: Unable to perform start operation Export start for mongodb failed with exit code 1
Jan 16 21:35:57 ip-172-31-29-196 bitnami[816]: ## 2022-01-16 21:35:57+00:00 ## INFO ## Running /opt/bitnami/var/init/post-start/010_bitnami_agent_extra…
Jan 16 21:35:57 ip-172-31-29-196 bitnami[816]: ## 2022-01-16 21:35:57+00:00 ## INFO ## Running /opt/bitnami/var/init/post-start/020_bitnami_agent…
Jan 16 21:35:57 ip-172-31-29-196 bitnami[816]: ## 2022-01-16 21:35:57+00:00 ## INFO ## Running /opt/bitnami/var/init/post-start/030_update_welcome_file…
Jan 16 21:35:57 ip-172-31-29-196 bitnami[816]: ## 2022-01-16 21:35:57+00:00 ## INFO ## Running /opt/bitnami/var/init/post-start/040_bitnami_credentials_file…
Jan 16 21:35:57 ip-172-31-29-196 bitnami[816]: ## 2022-01-16 21:35:57+00:00 ## INFO ## Running /opt/bitnami/var/init/post-start/050_clean_metadata…
Jan 16 21:35:57 ip-172-31-29-196 systemd[1]: bitnami.service: Control process exited, code=exited, status=1/FAILURE
Jan 16 21:35:57 ip-172-31-29-196 systemd[1]: bitnami.service: Failed with result ‘exit-code’.
Jan 16 21:35:57 ip-172-31-29-196 systemd[1]: Failed to start LSB: bitnami init script.

Can not figure out what s stopping from MongoDB to start. Note that it was working system which suddenly stopped after reboot.

I also checked the diskSpace for any issue and that seems to be ok :

sudo fdisk -l

Disk /dev/nvme0n1: 50 GiB, 53687091200 bytes, 104857600 sectors
Disk model: Amazon Elastic Block Store
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 77DF7ADC-D0A3-1649-900D-5F83E184311A

Device Start End Sectors Size Type
/dev/nvme0n1p1 262144 104857566 104595423 49.9G Linux filesystem
/dev/nvme0n1p14 2048 8191 6144 3M BIOS boot
/dev/nvme0n1p15 8192 262143 253952 124M EFI System

Partition table entries are not in disk order.

Please help.

To Add, I also do not see the data folder when connected to console as bitnami user. where can I locate data/db folder.

when I run Mongod command from console I can see this error as well:
“c”:“STORAGE”, “id”:20557, “ctx”:“initandlisten”,“msg”:“DBException in initAndListen, terminating”,“attr”:{“error”:“NonExistentPath: Data directory /data/db not found. Create the missing directory or specify another path using (1) the --dbpath command line option, or (2) by adding the ‘storage.dbPath’ option in the configuration file.”}}

Hi @prasoon.rana,

The gonit service takes some time to be started. However, you can start the services by running these commands

sudo gonit
sleep 10
sudo gonit status
sudo /opt/bitnami/ctlscript.sh start
for file in `find /opt/bitnami/scripts/ -name start.sh`; do sudo $file; done

All the MongoDB information is inside the /opt/bitnami/mongodb folder. However, the data folder is symlinked to this other one: /bitnami/mongodb/data/db

Happy to help!


Was my answer helpful? Click on :heart:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.