Manjaro

Kibana 服務無法啟動

  • November 20, 2020

我正在使用 Manjaro 並安裝了 elasticsearch 和 kibana

yay -S elasticsearch kibana

啟動elasticsearch服務效果很好

sudo systemctl start elasticsearch

我已經使用 /etc/kibana/kibana.yml 中的基本設置配置了 kibana:

server.port: 5601
server.host: "localhost"
elasticsearch.hosts: ["http://localhost:9200"]

但是執行 kibana 總是失敗:

❯❯❯ systemctl status kibana                                                                                                                                                              ✘ 7 
● kibana.service - Kibana - dashboard for Elasticsearch
    Loaded: loaded (/usr/lib/systemd/system/kibana.service; enabled; vendor preset: disabled)
    Active: failed (Result: exit-code) since Fri 2020-11-13 12:10:13 CET; 5min ago
   Process: 1609 ExecStart=/usr/bin/node --max-old-space-size=512 /usr/share/kibana/src/cli --config=/etc/kibana/kibana.yml (code=exited, status=1/FAILURE)
  Main PID: 1609 (code=exited, status=1/FAILURE)

Nov 13 12:10:13 Trinity systemd[1]: kibana.service: Scheduled restart job, restart counter is at 5.
Nov 13 12:10:13 Trinity systemd[1]: Stopped Kibana - dashboard for Elasticsearch.
Nov 13 12:10:13 Trinity systemd[1]: kibana.service: Start request repeated too quickly.
Nov 13 12:10:13 Trinity systemd[1]: kibana.service: Failed with result 'exit-code'.
Nov 13 12:10:13 Trinity systemd[1]: Failed to start Kibana - dashboard for Elasticsearch.

也許我正在監督一些想法。我應該怎麼做才能正確啟動它?

journal -u kibana

Nov 13 12:10:10 Trinity systemd[1]: Started Kibana - dashboard for Elasticsearch.
Nov 13 12:10:10 Trinity node[1419]: Kibana does not support the current Node.js version v15.0.1. Please use Node.js v10.22.1.
Nov 13 12:10:10 Trinity systemd[1]: kibana.service: Main process exited, code=exited, status=1/FAILURE
Nov 13 12:10:10 Trinity systemd[1]: kibana.service: Failed with result 'exit-code'.
Nov 13 12:10:11 Trinity systemd[1]: kibana.service: Scheduled restart job, restart counter is at 1.
Nov 13 12:10:11 Trinity systemd[1]: Stopped Kibana - dashboard for Elasticsearch.
Nov 13 12:10:11 Trinity systemd[1]: Stopped Kibana - dashboard for Elasticsearch.
Nov 13 12:10:11 Trinity systemd[1]: Started Kibana - dashboard for Elasticsearch.
Nov 13 12:10:11 Trinity node[1579]: Kibana does not support the current Node.js version v15.0.1. Please use Node.js v10.22.1.
Nov 13 12:10:11 Trinity systemd[1]: kibana.service: Main process exited, code=exited, status=1/FAILURE
Nov 13 12:10:11 Trinity systemd[1]: kibana.service: Failed with result 'exit-code'.
Nov 13 12:10:11 Trinity systemd[1]: kibana.service: Scheduled restart job, restart counter is at 2.
Nov 13 12:10:11 Trinity systemd[1]: Stopped Kibana - dashboard for Elasticsearch.
Nov 13 12:10:11 Trinity systemd[1]: Started Kibana - dashboard for Elasticsearch.
Nov 13 12:10:11 Trinity node[1589]: Kibana does not support the current Node.js version v15.0.1. Please use Node.js v10.22.1.
Nov 13 12:10:11 Trinity systemd[1]: kibana.service: Main process exited, code=exited, status=1/FAILURE
Nov 13 12:10:11 Trinity systemd[1]: kibana.service: Failed with result 'exit-code'.
Nov 13 12:10:12 Trinity systemd[1]: kibana.service: Scheduled restart job, restart counter is at 3.
Nov 13 12:10:12 Trinity systemd[1]: Stopped Kibana - dashboard for Elasticsearch.
Nov 13 12:10:12 Trinity systemd[1]: Started Kibana - dashboard for Elasticsearch.
Nov 13 12:10:12 Trinity node[1599]: Kibana does not support the current Node.js version v15.0.1. Please use Node.js v10.22.1.
Nov 13 12:10:12 Trinity systemd[1]: kibana.service: Main process exited, code=exited, status=1/FAILURE
Nov 13 12:10:12 Trinity systemd[1]: kibana.service: Failed with result 'exit-code'.
Nov 13 12:10:12 Trinity systemd[1]: kibana.service: Scheduled restart job, restart counter is at 4.
Nov 13 12:10:12 Trinity systemd[1]: Stopped Kibana - dashboard for Elasticsearch.
Nov 13 12:10:12 Trinity systemd[1]: Started Kibana - dashboard for Elasticsearch.
Nov 13 12:10:12 Trinity node[1609]: Kibana does not support the current Node.js version v15.0.1. Please use Node.js v10.22.1.
Nov 13 12:10:12 Trinity systemd[1]: kibana.service: Main process exited, code=exited, status=1/FAILURE
Nov 13 12:10:12 Trinity systemd[1]: kibana.service: Failed with result 'exit-code'.
Nov 13 12:10:13 Trinity systemd[1]: kibana.service: Scheduled restart job, restart counter is at 5.
Nov 13 12:10:13 Trinity systemd[1]: Stopped Kibana - dashboard for Elasticsearch.
Nov 13 12:10:13 Trinity systemd[1]: kibana.service: Start request repeated too quickly.
Nov 13 12:10:13 Trinity systemd[1]: kibana.service: Failed with result 'exit-code'.
Nov 13 12:10:13 Trinity systemd[1]: Failed to start Kibana - dashboard for Elasticsearch.

