我正在尝试在我的 Mac(M2 芯片)上安装 Mongodb
我运行以下命令:
brew tap mongodb/brew
brew install [email protected]
brew services start [email protected]
然后检查服务是否正在运行并检查日志
➜ brew services list
Name Status User File
mongodb-community error 15872 foo ~/Library/LaunchAgents/homebrew.mxcl.mongodb-community.plist
➜ payload tail $(brew --prefix)/var/log/mongodb/mongo.log
{"t":{"$date":"2024-08-07T17:23:20.516+08:00"},"s":"I", "c":"STORAGE", "id":4795902, "ctx":"initandlisten","msg":"Closing WiredTiger","attr":{"closeConfig":"leak_memory=true,use_timestamp=false,"}}
{"t":{"$date":"2024-08-07T17:23:20.516+08:00"},"s":"I", "c":"WTCHKPT", "id":22430, "ctx":"initandlisten","msg":"WiredTiger message","attr":{"message":{"ts_sec":1723022600,"ts_usec":516819,"thread":"62910:0x2058c7ac0","session_name":"close_ckpt","category":"WT_VERB_CHECKPOINT_PROGRESS","category_id":6,"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: 48"}}}
{"t":{"$date":"2024-08-07T17:23:20.537+08:00"},"s":"I", "c":"WTRECOV", "id":22430, "ctx":"initandlisten","msg":"WiredTiger message","attr":{"message":{"ts_sec":1723022600,"ts_usec":537513,"thread":"62910:0x2058c7ac0","session_name":"WT_CONNECTION.close","category":"WT_VERB_RECOVERY_PROGRESS","category_id":30,"verbose_level":"DEBUG_1","verbose_level_id":1,"msg":"shutdown checkpoint has successfully finished and ran for 20 milliseconds"}}}
{"t":{"$date":"2024-08-07T17:23:20.537+08:00"},"s":"I", "c":"WTRECOV", "id":22430, "ctx":"initandlisten","msg":"WiredTiger message","attr":{"message":{"ts_sec":1723022600,"ts_usec":537566,"thread":"62910:0x2058c7ac0","session_name":"WT_CONNECTION.close","category":"WT_VERB_RECOVERY_PROGRESS","category_id":30,"verbose_level":"DEBUG_1","verbose_level_id":1,"msg":"shutdown was completed successfully and took 21ms, including 0ms for the rollback to stable, and 20ms for the checkpoint."}}}
{"t":{"$date":"2024-08-07T17:23:20.570+08:00"},"s":"I", "c":"STORAGE", "id":4795901, "ctx":"initandlisten","msg":"WiredTiger closed","attr":{"durationMillis":54}}
{"t":{"$date":"2024-08-07T17:23:20.570+08:00"},"s":"I", "c":"STORAGE", "id":22279, "ctx":"initandlisten","msg":"shutdown: removing fs lock..."}
{"t":{"$date":"2024-08-07T17:23:20.570+08:00"},"s":"I", "c":"-", "id":4784931, "ctx":"initandlisten","msg":"Dropping the scope cache for shutdown"}
{"t":{"$date":"2024-08-07T17:23:20.570+08:00"},"s":"I", "c":"CONTROL", "id":20565, "ctx":"initandlisten","msg":"Now exiting"}
{"t":{"$date":"2024-08-07T17:23:20.570+08:00"},"s":"I", "c":"CONTROL", "id":8423404, "ctx":"initandlisten","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":"1 ms","Shut down the transport layer":"0 ms","Shut down the global connection pool":"0 ms","Shut down the flow control ticket holder":"0 ms","Kill all operations for shutdown":"0 ms","Shut down all tenant migration access blockers on global shutdown":"0 ms","Shut down all open transactions":"0 ms","Acquire the RSTL for shutdown":"0 ms","Shut down the IndexBuildsCoordinator and wait for index builds to finish":"0 ms","Shut down the replica set monitor":"0 ms","Shut down the migration util executor":"0 ms","Shut down the TTL monitor":"0 ms","Shut down expired pre-images and documents removers":"0 ms","Shut down the storage engine":"54 ms","Wait for the oplog cap maintainer thread to stop":"0 ms","Shut down full-time data capture":"0 ms","shutdownTask total elapsed time":"55 ms"}}}}
{"t":{"$date":"2024-08-07T17:23:20.570+08:00"},"s":"I", "c":"CONTROL", "id":23138, "ctx":"initandlisten","msg":"Shutting down","attr":{"exitCode":62}}
知道该日志显示什么吗?
您从 MongoDB 提供的日志表明 mongodb 服务器正在启动,但随后立即关闭。
与“WiredTiger”相关的日志条目显示Mongodb的存储引擎正在关闭并关闭。 WiredTiger 是 mongodb 默认的存储引擎用户
{"t":{"$date":"2024-08-07T17:23:20.516+08:00"},"s":"I", "c":"STORAGE", "id":4795902, "ctx":"initandlisten","msg":"Closing WiredTiger","attr":{"closeConfig":"leak_memory=true,use_timestamp=false,"}}
{"t":{"$date":"2024-08-07T17:23:20.570+08:00"},"s":"I", "c":"STORAGE", "id":4795901, "ctx":"initandlisten","msg":"WiredTiger closed","attr":{"durationMillis":54}}
退出代码62一般表示mongodb在启动或关闭过程中遇到错误。
{"t":{"$date":"2024-08-07T17:23:20.570+08:00"},"s":"I", "c":"CONTROL", "id":23138, "ctx":"initandlisten","msg":"Shutting down","attr":{"exitCode":62}}
潜在原因:
尝试卸载并重新安装 mongodb。但这一次试试这个命令,
brew uninstall mongodb-community
brew install mongodb-community