😀
Notes
  • My Notes
  • Software Development
    • Getting Started
    • VSCodium
    • Go
  • System Administration
    • Networking cheatsheet
    • Infra security check tools
    • Using Ubuntu as a workstation
  • Application Infrastructure
    • Message Brokers
      • Kafka
      • NATS
    • Databases
      • MongoDB
      • MySQL
      • PostgreSQL
      • Redis
    • Kubernetes
      • Standard resources cheatsheet
      • Istio
      • Prometheus
    • Workflow Orchestrators
      • Airflow
  • Cloud Infrastructure
    • Terraform
      • AWS
        • Kubernetes IAM roles
  • Climbing
    • Overview of Climbing
    • Singapore
  • Crypto
    • Introduction to Crypto
    • Web3 terminology
  • Guides
    • Beginner's Guide to Personal Operational Security
Powered by GitBook
On this page
  • Reference Links
  • Configuration
  • Docker
  • Image
  • Compose
  • Debugging/error handling
  • Useful links
  • Exit code 14
  1. Application Infrastructure
  2. Databases

MongoDB

PreviousDatabasesNextMySQL

Last updated 1 year ago

Reference Links

Configuration

Docker

Image

Compose

version: "3.7"
services:
  mongo: # access with `mongosh 'mongodb://user:password@127.0.0.1/database?authSource=admin'`
    # image reference: https://hub.docker.com/_/mongo
    image: library/mongo:6.0.8
    environment:
      MONGO_INITDB_DATABASE: database
      MONGO_INITDB_ROOT_USERNAME: user
      MONGO_INITDB_ROOT_PASSWORD: password
    ports: ["27017:27017"]
    network_mode: host
    volumes: # [] # uncomment this and comment below to remove persistence
      - ./.data/mongodb/data/data/db:/data/db

Debugging/error handling

Useful links

Exit code 14

Keywords

"FileNotOpen", "Failed to open archive file"

Explanation

This exit code is formally defined as:


Returned by MongoDB applications which encounter an unrecoverable error, an uncaught exception or uncaught signal. The system exits without performing a clean shutdown.

Exploration

This error typically implies a system-level issue that prevents MongoDB from starting successfully.

Known Fixes 1 - MongoDB by Bitnami running in Kubernetes

This fix addresses an issue where the disk space allocated for MongoDB was filled to 100%

  • Update the statefulset resource so that the container's command is sleep 1000000.

  • Allow the MongoDB pod instances to restart

  • Get a shell into each of them and use df -h to view the available diskspace

  • Observe that /bitnami/mongodb is at 100% or near that

  • Using MongoDB logs, figure out where it is trying to write to, in this fix, the issue was with the diagnostic data and the following command was run to free up disk space:

rm -rf /bitnami/mongodb/data/db/diagnostic.data/*

Reference/useful links

Official MongoDB documentation on exit codes and statuses
https://stackoverflow.com/questions/68067064/mongodb-failed-to-start-due-to-filenotopen
Mongo - Official Image | Docker Hub
Logo