mongodb進程號的尋找,mongodb進程號尋找

來源:互聯網
上載者:User

mongodb進程號的尋找,mongodb進程號尋找

因監控需要,必須調用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


相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.