elasticsearch&kibana&logstashをインストールしてみた
きっかけ
会社でkibanaという言葉がちらっと出てきた。
どうやらデータを可視化できるものらしい。
Apacheログをこいつで分析できないものかとインストールしてみた。
作業記録
・openjdkのインストール yum install java-1.8.0-openjdk-devel java -version ----- openjdk version "1.8.0_252" OpenJDK Runtime Environment (build 1.8.0_252-b09) OpenJDK 64-Bit Server VM (build 25.252-b09, mixed mode) ----- ・Elasticsearch PGPキーのインストール rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch ・リポジトリの登録 vi /etc/yum.repos.d/elasticsearch.repo ----- [elasticsearch] name=Elasticsearch repository for 7.x packages baseurl=https://artifacts.elastic.co/packages/7.x/yum gpgcheck=1 gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch enabled=0 autorefresh=1 type=rpm-md ----- ・elasticsearch kibana logstashのインストール yum install --enablerepo=elasticsearch elasticsearch kibana logstash ======================================================================================================================================================================= Package Arch Version Repository Size ======================================================================================================================================================================= Installing: elasticsearch x86_64 7.8.0-1 elasticsearch 304 M kibana x86_64 7.8.0-1 elasticsearch 329 M logstash noarch 1:7.8.0-1 elasticsearch 160 M Transaction Summary ======================================================================================================================================================================= Install 3 Packages cp -ai /etc/elasticsearch/elasticsearch.yml /etc/elasticsearch/elasticsearch.yml.0 vi /etc/elasticsearch/elasticsearch.yml ----- (追加) network.host: 0.0.0.0 discovery.type: single-node ----- cp -ai /etc/kibana/kibana.yml /etc/kibana/kibana.yml.0 vi /etc/kibana/kibana.yml ----- (追加) server.host: "0.0.0.0" ----- systemctl daemon-reload systemctl restart elasticsearch kibana logstash systemctl enable elasticsearch kibana logstash ・elasticsearchの動作確認 curl http://localhost:9200 ----- { "name" : "ip-10-0-3-47.ap-northeast-1.compute.internal", "cluster_name" : "elasticsearch", "cluster_uuid" : "UNSDNcQVTJGmCdIelCr92w", "version" : { "number" : "7.8.0", "build_flavor" : "default", "build_type" : "rpm", "build_hash" : "757314695644ea9a1dc2fecd26d1a43856725e65", "build_date" : "2020-06-14T19:35:50.234439Z", "build_snapshot" : false, "lucene_version" : "8.5.1", "minimum_wire_compatibility_version" : "6.8.0", "minimum_index_compatibility_version" : "6.0.0-beta1" }, "tagline" : "You Know, for Search" } ----- ・kibanaの動作確認 curl http://localhost:5601 ----- ----- ※何も出力されなければよい。 http://グローバルIPアドレス:5601/ ↓ kibanaのダッシュボードが表示された。
エラー~Kibana server is not ready yet~
elasticsearchとkibanaと、両方動かす必要があるのだが、elasticsearchは動いてもkibanaが全く動かない。
下記エラーが出てしまう。
「Kibana server is not ready yet」
めっちゃ時間喰ったが、結局elasticsearchとkibanaのバージョンに差異があったというオチ。
https://www.elastic.co/jp/support/matrix#matrix_compatibility
[root@ip-10-0-3-168 centos]# rpm -qa | grep elasticsearch-2.4.6-1.noarch [root@ip-10-0-3-168 centos]# rpm -qa | grep kibana-6.8.10-1.x86_64
あとスペック不足でのインストール失敗などを気にしないようにするためにも、インストール時はt3a.mediumぐらいにしておいたほうがよい。
サービス起動もt3a.small以下だと失敗した。