“文件移动后忘了放回原处,结果服务启动失败” —— 一次因路径操作失误导致的 MongoDB 启动故障深度复盘
事故现场:文件"移动"而非"删除"的致命陷阱
某天,我在测试环境整理磁盘空间时,将 MongoDB 数据文件(.wt 文件)从 D:\DB\MongoDB\data 移动到了 D:\DB\MongoDB\data_backup 目录,以为只是临时整理。
重启 MongoDB 时,服务完全无法启动,日志中抛出关键错误:


log
编辑
1{"t":{"$date":"2026-01-04T20:36:09.543+08:00"},"s":"E", "c":"WT", "id":22435, 2 "attr":{ 3 "error":2, 4 "error_str":"No such file or directory", 5 "session_dhandle_name":"file:collection-2-8033372299298531302.wt" 6 }} 7 8{"t":{"$date":"2026-01-04T20:36:09.556+08:00"},"s":"E", "c":"CONTROL", "id":20557, 9 "attr":{"error":"CursorNotFound: Failed to open a WiredTiger cursor. Reason: UnknownError: 2: No such file or directory, uri: table:collection-2-8033372299298531302"}}
关键发现:
文件没有被删除,而是被移动到了错误位置!MongoDB 无法找到元数据中记录的文件路径,导致启动失败。
关键日志深度解析(与"误删"的本质区别)
✅ 日志 1:文件路径不匹配的证据
log
编辑
1"session_dhandle_name":"file:collection-2-8033372299298531302.wt" 2"message":"CreateFileW: The system cannot find the file specified.\r\n"
- 核心问题:
MongoDB 元数据中记录的文件路径是D:\DB\MongoDB\data\collection-2-8033372299298531302.wt
但实际文件在D:\DB\MongoDB\data_backup\collection-2-8033372299298531302.wt
✅ 日志 2:启动失败的直接原因
log
编辑
1"error":"CursorNotFound: Failed to open a WiredTiger cursor. Reason: UnknownError: 2: No such file or directory, uri: table:collection-2-8033372299298531302"
- 为什么不是"文件不存在"错误?
文件确实存在,但路径与元数据记录的路径不一致 → WiredTiger 无法匹配 → 启动失败
为什么移动文件比删除文件更危险?
MongoDB 存储机制关键点

本质区别:
- 误删 → 需要备份恢复
- 误移 → 放回原路径即可(本次事故的幸运点!)
⚠️ 事故根源:对 MongoDB 文件路径机制的误解

MongoDB 的数据文件是“路径绑定”的,移动文件后必须放回原路径,否则启动失败。
30秒快速修复方案(本次事故的正确解法)
bash
编辑
1# 1. 停止 MongoDB 服务 2net stop MongoDB 3 4# 2. 将文件移回原路径(关键步骤!) 5move D:\DB\MongoDB\data_backup\collection-2-8033372299298531302.wt ^ 6 D:\DB\MongoDB\data\collection-2-8033372299298531302.wt 7 8# 3. 启动服务 9net start MongoDB
✅ 结果:MongoDB 成功启动,数据完整可用!
️ 为什么这次事故比“误删”更幸运?

