docker 安装 kibana

去dockerhup进行下载,注意:kibana,elasticsearch,logstash版本要一致

docker pull kibana:7.6.0

在这里插入图片描述
在这里插入图片描述

启动kibana容器

#将宿主机端口映射到容器内部端口
docker run --name kibana  -p 5601:5601 -d kibana:7.6.0

进入kibana容器内部

 docker exec -it -uroot  容器id  /bin/bash

进入config目录,修改kibana.yml文件配置为

server.name: kibana
server.host: "0.0.0.0"
## 自己es的ip地址,若是windows下用docker安装的,由于docker容器隔离的原因,ip这里就写宿主机ip
elasticsearch.hosts: [ "http://es所在服务器ip(宿主机ip):9200" ]
xpack.monitoring.ui.container.elasticsearch.enabled: true

退出容器,重启容器即可

#退出容器
exit

##重启kibana容器
docker restart   kibana容器id

最后访问http://自己的ip:5601/
在这里插入图片描述

**
kibana默认没有访问的权限控制,如果需要设置访问的账号密码,可以使用nginx配置代理来发布kibana。我尝试了此种方法没有成功,我用的是另一种方法,链接:https://blog.csdn.net/Ming13416908424/article/details/115617571**

用nginx代理的步骤

#安装httpd插件
yum install -y httpd


#使用htpasswd命令生成密码文件,密码文件应该放在nginx的
#目录下(我试过了,我生成在 /etc/nginx/conf.d/就没报错),其他路径会报错了
htpasswd -c /etc/nginx/conf.d/kibanapw user password

#重启nginx
docker restart nginx容器id

#然后再nginx配置文件里配置这两项
auth_basic “Authorized users only”;
auth_basic_user_file 密码文件的位置(最好写容器内路径,因为我喜欢顺便挂载文件到容器里的); # 密码文件

nginx.conf的配置文件

server {
    listen       8077;
    listen  [::]:8077;
    server_name  localhost;

    #charset koi8-r;
    #access_log  /var/log/nginx/host.access.log  main;

    location / {
       auth_basic "Authorized users only";
	   auth_basic_user_file /etc/nginx/conf.d/kibanapw; # 密码文件
	   proxy_pass http://内网ip:5601;
        #root   /usr/share/nginx/html;
        #index  index.html index.htm;
    }

    #error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }

    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ \.php$ {
    #    proxy_pass   http://127.0.0.1;
    #}

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    #location ~ \.php$ {
    #    root           html;
    #    fastcgi_pass   127.0.0.1:9000;
    #    fastcgi_index  index.php;
    #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
    #    include        fastcgi_params;
    #}

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #    deny  all;
    #}
}
  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值