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-11-15SendGrid 的 Go 客户端库怎么实现同时向多个邮箱发送邮件?-icode9专业技术文章分享
- 2024-11-15SendGrid 的 Go 客户端库怎么设置header 和 标签tag 呢?-icode9专业技术文章分享
- 2024-11-12Cargo deny安装指路
- 2024-11-02MongoDB项目实战:从入门到初级应用
- 2024-11-01随时随地一键转录,Google Cloud 新模型 Chirp 2 让语音识别更上一层楼
- 2024-10-25Google Cloud动手实验详解:如何在Cloud Run上开发无服务器应用
- 2024-10-24AI ?先驱齐聚 BAAI 2024,发布大规模语言、多模态、具身、生物计算以及 FlagOpen 2.0 等 AI 模型创新成果。
- 2024-10-20goland工具下,如修改一个项目的标准库SDK的版本-icode9专业技术文章分享
- 2024-10-17Go学习:初学者的简单教程
- 2024-10-17Go学习:新手入门完全指南