关键优势:
文件并未丢失,只是路径错误 → 无需备份,秒级恢复
核心教训:MongoDB 文件路径的"绝对性"
为什么必须严格匹配路径?
- 元数据存储:
WiredTiger.wt中存储的文件路径是 编译时确定的绝对路径(如D:\DB\MongoDB\data\) - 启动检查:
MongoDB 启动时不会搜索,而是直接访问预设路径 - 安全设计:
防止因文件系统变更导致数据不一致(如挂载点变化)
类比:
就像给房子贴了门牌号(123 Main St),然后把房子搬到456 Oak Ave,再贴上新门牌号 → 但快递员还是按旧门牌号送信 → 送不到!
️ 防范措施:避免"路径陷阱"的3个最佳实践
✅ 实践1:使用符号链接(Symbolic Link)替代直接移动
bash
编辑
1# 创建符号链接(Windows) 2mklink /J D:\DB\MongoDB\data_backup D:\DB\MongoDB\data 3 4# 重启后,所有访问 data 目录的请求都会指向实际路径
优势:
保留原始路径,文件实际在备份目录,MongoDB 无感知
✅ 实践2:操作前备份元数据
bash
编辑
1# 在移动文件前备份 WiredTiger.wt 2copy D:\DB\MongoDB\data\WiredTiger.wt D:\DB\MongoDB\backup\WiredTiger.wt.bak
✅ 实践3:使用 MongoDB 命令管理文件
javascript
编辑
1// 正确删除集合(非直接操作文件) 2db.users.drop()
原则:
永远不要直接操作data目录下的.wt文件,除非使用 MongoDB 命令
总结:一次移动引发的路径哲学

