LoginSignup
0

More than 3 years have passed since last update.

kibanaのインストールに苦戦した話

Last updated at Posted at 2020-07-04

Elasticsearchを使う上で一緒に導入することになるだろうKibana.

このサイトをもとに、Homebrewでインストールしたけど、めちゃ時間がかかった。

TL;DR

他バージョンのelasticsearchやkibanaがinstallされてない状態で

$ brew tap elastic/tap
$ brew install elastic/tap/elasticsearch-oss
$ brew install elastic/tap/kibana-oss

$ elasticsearch // 起動
$ kibana // 起動

localhost:9200
localhost:5601

インストール終わらない

Pouringにメチャ時間がかかった。体感にして10分くらい。

$ brew install kibana
Updating Homebrew...

==> Downloading https://homebrew.bintray.com/bottles/kibana-7.6.2.mojave.bottle.tar.gz

==> Pouring kibana-7.6.2.mojave.bottle.tar.gz

// ここで10分くらいこのままMacのファンがひたすら回ってる

==> Caveats
Config: /usr/local/etc/kibana/
If you wish to preserve your plugins upon upgrade, make a copy of
/usr/local/opt/kibana/plugins before upgrading, and copy it into the
new keg location after upgrading.

To have launchd start kibana now and restart at login:
  brew services start kibana
Or, if you don't want/need a background service you can just run:
  kibana
==> Summary
🍺  /usr/local/Cellar/kibana/7.6.2: 58,186 files, 334.4MB

また公式ドキュメントにあるbrew install elastic/tap/kibana-fullでやり直すとさらに3倍くらいかかって、しかも(過去にダウンロードしてたので)Already Downloaded: /Users...というメッセージのままPouringとか出ずにうんともすんともいわないまま突然Conveatsとか出ておわる。途中であきらめて適当にコマンドを売ったりしたから動いたのかも。

起動できない

なんとかインストールできたけど、いざ起動してみると‥😥

$ kibana
Elastic APM initialization error: Can't read config file /usr/local/Cellar/kibana/7.6.2/config/apm.js
Error: Cannot find module 'lodash.merge'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/usr/local/etc/kibana/apm.js:53:15)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
APM Server transport error (ECONNREFUSED): connect ECONNREFUSED 127.0.0.1:8200
APM Server transport error (ECONNREFUSED): connect ECONNREFUSED 127.0.0.1:8200
  log   [10:49:56.004] [fatal][root] Error: Unable to write Kibana UUID file, please check the uuid.server configuration value in kibana.yml and ensure Kibana has sufficient permissions to read / write to this file. Error was: ENOENT
    at writeUuidToFile (/usr/local/Cellar/kibana/7.6.2/src/core/server/uuid/resolve_uuid.js:123:11)

 FATAL  Error: Unable to write Kibana UUID file, please check the uuid.server configuration value in kibana.yml and ensure Kibana has sufficient permissions to read / write to this file. Error was: ENOENT

ググったら、node_moduleを削除してからnpm install -g lodashしなよと書いてるけど、lodashを入れても結果は同じ。

公式のやり方でやると起動できた

brew install kibanaではなくて、公式のドキュメントにある以下でやると起動はできた。

brew tap elastic/tap
brew install elastic/tap/kibana-full

が、これでもプラグインのidが見つからないとか、無効だとか言われる。