我花了無數個小時試圖讓 Kibana 參與 Arch 和 Manjaro。我終於成功了。

以下是我自己的筆記,以防其他人有同樣的問題。

請注意,我是新手,坦率地說,我不知道自己在做什麼,所以請謹慎行事。

  1. 安裝後安裝 Kibanaelasticsearch

在 Arch 中,使用了這個命令:

$sudo pacman -S kibana

在 Manjaro 中,我使用了添加/刪除軟體 GUI。搜尋kibana,點擊安裝,應用

  1. 安裝 Kibana 後,我更改了這些設置/etc/kibana/kibana.yml(取消註釋以下行):
$ sudo nano /etc/kibana/kibana.yml

#server.port: 5601
#server.host: "localhost"
#elasticsearch.hosts: ["http://localhost:9200"]
  1. Kibana 需要node,但 Kibana 7.9.2-1 不適用於最新node版本。因此,您需要使用舊版本的 Node,特別是 Node 10.22.1。為了安裝這個舊版本的 Node,我使用了 NVM(Node Version Manager)。

我執行了這些命令:

$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.0/install.sh | bash
$ export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
$ [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
  1. 使用 NVM,安裝節點 10.22.1。
$ nvm install v10.22.1

這將在此位置安裝名為“node”的二進製文件:(/home/manjaro1/.nvm/versions/node/v10.22.1/bin 注意 .nvm 目錄是隱藏的)

  1. 安裝後,我將現有節點文件 ( /usr/bin/node) 重命名為 ( /usr/bin/node) 我使用這些命令來實現:
$ cd /usr/bin
$ sudo mv -- node node_backup

警告:關於其他程序,我不知道重命名此文件是否是個好主意。

  1. 然後我使用這個命令將我的新節點文件複製到/usr/bin, (確保我從/usr/bin目錄執行命令):
$ cd /usr/bin
$ sudo cp -- /home/manjaro1/.nvm/version/node/v10.22.1/bin/node node
  1. 我讓 Kibana 在啟動時執行:
$ systemctl enable kibana
  1. 然後我開始了 Kibana
$ systemctl start kibana
  1. 並檢查了狀態:
$ systemctl status kibana
  1. 一切看起來都很好。然後我確保 Elasticsearch 正在執行(systemctl status elasticsearch)並打開瀏覽器,然後轉到 localhost:5601

幾秒鐘後,出現了 Kibana 控制面板。


有用的筆記

  1. 在上面的第 5 步和第 6 步中,您可以將現有節點文件保留在 中/usr/bin,並將版本 10.22.1 的節點文件複製到/usr/bin新名稱,例如node10221. 在這種情況下,您需要在此文件中進行更改:/usr/lib/systemd/system/kibana.service使用:
$ sudo nano /usr/lib/systemd/system/kibana.service

ExecStart=/usr/bin/node在以將文件名更改為新節點名開頭的行中,如下所示:

ExecStart=/usr/bin/node10221

保存文件並啟動或重啟 Kibana:

$ systemctl start kibana 

或者

$ systemctl restart kibana
  1. 確保您使用的是eleasticsearch7.9.2-1 和Kibana7.9.2-1 並elasticsearch在之前安裝Kibana
  2. 如果執行時出現問題:
$ systemctl status kibana

您可以使用以下方法進行故障排除:

$ journalctl -fu kibana.service
  1. 如果 Kibana 因權限問題無法啟動,請使用以下命令檢查權限:
$ ls -l
  1. 我的安裝只在本地執行,所以localhost在 kibana.yml 中使用對我來說很好。我的理解是,如果您想允許遠端訪問,您需要更改此設置。

我希望這可以幫助別人。

引用自:https://unix.stackexchange.com/questions/619444