Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8714349
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:34:36+00:00 2026-06-13T05:34:36+00:00

I have a rather complicated problem that I think boils down to the following.

  • 0

I have a rather complicated problem that I think boils down to the following. This morning, I had a replica set consisting of hosts A, B and C with A being the primary. Then I lost A completely and B might have been down for a short while (I don’t know). It’s an ec2 instance, so when it came back it had a different host name (though it had the exact same ebs volume and thus the same file structure).

So at this point, as far as host names A is gone, and I have B, C and D. The contents of D is same as what A was, but the external world views them as two different hosts (which they are). Logging into mongo for B and C shows that they are secondary (priority 0) and it still lists the old host A with no priority noted:

SECONDARY> rs.conf() //this is from C
{
"_id" : "rs_0",
"version" : 1,
"members" : [
    {
        "_id" : 0,
        "host" : "A:27018"  //this is the dead guy ....
    },
    {
        "_id" : 1,
        "host" : "C:27019",
        "priority" : 0
    },
    {
        "_id" : 2,
        "host" : "B:27020",
        "priority" : 0
    }
]
}

Anything command I issue from B or C, comes back with a message telling me I’m not the master, so I can’t change any of the hosts in the conf record for this replica set.

Worst case scenario is I can use mongoexport and dump everything to json which is (a) a pain the ass and (b) very VERY ugly and (c) not really practical when I’m in prod.

So basically, it boils down to this. What do I do when I have a replica set and I lose control/access to the primary and want to add another host to take over that functionality?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T05:34:37+00:00Added an answer on June 13, 2026 at 5:34 am

    When you must reconfigure without a primary you can send the commands to a secondary, but you must include an extra option: {force:true}. This says that you know you are not talking to the primary but you want to force a reconfiguration anyway.

    Before you proceed though, I want to point out that Priority 0 on every secondary defeats the point of having replica set for automatic failover in case of primary failure. Priority 0 means the node can never become primary. Since the only non-0 node failed your replica set was left without a primary.

    I recommend having at least one secondary with a priority score higher than 0 (1 is the default). I also recommend using external/resolvable DNS names for your hosts rather than AWS names so that if you find yourself in this situation again you can just reassign the name that used to point at the now dead host to the new host that took its place. In that case you won’t need to reconfigure the replica set at all.

    For further reading I recommend: http://docs.mongodb.org/manual/tutorial/reconfigure-replica-set-with-unavailable-members/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following tricky problem: I have implemented a (rather complicated) class which
I have a page that loads a complicated set of forms. In this set
I have a rather complicated deploy setup for our Drupal site that is a
I have some rather odd behavior in my D program that I've narrowed down
I have a PHP script that I am using to generate some rather complicated
I have a rather complicated issue that I am trying to solve in PHP
I have a rather complicated lookup for an option. It comes from a separate
I have a rather complicated (and very inefficient) way of getting utilisation from a
I have rather large project that uses ICU regex classes. Basically it might run
I have a rather complicated toolchain so prepare for a lengthy post until getting

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.