Loading

docker安装es-header及相关问题解决

安装es-header

docker pull mobz/elasticsearch-head:5
docker run --restart=always --name elasticsearch-head -di -p 9100:9100 docker.io/mobz/elasticsearch-head:5

es-header密码访问

image

浏览器输入http://[ip]:9100/?auth_user=xxx&auth_password=xxx

连接框框内输入你es的地址:http://[ip]:9200/

遇到的问题:

es跨域问题

新增配置: config/elasticsearch.yml

# 是否支持跨域,默认为false
http.cors.enabled: true
# 当设置允许跨域,默认为*,表示支持所有域名,如果我们只是允许某些网站能访问,那么可以使用正则表达式。比如只允许本地地址。 /https?:\ /\ /localhost(:[0-9]+)?/
http.cors.allow-origin: "*"
# 跨域允许设置的头信息,默认为X-Requested-With,Content-Type,Content-Length
http.cors.allow-headers: Authorization,X-Requested-With,Content-Type,Content-Length

es header数据浏览点击没反应,接口406 Not Acceptable

tips:vim 显示行号::set nu 取消行号显示::set nonu

  1. 进入 es-head 安装目录;
  2. cd _site/
  3. 编辑 vendor.js 共有两处

    6886行 contentType:"application/x-www-form-urlencoded" 修改为 contentType: "application/json;charset=UTF-8"
    7573行 var inspectData = s.contentType === "application/x-www-form-urlencoded" && 修改为 var inspectData = s.contentType === "application/json;charset=UTF-8" &&

  4. 重启容器后刷新浏览器验证。

参考链接:
[1] https://blog.csdn.net/csdn_chenhao/article/details/108983272
[2] https://blog.csdn.net/qq_46480020/article/details/112709170
[3] https://blog.csdn.net/catoop/article/details/103737698

posted @ 2022-10-21 10:19  fogey  阅读(88)  评论(0编辑  收藏  举报