본문 바로가기
Database/MongoDB

[MongoDB] /tmp/mongodb-27017.sock error operation not permitted

by SpiralMoon 2021. 10. 17.
반응형

/tmp/mongodb-27017.sock error operation not permitted

서비스중이던 mongodb 프로세스가 갑자기 권한 오류로 다운되었다.


에러 로그

Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused : connect@src/mongo/shell/mongo.js:374:17

중지된 mongodb를 다시 시작하려고 시도할 때 쉘에 출력되는 로그

 

{"t":{"$date":"2021-09-16T04:20:03.278+00:00"},"s":"I",  "c":"CONTROL",  "id":20698,   "ctx":"main","msg":"***** SERVER RESTARTED *****"}
{"t":{"$date":"2021-09-16T04:20:03.282+00:00"},"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-09-16T04:20:03.616+00:00"},"s":"W",  "c":"ASIO",     "id":22601,   "ctx":"main","msg":"No TransportLayer configured during NetworkInterface startup"}
{"t":{"$date":"2021-09-16T04:20:03.616+00:00"},"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-09-16T04:20:03.617+00:00"},"s":"I",  "c":"STORAGE",  "id":4615611, "ctx":"initandlisten","msg":"MongoDB starting","attr":{"pid":2336,"port":27017,"dbPath":"/var/lib/mongodb","architecture":"64-bit","host":"ip-172-16-21-252"}}
{"t":{"$date":"2021-09-16T04:20:03.617+00:00"},"s":"I",  "c":"CONTROL",  "id":23403,   "ctx":"initandlisten","msg":"Build Info","attr":{"buildInfo":{"version":"4.4.3","gitVersion":"913d6b62acfbb344dde1b116f4161360acd8fd13","openSSLVersion":"OpenSSL 1.1.1  11 Sep 2018","modules":[],"allocator":"tcmalloc","environment":{"distmod":"ubuntu1804","distarch":"x86_64","target_arch":"x86_64"}}}}
{"t":{"$date":"2021-09-16T04:20:03.617+00:00"},"s":"I",  "c":"CONTROL",  "id":51765,   "ctx":"initandlisten","msg":"Operating System","attr":{"os":{"name":"Ubuntu","version":"18.04"}}}
{"t":{"$date":"2021-09-16T04:20:03.617+00:00"},"s":"I",  "c":"CONTROL",  "id":21951,   "ctx":"initandlisten","msg":"Options set by command line","attr":{"options":{"config":"/etc/mongod.conf","net":{"bindIp":"0.0.0.0","port":27017},"processManagement":{"timeZoneInfo":"/usr/share/zoneinfo"},"security":{"authorization":"enabled"},"storage":{"dbPath":"/var/lib/mongodb","journal":{"enabled":true}},"systemLog":{"destination":"file","logAppend":true,"path":"/var/log/mongodb/mongod.log"}}}}
{"t":{"$date":"2021-09-16T04:20:03.618+00:00"},"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-09-16T04:20:03.618+00:00"},"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-09-16T04:20:03.618+00:00"},"s":"F",  "c":"-",        "id":23092,   "ctx":"initandlisten","msg":"\n\n***aborting after fassert() failure\n\n"}

/var/log/mongodb/mongodb.log에 출력된 로그


발생 원인

발생 환경

  • MongoDB 4.4.3
  • ubuntu 18.04

/tmp/mongodb-27017.sock 파일에 설정된 접근권한이 mongodb에게 허용이 되지 않은 상태일 때 발생 (Operation not permitted)

첫 시작때 뿐 아니라 이미 서비스 중인 mongodb에서도 갑자기 발생 가능하므로 주의


해결 방법

/tmp/mongodb-27017.sock 파일의 접근권한을 변경하거나 파일 삭제 후 서비스를 재시작하면 정상적으로 mongodb가 부팅된다.

 

sudo rm -rf /tmp/mongodb-27017.sock

참조

 

'Failed to unlink socket file" error in MongoDB 3.0

I am new to MongoDB. I am trying to install MongoDb 3.0 on Ubuntu 13.0 LTS, which is a VM on Windows 7 Host. I have installed MongoDB successfully (packages etc.), but when I execute the command sudo

stackoverflow.com

 

반응형

'Database > MongoDB' 카테고리의 다른 글

[MongoDB] 계정을 사용하여 DB 권한 제어하기  (0) 2020.01.28

댓글