CentOS安装Kibana

1,582 阅读2分钟

一、下载

下载地址:www.elastic.co/downloads/k…

历史版本:www.elastic.co/downloads/p…

如果机器可以访问外网,也可以直接wget下载

shell> wget wget https://artifacts.elastic.co/downloads/kibana/kibana-5.6.4-linux-x86_64.tar.gz

关于版本的选择,可以查看官方文档Elasticsearch与Kibana的兼容性:www.elastic.co/support/mat…

另外,官网还有一段描述:

Kibana should be configured to run against an Elasticsearch node of the same version. This is the officially supported configuration.

Running different major version releases of Kibana and Elasticsearch (e.g. Kibana 5.x and Elasticsearch 2.x) is not supported, nor is running a minor version of Kibana that is newer than the version of Elasticsearch (e.g. Kibana 5.1 and Elasticsearch 5.0).

Running a minor version of Elasticsearch that is higher than Kibana will generally work in order to faciliate an upgrade process where Elasticsearch is upgraded first (e.g. Kibana 5.0 and Elasticsearch 5.1). In this configuration, a warning will be logged on Kibana server startup, so it’s only meant to be temporary until Kibana is upgraded to the same version as Elasticsearch.

Running different patch version releases of Kibana and Elasticsearch (e.g. Kibana 5.0.0 and Elasticsearch 5.0.1) is generally supported, though we encourage users to run the same versions of Kibana and Elasticsearch down to the patch version.

总之,建议大家安装时选择完全一致的版本号,这样就一定不会有问题

二、安装

解压

shell> tar -zxvf kibana-5.6.4-linux-x86_64.tar.gz -C /usr/local/

配置

shell> cd /usr/local/kibana-5.6.4-linux-x86_64/config/
shell> vim kibana.yml

编辑以下内容

# 默认值5601,没有需要可以不修改
server.port: 5601
# 允许远程访问,也可以直接设置为“0.0.0.0”
server.host: "192.168.1.10"
# 默认值http://localhost:9200
elasticsearch.url: "http://192.168.1.10:9200"

三、启动

shell> cd /usr/local/kibana-5.6.4-linux-x86_64/
shell> ./bin/kibana

指定配置文件启动

Kibana 默认情况下从 $KIBANA_HOME/config/kibana.yml 加载配置文件,也可以通过-c--config选项指定配置文件

shell> ./bin/kibana -c /path/to/config/kibana.yml
后台启动
shell> nohup ./bin/kibana >/dev/null 2>&1 &

但是通过上面的命令启动会有个问题,如果想停止kibana会找不到进程

shell> ps aux|grep kibana
root      5566  0.0  0.0 112712   968 pts/0    S+   02:25   0:00 grep --color=auto kibana
shell> ps -ef|grep kibana
root      5615  1856  0 02:25 pts/0    00:00:00 grep --color=auto kibana

可以通过如下几种方式找到进程并杀死

lsof -i:5601
shell> lsof -i:5601
COMMAND  PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
node    6030 root    9u  IPv4  49052      0t0  TCP *:esmagent (LISTEN)
node    6030 root   11u  IPv4  50383      0t0  TCP VM_2_24_centos:esmagent->111.196.219.22:65303 (ESTABLISHED)
node    6030 root   12u  IPv4  50384      0t0  TCP VM_2_24_centos:esmagent->111.196.219.22:65304 (ESTABLISHED)
node    6030 root   13u  IPv4  50390      0t0  TCP VM_2_24_centos:esmagent->111.196.219.22:65306 (ESTABLISHED)
node    6030 root   14u  IPv4  50399      0t0  TCP VM_2_24_centos:esmagent->111.196.219.22:65309 (ESTABLISHED)
node    6030 root   15u  IPv4  50401      0t0  TCP VM_2_24_centos:esmagent->111.196.219.22:65310 (ESTABLISHED)
node    6030 root   16u  IPv4  50392      0t0  TCP VM_2_24_centos:esmagent->111.196.219.22:65307 (ESTABLISHED)
netstat -tunlp|grep 5601
shell> netstat -tunlp|grep 5601
tcp        0      0 0.0.0.0:5601            0.0.0.0:*               LISTEN      6030/./bin/../node/ 
fuser -n tcp 5601
shell> fuser -n tcp 5601
5601/tcp:             6030
找到PID后,杀掉进程即可停止kibana
shell> kill -9 6030