TLDR: I am unable to start a clean installation of Mongo (from ZIP) with an empty data directory, because of a UserNotFound Error (the not found user is from the old installation).
In more detail: My initial Mongo database is working fine. For testing purpose I moved my current data directory and created a new one. So I stopped my running Windows Service with
mongod --dbpath=C:\data\db --remove
created a new data directory and tried to start a new MongoDB in noauth mode with
mongod --dbpath=C:\data\db --noauth
And here begins the trouble: MongoDB tries to connect with an user from my old database which is nowhere mentioned in the current settings. Here is the log
2018-10-23T04:45:47.323-0700 I CONTROL [initandlisten] MongoDB starting : pid=12508 port=27017 dbpath=C:\data\db 64-bit host=XXX
2018-10-23T04:45:47.323-0700 I CONTROL [initandlisten] targetMinOS: Windows 7/Windows Server 2008 R2
2018-10-23T04:45:47.323-0700 I CONTROL [initandlisten] db version v3.6.8-45-g4f1bd30460
2018-10-23T04:45:47.323-0700 I CONTROL [initandlisten] git version: 4f1bd3046036a8621c2ad5acde7cdf103a533226
2018-10-23T04:45:47.323-0700 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2o-fips 27 Mar 2018
2018-10-23T04:45:47.323-0700 I CONTROL [initandlisten] allocator: tcmalloc
2018-10-23T04:45:47.323-0700 I CONTROL [initandlisten] modules: none
2018-10-23T04:45:47.323-0700 I CONTROL [initandlisten] build environment:
2018-10-23T04:45:47.327-0700 I CONTROL [initandlisten] distmod: 2008plus-ssl
2018-10-23T04:45:47.327-0700 I CONTROL [initandlisten] distarch: x86_64
2018-10-23T04:45:47.327-0700 I CONTROL [initandlisten] target_arch: x86_64
2018-10-23T04:45:47.327-0700 I CONTROL [initandlisten] options: { security: { authorization: "disabled" }, storage: { dbPath: "C:\data\db" } }
2018-10-23T04:45:47.330-0700 I - [initandlisten] Detected data files in C:\data\db created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2018-10-23T04:45:47.330-0700 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=7379M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),cache_cursors=false,compatibility=(release="3.0",require_max="3.0"),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),statistics_log=(wait=0),verbose=(recovery_progress),
2018-10-23T04:45:47.569-0700 I STORAGE [initandlisten] WiredTiger message [1540295147:568779][12508:140717431611728], txn-recover: Main recovery loop: starting at 2/4736
2018-10-23T04:45:47.718-0700 I STORAGE [initandlisten] WiredTiger message [1540295147:718169][12508:140717431611728], txn-recover: Recovering log 2 through 3
2018-10-23T04:45:47.815-0700 I STORAGE [initandlisten] WiredTiger message [1540295147:815426][12508:140717431611728], txn-recover: Recovering log 3 through 3
2018-10-23T04:45:48.053-0700 I STORAGE [initandlisten] WiredTiger message [1540295148:53068][12508:140717431611728], txn-recover: Set global recovery timestamp: 0
2018-10-23T04:45:48.137-0700 I CONTROL [initandlisten]
2018-10-23T04:45:48.138-0700 I CONTROL [initandlisten] ** WARNING: This server is bound to localhost.
2018-10-23T04:45:48.138-0700 I CONTROL [initandlisten] ** Remote systems will be unable to connect to this server.
2018-10-23T04:45:48.138-0700 I CONTROL [initandlisten] ** Start the server with --bind_ip to specify which IP
2018-10-23T04:45:48.138-0700 I CONTROL [initandlisten] ** addresses it should serve responses from, or with --bind_ip_all to
2018-10-23T04:45:48.138-0700 I CONTROL [initandlisten] ** bind to all interfaces. If this behavior is desired, start the
2018-10-23T04:45:48.138-0700 I CONTROL [initandlisten] ** server with --bind_ip 127.0.0.1 to disable this warning.
2018-10-23T04:45:48.138-0700 I CONTROL [initandlisten]
2018-10-23T13:45:48.471+0200 W FTDC [initandlisten] Failed to initialize Performance Counters for FTDC: WindowsPdhError: PdhExpandCounterPathW failed with 'Das angegebene Objekt wurde nicht auf dem Computer gefunden.' for counter '\Memory\Available Bytes'
2018-10-23T13:45:48.471+0200 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory 'C:/data/db/diagnostic.data'
2018-10-23T13:45:48.473+0200 I NETWORK [initandlisten] waiting for connections on port 27017
2018-10-23T13:45:48.863+0200 I NETWORK [listener] connection accepted from 127.0.0.1:57924 #1 (1 connection now open)
2018-10-23T13:45:48.864+0200 I NETWORK [conn1] received client metadata from 127.0.0.1:57924 conn1: { driver: { name: "mongo-java-driver", version: "unknown" }, os: { type: "Windows", name: "Windows 10", architecture: "amd64", version: "10.0" }, platform: "Java/Oracle Corporation/1.8.0_171-b11" }
2018-10-23T13:45:48.865+0200 I ACCESS [conn1] SCRAM-SHA-1 authentication failed for fritz1338 on admin from client 127.0.0.1:57924 ; UserNotFound: Could not find user fritz1338@admin
2018-10-23T13:45:48.865+0200 I NETWORK [conn1] end connection 127.0.0.1:57924 (0 connections now open)
2018-10-23T13:45:49.366+0200 I NETWORK [listener] connection accepted from 127.0.0.1:57925 #2 (1 connection now open)
2018-10-23T13:45:49.367+0200 I NETWORK [conn2] received client metadata from 127.0.0.1:57925 conn2: { driver: { name: "mongo-java-driver", version: "unknown" }, os: { type: "Windows", name: "Windows 10", architecture: "amd64", version: "10.0" }, platform: "Java/Oracle Corporation/1.8.0_171-b11" }
2018-10-23T13:45:49.369+0200 I ACCESS [conn2] SCRAM-SHA-1 authentication failed for fritz1338 on admin from client 127.0.0.1:57925 ; UserNotFound: Could not find user fritz1338@admin
2018-10-23T13:45:49.370+0200 I NETWORK [conn2] end connection 127.0.0.1:57925 (0 connections now open)
2018-10-23T13:45:49.872+0200 I NETWORK [listener] connection accepted from 127.0.0.1:57926 #3 (1 connection now open)
2018-10-23T13:45:49.873+0200 I NETWORK [conn3] received client metadata from 127.0.0.1:57926 conn3: { driver: { name: "mongo-java-driver", version: "unknown" }, os: { type: "Windows", name: "Windows 10", architecture: "amd64", version: "10.0" }, platform: "Java/Oracle Corporation/1.8.0_171-b11" }
2018-10-23T13:45:49.875+0200 I ACCESS [conn3] SCRAM-SHA-1 authentication failed for fritz1338 on admin from client 127.0.0.1:57926 ; UserNotFound: Could not find user fritz1338@admin
2018-10-23T13:45:49.877+0200 I NETWORK [conn3] end connection 127.0.0.1:57926 (0 connections now open)
"fritz1338" is an user from my old db instance. If I move the old database directory to data\db everyting works fine again. But I cannot start a clean install from MongoDB.
What I have already tried:
create a brand new data\db directory
redownload MongoDB (ZIP File)
searched the entire PC and registry for references to a mongo configuration file (even though mongo does not use an config file by default)
removed the "mongo-java-driver" in my .m2 maven directory (evetn though it shouldn't been accessed)
run the mongod repair option with
mongod --dbpath=C:\data\db --repair
Can anyone tell me why aclean installation of MongoDB knows about an old username from another data directory?
Problem solved! The log entries came from another application, which attempted to connect to the database.