我正在构建一个 solr 服务器(在 Ubuntu 18.04 上,使用 repo solr-common 和 solr-jetty)。启动时,solr 报告 nfile 和 nproc(分别为 1024、6721)设置得太低。我运行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 不再抱怨文件限制,但仍然抱怨进程限制。波特到底是什么鬼?
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.
天啊!
现在,我把那张 Centos 5 CD 放在哪里了?
更新 3
事实证明,这不再是打包的 solr。我不知道,有人在使原始版本工作时遇到了问题,并在互联网上找到了有关如何从 tarball 安装的教程。所以我现在有一个半 tarball/半 repo solr 的系统,我们无法修补/升级。
答案1
在 Ubuntu 18.04 上,solr 实际上是由 systemd 调用的 initV 脚本启动的。
我已经摆脱了警告
1)删除 /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
2)将其添加到 /etc/init.d/solr 的顶部
ulimit -n 65000
ulimit -u 65000
(尽管 -u 行似乎没有做任何事情)
3)跑步systemctl daemon-reload
4)硬重启
当我跑步时,警告就消失了systemctl reload solr
。
但是现在我的配置机器人散落在各处,我需要修剪其中的一些。