无法使用干净的数据目录 UserNotFound 启动 MongoDB 的全新安装
Cannot start a clean installation of MongoDB with a clean data directory UserNotFound
TLDR:由于 UserNotFound 错误(未找到的用户来自旧安装),我无法使用空数据目录启动 Mongo(来自 ZIP)的全新安装。
更详细地说:我的初始 Mongo 数据库运行良好。出于测试目的,我移动了当前数据目录并创建了一个新目录。所以我用
停止了我的 运行ning Windows 服务
mongod --dbpath=C:\data\db --remove
创建了一个新的数据目录并尝试以
以 noauth 模式启动一个新的 MongoDB
mongod --dbpath=C:\data\db --noauth
麻烦从这里开始:MongoDB 尝试连接我旧数据库中的用户,而当前设置中未提及该用户。这是日志
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" 是我旧数据库实例中的用户。如果我将旧的数据库目录移动到 data\db,一切都会再次正常工作。但是我无法从 MongoDB.
开始全新安装
我已经尝试过的:
创建一个全新的data\db目录
重新下载 Mongo数据库(ZIP 文件)
在整个 PC 和注册表中搜索了对 mongo 配置文件的引用(尽管 mongo 默认情况下不使用配置文件)
删除了我的 .m2 maven 目录中的 "mongo-java-driver"(即使它不应该被访问)
运行 mongod 修复选项
mongod --dbpath=C:\data\db --repair
谁能告诉我为什么 MongoDB 的全新安装知道另一个数据目录中的旧用户名?
问题解决了!
日志条目来自另一个试图连接到数据库的应用程序。
TLDR:由于 UserNotFound 错误(未找到的用户来自旧安装),我无法使用空数据目录启动 Mongo(来自 ZIP)的全新安装。
更详细地说:我的初始 Mongo 数据库运行良好。出于测试目的,我移动了当前数据目录并创建了一个新目录。所以我用
停止了我的 运行ning Windows 服务mongod --dbpath=C:\data\db --remove
创建了一个新的数据目录并尝试以
以 noauth 模式启动一个新的 MongoDBmongod --dbpath=C:\data\db --noauth
麻烦从这里开始:MongoDB 尝试连接我旧数据库中的用户,而当前设置中未提及该用户。这是日志
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" 是我旧数据库实例中的用户。如果我将旧的数据库目录移动到 data\db,一切都会再次正常工作。但是我无法从 MongoDB.
开始全新安装我已经尝试过的:
创建一个全新的data\db目录
重新下载 Mongo数据库(ZIP 文件)
在整个 PC 和注册表中搜索了对 mongo 配置文件的引用(尽管 mongo 默认情况下不使用配置文件)
删除了我的 .m2 maven 目录中的 "mongo-java-driver"(即使它不应该被访问)
运行 mongod 修复选项
mongod --dbpath=C:\data\db --repair
谁能告诉我为什么 MongoDB 的全新安装知道另一个数据目录中的旧用户名?
问题解决了! 日志条目来自另一个试图连接到数据库的应用程序。