時(shí)間:2024-02-07 12:09作者:下載吧人氣:24
在項(xiàng)目實(shí)際使用過(guò)程中,客戶(hù)反饋能打開(kāi)網(wǎng)頁(yè)但無(wú)法登陸,第一時(shí)間感覺(jué)到應(yīng)該是數(shù)據(jù)庫(kù)服務(wù)器掛了,于是查看Mongodb數(shù)據(jù)庫(kù)服務(wù)器日志,果不其然掛了。
報(bào)錯(cuò)信息如下:
2020-12-28T13:21:21.731+0800 E STORAGE [conn2624] WiredTiger error (24) [1609132881:731422][23581:0x7fe157189700], WT_SESSION.create: __posix_directory_sync, 135: /data1/mongodb/data/db/: directory-sync: open: Too many open files Raw: [1609132881:731422][23581:0x7fe157189700], WT_SESSION.create: __posix_directory_sync, 135: /data1/mongodb/data/db/: directory-sync: open: Too many open files
2020-12-28T13:21:21.731+0800 E STORAGE [conn2624] WiredTiger error (24) [1609132881:731616][23581:0x7fe157189700], WT_SESSION.create: __posix_directory_sync, 151: /data1/mongodb/data/db/collection-1063-1706476241051221735.wt: directory-sync: Too many open files Raw: [1609132881:731616][23581:0x7fe157189700], WT_SESSION.create: __posix_directory_sync, 151: /data1/mongodb/data/db/collection-1063-1706476241051221735.wt: directory-sync: Too many open files
2020-12-28T13:21:21.731+0800 E STORAGE [conn2624] WiredTiger error (-31804) [1609132881:731651][23581:0x7fe157189700], WT_SESSION.create: __wt_panic, 494: the process must exit and restart: WT_PANIC: WiredTiger library panic Raw: [1609132881:731651][23581:0x7fe157189700], WT_SESSION.create: __wt_panic, 494: the process must exit and restart: WT_PANIC: WiredTiger library panic
2020-12-28T13:21:21.731+0800 F – [conn2624] Fatal Assertion 50853 at src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp 420
2020-12-28T13:21:21.731+0800 F – [conn2624]***aborting after fassert() failure
可以看到核心問(wèn)題就是 Too many open files。經(jīng)查閱相關(guān)資料,造成如下問(wèn)題的原因就是Centos7給每個(gè)用戶(hù)默認(rèn)的同時(shí)打開(kāi)文件的數(shù)值為1024,可通過(guò)如下配置文件查看:
ulimit -a
其中所有的參數(shù)均可修改,那么如何修改open files呢?
在此提供兩種方法:
首先查看系統(tǒng)全局參數(shù):
所以我們可以修改的最大值也是174198
具體修改方法一:
新建一個(gè)nofile.conf文件:
vi /etc/security/limits.d/nofile.conf
網(wǎng)友評(píng)論