Troubleshoot MongoDB

Troubleshoot MongoDBΒΆ

This section instructs you on how to troubleshoot the MongoDB failures.

To troubleshoot MongoDB:

  1. Log in to the MongoDB shell as Administrator into the admin collection:

    mongo -uadmin -p$(salt-call pillar.get mongodb:server:admin:password|tail -1|tr -d ' ') admin
    
  2. Verify the replica set configuration and status:

    rs.conf()
    rs.status()
    
  3. To force synchronization of one of the replicas, delete data in the replica directory and start MongoDB:

    Caution

    Proceed with caution to avoid any data loss.

    service mongodb stop
    mv /var/lib/mongodb /var/lib/mongodb.backup
    mkdir /var/lib/mongodb
    chown mongodb:mongodb /var/lib/mongodb
    service mongodb start