Kibana增加nginx负载均衡

一、背景

用户访问量大,导致kibana使用卡顿,严重时无法登录
二、解决方法
访问kibana前增加一个nginx负载均衡,新增一个kibana(原本一个)
1、安装nginx
(1)解压

tar -zxvf  nginx-1.21.1.tar.gz  -C  ./

(2)安装

make && make install

2、修改nginx.conf配置(负载均衡策略选择ip_hash)

user  dy users;
worker_processes  16;

error_log  logs/error.log;

pid        logs/nginx.pid;


events {
    worker_connections  10240;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    log_format  test  escape=json  '$remote_addr - $remote_user [$time_local] "$request" "$request_body" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    log_format  main  escape=json  '$remote_addr - $remote_user - [$time_local] - "$request" - "$request_body" - '
                      '$status - $request_time - $upstream_response_time - $body_bytes_sent - $request_method - "$http_x_forwarded_for"';

    log_format  test2 '$query_string';

    access_log  logs/access.log  main;

    client_max_body_size 20m;

    sendfile        on;

    keepalive_timeout  65;

    vhost_traffic_status_zone;
    vhost_traffic_status_filter_by_host on;
    upstream kibana {
        ip_hash;
        server kibana_ip1:5601;
        server kibana_ip2:5601;
    }
    server {
        listen       5601;
	listen  [::]:5601;
        location / {
            proxy_pass http://kibana;
            proxy_http_version 1.1;
            proxy_set_header Connection "Keep-Alive";
            proxy_set_header Proxy-Connection "Keep-Alive";
            proxy_read_timeout 180s;
            proxy_connect_timeout 180s;
            
        }
    }
    
}

二、根据具体用户进行校验,分配到具体kibana

增加请求分流接口,根据用户名选择重定向得kibana
Kibana请求登录接口

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值