[SERVER-14883] MongoDB replication does not work with authentication. Created: 13/Aug/14  Updated: 10/Dec/14  Resolved: 14/Aug/14

Status: Closed
Project: Core Server
Component/s: Replication
Affects Version/s: 2.2.7
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Vinod Sugur Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Steps To Reproduce:

Start mongod instance:

mongod --dbpath d:\data

From mong client create user:

db.addUser("u","p")
db.auth("u","p")

Stop the server and restart it with following options

mongod --dbpath d:\data --auth --replSet "rs0"

Execute following from mongo client with/without authentication

rs.initiate()

Participants:

 Description   

We have standalone MongoDB server which has authentication service enabled. We want to query oplog.rs collection to implement certain feature. When we try to enable replication we get following error.

(code)
> rs.initiate()
{
"info2" : "no configuration explicitly specified – making one",
"me" : "EDemo:37017",
"errmsg" : "couldn't initiate : can't find self in the replset config my port: 37017",
"ok" : 0
}

> db.isMaster()
{
"ismaster" : false,
"secondary" : false,
"info" : "can't get local.system.replset config from self or any seed (EMPTYCONFIG)",
"isreplicaset" : true,
"maxBsonObjectSize" : 16777216,
"localTime" : ISODate("2014-08-13T10:50:40.321Z"),
"ok" : 1
}

On server following error is observed:

invalid parameter: expected an object ()
[rsStart] replSet can't get local.system.replset config from self or any seed (EMPTYCONFIG)
(code)

If we disable authentication then replication works fine. please suggest.



 Comments   
Comment by Spencer Brody (Inactive) [ 14/Aug/14 ]

Great! Glad to hear it.

Comment by Vinod Sugur [ 14/Aug/14 ]

I configured mongod instance using keyFile and it is working fine.

Comment by Spencer Brody (Inactive) [ 13/Aug/14 ]

Looks like you have not provided a keyFile which is needed so that the nodes in the replica set can authenticate to each other. See this tutorial for more information on deploying a replica set with access control enabled.

Generated at Thu Feb 08 03:36:16 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.