目录
安装配置
创建用户
useradd kibana
下载安装包
wget https://artifacts.elastic.co/downloads/kibana/kibana-8.10.4-linux-x86_64.tar.gz
tar -zxf kibana-8.10.4-linux-x86_64.tar.gz
mv kibana-8.10.4 /usr/local/src/kibana
chown -R kibana:kibana /usr/local/src/kibana
账号密码方式连接ES
除了使用常用的token方式连接es外,kibana也可以使用账号密码方式连接es,配置如下
es生成kibana_system用户密码
[root@node01 ~]# cd /es8/soft/elasticsearch-8.10.4/bin/
[root@node01 bin]# ./elasticsearch-reset-password -u kibana_system
This tool will reset the password of the [kibana_system] user to an autogenerated value.
The password will be printed in the console.
Please confirm that you would like to continue [y/N]y
Password for the [kibana_system] user successfully reset.
New value: 6M_qUdkmBJVr0QJj0=T1
修改配置文件
[root@node01 ~]# cat /usr/local/src/kibana/config/kibana.yml
server.host: "0.0.0.0"
#server.publicBaseUrl: "https://kibana.test.com:5601" 域名访问
elasticsearch.hosts: ['https://node01:9200','https://node02:9200','https://node03:9200']
elasticsearch.username: kibana_system
elasticsearch.password: 6M_qUdkmBJVr0QJj0=T1 #生成的密码,用于连接es
elasticsearch.ssl.verificationMode: none
i18n.locale: "zh-CN" # 设置为中文
使用system启动
[root@es-1 ~]# vim /usr/lib/systemd/system/kibana.service
[Unit]
Description=Kibana
Documentation=https://www.elastic.co
Wants=network-online.target
After=network-online.target
[Service]
Type=simple
User=kibana
Group=kibana
PrivateTmp=true
Environment=KBN_HOME=/usr/local/src/kibana
Environment=KBN_PATH_CONF=/usr/local/src/kibana/config
ExecStart=/usr/local/src/kibana/bin/kibana
Restart=on-failure
RestartSec=3
StartLimitBurst=3
StartLimitInterval=60
WorkingDirectory=/usr/local/src/kibana
StandardOutput=journal
StandardError=inherit
[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl enable kibana --now
登录验证
开启https
默认情况下kibana是http方式访问,在实际生产环境中通常需要修改为https方式。此时可选择申请公网tls证书或使用elasticsearch工具自签证书
生成kibana证书和私钥
[root@node01 config]# cd /es8/soft/elasticsearch-8.10.4/bin/
root@node01 bin]# ./elasticsearch-certutil csr -name kibana-server -dns kibana.test.com, localhost
回车即可
/es8/soft/elasticsearch-8.10.4/csr-bundle.zip 证书路径
拷贝证书至kibana
[root@node01 elasticsearch-8.10.4]# mv kibana-server /usr/local/src/kibana/
生成crt文件
[root@node01 elasticsearch-8.10.4]# cd /usr/local/src/kibana/kibana-server/
[root@node01 kibana-server]# openssl x509 -req -in kibana-server.csr -signkey kibana-server.key -out kibana-server.crt
Signature ok
subject=/CN=kibana-server
Getting Private key
Getting Private key
[root@node01 kibana-server]# ll
总用量 12
-rw-r--r-- 1 root root 989 6月 17 11:22 kibana-server.crt
-rw-r--r-- 1 root root 956 6月 17 11:19 kibana-server.csr
-rw-r--r-- 1 root root 1675 6月 17 11:19 kibana-server.key
修改配置文件
[root@node01 config]# cat kibana.yml
server.host: "0.0.0.0"
server.ssl.enabled: true
server.ssl.certificate: /usr/local/src/kibana/kibana-server/kibana-server.crt #证书路径
server.ssl.key: /usr/local/src/kibana/kibana-server/kibana-server.key #证书路径
elasticsearch.hosts: ['https://node01:9200','https://node02:9200','https://node03:9200']
elasticsearch.username: kibana_system
elasticsearch.password: 6M_qUdkmBJVr0QJj0=T1 #生成的密码,用于连接es
elasticsearch.ssl.verificationMode: none
i18n.locale: "zh-CN" # 设置为中文
重启服务
systemctl restart kibana.service