$ kibana
  log   [12:41:00.419] [warning][plugins-discovery] Expect plugin "id" in camelCase, but found: apm_oss
  log   [12:41:00.433] [warning][plugins-discovery] Expect plugin "id" in camelCase, but found: triggers_actions_ui
  log   [12:41:11.159] [info][plugins-service] Plugin "visTypeXy" is disabled.
  log   [12:41:11.160] [info][plugins-service] Plugin "endpoint" is disabled.
  log   [12:41:11.160] [info][plugins-service] Plugin "ingestManager" is disabled.
  log   [12:41:11.160] [info][plugins-service] Plugin "lists" is disabled.
  log   [12:41:13.850] [warning][config][deprecation] Environment variable "DATA_PATH" will be removed.  It has been replaced with kibana.yml setting "path.data"
  log   [12:41:13.929] [info][plugins-system] Setting up [94] plugins: [taskManager,licensing,observability,eventLog,encryptedSavedObjects,code,usageCollection,ossTelemetry,telemetryCollectionManager,telemetry,telemetryCollectionXpack,kibanaLegacy,devTools,bfetch,expressions,translations,uiActions,data,home,console,consoleExtensions,cloud,apm_oss,searchprofiler,painlessLab,grokdebugger,management,upgradeAssistant,licenseManagement,indexManagement,remoteClusters,crossClusterReplication,indexLifecycleManagement,advancedSettings,telemetryManagementSection,fileUpload,dataEnhanced,savedObjects,navigation,statusPage,share,newsfeed,mapsLegacy,mapsLegacyLicensing,kibanaUtils,kibanaReact,inspector,embeddable,reporting,dashboard,advancedUiActions,embeddableEnhanced,drilldowns,dashboardEnhanced,visualizations,lens,visTypeVega,visTypeTimelion,features,security,snapshotRestore,transform,ingestPipelines,graph,canvas,visTypeTable,visTypeMarkdown,inputControlVis,maps,visualize,indexPatternManagement,esUiShared,discover,savedObjectsManagement,spaces,actions,case,alerting,alertingBuiltins,ml,charts,visTypeVislib,visTypeTimeseries,rollup,visTypeTagcloud,visTypeMetric,watcher,triggers_actions_ui,siem,infra,monitoring,logstash,apm,uptime]

どうやらこの方法は有料の製品版のやり方(トライアルを申し込んだ人用)では?

kibana-ossをインストールしてみる

To install the OSS distribution, specify elastic/tap/kibana-oss.

brew uninstall kibana-full
brew install elastic/tap/kibana-oss

こうして起動すると、一見同じエラーになるが


log   [15:49:10.608] [error][savedobjects-service] This version of Kibana (v7.8.0) is incompatible with the following Elasticsearch nodes in your cluster: v7.6.2 @ 127.0.0.1:9200 (127.0.0.1)

FATAL Error: Cluster client cannot be used after it has been closed.

こんな感じのエラーログが見つかる。要はkibanaとElasticsearchのバージョン違いまっせということらしく

brew uninstall elasticsearch
brew install elastic/tab/elasticsearch-oss

公式ドキュメントに従って実行しv7.8.0をインストールし、再度それぞれ起動。

$ elasticsearch
// Cmd+T で新しいターミナルタブを開き
$ kibana

localhost:9200
スクリーンショット 2020-07-06 1.02.15.png

localhost:5601
スクリーンショット 2020-07-06 1.02.11.png
※ダークモードのChrome拡張を入れているので暗くなってます。

できた😊

他に考えたこと

Pythonのバージョンが原因でもなさそう

もういちど最新のkibanaの情報をみてみると、Python3.8のとこに×と書いてあった。PCのglobalのPythonバージョンをそれ以上に上げたけど結果は同じだった。


$brew info kibana
kibana: stable 7.6.2 (bottled), HEAD
Analytics and search dashboard for Elasticsearch
https://www.elastic.co/products/kibana
/usr/local/Cellar/kibana/7.6.2 (58,186 files, 334.4MB) *
  Poured from bottle on 2020-07-04 at 19:48:02
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/kibana.rb
==> Dependencies
Build: python@3.8 ✘, yarn ✔
Required: node@10 ✔
==> Options
--HEAD
    Install HEAD version
==> Caveats
Config: /usr/local/etc/kibana/
If you wish to preserve your plugins upon upgrade, make a copy of
/usr/local/opt/kibana/plugins before upgrading, and copy it into the
new keg location after upgrading.

To have launchd start kibana now and restart at login:
  brew services start kibana
Or, if you don't want/need a background service you can just run:
  kibana
==> Analytics
install: 2,324 (30 days), 6,866 (90 days), 30,606 (365 days)
install-on-request: 2,241 (30 days), 6,610 (90 days), 29,491 (365 days)
build-error: 0 (30 days)

「設定ファイルが読めないよ」とのことだがググっても情報がすぐにでず‥誰か助けて‥。

参考

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0