karaxuna
karaxuna

Reputation: 26940

One of replica members is not authorized

I have added mongolab instance to replica set. rs.status() looks like this:

            {
                    "_id" : 2,
                    "name" : "*****.mongolab.com:*****",
                    "health" : 0,
                    "state" : 6,
                    "stateStr" : "(not reachable/healthy)",
                    "uptime" : 0,
                    "optime" : Timestamp(0, 0),
                    "optimeDate" : ISODate("1970-01-01T00:00:00Z"),
                    "lastHeartbeat" : ISODate("2014-06-04T14:14:01Z"),
                    "lastHeartbeatRecv" : ISODate("1970-01-01T00:00:00Z"),
                    "pingMs" : 141,
                    "authenticated" : false
            }

How to authorize mongolab instance?

Upvotes: 0

Views: 385

Answers (1)

John Petrone
John Petrone

Reputation: 27507

Ok - first off never create a replica set of 2 members - if you lose one you will lose a quorum and won't be able to write to the surviving member. You need at least 3 members and should always be an odd number of voting members. If you don't want 3 copies of your data you can use an arbiter as one of the members.

http://docs.mongodb.org/manual/tutorial/deploy-replica-set/

More importantly, though, I don't believe you can do what you are trying to do. MongoDB instances that are members of a replica set need to be started with --replicaset "" and then added to the replica set via rs.add() after having initialized the first member with rs.initialize().

MongoLab provides shared hosting and most of their single instance plans are not a replica set, so I don't see how you can add them in this way.

I assume it's possible to start with a replica set plan at MongoLab and then add in new members from your local system but I've not tried it. I'd ask them directly if that's supported before giving it a try, should save you both time and money. In any event, a replica set plan from MongoLab is significantly more expensive per month than one of their single shared plans so keep that in mind too.

Upvotes: 1

Related Questions