filebeat+ELK+kafka集群搭建(六:kibana部署)
安装kibana
官网提示centos5版本或以下不适合rpm包安装,所以建议centos5以下的使用源码安装。
1. 导入kabana 密钥
[root@ kibana ~]# rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch
2. 建立rpm 包的repo
[root@ kibana ~]# vim /etc/yum.repos.d/kibana.repo
[kibana-5.x]
name=Kibana repository for 5.x packages
baseurl=https://artifacts.elastic.co/packages/5.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md
3 .安装kibana
[root@kibana ~]# yum -y install kibana
4. 修改配置文件/etc/kibana/kibana.yml
[root@kibana ~]# vim /etc/kibana/kibana.yml
# Kibana is served by a back end server. This setting specifies the port to use.
#server.port: 5601 ##默认端口
…………
#server.host: "localhost"
server.host: "192.168.205.161" #本机IP
…………
#elasticsearch.url: "http://localhost:9200"
elasticsearch.url: http://192.168.205.155:9200#es的地址
…………
#####**5.****启动、添加开机自启**
[root@kibana ~]# systemctl start kibana
[root@kibana ~]# systemctl enable kibana
[root@kibana ~]# systemctl status kibana
● kibana.service - Kibana
Loaded: loaded (/etc/systemd/system/kibana.service; enabled; vendor preset: disabled)
Active: active (running) since 五 2018-05-25 09:04:17 CST; 12s ago
[root@kibana ~]# netstat -ntlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 192.168.205.161:5601 0.0.0.0:* LISTEN 13407/node
6. 添加nginx 反向代理
[root@kibana ~]# yum -y install epel-release
[root@kibana ~]# yum -y install nginx httpd-tools
7 .更改nginx 配置文件(删除默认的配置文件,之后重新编写自己的配置文件)
[root@kibana ~]# vim /etc/nginx/nginx.conf
[root@kibana ~]# cd /etc/nginx/conf.d/
[root@kibana conf.d]# vim kibana.conf
server {
listen 80;
server_name kibana;
auth_basic "Restricted Access";
auth_basic_user_file /etc/nginx/kibana-user;
location / {
proxy_pass http://192.168.205.161:5601;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
- 生成页面登录用户认证文件
[root@kibana ~]# htpasswd -cm /etc/nginx/kibana-user kibana
New password:
Re-type new password:
Adding password for user kibana
9.启动、开机自启动
[root@kibana ~]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
[root@kibana ~]# systemctl start nginx
[root@kibana ~]# systemctl enable nginx
[root@kibana ~]# systemctl status nginx
● nginx.service - The nginx HTTP and reverse proxy server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)
Active: active (running) since 五 2018-05-25 09:34:53 CST; 9s ago
10.浏览器登录
账号密码是之前设置的nginx的用户名密码
这不是报错,是因为没有默认索引模式