Sunday, September 25, 2022

MongoDB failed to unlink socket file

IGNORE THIS FUCKING ERROR AND START WORKING

mongod

"msg":"Failed to unlink socket file","attr":{"path":"/tmp/mongodb-27017.sock","error":"Operation not permitted"}

+--------------------------+-----------------+------------------------+
|         Platform         | Package Manager | Default storage.dbPath |
+--------------------------+-----------------+------------------------+
| RHEL / CentOS and Amazon | yum             | /var/lib/mongo         |
| SUSE                     | zypper          | /var/lib/mongo         |
| Ubuntu and Debian        | apt             | /var/lib/mongodb       |
| macOS                    | brew            | /usr/local/var/mongodb |
+--------------------------+-----------------+------------------------+

ps -xa | grep mongod 

rep dbPath /etc/mongod.conf

ls -la /tmp/mongodb-27017.sock  

srwx------ 1 mongodb mongodb 0 syys   25 11:14 mongodb-27017.sock

sudo mkdir /var/lib/mongodb/data/db DID NOT HELP

sudo chown -R mongodb:mongodb /var/lib/mongodb/ DID NOT HELP


sudo chown -R `id -u` /data/db // -R means Recursively, means, its applied to every files in the directory, id -u === myusername DID NOT HELP

drwxr-xr-x 2 mongodb mongodb 4096 syys   25 11:01 db


nmap -p- localhost | grep mongod

27017/tcp open  mongod


sudo ufw status

Status: inactive


sudo systemctl stop mongod

sudo systemctl start mongod

sudo systemctl status mongod


sudo systemctl daemon-reload // if failed to start mongod.service

https://wiki.archlinux.org/title/MongoDB


IGNORE THIS FUCKING ERROR AND START WORKING

mongosh

Current Mongosh Log ID: 6330378834759ade51dd78e8
Connecting to:          mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+1.6.0
Using MongoDB:          6.0.1
Using Mongosh:          1.6.0

For mongosh info see: https://docs.mongodb.com/mongodb-shell/

test>

Working with MongoDB Shell

No comments:

Post a Comment