Company logo
  • Jobs
  • Bootcamp
  • About Us
  • For professionals
    • Home
    • Jobs
    • Courses
    • Questions
    • Teachers
    • Bootcamp
  • For business
    • Home
    • Our process
    • Plans
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Calculator

0

93
Views
mongodb replica sets -all nodes recovering

i am using a simple mongodb replica set configuration. i have one primary and two secondaries. every thing was fine until i planned to add access control to the mongodb instances.(i know how to add it)

i close down all mongod instances and when i restarted them , all the nodes went into RECOVERING state. i noticed when any (only one at a time) instance is running the state changes to SECONDARY. now to add access controll (use access) i have to be in PRIMARY node which cant come up because as soon as i start all the instances all go into RECOVERING state.

why is this happening? EDIT1: size of database is 700 Mb

EDIT2: i managed to bring back them to a consistent state , it was because i think before i had different settings in mongod.conf file. now i have two secondaries and one primary. now i want to add use access control how should i go about it so that nodes don't go into inconsistent state again.

8 months ago · Santiago Trujillo
1 answers
Answer question

0

The solution for me was to use keyFile authentication. So instead of:

security:
    authorization: enabled

use:

security:
  keyFile: <path-to-keyfile>

Basically I followed the instructions at:

https://docs.mongodb.com/manual/tutorial/enforce-keyfile-access-control-in-existing-replica-set

This guarantees a few things:

  1. It simultaneously enforces internal authentication (communication between replicas) and user access control
  2. With keyfile authentication, each mongod instances in the replica set uses the contents of the keyfile as the shared password for authenticating other members in the deployment. Only mongod instances with the correct keyfile can join the replica set.

8 months ago · Santiago Trujillo Report
Answer question
Find remote jobs