Home  >  Article  >  Database  >  mongodb进程号的查找

mongodb进程号的查找

WBOY
WBOYOriginal
2016-06-07 16:11:151676browse

因监控需要,必须调用mongodb的PID, 方法1: 在交互文件里面加上,pidfilepath=/var/run/mongodb.pid,重启mongodb后, 注意,2.5.3以下的版本,找不到PID文件,这个是bug,在2.5.3以上的版本才修复; 方法2: 写脚本获取吧:脚本主要内容 PID=`ps aux|grep m

因监控需要,必须调用mongodb的PID,

方法1:

在交互文件里面加上,pidfilepath=/var/run/mongodb.pid,重启mongodb后,

注意,2.5.3以下的版本,找不到PID文件,这个是bug,在2.5.3以上的版本才修复;

方法2:写脚本获取吧:脚本主要内容

PID=`ps aux|grep mongodb |awk '{print $2}'|sed -n '1p'`

方法3:无意间去mongodb的data目录下,发现有个mongod.lock,里面记录就是pid嘛

随后做个链接,给监控调用就好了

#ln -s /data/mongodb/mongod.lock /var/run/mongodb.pid

cat /var/run/mongodb.pid

5231

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn