我在跑步Linux centos-002 3.10.0-1062.9.1.el7.x86_64 #1 SMP Fri Dec 6 15:49:49 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
。我根据官方指南安装了最新的 MongoDB(尽管我没有按照安装部分之后的步骤进行操作)。我的 mongod 服务无法启动,在日志中我发现以下内容:
2020-02-18T08:55:32.762+0000 I CONTROL [main] ***** SERVER RESTARTED *****
2020-02-18T08:55:32.768+0000 I CONTROL [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
2020-02-18T08:55:32.778+0000 I CONTROL [initandlisten] MongoDB starting : pid=65692 port=27017 dbpath=/var/lib/mongo 64-bit host=centos
2020-02-18T08:55:32.778+0000 I CONTROL [initandlisten] db version v4.2.3
2020-02-18T08:55:32.778+0000 I CONTROL [initandlisten] git version: 6874650b362138df74be53d366bbefc321ea32d4
2020-02-18T08:55:32.778+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.1e-fips 11 Feb 2013
2020-02-18T08:55:32.778+0000 I CONTROL [initandlisten] allocator: tcmalloc
2020-02-18T08:55:32.778+0000 I CONTROL [initandlisten] modules: none
2020-02-18T08:55:32.778+0000 I CONTROL [initandlisten] build environment:
2020-02-18T08:55:32.778+0000 I CONTROL [initandlisten] distmod: rhel70
2020-02-18T08:55:32.778+0000 I CONTROL [initandlisten] distarch: x86_64
2020-02-18T08:55:32.778+0000 I CONTROL [initandlisten] target_arch: x86_64
2020-02-18T08:55:32.778+0000 I CONTROL [initandlisten] options: { config: "/etc/mongod.conf", net: { bindIp: "127.0.0.1", port: 27017 }, processManagement: { fork: true, pidFilePath: "/var/run/mongodb/mongod.pid", timeZoneInfo: "/usr/$
2020-02-18T08:55:32.778+0000 E NETWORK [initandlisten] Failed to unlink socket file /tmp/mongodb-27017.sock Operation not permitted
2020-02-18T08:55:32.778+0000 F - [initandlisten] Fatal Assertion 40486 at src/mongo/transport/transport_layer_asio.cpp 683
2020-02-18T08:55:32.778+0000 F - [initandlisten]
***aborting after fassert() failure
答案1
通过将 /tmp/mongodb-27017.sock 的所有者设置为mongod:mongod