Ubuntu
systemctl 限制 - solr 抱怨
我正在建構一個 solr 伺服器(在 Ubuntu 18.04 上,使用 repo solr-common 和 solr-jetty)。啟動時,solr 報告 nfile 和 nproc (1024, 6721 resp) 設置得太低。我執行
systemctl edit solr
並創建了一個覆蓋,如下所示:[Service] LimitNOFILE=65000 LimitNPROC=65000
然後我重新啟動了服務 - solr 仍然報告同樣的問題。
我添加了 /etc/security/limits.d/solr 包含:
solr hard nofile 65535 solr soft nofile 65535 solr hard nproc 65535 solr soft nproc 65535
重新啟動服務後仍然報告相同的問題:
# systemctl status solr ● solr.service - LSB: Controls Apache Solr as a Service Loaded: loaded (/etc/init.d/solr; generated) Drop-In: /etc/systemd/system/solr.service.d └─override.conf Active: active (exited) since Mon 2020-03-30 14:55:49 BST; 6s ago Docs: man:systemd-sysv-generator(8) Process: 6848 ExecStop=/etc/init.d/solr stop (code=exited, status=0/SUCCESS) Process: 6973 ExecStart=/etc/init.d/solr start (code=exited, status=0/SUCCESS) Mar 30 14:55:43 dev-a01-si-solr.bip solr[6973]: *** [WARN] *** Your open file limit is currently 1024. Mar 30 14:55:43 dev-a01-si-solr.bip solr[6973]: It should be set to 65000 to avoid operational disruption. Mar 30 14:55:43 dev-a01-si-solr.bip solr[6973]: If you no longer wish to see this warning, set SOLR_ULIMIT_CHECKS to false in your profile or solr.in.sh Mar 30 14:55:43 dev-a01-si-solr.bip solr[6973]: *** [WARN] *** Your Max Processes Limit is currently 6721. Mar 30 14:55:43 dev-a01-si-solr.bip solr[6973]: It should be set to 65000 to avoid operational disruption. Mar 30 14:55:43 dev-a01-si-solr.bip solr[6973]: If you no longer wish to see this warning, set SOLR_ULIMIT_CHECKS to false in your profile or solr.in.sh Mar 30 14:55:49 dev-a01-si-solr.bip solr[6973]: [194B blob data] Mar 30 14:55:49 dev-a01-si-solr.bip solr[6973]: Started Solr server on port 8983 (pid=7045). Happy searching! Mar 30 14:55:49 dev-a01-si-solr.bip solr[6973]: [14B blob data] Mar 30 14:55:49 dev-a01-si-solr.bip systemd[1]: Started LSB: Controls Apache Solr as a Service.
我在這裡做錯了什麼?
更新 修改 /etc/systemd/system.conf 以包含…
DefaultLimitNOFILE=65000 DefaultLimitNPROC=65000
Solr 不再抱怨文件限制,但仍在抱怨程序限制。WTF波特林?
Drop-In: /etc/systemd/system/solr.service.d └─override.conf Active: active (exited) since Mon 2020-03-30 15:21:59 BST; 14s ago Docs: man:systemd-sysv-generator(8) Process: 1141 ExecStart=/etc/init.d/solr start (code=exited, status=0/SUCCESS) Mar 30 15:21:51 dev-a01-si-solr.bip solr[1141]: If you no longer wish to see this warning, set SOLR_ULIMIT_CHECKS to false in your profile or solr.in.sh Mar 30 15:21:51 dev-a01-si-solr.bip solr[1141]: *** [WARN] *** Your Max Processes Limit is currently 6721. Mar 30 15:21:51 dev-a01-si-solr.bip solr[1141]: It should be set to 65000 to avoid operational disruption. Mar 30 15:21:51 dev-a01-si-solr.bip solr[1141]: If you no longer wish to see this warning, set SOLR_ULIMIT_CHECKS to false in your profile or solr.in.sh Mar 30 15:21:51 dev-a01-si-solr.bip solr[1141]: Warning: Available entropy is low. As a result, use of the UUIDField, SSL, or any other features that require Mar 30 15:21:51 dev-a01-si-solr.bip solr[1141]: RNG might not work properly. To check for the amount of available entropy, use 'cat /proc/sys/kernel/random/entropy_avail'. Mar 30 15:21:59 dev-a01-si-solr.bip solr[1141]: [230B blob data] Mar 30 15:21:59 dev-a01-si-solr.bip solr[1141]: Started Solr server on port 8983 (pid=1459). Happy searching! Mar 30 15:21:59 dev-a01-si-solr.bip solr[1141]: [14B blob data] Mar 30 15:21:59 dev-a01-si-solr.bip systemd[1]: Started LSB: Controls Apache Solr as a Service.
修改 user.conf 以匹配沒有幫助。
更新 2 好吧,這只會越來越好。重新啟動主機後,nfile 警告消失了。當我隨後執行時,
systemctl restart solr
我得到了這個:Mar 30 15:39:21 dev-a01-si-solr.bip solr[2503]: *** [WARN] *** Your open file limit is currently 1024. Mar 30 15:39:21 dev-a01-si-solr.bip solr[2503]: It should be set to 65000 to avoid operational disruption.
FFS!
現在,我把 Centos 5 CD 放在哪裡了?
更新 3
事實證明,這不再是打包好的 solr。我不知道,有人在使原始版本正常工作時遇到問題,並在網際網路上找到了有關如何從 tarball 安裝的教程。所以我現在有一個半 tarball/半 repo solr 的系統,我們無法修補/升級。
在 Ubuntu 18.04 上,solr 實際上是由從 systemd 呼叫的 initV 腳本啟動的。
我已經擺脫了警告
- 刪除 /etc/security/limits.d/solr 並在 /etc/security/limits.conf 中添加以下內容:
* hard nofile 2048 * hard nproc 2048 root hard nofile unlimited root soft nofile unlimited root hard nproc unlimited root soft nproc unlimited solr hard nofile 65535 solr soft nofile 65535 solr hard nproc 65535 solr soft nproc 65535
- 將此添加到 /etc/init.d/solr 的頂部
ulimit -n 65000 ulimit -u 65000
(雖然 -u 行似乎沒有做任何事情)
- 執行
systemctl daemon-reload
4)進行硬重啟
當我跑步時,警告就會消失
systemctl reload solr
。但是我現在到處都有配置機器人,我需要刪除其中的一些。