首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >专栏 >kibana8.18配置访问Elasticsearch8.18

kibana8.18配置访问Elasticsearch8.18

原创
作者头像
空洞的盒子
发布2025-07-28 17:02:53
发布2025-07-28 17:02:53
3801
举报
文章被收录于专栏:JD的专栏JD的专栏大数据生态

Elasticsearch8.18在使用安装完成后默认会生成http_ca.crt,http.p12,transport.p12,这三个文件。

我们在kibana中使用Elasticsearch提供的http_ca.crt实现kibana与Elasticsearch之间的HTTP加密通信。

kibana与Elasticsearch文件配置

kibana.yml

代码语言:yml
复制
elasticsearch.ssl.certificateAuthorities: [ "/etc/kibana/certs/http_ca.crt" ]
elasticsearch.username: "kibana_system"
elasticsearch.password: "password"
elasticsearch.hosts: ["https://127.0.0.1:9200"]
server.ssl.enabled: true
server.ssl.certificate: /etc/kibana/certs/kibana-cert.pem
server.ssl.key: /etc/kibana/certs/kibana-key.pem
server.host: "127.0.0.1"
server.port: 5601

elasticsearch.yml

代码语言:yml
复制
# Enable security features
xpack.security.enabled: true
xpack.security.enrollment.enabled: true
xpack.security.http.ssl.client_authentication: "optional"
# Enable encryption for HTTP API client connections, such as Kibana, Logstash, and Agents
xpack.security.http.ssl:
  enabled: true
  keystore.path: certs/http.p12

注:以上配置仅列出了kibana81.8访问Elasticsearch8.18需要的基础配置。

FAQ

1.[elasticsearch-service] Unable to retrieve version information from Elasticsearch nodes. self-signed certificate in certificate chain;错误

原因:kibana使用elasticsearch.serviceAccountToken连接Elasticsearch时,TLS/SSL连接失败。kibana没有信任该证书。

解决办法:将Elasticsearch的http_ca.crtCA文件拷贝纸kibana的certs目录下。在kibana.yml中添加以下配置。显式指定kibana信任Elasticsearch的自签名CA。

代码语言:yml
复制
elasticsearch.ssl.certificateAuthorities: ["/etc/kibana/certs/http_ca.crt"]

2.[ERROR][elasticsearch-service] Unable to retrieve version information from Elasticsearch nodes. security_exception;security_exception: unable to authenticate with provided credentials and anonymous access is not allowed for this request错误

原因:kibana通过HTTPS与Elasticsearch建立了连接。但是认证失败。Elasticsearch拒绝了kibana发起的未认证请求,并且不允许匿名访问。

解决办法

①需要修改http_ca.crt证书权限。

代码语言:bash
复制
chown kibana:kibana /etc/kibana/certs/http_ca.crt
chmod 644 /etc/kibana/certs/http_ca.crt

②使用elasticsearch.username和elasticsearch.password替代token完成认证。

使用以下命令重置kibana_system账号密码

代码语言:bash
复制
bin/elasticsearch-reset-password -u kibana_system

然后使用

代码语言:yml
复制
elasticsearch.username:"kibana_system"
elasticsearch.password:"password"

替代

代码语言:yml
复制
elasticsearch.serviceAccountToken: "xxxxxxxx"

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • kibana与Elasticsearch文件配置
    • kibana.yml
    • elasticsearch.yml
  • FAQ
    • 1.[elasticsearch-service] Unable to retrieve version information from Elasticsearch nodes. self-signed certificate in certificate chain;错误
    • 2.[ERROR][elasticsearch-service] Unable to retrieve version information from Elasticsearch nodes. security_exception;security_exception: unable to authenticate with provided credentials and anonymous access is not allowed for this request错误
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档