PIDFile没有配置导致将mongodb配置成服务时启动失败
2021/10/29 19:39:36
本文主要是介绍PIDFile没有配置导致将mongodb配置成服务时启动失败,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
安装MongoDB,尝试配置成服务后,启动一直不成功
# systemctl start mongod # systemctl status mongod ● mongod.service - High-performance, schema-free document-oriented database Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; vendor preset: disabled) Active: inactive (dead) since 五 2021-10-29 18:14:10 CST; 4s ago Docs: https://docs.mongodb.org/manual Process: 3921 ExecStart=/usr/local/mongodb/bin/mongod $OPTIONS (code=exited, status=0/SUCCESS) Main PID: 3921 (code=exited, status=0/SUCCESS) 10月 29 18:14:09 abce systemd[1]: Started High-performance, schema-free document-oriented database. 10月 29 18:14:09 abce mongod[3921]: about to fork child process, waiting until server is ready for connections. 10月 29 18:14:09 abce mongod[3921]: forked process: 3925 10月 29 18:14:10 abce mongod[3921]: child process started successfully, parent exiting
启动的时候,进程会自动被kill掉。
看看mongodb的日志可以看到,会自动发送kill信号
{"t":{"$date":"2021-10-29T18:14:10.140+08:00"},"s":"I", "c":"CONTROL", "id":23377, "ctx":"SignalHandler","msg":"Received signal","attr":{"signal":15,"error":"Terminated"}} {"t":{"$date":"2021-10-29T18:14:10.140+08:00"},"s":"I", "c":"CONTROL", "id":23378, "ctx":"SignalHandler","msg":"Signal was sent by kill(2)","attr":{"pid":1,"uid":0}} {"t":{"$date":"2021-10-29T18:14:10.140+08:00"},"s":"I", "c":"CONTROL", "id":23381, "ctx":"SignalHandler","msg":"will terminate after current cmd ends"}
原因和解决方法:
在/usr/lib/systemd/system/mongod.service文件中添加
PIDFile=mongod.pid(实际pid文件名和路径)
这篇关于PIDFile没有配置导致将mongodb配置成服务时启动失败的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-06-26解决google chrome helper 内存占用较高!
- 2024-04-01got an unexpected keyword argument
- 2024-03-30维多利亚的秘密 golang入坑系统
- 2024-03-29mongodb sort by date
- 2024-03-29go swagger
- 2024-03-25mongodb cdc
- 2024-03-25how to use go in vscode
- 2024-03-22mongooseserverselectionerror: connect econnrefused ::1:27017
- 2024-03-21pymongo insert_many
- 2024-03-18projection mongodb