附:故障日志关键片段
log
编辑
{"t":{"$date":"2026-01-04T20:34:58.110+08:00"},"s":"I", "c":"CONTROL", "id":20698, "ctx":"thread1","msg":"***** SERVER RESTARTED *****"}
{"t":{"$date":"2026-01-04T20:34:58.113+08:00"},"s":"I", "c":"CONTROL", "id":23285, "ctx":"thread1","msg":"Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'"}
{"t":{"$date":"2026-01-04T20:34:59.867+08:00"},"s":"I", "c":"CONTROL", "id":5945603, "ctx":"thread1","msg":"Multi threading initialized"}
{"t":{"$date":"2026-01-04T20:34:59.867+08:00"},"s":"I", "c":"NETWORK", "id":4648601, "ctx":"thread1","msg":"Implicit TCP FastOpen unavailable. If TCP FastOpen is required, set at least one of the related parameters","attr":{"relatedParameters":["tcpFastOpenServer","tcpFastOpenClient","tcpFastOpenQueueSize"]}}
{"t":{"$date":"2026-01-04T20:34:59.867+08:00"},"s":"I", "c":"NETWORK", "id":4915701, "ctx":"thread1","msg":"Initialized wire specification","attr":{"spec":{"incomingExternalClient":{"minWireVersion":0,"maxWireVersion":25},"incomingInternalClient":{"minWireVersion":0,"maxWireVersion":25},"outgoing":{"minWireVersion":6,"maxWireVersion":25},"isInternalClient":true}}}
{"t":{"$date":"2026-01-04T20:34:59.869+08:00"},"s":"I", "c":"CONTROL", "id":23316, "ctx":"thread1","msg":"Trying to start Windows service","attr":{"serviceName":"MongoDB"}}
{"t":{"$date":"2026-01-04T20:34:59.869+08:00"},"s":"I", "c":"CONTROL", "id":4615611, "ctx":"initandlisten","msg":"MongoDB starting","attr":{"pid":14652,"port":27017,"dbPath":"D:/DB/MongoDB/data","architecture":"64-bit","host":"WIN-BOJTPLLJ5D0"}}
{"t":{"$date":"2026-01-04T20:34:59.869+08: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":"2026-01-04T20:34:59.869+08:00"},"s":"I", "c":"CONTROL", "id":23403, "ctx":"initandlisten","msg":"Build Info","attr":{"buildInfo":{"version":"8.0.9","gitVersion":"f882ef816d531ecfbb593843e4c554fda90ca416","modules":[],"allocator":"tcmalloc-gperf","environment":{"distmod":"windows","distarch":"x86_64","target_arch":"x86_64"}}}}
{"t":{"$date":"2026-01-04T20:34:59.869+08:00"},"s":"I", "c":"CONTROL", "id":51765, "ctx":"initandlisten","msg":"Operating System","attr":{"os":{"name":"Microsoft Windows Server 2019","version":"10.0 (build 20348)"}}}
{"t":{"$date":"2026-01-04T20:34:59.869+08:00"},"s":"I", "c":"CONTROL", "id":21951, "ctx":"initandlisten","msg":"Options set by command line","attr":{"options":{"config":"C:\\Program Files\\MongoDB\\Server\\8.0\\bin\\mongod.cfg","net":{"bindIp":"192.200.99.7","port":27017},"security":{"authorization":"enabled"},"service":true,"storage":{"dbPath":"D:\\DB\\MongoDB\\data","wiredTiger":{"collectionConfig":{"blockCompressor":"zstd"},"engineConfig":{"cacheSizeGB":8}}},"systemLog":{"destination":"file","logAppend":true,"path":"D:\\DB\\MongoDB\\log\\mongod.log"}}}}
{"t":{"$date":"2026-01-04T20:34:59.870+08:00"},"s":"I", "c":"STORAGE", "id":22270, "ctx":"initandlisten","msg":"Storage engine to use detected by data files","attr":{"dbpath":"D:/DB/MongoDB/data","storageEngine":"wiredTiger"}}
{"t":{"$date":"2026-01-04T20:34:59.870+08:00"},"s":"I", "c":"STORAGE", "id":22315, "ctx":"initandlisten","msg":"Opening WiredTiger","attr":{"config":"create,cache_size=8192M,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],prefetch=(available=true,default=false),"}}
{"t":{"$date":"2026-01-04T20:34:59.890+08:00"},"s":"I", "c":"WTRECOV", "id":22430, "ctx":"initandlisten","msg":"WiredTiger message","attr":{"message":{"ts_sec":1767530099,"ts_usec":890301,"thread":"14652:140717428399744","session_name":"txn-recover","category":"WT_VERB_RECOVERY_PROGRESS","category_id":34,"verbose_level":"DEBUG_1","verbose_level_id":1,"msg":"Recovering log 13220 through 13221"}}}
{"t":{"$date":"2026-01-04T20:34:59.941+08:00"},"s":"I", "c":"WTRECOV", "id":22430, "ctx":"initandlisten","msg":"WiredTiger message","attr":{"message":{"ts_sec":1767530099,"ts_usec":941131,"thread":"14652:140717428399744","session_name":"txn-recover","category":"WT_VERB_RECOVERY_PROGRESS","category_id":34,"verbose_level":"DEBUG_1","verbose_level_id":1,"msg":"Recovering log 13221 through 13221"}}}
{"t":{"$date":"2026-01-04T20:35:00.018+08:00"},"s":"I", "c":"WTRECOV", "id":22430, "ctx":"initandlisten","msg":"WiredTiger message","attr":{"message":{"ts_sec":1767530100,"ts_usec":17876,"thread":"14652:140717428399744","session_name":"txn-recover","category":"WT_VERB_RECOVERY_PROGRESS","category_id":34,"verbose_level":"DEBUG_1","verbose_level_id":1,"msg":"Main recovery loop: starting at 13220/1536 to 13221/256"}}}
{"t":{"$date":"2026-01-04T20:35:00.114+08:00"},"s":"I", "c":"WTRECOV", "id":22430, "ctx":"initandlisten","msg":"WiredTiger message","attr":{"message":{"ts_sec":1767530100,"ts_usec":114552,"thread":"14652:140717428399744","session_name":"txn-recover","category":"WT_VERB_RECOVERY_PROGRESS","category_id":34,"verbose_level":"DEBUG_1","verbose_level_id":1,"msg":"Recovering log 13220 through 13221"}}}
{"t":{"$date":"2026-01-04T20:35:00.157+08:00"},"s":"I", "c":"WTRECOV", "id":22430, "ctx":"initandlisten","msg":"WiredTiger message","attr":{"message":{"ts_sec":1767530100,"ts_usec":157413,"thread":"14652:140717428399744","session_name":"txn-recover","category":"WT_VERB_RECOVERY_PROGRESS","category_id":34,"verbose_level":"DEBUG_1","verbose_level_id":1,"msg":"Recovering log 13221 through 13221"}}}
{"t":{"$date":"2026-01-04T20:35:00.196+08:00"},"s":"I", "c":"WTRECOV", "id":22430, "ctx":"initandlisten","msg":"WiredTiger message","attr":{"message":{"ts_sec":1767530100,"ts_usec":195283,"thread":"14652:140717428399744","session_name":"txn-recover","category":"WT_VERB_RECOVERY_PROGRESS","category_id":34,"verbose_level":"DEBUG_1","verbose_level_id":1,"msg":"recovery log replay has successfully finished and ran for 304 milliseconds"}}}
{"t":{"$date":"2026-01-04T20:35:00.196+08:00"},"s":"I", "c":"WTRECOV", "id":22430, "ctx":"initandlisten","msg":"WiredTiger message","attr":{"message":{"ts_sec":1767530100,"ts_usec":195283,"thread":"14652:140717428399744","session_name":"txn-recover","category":"WT_VERB_RECOVERY_PROGRESS","category_id":34,"verbose_level":"DEBUG_1","verbose_level_id":1,"msg":"Set global recovery timestamp: (0, 0)"}}}
{"t":{"$date":"2026-01-04T20:35:00.196+08:00"},"s":"I", "c":"WTRECOV", "id":22430, "ctx":"initandlisten","msg":"WiredTiger message","attr":{"message":{"ts_sec":1767530100,"ts_usec":195283,"thread":"14652:140717428399744","session_name":"txn-recover","category":"WT_VERB_RECOVERY_PROGRESS","category_id":34,"verbose_level":"DEBUG_1","verbose_level_id":1,"msg":"Set global oldest timestamp: (0, 0)"}}}
{"t":{"$date":"2026-01-04T20:35:00.211+08:00"},"s":"I", "c":"WTRECOV", "id":22430, "ctx":"initandlisten","msg":"WiredTiger message","attr":{"message":{"ts_sec":1767530100,"ts_usec":211229,"thread":"14652:140717428399744","session_name":"txn-recover","category":"WT_VERB_RECOVERY_PROGRESS","category_id":34,"verbose_level":"DEBUG_1","verbose_level_id":1,"msg":"recovery rollback to stable has successfully finished and ran for 15 milliseconds"}}}
{"t":{"$date":"2026-01-04T20:35:00.229+08:00"},"s":"I", "c":"WTCHKPT", "id":22430, "ctx":"initandlisten","msg":"WiredTiger message","attr":{"message":{"ts_sec":1767530100,"ts_usec":229170,"thread":"14652:140717428399744","session_name":"WT_SESSION.checkpoint","category":"WT_VERB_CHECKPOINT_PROGRESS","category_id":7,"verbose_level":"DEBUG_1","verbose_level_id":1,"msg":"saving checkpoint snapshot min: 1, snapshot max: 1 snapshot count: 0, oldest timestamp: (0, 0) , meta checkpoint timestamp: (0, 0) base write gen: 45028661"}}}
{"t":{"$date":"2026-01-04T20:35:00.234+08:00"},"s":"I", "c":"WTRECOV", "id":22430, "ctx":"initandlisten","msg":"WiredTiger message","attr":{"message":{"ts_sec":1767530100,"ts_usec":234154,"thread":"14652:140717428399744","session_name":"txn-recover","category":"WT_VERB_RECOVERY_PROGRESS","category_id":34,"verbose_level":"DEBUG_1","verbose_level_id":1,"msg":"recovery checkpoint has successfully finished and ran for 22 milliseconds"}}}
{"t":{"$date":"2026-01-04T20:35:00.234+08:00"},"s":"I", "c":"WTRECOV", "id":22430, "ctx":"initandlisten","msg":"WiredTiger message","attr":{"message":{"ts_sec":1767530100,"ts_usec":234154,"thread":"14652:140717428399744","session_name":"txn-recover","category":"WT_VERB_RECOVERY_PROGRESS","category_id":34,"verbose_level":"DEBUG_1","verbose_level_id":1,"msg":"recovery was completed successfully and took 343ms, including 304ms for the log replay, 15ms for the rollback to stable, and 22ms for the checkpoint."}}}
{"t":{"$date":"2026-01-04T20:35:00.236+08:00"},"s":"I", "c":"STORAGE", "id":4795906, "ctx":"initandlisten","msg":"WiredTiger opened","attr":{"durationMillis":366}}
{"t":{"$date":"2026-01-04T20:35:00.236+08:00"},"s":"I", "c":"RECOVERY", "id":23987, "ctx":"initandlisten","msg":"WiredTiger recoveryTimestamp","attr":{"recoveryTimestamp":{"$timestamp":{"t":0,"i":0}}}}
{"t":{"$date":"2026-01-04T20:35:00.238+08:00"},"s":"I", "c":"STORAGE", "id":9529901, "ctx":"initandlisten","msg":"Initializing durable catalog","attr":{"numRecords":450}}
{"t":{"$date":"2026-01-04T20:35:00.239+08:00"},"s":"I", "c":"STORAGE", "id":9529902, "ctx":"initandlisten","msg":"Retrieving all idents from storage engine"}
{"t":{"$date":"2026-01-04T20:35:00.240+08:00"},"s":"I", "c":"STORAGE", "id":9529903, "ctx":"initandlisten","msg":"Initializing all collections in durable catalog","attr":{"numEntries":450}}
{"t":{"$date":"2026-01-04T20:35:00.241+08:00"},"s":"E", "c":"WT", "id":22435, "ctx":"initandlisten","msg":"WiredTiger error message","attr":{"error":2,"message":{"ts_sec":1767530100,"ts_usec":241130,"thread":"14652:140717428399744","session_dhandle_name":"file:collection-2-8033372299298531302.wt","session_name":"WT_SESSION.open_cursor","category":"WT_VERB_DEFAULT","category_id":12,"verbose_level":"ERROR","verbose_level_id":-3,"msg":"int __cdecl __win_open_file(struct __wt_file_system *,struct __wt_session *,const char *,enum WT_FS_OPEN_FILE_TYPE,unsigned int,struct __wt_file_handle **):535:D:\\DB\\MongoDB\\data\\collection-2-8033372299298531302.wt: handle-open: CreateFileW: The system cannot find the file specified.\r\n","error_str":"No such file or directory","error_code":2}}}
{"t":{"$date":"2026-01-04T20:35:00.241+08:00"},"s":"I", "c":"STORAGE", "id":22317, "ctx":"initandlisten","msg":"WiredTigerKVEngine shutting down"}
{"t":{"$date":"2026-01-04T20:35:00.241+08:00"},"s":"I", "c":"STORAGE", "id":22318, "ctx":"initandlisten","msg":"Shutting down session sweeper thread"}
{"t":{"$date":"2026-01-04T20:35:00.241+08:00"},"s":"I", "c":"STORAGE", "id":22319, "ctx":"initandlisten","msg":"Finished shutting down session sweeper thread"}
{"t":{"$date":"2026-01-04T20:35:00.241+08:00"},"s":"I", "c":"STORAGE", "id":4795902, "ctx":"initandlisten","msg":"Closing WiredTiger","attr":{"closeConfig":"leak_memory=true,use_timestamp=false,"}}
{"t":{"$date":"2026-01-04T20:35:00.243+08:00"},"s":"I", "c":"WTCHKPT", "id":22430, "ctx":"initandlisten","msg":"WiredTiger message","attr":{"message":{"ts_sec":1767530100,"ts_usec":243123,"thread":"14652:140717428399744","session_name":"close_ckpt","category":"WT_VERB_CHECKPOINT_PROGRESS","category_id":7,"verbose_level":"DEBUG_1","verbose_level_id":1,"msg":"saving checkpoint snapshot min: 2, snapshot max: 2 snapshot count: 0, oldest timestamp: (0, 0) , meta checkpoint timestamp: (0, 0) base write gen: 45028661"}}}
{"t":{"$date":"2026-01-04T20:35:00.265+08:00"},"s":"I", "c":"WTRECOV", "id":22430, "ctx":"initandlisten","msg":"WiredTiger message","attr":{"message":{"ts_sec":1767530100,"ts_usec":265050,"thread":"14652:140717428399744","session_name":"WT_CONNECTION.close","category":"WT_VERB_RECOVERY_PROGRESS","category_id":34,"verbose_level":"DEBUG_1","verbose_level_id":1,"msg":"shutdown checkpoint has successfully finished and ran for 22 milliseconds"}}}
{"t":{"$date":"2026-01-04T20:35:00.265+08:00"},"s":"I", "c":"WTRECOV", "id":22430, "ctx":"initandlisten","msg":"WiredTiger message","attr":{"message":{"ts_sec":1767530100,"ts_usec":265050,"thread":"14652:140717428399744","session_name":"WT_CONNECTION.close","category":"WT_VERB_RECOVERY_PROGRESS","category_id":34,"verbose_level":"DEBUG_1","verbose_level_id":1,"msg":"shutdown was completed successfully and took 23ms, including 0ms for the rollback to stable, and 22ms for the checkpoint."}}}
{"t":{"$date":"2026-01-04T20:35:00.270+08:00"},"s":"I", "c":"STORAGE", "id":4795901, "ctx":"initandlisten","msg":"WiredTiger closed","attr":{"durationMillis":29}}
{"t":{"$date":"2026-01-04T20:35:00.270+08:00"},"s":"E", "c":"CONTROL", "id":20557, "ctx":"initandlisten","msg":"DBException in initAndListen, terminating","attr":{"error":"CursorNotFound: Failed to open a WiredTiger cursor. Reason: UnknownError: 2: No such file or directory, uri: table:collection-2-8033372299298531302, config: "}}
{"t":{"$date":"2026-01-04T20:35:00.270+08:00"},"s":"I", "c":"REPL", "id":4784900, "ctx":"serviceStopWorker","msg":"Stepping down the ReplicationCoordinator for shutdown","attr":{"waitTimeMillis":15000}}
{"t":{"$date":"2026-01-04T20:35:00.270+08:00"},"s":"I", "c":"REPL", "id":4794602, "ctx":"serviceStopWorker","msg":"Attempting to enter quiesce mode"}
{"t":{"$date":"2026-01-04T20:35:00.270+08:00"},"s":"I", "c":"-", "id":6371601, "ctx":"serviceStopWorker","msg":"Shutting down the FLE Crud thread pool"}
{"t":{"$date":"2026-01-04T20:35:00.270+08:00"},"s":"I", "c":"COMMAND", "id":4784901, "ctx":"serviceStopWorker","msg":"Shutting down the MirrorMaestro"}
{"t":{"$date":"2026-01-04T20:35:00.270+08:00"},"s":"I", "c":"SHARDING", "id":4784902, "ctx":"serviceStopWorker","msg":"Shutting down the WaitForMajorityService"}
{"t":{"$date":"2026-01-04T20:35:00.270+08:00"},"s":"I", "c":"NETWORK", "id":8314100, "ctx":"serviceStopWorker","msg":"Shutdown: Closing listener sockets"}
{"t":{"$date":"2026-01-04T20:35:00.270+08:00"},"s":"I", "c":"NETWORK", "id":4784905, "ctx":"serviceStopWorker","msg":"Shutting down the global connection pool"}
{"t":{"$date":"2026-01-04T20:35:00.270+08:00"},"s":"I", "c":"CONTROL", "id":4784906, "ctx":"serviceStopWorker","msg":"Shutting down the FlowControlTicketholder"}
{"t":{"$date":"2026-01-04T20:35:00.270+08:00"},"s":"I", "c":"-", "id":20520, "ctx":"serviceStopWorker","msg":"Stopping further Flow Control ticket acquisitions."}
{"t":{"$date":"2026-01-04T20:35:00.270+08:00"},"s":"I", "c":"NETWORK", "id":4784918, "ctx":"serviceStopWorker","msg":"Shutting down the ReplicaSetMonitor"}
{"t":{"$date":"2026-01-04T20:35:00.270+08:00"},"s":"I", "c":"SHARDING", "id":4784921, "ctx":"serviceStopWorker","msg":"Shutting down the MigrationUtilExecutor"}
{"t":{"$date":"2026-01-04T20:35:00.270+08:00"},"s":"I", "c":"ASIO", "id":22582, "ctx":"MigrationUtil-TaskExecutor","msg":"Killing all outstanding egress activity."}
{"t":{"$date":"2026-01-04T20:35:00.270+08:00"},"s":"I", "c":"NETWORK", "id":20562, "ctx":"serviceStopWorker","msg":"Shutdown: Closing open transport sessions"}
{"t":{"$date":"2026-01-04T20:35:00.270+08:00"},"s":"I", "c":"NETWORK", "id":4784923, "ctx":"serviceStopWorker","msg":"Shutting down the ASIO transport SessionManager"}
{"t":{"$date":"2026-01-04T20:35:00.270+08:00"},"s":"I", "c":"CONTROL", "id":4784928, "ctx":"serviceStopWorker","msg":"Shutting down the TTL monitor"}
{"t":{"$date":"2026-01-04T20:35:00.270+08:00"},"s":"I", "c":"CONTROL", "id":6278511, "ctx":"serviceStopWorker","msg":"Shutting down the Change Stream Expired Pre-images Remover"}
{"t":{"$date":"2026-01-04T20:35:00.270+08:00"},"s":"I", "c":"CONTROL", "id":4784929, "ctx":"serviceStopWorker","msg":"Acquiring the global lock for shutdown"}
{"t":{"$date":"2026-01-04T20:35:00.270+08:00"},"s":"I", "c":"-", "id":4784931, "ctx":"serviceStopWorker","msg":"Dropping the scope cache for shutdown"}
{"t":{"$date":"2026-01-04T20:35:00.270+08:00"},"s":"I", "c":"CONTROL", "id":20565, "ctx":"serviceStopWorker","msg":"Now exiting"}
{"t":{"$date":"2026-01-04T20:35:00.271+08:00"},"s":"I", "c":"CONTROL", "id":8423404, "ctx":"serviceStopWorker","msg":"mongod shutdown complete","attr":{"Summary of time elapsed":{"Statistics":{"Enter terminal shutdown":"0 ms","Step down the replication coordinator for shutdown":"0 ms","Time spent in quiesce mode":"0 ms","Shut down FLE Crud subsystem":"0 ms","Shut down MirrorMaestro":"0 ms","Shut down WaitForMajorityService":"0 ms","Shut down the global connection pool":"0 ms","Shut down the flow control ticket holder":"0 ms","Shut down the replica set monitor":"0 ms","Shut down the migration util executor":"0 ms","Shut down the transport layer":"0 ms","Shut down the TTL monitor":"0 ms","Shut down expired pre-images and documents removers":"0 ms","Wait for the oplog cap maintainer thread to stop":"0 ms","Shut down full-time data capture":"0 ms","Shut down online certificate status protocol manager":"0 ms","shutdownTask total elapsed time":"0 ms"}}}}
最后提醒:
本次事故发生在 MongoDB 8.0.9(WiredTiger 引擎),但所有版本均适用。
记住:移动文件 ≠ 修复,放回原路径才是关键。
本文基于真实故障复盘,欢迎在评论区分享你的“文件路径”事故故事!