Not able to start mongod with replication set

I am following the third lecture of Chapter 2: Replication from the M103 course.

My file structure is:
C:\Users\Satan\Desktop\Github\data

  • node1.conf
  • m103-keyfile
  • db
    • node1
      • mongod.log

Similarly, I have also added my config file for node2 and node3 as well. I have also created folders for node2 and node3 in the above-specified structure.

node1.conf

storage:
  dbPath: C:\Users\Satan\Desktop\Github\data\db\node1
net:
  bindIp: 192.168.103.100,localhost
  port: 27011
security:
  authorization: enabled
  keyFile: C:\Users\Satan\Desktop\Github\data\m103-keyfile
systemLog:
  destination: file
  path: C:\Users\Satan\Desktop\Github\data\db\node1\mongod.log
  logAppend: true
replication:
  replSetName: m103-example

m103-keyfile
dGhpcyBpcyBteSBwYXNzd29yZA==

Command Used:
mongod -f node1.conf

After running the above command, I got the following logs:

{"t":{"$date":"2021-07-29T20:20:53.112+05:30"},"s":"I",  "c":"CONTROL",  "id":23285,   "ctx":"main","msg":"Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'"}
{"t":{"$date":"2021-07-29T20:20:53.983+05:30"},"s":"I",  "c":"NETWORK",  "id":4915701, "ctx":"main","msg":"Initialized wire specification","attr":{"spec":{"incomingExternalClient":{"minWireVersion":0,"maxWireVersion":13},"incomingInternalClient":{"minWireVersion":0,"maxWireVersion":13},"outgoing":{"minWireVersion":0,"maxWireVersion":13},"isInternalClient":true}}}
{"t":{"$date":"2021-07-29T20:20:53.984+05:30"},"s":"W",  "c":"ASIO",     "id":22601,   "ctx":"main","msg":"No TransportLayer configured during NetworkInterface startup"}
{"t":{"$date":"2021-07-29T20:20:53.986+05:30"},"s":"I",  "c":"NETWORK",  "id":4648602, "ctx":"main","msg":"Implicit TCP FastOpen in use."}
{"t":{"$date":"2021-07-29T20:20:54.097+05:30"},"s":"W",  "c":"ASIO",     "id":22601,   "ctx":"main","msg":"No TransportLayer configured during NetworkInterface startup"}
{"t":{"$date":"2021-07-29T20:20:54.097+05:30"},"s":"W",  "c":"ASIO",     "id":22601,   "ctx":"main","msg":"No TransportLayer configured during NetworkInterface startup"}
{"t":{"$date":"2021-07-29T20:20:54.097+05:30"},"s":"I",  "c":"REPL",     "id":5123008, "ctx":"main","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"TenantMigrationDonorService","ns":"config.tenantMigrationDonors"}}
{"t":{"$date":"2021-07-29T20:20:54.097+05:30"},"s":"I",  "c":"REPL",     "id":5123008, "ctx":"main","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"TenantMigrationRecipientService","ns":"config.tenantMigrationRecipients"}}
{"t":{"$date":"2021-07-29T20:20:54.099+05:30"},"s":"I",  "c":"CONTROL",  "id":4615611, "ctx":"initandlisten","msg":"MongoDB starting","attr":{"pid":1556,"port":27011,"dbPath":"C:/Users/Satan/Desktop/Github/data/db/node1","architecture":"64-bit","host":"DESKTOP-7RIBS2N"}}
{"t":{"$date":"2021-07-29T20:20:54.099+05:30"},"s":"I",  "c":"CONTROL",  "id":23398,   "ctx":"initandlisten","msg":"Target operating system minimum version","attr":{"targetMinOS":"Windows 7/Windows Server 2008 R2"}}
{"t":{"$date":"2021-07-29T20:20:54.099+05:30"},"s":"I",  "c":"CONTROL",  "id":23403,   "ctx":"initandlisten","msg":"Build Info","attr":{"buildInfo":{"version":"5.0.0","gitVersion":"1184f004a99660de6f5e745573419bda8a28c0e9","modules":[],"allocator":"tcmalloc","environment":{"distmod":"windows","distarch":"x86_64","target_arch":"x86_64"}}}}
{"t":{"$date":"2021-07-29T20:20:54.099+05:30"},"s":"I",  "c":"CONTROL",  "id":51765,   "ctx":"initandlisten","msg":"Operating System","attr":{"os":{"name":"Microsoft Windows 10","version":"10.0 (build 19042)"}}}
{"t":{"$date":"2021-07-29T20:20:54.099+05:30"},"s":"I",  "c":"CONTROL",  "id":21951,   "ctx":"initandlisten","msg":"Options set by command line","attr":{"options":{"config":"node1.conf","net":{"bindIp":"192.168.103.100,localhost","port":27011},"replication":{"replSetName":"m103-example"},"security":{"authorization":"enabled","keyFile":"C:\\Users\\Satan\\Desktop\\Github\\data\\m103-keyfile"},"storage":{"dbPath":"C:\\Users\\Satan\\Desktop\\Github\\data\\db\\node1"},"systemLog":{"destination":"file","logAppend":true,"path":"C:\\Users\\Satan\\Desktop\\Github\\data\\db\\node1\\mongod.log"}}}}
{"t":{"$date":"2021-07-29T20:20:54.105+05:30"},"s":"E",  "c":"CONTROL",  "id":20568,   "ctx":"initandlisten","msg":"Error setting up listener","attr":{"error":{"code":9001,"codeName":"SocketException","errmsg":"The requested address is not valid in its context."}}}
{"t":{"$date":"2021-07-29T20:20:54.105+05:30"},"s":"I",  "c":"REPL",     "id":4784900, "ctx":"initandlisten","msg":"Stepping down the ReplicationCoordinator for shutdown","attr":{"waitTimeMillis":15000}}
{"t":{"$date":"2021-07-29T20:20:54.106+05:30"},"s":"I",  "c":"COMMAND",  "id":4784901, "ctx":"initandlisten","msg":"Shutting down the MirrorMaestro"}
{"t":{"$date":"2021-07-29T20:20:54.106+05:30"},"s":"I",  "c":"SHARDING", "id":4784902, "ctx":"initandlisten","msg":"Shutting down the WaitForMajorityService"}
{"t":{"$date":"2021-07-29T20:20:54.106+05:30"},"s":"I",  "c":"NETWORK",  "id":4784905, "ctx":"initandlisten","msg":"Shutting down the global connection pool"}
{"t":{"$date":"2021-07-29T20:20:54.106+05:30"},"s":"I",  "c":"REPL",     "id":4784907, "ctx":"initandlisten","msg":"Shutting down the replica set node executor"}
{"t":{"$date":"2021-07-29T20:20:54.106+05:30"},"s":"I",  "c":"NETWORK",  "id":4784918, "ctx":"initandlisten","msg":"Shutting down the ReplicaSetMonitor"}
{"t":{"$date":"2021-07-29T20:20:54.106+05:30"},"s":"I",  "c":"SHARDING", "id":4784921, "ctx":"initandlisten","msg":"Shutting down the MigrationUtilExecutor"}
{"t":{"$date":"2021-07-29T20:20:54.106+05:30"},"s":"I",  "c":"ASIO",     "id":22582,   "ctx":"MigrationUtil-TaskExecutor","msg":"Killing all outstanding egress activity."}
{"t":{"$date":"2021-07-29T20:20:54.107+05:30"},"s":"I",  "c":"COMMAND",  "id":4784923, "ctx":"initandlisten","msg":"Shutting down the ServiceEntryPoint"}
{"t":{"$date":"2021-07-29T20:20:54.107+05:30"},"s":"I",  "c":"CONTROL",  "id":4784925, "ctx":"initandlisten","msg":"Shutting down free monitoring"}
{"t":{"$date":"2021-07-29T20:20:54.107+05:30"},"s":"I",  "c":"CONTROL",  "id":4784927, "ctx":"initandlisten","msg":"Shutting down the HealthLog"}
{"t":{"$date":"2021-07-29T20:20:54.107+05:30"},"s":"I",  "c":"CONTROL",  "id":4784928, "ctx":"initandlisten","msg":"Shutting down the TTL monitor"}
{"t":{"$date":"2021-07-29T20:20:54.107+05:30"},"s":"I",  "c":"CONTROL",  "id":4784929, "ctx":"initandlisten","msg":"Acquiring the global lock for shutdown"}
{"t":{"$date":"2021-07-29T20:20:54.107+05:30"},"s":"I",  "c":"-",        "id":4784931, "ctx":"initandlisten","msg":"Dropping the scope cache for shutdown"}
{"t":{"$date":"2021-07-29T20:20:54.107+05:30"},"s":"I",  "c":"FTDC",     "id":4784926, "ctx":"initandlisten","msg":"Shutting down full-time data capture"}
{"t":{"$date":"2021-07-29T20:20:54.107+05:30"},"s":"I",  "c":"CONTROL",  "id":20565,   "ctx":"initandlisten","msg":"Now exiting"}
{"t":{"$date":"2021-07-29T20:20:54.107+05:30"},"s":"I",  "c":"CONTROL",  "id":23138,   "ctx":"initandlisten","msg":"Shutting down","attr":{"exitCode":48}}

Things Tried:

  1. After searching a lot about it on google, I found that Windows doesn’t support forking the daemon. So, I removed fork.
  2. I have changed permission for m103-keyfile to Read Only.
  3. I have also tried to do this in Linux but it didn’t work there as well.

You are supposed to use IDE for this course where you have readymade config files
Why you are trying it on local host?
Your error log clearly says invalid address.The 192…IP in your bindIp is not valid

Please go through your lab instructions and follow that process

2 Likes

Thanks a lot. It worked perfectly in IDE.

If I want to add all members of replica sets in different servers, I will just have to add their IP Addresses in bindIp of all three files and while adding them in replication set, I will have to do, rs.add("server_ip_2:specified_port"). Is this correct?

Please let me know. I am beginner and sometimes, It’s hard to understand some concepts.

Yes add IP address of each server in their respective config file

Syntax for rs.add

rs.add(HOST_NAME:PORT)

1 Like

Okay. thanks for your help.

Hi @Chetan_Goyal,

To be clear on the use of bindIp: this setting determines which local IP addresses a MongoDB process listens to. Each member of your replica set would have a different local IP & net.bindIp configuration value.

For more context please see I can't set bindIp - #2 by Stennie.

Regards,
Stennie

1 Like

Thanks a lot for mentioning this. Earlier, I believed it can be the IP of other servers which we can access. But now, I understand that it should be the local IP.

1 Like