我正在通过此链接在 Unix 上安装 Solr 9.6.1 ,并且我能够通过以下命令启动该服务
service solr start
但我无法通过以下方式启动服务systemctl
。执行时systemctl start solr
出现以下消息
Job for solr.service failed because the control process exited with error code.
See "systemctl status solr.service" and "journalctl -xeu solr.service" for details.
执行后systemctl status solr
会显示以下信息
× solr.service - Apache SOLR
Loaded: loaded (/etc/systemd/system/solr.service; enabled; preset: disabled)
Active: failed (Result: exit-code) since Fri 2025-04-25 02:54:41 EDT; 1min 19s ago
Process: 5298 ExecStart=/opt/solr/bin/solr start -noprompt (code=exited, status=1/FAILURE)
CPU: 89ms
systemd[1]: solr.service: Scheduled restart job, restart counter is at 5.
systemd[1]: Stopped Apache SOLR.
systemd[1]: solr.service: Start request repeated too quickly.
systemd[1]: solr.service: Failed with result 'exit-code'.
systemd[1]: Failed to start Apache SOLR.
以下是/etc/systemd/system/solr.service
[Unit]
Description=Apache SOLR
After=syslog.target network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
PIDFile=/var/solr/solr-8983.pid
Environment=SOLR_INCLUDE=/etc/sysconfig/solr
ExecStart=/opt/solr/bin/solr start -noprompt
ExecStop=/opt/solr/bin/solr stop -noprompt
ExecReload=/bin/kill -s HUP $MAINPID
Restart=on-failure
User=solr
PrivateTmp=true
TimeoutSec=180s
LimitNOFILE=65000
LimitNPROC=65000
[Install]
WantedBy=multi-user.target
solr 文件夹似乎不属于 solr 用户。将其从 root 权限更改为 solr 权限后,一切正常。