友情提示:ELK日志平台安裝部署請看此連結:https://blog.csdn.net/m0_49854082/article/details/109312699
ELK叢集部署和Kibana WEB安全認證
- 一、常見ELK叢集部署方式
- 二、Kibana Web安全認證
-
- 1.安裝nginx
- 2.配置檔案
- 總結
提示:上一篇文章詳細說明了ELK平台的部署步驟,文章連結開頭有提到
提示:以下是本篇文章正文内容,下面步驟可供參考
一、常見ELK叢集部署方式
常見步驟:
①基于Shell腳本同步logstash檔案夾至其他主機上,或者使用自動化工具Ansible、Saltstack均可。
②例如:收集幾台Nginx伺服器上的日志,agent.conf和index.conf内容保持不變即可。配置檔案目錄local/logstash/config/etc/下的,agent.conf中redis伺服器的IP位址,要更換為該伺服器的IP。
二、Kibana Web安全認證
1.安裝nginx
當我們安裝完ES、Kibana啟動程序,可以直接在浏覽器中通路,這樣明顯不安全。這裡我們利用Apache的密碼驗證進行安全設定,通過通路Nginx隻轉發ES、Kibana伺服器。
安裝步驟如下:
[[email protected] ~]$ yum install pcre-devel pcre -y
[[email protected] ~]$ tar -xzf nginx-1.16.0.tar.gz
[[email protected] ~]$ cd nginx-1.16.0
[[email protected] ~]$ useradd www
[[email protected] nginx-1.16.0]$ ./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
[[email protected] nginx-1.16.0]$ make && make install
2.配置檔案
修改nginx配置檔案如下:
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
upstream Kibana_Web {
server 127.0.0.1:5601 weight=1 max_fails=2 fail_timeout=30s;
}
server {
listen 80;
server_name localhost;
location / {
proxy_set_header Host $host;
proxy_set_header X_Real_IP $remote_addr;
proxy_set_header X_Forwarded_For $proxy_add_x_forwarded_for;
root html;
index index.html index.htm;
proxy_pass http://Kibana_Web;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
修改Kibana WEB配置檔案監聽IP為127.0.0.1

重新開機kibana和nginx服務,通過通路192.168.211.132的80端口進行通路
添加Nginx權限認證(Nginx配置檔案location /添加如下代碼:)
auth_basic “ELK Kibana Monitor Center”;
auth_basic_user_file /usr/local/nginx/html/.htpasswd;
通過Apache加密工具htpasswd生成使用者名和密碼:
重新開機Nginx服務,輸入賬号密碼登入
總結
以上就是今天要講的内容,本文簡單介紹了ELK叢集部署的方式,以及Kibana Web認證。