Kibana 请求超时错误 Request Timeout after 30000ms

Kibana

在Kubernetes上为了更好的管理查看日志,通常都使用ELK(Elasticsearch Logstash Kibana)或者EFK(Elasticsearch Fluentd Kibana)方案统一收集并在Kibana上查询日志。可能是在我搭建EFK的时候没有给Elasticsearch足够的资源,导致Kibana在查询Elasticsearch时没有及时得到响应,此时Kibana会自动停止该请求,并提示用户请求超时

Request Timeout after 30000ms

上面的30000ms就是30秒,这是一个请求超时的阀值,默认就是30秒,Kibana允许你通过配置文件kibana.yml修改这个值。所以接下来你要做的事情是找到kibana.yml这个文件的路径,默认的配置文件路径会取决于你如何安装Kibana有所不同。

关于配置文件位置官网有一段描述

The Kibana server reads properties from the kibana.yml file on startup. The location of this file differs depending on how you installed Kibana. For example, if you installed Kibana from an archive distribution (.tar.gz or .zip), by default it is in $KIBANA_HOME/config. By default, with package distributions (Debian or RPM), it is in /etc/kibana

最简单的方式,就是通过kibana --help获取默认配置文件路径,如我的配置文件路径就是/usr/share/kibana/config/kibana.yml

$ kibana --help
Usage: bin/kibana [command=serve] [options]

Kibana is an open source (Apache Licensed), browser based analytics and search dashboard for Elasticsearch.

Commands:
  serve  [options]  Run the kibana server
  help  <command>   Get the help for a specific command

"serve" Options:

  -e, --elasticsearch <uri1,uri2>  Elasticsearch instances
  -c, --config <path>              Path to the config file, use multiple --config args to include multiple config files (default: ["/usr/share/kibana/config/kibana.yml"])
  -p, --port <port>                The port to bind to
  -q, --quiet                      Prevent all logging except errors
  -Q, --silent                     Prevent all logging
  --verbose                        Turns on verbose logging
  -H, --host <host>                The host to bind to
  -l, --log-file <path>            The file to log to
  --plugin-dir <path>              A path to scan for plugins, this can be specified multiple times to specify multiple directories (default: ["/usr/share/kibana/plugins","/usr/share/kibana/src/legacy/core_plugins"])
  --plugin-path <path>             A path to a plugin which should be included by the server, this can be specified multiple times to specify multiple paths (default: [])
  --plugins <path>                 an alias for --plugin-dir
  --optimize                       Optimize and then stop the server
  -h, --help                       output usage information

请注意,--config参数跟传统其它命令不太一样,他是允许多个配置文件,重复项会以顺序覆盖掉旧的。找到配置文件路径之后,只需要在里边加一句配置项elasticsearch.requestTimeout,如我需要把默认30秒改成120秒,我就这么写

elasticsearch.requestTimeout: 120000

每修改一次配置文件,就需要重启一下kibana这样最新修改的配置项才能生效,Okay,那么现在我的Kibana的默认等待时间会从30秒增加到120秒。这个值设置多少合适呢?取决于你的需求,你还可以同时增加Elastaicsearch的内存、CPU等资源来提升它的处理速度,也可以在Kibana中优化你的查询语句,避免不必要的资源浪费。

分享

TITLE: Kibana 请求超时错误 Request Timeout after 30000ms

LINK: https://www.qttc.net/505-kibana-request-timeout-set-up.html

NOTE: 原创内容,转载请注明出自琼台博客