启动时报错:
# more mongod.log {"t":{"$date":"2022-06-19T12:43:29.495+08:00"},"s":"I", "c":"CONTROL", "id":23285, "ctx":"main","msg":"Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledPro tocols 'none'"} {"t":{"$date":"2022-06-19T12:43:29.498+08:00"},"s":"W", "c":"ASIO", "id":22601, "ctx":"main","msg":"No TransportLayer configured during NetworkInterface startup"} {"t":{"$date":"2022-06-19T12:43:29.498+08:00"},"s":"I", "c":"NETWORK", "id":4648601, "ctx":"main","msg":"Implicit TCP FastOpen unavailable. If TCP FastOpen is required, set tcpFastOpenSe rver, tcpFastOpenClient, and tcpFastOpenQueueSize."} {"t":{"$date":"2022-06-19T12:43:29.498+08:00"},"s":"I", "c":"STORAGE", "id":4615611, "ctx":"initandlisten","msg":"MongoDB starting","attr":{"pid":4743,"port":27017,"dbPath":"/data/mongo_ data/data","architecture":"64-bit","host":"VM-16-12-centos"}} {"t":{"$date":"2022-06-19T12:43:29.498+08:00"},"s":"I", "c":"CONTROL", "id":23403, "ctx":"initandlisten","msg":"Build Info","attr":{"buildInfo":{"version":"4.4.14","gitVersion":"0b0843 af97c3ec9d2c0995152d96d2aad725aab7","openSSLVersion":"OpenSSL 1.0.1e-fips 11 Feb 2013","modules":[],"allocator":"tcmalloc","environment":{"distmod":"rhel70","distarch":"x86_64","target_arc h":"x86_64"}}}} {"t":{"$date":"2022-06-19T12:43:29.498+08:00"},"s":"I", "c":"CONTROL", "id":51765, "ctx":"initandlisten","msg":"Operating System","attr":{"os":{"name":"CentOS Linux release 7.6.1810 (C ore) ","version":"Kernel 3.10.0-1160.11.1.el7.x86_64"}}} {"t":{"$date":"2022-06-19T12:43:29.498+08:00"},"s":"I", "c":"CONTROL", "id":21951, "ctx":"initandlisten","msg":"Options set by command line","attr":{"options":{"config":"/etc/mongod.co nf","net":{"bindIp":"0.0.0.0","port":27017},"processManagement":{"pidFilePath":"/data/mongo_data/mongod.pid"},"storage":{"dbPath":"/data","directoryPerDB":true,"journal":{" enabled":true},"wiredTiger":{"engineConfig":{"directoryForIndexes":true}}},"systemLog":{"destination":"file","logAppend":true,"path":"/log/mongod.log","quiet":true}}}} {"t":{"$date":"2022-06-19T12:43:29.499+08: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":"2022-06-19T12:43:29.499+08:00"},"s":"F", "c":"-", "id":23091, "ctx":"initandlisten","msg":"Fatal assertion","attr":{"msgid":40486,"file":"src/mongo/transport/trans port_layer_asio.cpp","line":948}} {"t":{"$date":"2022-06-19T12:43:29.499+08:00"},"s":"F", "c":"-", "id":23092, "ctx":"initandlisten","msg":"\n\n***aborting after fassert() failure\n\n"}
从日志看是因为unlink socket文件。
# cd /tmp/ # ll |grep mongo srwx------ 1 992 mongod 0 Jun 9 20:45 mongodb-27017.sock
可以看到,sock文件的属主不对。删除,重启启动即可