I have this config file in my windows machine:
# mongod.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# Where and how to store data.
storage:
dbPath: C:\Program Files\MongoDB\Server\6.0\data
journal:
enabled: true
# engine:
# wiredTiger:
# where to write logging data.
systemLog:
destination: file
logAppend: true
path: C:\Program Files\MongoDB\Server\6.0\log\mongod.log
# network interfaces
net:
port: 27017
bindIp: 127.0.0.1
# replication options
replication:
replSetName: rs0
oplogSizeMB: 100
enableMajorityReadConcern: true
#processManagement:
security:
authorization: disabled
#operationProfiling:
#replication:
#sharding:
## Enterprise-Only Options:
#auditLog:
#snmp:
I would like to enable replication, I have named my set rs0
.
When I try to start the instance using:
"C:\Program Files\MongoDB\Server\6.0\bin\mongod.exe" --port 27017 --replSet rs0 --dbpath="C:\Program Files\MongoDB\Server\6.0\data"
I always get this:
C:\Windows\System32>"C:\Program Files\MongoDB\Server\6.0\bin\mongod.exe" --port 27017 --replSet rs0 --dbpath="C:\Program Files\MongoDB\Server\6.0\data"
{"t":{"$date":"2023-04-14T02:09:01.610+03:00"},"s":"I", "c":"CONTROL", "id":23285, "ctx":"-","msg":"Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'"}
{"t":{"$date":"2023-04-14T02:09:01.615+03:00"},"s":"I", "c":"NETWORK", "id":4915701, "ctx":"-","msg":"Initialized wire specification","attr":{"spec":{"incomingExternalClient":{"minWireVersion":0,"maxWireVersion":17},"incomingInternalClient":{"minWireVersion":0,"maxWireVersion":17},"outgoing":{"minWireVersion":6,"maxWireVersion":17},"isInternalClient":true}}}
{"t":{"$date":"2023-04-14T02:09:03.136+03:00"},"s":"I", "c":"NETWORK", "id":4648602, "ctx":"thread1","msg":"Implicit TCP FastOpen in use."}
{"t":{"$date":"2023-04-14T02:09:03.138+03:00"},"s":"I", "c":"REPL", "id":5123008, "ctx":"thread1","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"TenantMigrationDonorService","namespace":"config.tenantMigrationDonors"}}
{"t":{"$date":"2023-04-14T02:09:03.138+03:00"},"s":"I", "c":"REPL", "id":5123008, "ctx":"thread1","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"TenantMigrationRecipientService","namespace":"config.tenantMigrationRecipients"}}
{"t":{"$date":"2023-04-14T02:09:03.138+03:00"},"s":"I", "c":"REPL", "id":5123008, "ctx":"thread1","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"ShardSplitDonorService","namespace":"config.tenantSplitDonors"}}
{"t":{"$date":"2023-04-14T02:09:03.138+03:00"},"s":"I", "c":"CONTROL", "id":5945603, "ctx":"thread1","msg":"Multi threading initialized"}
{"t":{"$date":"2023-04-14T02:09:03.140+03:00"},"s":"I", "c":"CONTROL", "id":4615611, "ctx":"initandlisten","msg":"MongoDB starting","attr":{"pid":4360,"port":27017,"dbPath":"C:/Program Files/MongoDB/Server/6.0/data","architecture":"64-bit","host":"DESKTOP-J8NQ0TF"}}
{"t":{"$date":"2023-04-14T02:09:03.140+03:00"},"s":"I", "c":"CONTROL", "id":23398, "ctx":"initandlisten","msg":"Target operating system minimum version","attr":{"targetMinOS":"Windows 7/Windows Server 2008 R2"}}
{"t":{"$date":"2023-04-14T02:09:03.140+03:00"},"s":"I", "c":"CONTROL", "id":23403, "ctx":"initandlisten","msg":"Build Info","attr":{"buildInfo":{"version":"6.0.5","gitVersion":"c9a99c120371d4d4c52cbb15dac34a36ce8d3b1d","modules":[],"allocator":"tcmalloc","environment":{"distmod":"windows","distarch":"x86_64","target_arch":"x86_64"}}}}
{"t":{"$date":"2023-04-14T02:09:03.140+03:00"},"s":"I", "c":"CONTROL", "id":51765, "ctx":"initandlisten","msg":"Operating System","attr":{"os":{"name":"Microsoft Windows 10","version":"10.0 (build 22621)"}}}
{"t":{"$date":"2023-04-14T02:09:03.141+03:00"},"s":"I", "c":"CONTROL", "id":21951, "ctx":"initandlisten","msg":"Options set by command line","attr":{"options":{"net":{"port":27017},"replication":{"replSet":"rs0"},"storage":{"dbPath":"C:\\Program Files\\MongoDB\\Server\\6.0\\data"}}}}
{"t":{"$date":"2023-04-14T02:09:03.143+03:00"},"s":"I", "c":"STORAGE", "id":22315, "ctx":"initandlisten","msg":"Opening WiredTiger","attr":{"config":"create,cache_size=7620M,session_max=33000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,remove=true,path=journal,compressor=snappy),builtin_extension_config=(zstd=(compression_level=6)),file_manager=(close_idle_time=600,close_scan_interval=10,close_handle_minimum=2000),statistics_log=(wait=0),json_output=(error,message),verbose=[recovery_progress:1,checkpoint_progress:1,compact_progress:1,backup:0,checkpoint:0,compact:0,evict:0,history_store:0,recovery:0,rts:0,salvage:0,tiered:0,timestamp:0,transaction:0,verify:0,log:0],"}}
{"t":{"$date":"2023-04-14T02:09:03.217+03:00"},"s":"I", "c":"STORAGE", "id":4795906, "ctx":"initandlisten","msg":"WiredTiger opened","attr":{"durationMillis":74}}
{"t":{"$date":"2023-04-14T02:09:03.217+03:00"},"s":"I", "c":"RECOVERY", "id":23987, "ctx":"initandlisten","msg":"WiredTiger recoveryTimestamp","attr":{"recoveryTimestamp":{"$timestamp":{"t":0,"i":0}}}}
{"t":{"$date":"2023-04-14T02:09:03.376+03:00"},"s":"W", "c":"CONTROL", "id":22120, "ctx":"initandlisten","msg":"Access control is not enabled for the database. Read and write access to data and configuration is unrestricted","tags":["startupWarnings"]}
{"t":{"$date":"2023-04-14T02:09:03.377+03:00"},"s":"W", "c":"CONTROL", "id":22140, "ctx":"initandlisten","msg":"This server is bound to localhost. Remote systems will be unable to connect to this server. Start the server with --bind_ip <address> to specify which IP addresses it should serve responses from, or with --bind_ip_all to bind to all interfaces. If this behavior is desired, start the server with --bind_ip 127.0.0.1 to disable this warning","tags":["startupWarnings"]}
{"t":{"$date":"2023-04-14T02:09:03.377+03:00"},"s":"I", "c":"REPL", "id":5853300, "ctx":"initandlisten","msg":"current featureCompatibilityVersion value","attr":{"featureCompatibilityVersion":"unset","context":"startup"}}
{"t":{"$date":"2023-04-14T02:09:03.378+03:00"},"s":"I", "c":"STORAGE", "id":5071100, "ctx":"initandlisten","msg":"Clearing temp directory"}
{"t":{"$date":"2023-04-14T02:09:03.378+03:00"},"s":"I", "c":"CONTROL", "id":20536, "ctx":"initandlisten","msg":"Flow Control is enabled on this deployment"}
{"t":{"$date":"2023-04-14T02:09:03.547+03:00"},"s":"I", "c":"FTDC", "id":20625, "ctx":"initandlisten","msg":"Initializing full-time diagnostic data capture","attr":{"dataDirectory":"C:/Program Files/MongoDB/Server/6.0/data/diagnostic.data"}}
{"t":{"$date":"2023-04-14T02:09:03.550+03:00"},"s":"I", "c":"STORAGE", "id":20320, "ctx":"initandlisten","msg":"createCollection","attr":{"namespace":"local.startup_log","uuidDisposition":"generated","uuid":{"uuid":{"$uuid":"ea3d8409-9cec-48d6-98ff-a3631856ea64"}},"options":{"capped":true,"size":10485760}}}
{"t":{"$date":"2023-04-14T02:09:03.914+03:00"},"s":"I", "c":"INDEX", "id":20345, "ctx":"initandlisten","msg":"Index build: done building","attr":{"buildUUID":null,"collectionUUID":{"uuid":{"$uuid":"ea3d8409-9cec-48d6-98ff-a3631856ea64"}},"namespace":"local.startup_log","index":"_id_","ident":"index-1-8305521056144148365","collectionIdent":"collection-0-8305521056144148365","commitTimestamp":null}}
{"t":{"$date":"2023-04-14T02:09:03.915+03:00"},"s":"I", "c":"REPL", "id":6015317, "ctx":"initandlisten","msg":"Setting new configuration state","attr":{"newState":"ConfigStartingUp","oldState":"ConfigPreStart"}}
{"t":{"$date":"2023-04-14T02:09:03.915+03:00"},"s":"I", "c":"REPL", "id":6005300, "ctx":"initandlisten","msg":"Starting up replica set aware services"}
{"t":{"$date":"2023-04-14T02:09:03.916+03:00"},"s":"I", "c":"REPL", "id":4280500, "ctx":"initandlisten","msg":"Attempting to create internal replication collections"}
{"t":{"$date":"2023-04-14T02:09:03.916+03:00"},"s":"I", "c":"STORAGE", "id":20320, "ctx":"initandlisten","msg":"createCollection","attr":{"namespace":"local.replset.oplogTruncateAfterPoint","uuidDisposition":"generated","uuid":{"uuid":{"$uuid":"68a7307c-6ed3-44e7-9fa3-c995511837f4"}},"options":{}}}
{"t":{"$date":"2023-04-14T02:09:03.917+03:00"},"s":"I", "c":"-", "id":4939300, "ctx":"monitoring-keys-for-HMAC","msg":"Failed to refresh key cache","attr":{"error":"ReadConcernMajorityNotAvailableYet: Read concern majority reads are currently not possible.","nextWakeupMillis":200}}
{"t":{"$date":"2023-04-14T02:09:04.005+03:00"},"s":"W", "c":"REPL", "id":21533, "ctx":"ftdc","msg":"Rollback ID is not initialized yet"}
{"t":{"$date":"2023-04-14T02:09:04.026+03:00"},"s":"I", "c":"INDEX", "id":20345, "ctx":"initandlisten","msg":"Index build: done building","attr":{"buildUUID":null,"collectionUUID":{"uuid":{"$uuid":"68a7307c-6ed3-44e7-9fa3-c995511837f4"}},"namespace":"local.replset.oplogTruncateAfterPoint","index":"_id_","ident":"index-3-8305521056144148365","collectionIdent":"collection-2-8305521056144148365","commitTimestamp":null}}
{"t":{"$date":"2023-04-14T02:09:04.026+03:00"},"s":"I", "c":"STORAGE", "id":20320, "ctx":"initandlisten","msg":"createCollection","attr":{"namespace":"local.replset.minvalid","uuidDisposition":"generated","uuid":{"uuid":{"$uuid":"aae4d3d7-ccb0-4b2f-b3ed-e28275cc8490"}},"options":{}}}
{"t":{"$date":"2023-04-14T02:09:04.119+03:00"},"s":"I", "c":"-", "id":4939300, "ctx":"monitoring-keys-for-HMAC","msg":"Failed to refresh key cache","attr":{"error":"ReadConcernMajorityNotAvailableYet: Read concern majority reads are currently not possible.","nextWakeupMillis":400}}
{"t":{"$date":"2023-04-14T02:09:04.119+03:00"},"s":"I", "c":"INDEX", "id":20345, "ctx":"initandlisten","msg":"Index build: done building","attr":{"buildUUID":null,"collectionUUID":{"uuid":{"$uuid":"aae4d3d7-ccb0-4b2f-b3ed-e28275cc8490"}},"namespace":"local.replset.minvalid","index":"_id_","ident":"index-5-8305521056144148365","collectionIdent":"collection-4-8305521056144148365","commitTimestamp":null}}
{"t":{"$date":"2023-04-14T02:09:04.120+03:00"},"s":"I", "c":"STORAGE", "id":20320, "ctx":"initandlisten","msg":"createCollection","attr":{"namespace":"local.replset.election","uuidDisposition":"generated","uuid":{"uuid":{"$uuid":"6d483ec5-6ba9-4e00-8632-88dbf0a46ca1"}},"options":{}}}
{"t":{"$date":"2023-04-14T02:09:04.191+03:00"},"s":"I", "c":"INDEX", "id":20345, "ctx":"initandlisten","msg":"Index build: done building","attr":{"buildUUID":null,"collectionUUID":{"uuid":{"$uuid":"6d483ec5-6ba9-4e00-8632-88dbf0a46ca1"}},"namespace":"local.replset.election","index":"_id_","ident":"index-7-8305521056144148365","collectionIdent":"collection-6-8305521056144148365","commitTimestamp":null}}
{"t":{"$date":"2023-04-14T02:09:04.192+03:00"},"s":"I", "c":"REPL", "id":4280501, "ctx":"initandlisten","msg":"Attempting to load local voted for document"}
{"t":{"$date":"2023-04-14T02:09:04.192+03:00"},"s":"I", "c":"REPL", "id":21311, "ctx":"initandlisten","msg":"Did not find local initialized voted for document at startup"}
{"t":{"$date":"2023-04-14T02:09:04.193+03:00"},"s":"I", "c":"REPL", "id":4280502, "ctx":"initandlisten","msg":"Searching for local Rollback ID document"}
{"t":{"$date":"2023-04-14T02:09:04.193+03:00"},"s":"I", "c":"REPL", "id":21312, "ctx":"initandlisten","msg":"Did not find local Rollback ID document at startup. Creating one"}
{"t":{"$date":"2023-04-14T02:09:04.194+03:00"},"s":"I", "c":"STORAGE", "id":20320, "ctx":"initandlisten","msg":"createCollection","attr":{"namespace":"local.system.rollback.id","uuidDisposition":"generated","uuid":{"uuid":{"$uuid":"ce6758f0-715c-4c6f-b7d6-de32e54cc633"}},"options":{}}}
{"t":{"$date":"2023-04-14T02:09:04.217+03:00"},"s":"I", "c":"INDEX", "id":20345, "ctx":"initandlisten","msg":"Index build: done building","attr":{"buildUUID":null,"collectionUUID":{"uuid":{"$uuid":"ce6758f0-715c-4c6f-b7d6-de32e54cc633"}},"namespace":"local.system.rollback.id","index":"_id_","ident":"index-9-8305521056144148365","collectionIdent":"collection-8-8305521056144148365","commitTimestamp":null}}
{"t":{"$date":"2023-04-14T02:09:04.218+03:00"},"s":"I", "c":"REPL", "id":21531, "ctx":"initandlisten","msg":"Initialized the rollback ID","attr":{"rbid":1}}
{"t":{"$date":"2023-04-14T02:09:04.220+03:00"},"s":"I", "c":"REPL", "id":21313, "ctx":"initandlisten","msg":"Did not find local replica set configuration document at startup","attr":{"error":{"code":47,"codeName":"NoMatchingDocument","errmsg":"Did not find replica set configuration document in local.system.replset"}}}
{"t":{"$date":"2023-04-14T02:09:04.225+03:00"},"s":"I", "c":"REPL", "id":6015317, "ctx":"initandlisten","msg":"Setting new configuration state","attr":{"newState":"ConfigUninitialized","oldState":"ConfigStartingUp"}}
{"t":{"$date":"2023-04-14T02:09:04.227+03:00"},"s":"I", "c":"STORAGE", "id":20320, "ctx":"initandlisten","msg":"createCollection","attr":{"namespace":"local.system.views","uuidDisposition":"generated","uuid":{"uuid":{"$uuid":"48a10d2a-4188-4da4-bca7-0c4164b6fe49"}},"options":{}}}
{"t":{"$date":"2023-04-14T02:09:04.257+03:00"},"s":"I", "c":"INDEX", "id":20345, "ctx":"initandlisten","msg":"Index build: done building","attr":{"buildUUID":null,"collectionUUID":{"uuid":{"$uuid":"48a10d2a-4188-4da4-bca7-0c4164b6fe49"}},"namespace":"local.system.views","index":"_id_","ident":"index-11-8305521056144148365","collectionIdent":"collection-10-8305521056144148365","commitTimestamp":null}}
{"t":{"$date":"2023-04-14T02:09:04.258+03:00"},"s":"I", "c":"STORAGE", "id":22262, "ctx":"initandlisten","msg":"Timestamp monitor starting"}
{"t":{"$date":"2023-04-14T02:09:04.263+03:00"},"s":"I", "c":"CONTROL", "id":20714, "ctx":"LogicalSessionCacheRefresh","msg":"Failed to refresh session cache, will try again at the next refresh interval","attr":{"error":"NotYetInitialized: Replication has not yet been configured"}}
{"t":{"$date":"2023-04-14T02:09:04.263+03:00"},"s":"I", "c":"REPL", "id":40440, "ctx":"initandlisten","msg":"Starting the TopologyVersionObserver"}
{"t":{"$date":"2023-04-14T02:09:04.263+03:00"},"s":"I", "c":"CONTROL", "id":20712, "ctx":"LogicalSessionCacheReap","msg":"Sessions collection is not set up; waiting until next sessions reap interval","attr":{"error":"NamespaceNotFound: config.system.sessions does not exist"}}
{"t":{"$date":"2023-04-14T02:09:04.268+03:00"},"s":"I", "c":"REPL", "id":40445, "ctx":"TopologyVersionObserver","msg":"Started TopologyVersionObserver"}
{"t":{"$date":"2023-04-14T02:09:04.269+03:00"},"s":"I", "c":"NETWORK", "id":23015, "ctx":"listener","msg":"Listening on","attr":{"address":"127.0.0.1"}}
{"t":{"$date":"2023-04-14T02:09:04.269+03:00"},"s":"I", "c":"NETWORK", "id":23016, "ctx":"listener","msg":"Waiting for connections","attr":{"port":27017,"ssl":"off"}}
{"t":{"$date":"2023-04-14T02:09:04.519+03:00"},"s":"I", "c":"-", "id":4939300, "ctx":"monitoring-keys-for-HMAC","msg":"Failed to refresh key cache","attr":{"error":"NotYetInitialized: Cannot use non-local read concern until replica set is finished initializing.","nextWakeupMillis":600}}
{"t":{"$date":"2023-04-14T02:09:05.120+03:00"},"s":"I", "c":"-", "id":4939300, "ctx":"monitoring-keys-for-HMAC","msg":"Failed to refresh key cache","attr":{"error":"NotYetInitialized: Cannot use non-local read concern until replica set is finished initializing.","nextWakeupMillis":800}}
{"t":{"$date":"2023-04-14T02:09:05.920+03:00"},"s":"I", "c":"-", "id":4939300, "ctx":"monitoring-keys-for-HMAC","msg":"Failed to refresh key cache","attr":{"error":"NotYetInitialized: Cannot use non-local read concern until replica set is finished initializing.","nextWakeupMillis":1000}}
{"t":{"$date":"2023-04-14T02:09:06.921+03:00"},"s":"I", "c":"-", "id":4939300, "ctx":"monitoring-keys-for-HMAC","msg":"Failed to refresh key cache","attr":{"error":"NotYetInitialized: Cannot use non-local read concern until replica set is finished initializing.","nextWakeupMillis":1200}}
Now the problem is, even though the instance starts, I cannot connect to 27017 using compass or anything, I can’t create the replica set in any way!
Also running netstat -an | findstr 27017
outputs:
TCP 127.0.0.1:27017 0.0.0.0:0 LISTENING
TCP 127.0.0.1:54047 127.0.0.1:27017 TIME_WAIT
TCP 127.0.0.1:54060 127.0.0.1:27017 TIME_WAIT
but I just can’t connect to the instance.