天天看点

ElasticSearch 6.x 学习笔记:3.Kibana插件

3.1 下载Kibana插件

https://www.elastic.co/downloads/kibana

ElasticSearch 6.x 学习笔记:3.Kibana插件

注意,ElasticSearch版本是6.1.1,kibana的版本必须对应,所以,此处下载kibana-6.1.1-linux-x86_64.tar.gz

[[email protected] ~]$ wget https://artifacts.elastic.co/downloads/kibana/kibana-6.1.1-linux-x86_64.tar.gz
--2018-01-06 04:30:47--  https://artifacts.elastic.co/downloads/kibana/kibana-6.1.1-linux-x86_64.tar.gz
Resolving artifacts.elastic.co (artifacts.elastic.co)... 184.73.156.41, 54.235.82.130, 184.72.218.26, ...
Connecting to artifacts.elastic.co (artifacts.elastic.co)|184.73.156.41|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 65947685 (63M) [application/x-gzip]
Saving to: ‘kibana-6.1.1-linux-x86_64.tar.gz’

100%[============================================================================================>] 65,947,685   190KB/s   in 16m 34s

2018-01-06 04:47:24 (64.8 KB/s) - ‘kibana-6.1.1-linux-x86_64.tar.gz’ saved [65947685/65947685]

[[email protected] ~]$ 
           

3.2 解压缩

[[email protected] ~]$ tar -zxvf kibana-6.1.1-linux-x86_64.tar.gz

           

进入kibana根目录

[[email protected] ~]$ cd kibana-6.1.1-linux-x86_64
[[email protected] kibana-6.1.1-linux-x86_64]$
           

3.3 修改配置

修改kibana配置文件kibana.yml

[[email protected] kibana-6.1.1-linux-x86_64]$ vi config/kibana.yml 
           

需要配置两处

(1)kibana向外提供服务,运行远程用户访问

# To allow connections from remote users, set this parameter to a non-loopback address.
server.host: "node1"
           

(2)配置elasticsearch.url

# The URL of the Elasticsearch instance to use for all your queries.
elasticsearch.url: "http://node1:9200"
           

3.4 启动kibana

[[email protected] kibana-6.1.1-linux-x86_64]$ bin/kibana
  log   [15:10:36.975] [info][status][plugin:[email protected]] Status changed from uninitialized to green - Ready
  log   [15:10:37.109] [info][status][plugin:[email protected]] Status changed from uninitialized to yellow - Waiting for Elasticsearch
  log   [15:10:37.154] [info][status][plugin:[email protected]] Status changed from uninitialized to green - Ready
  log   [15:10:37.227] [info][status][plugin:[email protected]] Status changed from uninitialized to green - Ready
  log   [15:10:37.279] [info][status][plugin:[email protected]] Status changed from yellow to green - Ready
  log   [15:10:38.033] [info][status][plugin:[email protected]] Status changed from uninitialized to green - Ready
  log   [15:10:38.057] [info][listening] Server running at http://node1:5601
           
ElasticSearch 6.x 学习笔记:3.Kibana插件

3.5 简单应用

ElasticSearch 6.x 学习笔记:3.Kibana插件
ElasticSearch 6.x 学习笔记:3.Kibana插件

curl -XGET “http://node1:9200/test/_search”

[[email protected] ~]# curl -XGET "http://node1:9200/test/_search"
{"took":3,"timed_out":false,"_shards":{"total":5,"successful":5,"skipped":0,"failed":0},"hits":{"total":0,"max_score":null,"hits":[]}}[[email protected] ~]# 
           

3.6 可能遇到的问题

启动kibana后关闭shell窗口后kibana自动关闭

解决办法:退出当前登录窗口用exit命令,不要直接点击窗口上的叉来关闭

[[email protected] kibana-5.6.9]$ bin/kibana &
[1] 9709
[[email protected] kibana-5.6.9]$   log   [14:50:31.223] [info][status][plugin:[email protected]] Status changed from uninitialized to green - Ready
  log   [14:50:31.343] [info][status][plugin:[email protected]] Status changed from uninitialized to yellow - Waiting for Elasticsearch
  log   [14:50:31.401] [info][status][plugin:[email protected]] Status changed from uninitialized to green - Ready
  log   [14:50:31.448] [info][status][plugin:[email protected]] Status changed from uninitialized to green - Ready
  log   [14:50:31.489] [info][status][plugin:[email protected]] Status changed from yellow to green - Kibana index ready
  log   [14:50:31.737] [info][status][plugin:[email protected]] Status changed from uninitialized to green - Ready
  log   [14:50:31.743] [info][listening] Server running at http://node1:5601
  log   [14:50:31.745] [info][status][ui settings] Status changed from uninitialized to green - Ready

[[email protected] kibana-5.6.9]$ 
[[email protected] kibana-5.6.9]$ exit
logout
Connection closing...Socket close.

Connection closed by foreign host.

Disconnected from remote host(ES-5.6) at 22:52:23.

Type `help' to learn how to use Xshell prompt.
[d:\~]$ 

           

这样的话,http://node1:5601页面依然可以访问

为了操作方便,也可以设置环境变量

[[email protected] ~]# vi /etc/profile.d/custom.sh 
[[email protected] ~]# cat /etc/profile.d/custom.sh
#!/bin/bash
#java path
export JAVA_HOME=/opt/jdk1.8.0_192
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=.:$CLASSPATH:$JAVA_HOME/lib

#kibana
export PATH=$PATH:/opt/kibana-6.4.3/bin
[[email protected] ~]#
[[email protected] ~]# source /etc/profile.d/custom.sh 
           
[[email protected] ~]$ kibana &
[1] 15969
[[email protected] ~]$
           

继续阅读