mount程式在systemctl守護的情況下,mount dir程式被oom後重新啟動失敗的處理方法
systemctl 如果用於守護mount 程式時,建議在systemctl程式碼段ExecStart指向的mount指令碼中增加umount命令再去執行mount命令,因為一旦一個mount的目錄的程式被OOM後,這個mount目錄其實還是被佔用的,需要umount後才能再次mount上去
mount指令碼如下
root@DAILAPGDBUP001:~# cat /root/mountdatadomaindir.sh /opt/emc/boostfs/bin/boostfs mount /mnt/datadomaindir -d DAILADD01.dai.netdai.com -s daipostgres -o allow-others=true
systemctl程式碼段ExecStart指向了該mount指令碼,systemctl資訊如下
root@DAILAPGDBUP001:~# vim /usr/lib/systemd/system/mountdatadomaindir.service [Unit] Description=mountdatadomaindir After=network.target [Service] User=root Group=root Type=forking ExecStart=/bin/bash /root/mountdatadomaindir.sh Restart=on-failure [Install] WantedBy=multi-user.target
root@DAILAPGDBUP001:~# systemctl enable mountdatadomaindir
有一次發生了OOM,我們們systemctl已經是加了Restart=on-failure的,但是沒看到/mnt/datadomaindir被掛載了,/var/log/syslogs有如下記錄,
Oct 15 01:01:02 DAILAPGDBUP001 systemd[1]: mountdatadomaindir.service: A process of this unit has been killed by the OOM killer. Oct 15 01:01:02 DAILAPGDBUP001 systemd[1]: mountdatadomaindir.service: Main process exited, code=killed, status=9/KILL Oct 15 01:01:02 DAILAPGDBUP001 systemd[1]: mountdatadomaindir.service: Failed with result 'oom-kill'. Oct 15 01:01:02 DAILAPGDBUP001 systemd[1]: mountdatadomaindir.service: Consumed 36min 37.125s CPU time. Oct 15 01:01:03 DAILAPGDBUP001 systemd[1]: mountdatadomaindir.service: Scheduled restart job, restart counter is at 1. Oct 15 01:01:03 DAILAPGDBUP001 systemd[1]: Stopped mountdatadomaindir. Oct 15 01:01:03 DAILAPGDBUP001 systemd[1]: mountdatadomaindir.service: Consumed 36min 37.125s CPU time. Oct 15 01:01:03 DAILAPGDBUP001 systemd[1]: Starting mountdatadomaindir... Oct 15 01:01:04 DAILAPGDBUP001 bash[1896219]: Not able to access the mount point /mnt/datadomaindir Oct 15 01:01:04 DAILAPGDBUP001 systemd[1]: mountdatadomaindir.service: Control process exited, code=exited, status=1/FAILURE Oct 15 01:01:04 DAILAPGDBUP001 systemd[1]: mountdatadomaindir.service: Failed with result 'exit-code'. Oct 15 01:01:04 DAILAPGDBUP001 systemd[1]: Failed to start mountdatadomaindir. Oct 15 01:01:04 DAILAPGDBUP001 systemd[1]: mountdatadomaindir.service: Scheduled restart job, restart counter is at 2. Oct 15 01:01:04 DAILAPGDBUP001 systemd[1]: Stopped mountdatadomaindir. Oct 15 01:01:04 DAILAPGDBUP001 systemd[1]: Starting mountdatadomaindir... Oct 15 01:01:06 DAILAPGDBUP001 bash[1896286]: Not able to access the mount point /mnt/datadomaindir Oct 15 01:01:06 DAILAPGDBUP001 systemd[1]: mountdatadomaindir.service: Control process exited, code=exited, status=1/FAILURE
並且ll /mnt/顯示ls: cannot access 'datadomaindir': Transport endpoint is not connected,並且掛載的目錄資訊都是顯示?問號
root@DAILAPGDBUP001:~# ll /mnt/ ls: cannot access 'datadomaindir': Transport endpoint is not connected total 8 drwxr-xr-x 3 root root 4096 Sep 16 04:16 ./ drwxr-xr-x 20 root root 4096 Aug 31 06:36 ../ d????????? ? ? ? ? ? datadomaindir/
解決方法:在/root/mountdatadomaindir.sh中增加一段umount /mnt/datadomaindir,原因就是一旦一個mount的目錄的程式被OOM後,這個mount目錄其實還是被佔用的,需要umount後才能再次mount上去
root@DAILAPGDBUP001:~# vim /root/mountdatadomaindir.sh umount /mnt/datadomaindir /opt/emc/boostfs/bin/boostfs mount /mnt/datadomaindir -d DAILADD01.dai.netdai.com -s daipostgres -o allow-others=true
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/30126024/viewspace-2989147/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Linux守護程式的啟動方法Linux
- Java程式異常處理的特殊情況Java
- Golang 後臺守護程式佇列處理方式小結Golang佇列
- mount 的使用
- Linux下的守護程式分析Linux
- systemctl 命令設定開機自啟動失敗
- 如何在不重新啟動phantomjs的情況下修改HTTP代理?JSHTTP
- Postgresql在ubuntu 22.04上遭遇OOM的處理方法SQLUbuntuOOM
- Spring Cloud Stream消費失敗後的處理策略(四):重新入隊(RabbitMQ)SpringCloudMQ
- AndroidKiller反編譯失敗的處理方法Android編譯
- CentOS7中使用systemctl列出啟動失敗的服務CentOS
- 文盤Rust -- 把程式作為守護程式啟動Rust
- xcodebuild -workspace 情況下,部分坑的處理XCodeUI
- w10安裝程式啟動失敗請重新啟動電腦怎麼辦
- systemctl 命令在 Linux 中啟動、停止和重新啟動服務Linux
- 3.1.5.4 啟動例項並mount 資料庫資料庫
- linux mountLinux
- 在不影響程式使用的情況下新增shellcode
- PBOOTCMS後臺出現“登入失敗:表單提交校驗失敗,重新整理後重試!”等情況怎麼辦?boot
- 在分散式事務失敗的情況下實現一致性:線上事件處理OLEP(事件溯源) - ACM權威分散式事件ACM
- npm install過程失敗的幾種處理方法NPM
- 守護程式
- 如何在不使用POJO程式碼的情況下建立Java批處理插入 -DZone JavaPOJOJava
- sql server 重新啟動計算機失敗SQLServer計算機
- win10更新程式安裝失敗怎麼解決_win10更新程式一直安裝失敗處理方法Win10
- Linux 下後臺執行和按照守護程式方式後臺執行的坑Linux
- windows10系統下apache啟動失敗的解決方法WindowsApache
- ctfmon.exe是什麼程式?ctfmon.exe程式不能自動啟動的處理方法
- Spring Cloud Stream消費失敗後的處理策略(一):自動重試SpringCloud
- 在FreeBSD上mount Ext4檔案系統的行動硬碟硬碟
- Vue原始碼分析系列二:$mount()方法Vue原始碼
- SSH 登入失敗:Host key verification failed 的處理方法AI
- Invoca:85%的客戶互動在沒有人工的情況下得到處理
- dbsnmp啟動失敗解決方法
- 框架下載後解壓失敗,有沒有遇到同樣情況的?框架
- 微信token驗證失敗的幾種情況
- 程式守護 supervisor
- Linux 守護程式Linux