Mongodb服务器无法启动

Posted

技术标签:

【中文标题】Mongodb服务器无法启动【英文标题】:Mongod server wont start 【发布时间】:2021-07-08 06:21:24 【问题描述】:

我跟着mongodb官方安装指南看here的来信 到目前为止我尝试过的事情

    删除并重新安装 mongodb 尝试使用 mongodb ubuntu 包(mongod 服务器也不会启动,输出 mongod.service 不存在)

这是我得到的输出

"t":"$date":"2021-04-13T13:09:20.760+05:30","s":"I",  "c":"CONTROL",  "id":23285,   "ctx":"main","msg":"Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'"
"t":"$date":"2021-04-13T13:09:20.763+05:30","s":"W",  "c":"ASIO",     "id":22601,   "ctx":"main","msg":"No TransportLayer configured during NetworkInterface startup"
"t":"$date":"2021-04-13T13:09:20.763+05:30","s":"I",  "c":"NETWORK",  "id":4648601, "ctx":"main","msg":"Implicit TCP FastOpen unavailable. If TCP FastOpen is required, set tcpFastOpenServer, tcpFastOpenClient, and tcpFastOpenQueueSize."
"t":"$date":"2021-04-13T13:09:20.763+05:30","s":"I",  "c":"STORAGE",  "id":4615611, "ctx":"initandlisten","msg":"MongoDB starting","attr":"pid":5972,"port":27017,"dbPath":"/data/db","architecture":"64-bit","host":"GL62"
"t":"$date":"2021-04-13T13:09:20.763+05:30","s":"I",  "c":"CONTROL",  "id":23403,   "ctx":"initandlisten","msg":"Build Info","attr":"buildInfo":"version":"4.4.5","gitVersion":"ff5cb77101b052fa02da43b8538093486cf9b3f7","openSSLVersion":"OpenSSL 1.1.1f  31 Mar 2020","modules":[],"allocator":"tcmalloc","environment":"distmod":"ubuntu2004","distarch":"x86_64","target_arch":"x86_64"
"t":"$date":"2021-04-13T13:09:20.763+05:30","s":"I",  "c":"CONTROL",  "id":51765,   "ctx":"initandlisten","msg":"Operating System","attr":"os":"name":"Ubuntu","version":"20.04"
"t":"$date":"2021-04-13T13:09:20.763+05:30","s":"I",  "c":"CONTROL",  "id":21951,   "ctx":"initandlisten","msg":"Options set by command line","attr":"options":
"t":"$date":"2021-04-13T13:09:20.763+05:30","s":"E",  "c":"NETWORK",  "id":23024,   "ctx":"initandlisten","msg":"Failed to unlink socket file","attr":"path":"/tmp/mongodb-27017.sock","error":"Operation not permitted"
"t":"$date":"2021-04-13T13:09:20.763+05:30","s":"F",  "c":"-",        "id":23091,   "ctx":"initandlisten","msg":"Fatal assertion","attr":"msgid":40486,"file":"src/mongo/transport/transport_layer_asio.cpp","line":919
"t":"$date":"2021-04-13T13:09:20.763+05:30","s":"F",  "c":"-",        "id":23092,   "ctx":"initandlisten","msg":"\n\n***aborting after fassert() failure\n\n"

【问题讨论】:

检查您是否对 /tmp 有足够的权限,因为日志表明套接字文件存在一些权限问题。或者看起来更早,mongodb 是从 root 用户开始的。 "path":"/tmp/mongodb-27017.sock","error":"不允许操作" 【参考方案1】:

每个日志对象中的s 字段是消息的严重性:I = 信息,W = 警告,E = 错误。

如果您在该日志中查找第一个错误,您会看到它是:


   "t":"$date":"2021-04-13T13:09:20.763+05:30",
   "s":"E", 
   "c":"NETWORK", 
   "id":23024, 
   "ctx":"initandlisten",
   "msg":"Failed to unlink socket file",
   "attr":"path":"/tmp/mongodb-27017.sock","error":"Operation not permitted"
 

这是文件权限问题。

您需要修复记录文件的权限。

【讨论】:

谢谢你,我发现什么不工作,使用 .deb 文件强制重新安装它并单独安装 mongo shell。

以上是关于Mongodb服务器无法启动的主要内容,如果未能解决你的问题,请参考以下文章

Mongodb服务器无法启动

MongoDB安装时无法启动服务

mongoDB无法启动服务器

无法启动mongodb服务:/data/db not found

Mongodb 4.0服务启动不了

MongoDB无法作为服务启动