当前位置: 首页 > 工具软件 > Mongodb-Log > 使用案例 >

启动MongoDB时出现Failed to unlink socket file /tmp/mongodb-27017.sock errno:1 Operation not permitted

施靖
2023-12-01

2019-06-28T09:25:06.516+0800 I CONTROL  [main] ***** SERVER RESTARTED *****
2019-06-28T09:25:06.537+0800 I CONTROL  [initandlisten] MongoDB starting : pid=62514 port=27017 dbpath=/var/lib/mongodb 64-bit host=ubuntu
2019-06-28T09:25:06.537+0800 I CONTROL  [initandlisten] db version v3.6.13
2019-06-28T09:25:06.537+0800 I CONTROL  [initandlisten] git version: db3c76679b7a3d9b443a0e1b3e45ed02b88c539f
2019-06-28T09:25:06.537+0800 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.2g  1 Mar 2016
2019-06-28T09:25:06.537+0800 I CONTROL  [initandlisten] allocator: tcmalloc
2019-06-28T09:25:06.537+0800 I CONTROL  [initandlisten] modules: none
2019-06-28T09:25:06.537+0800 I CONTROL  [initandlisten] build environment:
2019-06-28T09:25:06.538+0800 I CONTROL  [initandlisten]     distmod: ubuntu1604
2019-06-28T09:25:06.538+0800 I CONTROL  [initandlisten]     distarch: x86_64

2019-06-28T09:25:06.538+0800 I CONTROL  [initandlisten]     target_arch: x86_64
2019-06-28T09:25:06.538+0800 I CONTROL  [initandlisten] options: { config: "/etc/mongod.conf", net: { bindIp: "127.0.0.1", port: 27017 },     processManagement: { timeZoneInfo: "/usr/share/zoneinfo" }, storage: { dbPath: "/var/lib/mongodb", journal: { enabled: true } }, systemLog    : { destination: "file", logAppend: true, path: "/var/log/mongodb/mongod.log" } }
2019-06-28T09:25:06.538+0800 E NETWORK  [initandlisten] Failed to unlink socket file /tmp/mongodb-27017.sock Operation not permitted
2019-06-28T09:25:06.538+0800 F -        [initandlisten] Fatal Assertion 40486 at src/mongo/transport/transport_layer_asio.cpp 171
2019-06-28T09:25:06.538+0800 F -        [initandlisten]
 

从带颜色的提示可以看出是因为/tmp/mongodb-27017.sock这个文件没有操作权限。

原因分析:

查看该文件情况如下:

python@ubuntu:/etc$ ll /tmp/mongodb-27017.sock 
srwx------ 1 python python 0 6月  27 21:03 /tmp/mongodb-27017.sock=

觖方法:

直接把该文件删除掉用Mongodb用户启动就行了。

 类似资料: