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
- Linux 守護程式的啟動方法Linux
- 檢視mount掛載情況
- Redo 丟失的4種情況的處理方法
- Redo丟失的4種情況及處理方法
- Golang 後臺守護程式佇列處理方式小結Golang佇列
- Java程式異常處理的特殊情況Java
- svn dump 失敗後的處理
- systemctl 命令設定開機自啟動失敗
- Oracle 在mount狀態下重新命名資料檔案Oracle
- OracleDBConsole啟動失敗處理Oracle
- Linux下的守護程式分析Linux
- ASM 啟動時預設mount 的磁碟組ASM
- 文盤Rust -- 把程式作為守護程式啟動Rust
- linux上mount一個lv的處理過程Linux
- init.cssd程式啟動失敗CSS
- PHP實現守護程式的啟動和終止操作PHP
- Oracle 12c Clusterware讓ACFS 檔案系統在主機重啟後自動Mount的兩種方法Oracle
- mount 的使用
- 如何在不重新啟動phantomjs的情況下修改HTTP代理?JSHTTP
- w10安裝程式啟動失敗請重新啟動電腦怎麼辦
- PBOOTCMS後臺出現“登入失敗:表單提交校驗失敗,重新整理後重試!”等情況怎麼辦?boot
- 在分散式事務失敗的情況下實現一致性:線上事件處理OLEP(事件溯源) - ACM權威分散式事件ACM
- Spring Cloud Stream消費失敗後的處理策略(四):重新入隊(RabbitMQ)SpringCloudMQ
- 資料庫啟動在mount狀態,無任何報錯資料庫
- systemctl 命令在 Linux 中啟動、停止和重新啟動服務Linux
- Postgresql在ubuntu 22.04上遭遇OOM的處理方法SQLUbuntuOOM
- xcodebuild -workspace 情況下,部分坑的處理XCodeUI
- AndroidKiller反編譯失敗的處理方法Android編譯
- 守護程式
- aix 下nfs solaris mountAINFS
- root.sh執行失敗的解決方法及後續處理
- Android SERVICE後臺服務程式的守護Android
- 在不影響程式使用的情況下新增shellcode
- sql server 重新啟動計算機失敗SQLServer計算機
- 在MDX中處理邊界情況
- 3.1.5.4 啟動例項並mount 資料庫資料庫
- 處理表鎖定的情況