Solr 是 运行 但 systemctl 状态是非活动的

Solr is running but systemctl status is inactive

我已经使用 Salt 在 Amazon Linux V2 实例上安装了 Solr,运行 很好:

[root@ip-10-231-93-23[gtndorctq-solrms-1-1-v2] ec2-user]# service solr status
su: warning: cannot change directory to /home/solr: No such file or directory

Found 1 Solr nodes: 

Solr process 15691 running on port 8983
{
  "solr_home":"/database/solr/data",
  "version":"6.6.3 d1e9bbd333ea55cfa0c75d324424606e857a775b - sarowe - 2018-03-02 15:09:34",
  "startTime":"2020-06-02T13:19:30.722Z",
  "uptime":"0 days, 0 hours, 35 minutes, 4 seconds",
  "memory":"50.6 MB (%10.3) of 490.7 MB"}

但是当我执行 systemctl 时,它会抛出错误:

[root@ip-10-231-93-23[gtndorctq-solrms-1-1-v2] ec2-user]# systemctl status solr
● solr.service - Apache SOLR
   Loaded: loaded (/etc/systemd/system/solr.service; disabled; vendor preset: disabled)
   Active: failed (Result: start-limit) since Tue 2020-06-02 13:19:44 UTC; 35min ago

Jun 02 13:19:44 ip-10-231-93-23.ade.gtncloud.com systemd[1]: solr.service: control process exited, code=exited status=1
Jun 02 13:19:44 ip-10-231-93-23.ade.gtncloud.com systemd[1]: Failed to start Apache SOLR.
Jun 02 13:19:44 ip-10-231-93-23.ade.gtncloud.com systemd[1]: Unit solr.service entered failed state.
Jun 02 13:19:44 ip-10-231-93-23.ade.gtncloud.com systemd[1]: solr.service failed.
Jun 02 13:19:44 ip-10-231-93-23.ade.gtncloud.com systemd[1]: solr.service holdoff time over, scheduling restart.
Jun 02 13:19:44 ip-10-231-93-23.ade.gtncloud.com systemd[1]: start request repeated too quickly for solr.service
Jun 02 13:19:44 ip-10-231-93-23.ade.gtncloud.com systemd[1]: Failed to start Apache SOLR.
Jun 02 13:19:44 ip-10-231-93-23.ade.gtncloud.com systemd[1]: Unit solr.service entered failed state.
Jun 02 13:19:44 ip-10-231-93-23.ade.gtncloud.com systemd[1]: solr.service failed.
[root@ip-10-231-93-23[gtndorctq-solrms-1-1-v2] ec2-user]# systemctl start solr
Job for solr.service failed because the control process exited with error code. See "systemctl status solr.service" and "journalctl -xe" for details.

有关失败的更多信息,当我 运行 journalctl -xe 命令时,它说端口 8983 正在被进程 15691 使用,但这是由于我的安装而启动的相同进程:

我的 systemd 文件如下所示,其中状态 start-solr 失败。

solr-service-systemd-file:
  file.managed:
    - source: salt://config/solr.service
    - name: /etc/systemd/system/solr.service
    - mode: 0644
  module.run:
    - name: service.systemctl_reload
    - onchanges:
      - file: solr-service-systemd-file

start-solr:
  service.running:
    - name: solr
    - enable: True
    - watch:
      - file: solr-service-systemd-file
    - require:
      - file: solr-service-systemd-file

看起来 systemd 放弃启动您的服务,因为它尝试绑定到已占用的端口。可能由于某种原因你需要杀死一些驻留在内存中的并发进程才能使你的 systemd 服务成为 运行.

我怀疑你提到的进程15691不是systemd控制的进程。

是的,我注意到安装 Solr 后默认启动,所以我停止然后通过 systemd 启动,现在问题已解决。