Skip to content

Initializing replicaset with default configuration (single node) fails. #223

Closed

Description

@guptaarvindk

Initializing replicaset with default configuration (single node) fails. MongoDB server version: 3.6.0

rs.initiate()
{
"info2" : "no configuration specified. Using a default configuration for the set",
"me" : ":27017",
"ok" : 0,
"errmsg" : "FailedToParse: Empty host component parsing HostAndPort from ":27017" for member:{ _id: 0, host: ":27017" }",
"code" : 93,
"codeName" : "InvalidReplicaSetConfig"
}

Activity

  1. tianon commented on Dec 15, 2017

    @tianon
    Member

    I can't reproduce (taking into account #180 / #222 by adding --bind_ip_all, since we're talking about 3.6):

    $ docker pull mongo:3.6
    3.6: Pulling from library/mongo
    Digest: sha256:785f81e5cf14e8c2f6989bdf276cb025b076a8403f96f6ed45c8ec8161913fdd
    Status: Image is up to date for mongo:3.6
    
    $ docker run -dit --name mongo --hostname mongo mongo:3.6 --bind_ip_all --replSet some-repl
    5469769e0ae207d70f6e5b09642dcac23acee7707aaa5c7aaafc2d3e32b702fc
    
    $ docker logs --tail=2 mongo
    2017-12-15T04:20:49.167+0000 I REPL     [initandlisten] Did not find local replica set configuration document at startup;  NoMatchingDocument: Did not find replica set configuration document in local.system.replset
    2017-12-15T04:20:49.167+0000 I NETWORK  [initandlisten] waiting for connections on port 27017
    
    $ docker exec -it mongo mongo admin
    MongoDB shell version v3.6.0
    connecting to: mongodb://127.0.0.1:27017/admin
    MongoDB server version: 3.6.0
    Welcome to the MongoDB shell.
    For interactive help, type "help".
    For more comprehensive documentation, see
    	http://docs.mongodb.org/
    Questions? Try the support group
    	http://groups.google.com/group/mongodb-user
    Server has startup warnings: 
    2017-12-15T04:20:49.069+0000 I STORAGE  [initandlisten] 
    2017-12-15T04:20:49.069+0000 I STORAGE  [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
    2017-12-15T04:20:49.069+0000 I STORAGE  [initandlisten] **          See http://dochub.mongodb.org/core/prodnotes-filesystem
    2017-12-15T04:20:49.109+0000 I CONTROL  [initandlisten] 
    2017-12-15T04:20:49.109+0000 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
    2017-12-15T04:20:49.109+0000 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
    2017-12-15T04:20:49.109+0000 I CONTROL  [initandlisten] 
    2017-12-15T04:21:14.144+0000 E -        [main] Error loading history file: FileOpenFailed: Unable to fopen() file /root/.dbshell: No such file or directory
    > rs.initiate()
    {
    	"info2" : "no configuration specified. Using a default configuration for the set",
    	"me" : "mongo:27017",
    	"ok" : 1,
    	"operationTime" : Timestamp(1513311677, 1),
    	"$clusterTime" : {
    		"clusterTime" : Timestamp(1513311677, 1),
    		"signature" : {
    			"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
    			"keyId" : NumberLong(0)
    		}
    	}
    }
    some-repl:SECONDARY> rs.status()
    {
    	"set" : "some-repl",
    	"date" : ISODate("2017-12-15T04:21:58.368Z"),
    	"myState" : 1,
    	"term" : NumberLong(1),
    	"heartbeatIntervalMillis" : NumberLong(2000),
    	"optimes" : {
    		"lastCommittedOpTime" : {
    			"ts" : Timestamp(1513311709, 1),
    			"t" : NumberLong(1)
    		},
    		"readConcernMajorityOpTime" : {
    			"ts" : Timestamp(1513311709, 1),
    			"t" : NumberLong(1)
    		},
    		"appliedOpTime" : {
    			"ts" : Timestamp(1513311709, 1),
    			"t" : NumberLong(1)
    		},
    		"durableOpTime" : {
    			"ts" : Timestamp(1513311709, 1),
    			"t" : NumberLong(1)
    		}
    	},
    	"members" : [
    		{
    			"_id" : 0,
    			"name" : "mongo:27017",
    			"health" : 1,
    			"state" : 1,
    			"stateStr" : "PRIMARY",
    			"uptime" : 69,
    			"optime" : {
    				"ts" : Timestamp(1513311709, 1),
    				"t" : NumberLong(1)
    			},
    			"optimeDate" : ISODate("2017-12-15T04:21:49Z"),
    			"infoMessage" : "could not find member to sync from",
    			"electionTime" : Timestamp(1513311677, 2),
    			"electionDate" : ISODate("2017-12-15T04:21:17Z"),
    			"configVersion" : 1,
    			"self" : true
    		}
    	],
    	"ok" : 1,
    	"operationTime" : Timestamp(1513311709, 1),
    	"$clusterTime" : {
    		"clusterTime" : Timestamp(1513311709, 1),
    		"signature" : {
    			"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
    			"keyId" : NumberLong(0)
    		}
    	}
    }
  2. guptaarvindk commented on Dec 18, 2017

    @guptaarvindk
    Author

    In my case mongo server name is blank, thats what causing it to fail.

    "me" : ":27017",

    You think this could be happening because I dont have flag --bind_ip_all,

    My setup used to work until my kubernetes pod spec starting picking latest which is 3.6. When I moved back to older version mongo:3.4.10-jessie, its working again fine for me.

    Thanks,
    -Arvind

  3. tianon commented on Dec 18, 2017

    @tianon
    Member
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions