Mongodb 服务器无法启动

Mongod server wont start

我按照 mongodb 官方安装指南来信 here 到目前为止我尝试过的东西

  1. 删除并重新安装 mongodb
  2. 尝试使用 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"}

每个日志对象中的 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"}
} 

这是一个文件权限问题。

您将需要修复所指出文件的权限。