Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/reporting-services/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
<img src="//i.stack.imgur.com/RUiNP.png" height="16" width="18" alt="" class="sponsor tag img">elasticsearch 如何检查Elasticsearch群集运行状况?_<img Src="//i.stack.imgur.com/RUiNP.png" Height="16" Width="18" Alt="" Class="sponsor Tag Img">elasticsearch - Fatal编程技术网 elasticsearch 如何检查Elasticsearch群集运行状况?,elasticsearch,elasticsearch" /> elasticsearch 如何检查Elasticsearch群集运行状况?,elasticsearch,elasticsearch" />

elasticsearch 如何检查Elasticsearch群集运行状况?

elasticsearch 如何检查Elasticsearch群集运行状况?,elasticsearch,elasticsearch,我试着通过电话查一下 curl -XGET 'http://localhost:9200/_cluster/health' 但什么也没发生。好像在等什么。控制台没有回来。必须用CTRL+C组合键杀死它 我还试图通过 curl -XGET 'http://localhost:9200/_cat/indices?v' 与上述行为相同 要检查elasticsearch群集运行状况,需要使用 curl localhost:9200/_cat/health 更多关于cat API的信息 我通常使用E

我试着通过电话查一下

curl -XGET 'http://localhost:9200/_cluster/health'
但什么也没发生。好像在等什么。控制台没有回来。必须用CTRL+C组合键杀死它

我还试图通过

curl -XGET 'http://localhost:9200/_cat/indices?v'

与上述行为相同

要检查elasticsearch群集运行状况,需要使用

curl localhost:9200/_cat/health
更多关于cat API的信息

我通常使用ElasticSearchHead插件将其可视化

您可以找到它的github项目

很容易安装
sudo$ES_HOME/bin/plugin-i mobz/elasticsearch head
然后您可以在web浏览器中打开
localhost:9200/\u plugin/head/

你应该有这样的东西:


您可以使用(CURL)和elasticsearch提供的群集API检查elasticsearch群集运行状况:

$ curl -XGET 'localhost:9200/_cluster/health?pretty'
这将为您提供所需的状态和其他相关数据

{
 "cluster_name" : "xxxxxxxx",
 "status" : "green",
 "timed_out" : false,
 "number_of_nodes" : 2,
 "number_of_data_nodes" : 2,
 "active_primary_shards" : 15,
 "active_shards" : 12,
 "relocating_shards" : 0,
 "initializing_shards" : 0,
 "unassigned_shards" : 0,
 "delayed_unassigned_shards" : 0,
 "number_of_pending_tasks" : 0,
 "number_of_in_flight_fetch" : 0
}

问题:-

有时,Localhost可能无法解析。 因此,它倾向于返回如下所示的输出:

#curl-XGET localhost:9200/_cluster/health?pretty

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head>
<meta http-equiv="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<title>ERROR: The requested URL could not be retrieved</title>
<style type="text/css"><!--BODY{background-color:#ffffff;font-family:verdana,sans-serif}PRE{font-family:sans-serif}--></style>
</head><body>
<h1>ERROR</h1>
<h2>The requested URL could not be retrieved</h2>
<hr>
<p>The following error was encountered while trying to retrieve the URL: <a href="http://localhost:9200/_cluster/health?">http://localhost:9200/_cluster/health?</a></p>
<blockquote>
<p><b>Connection to 127.0.0.1 failed.</b></p>
</blockquote>

<p>The system returned: <i>(111) Connection refused</i></p>

<p>The remote host or network may be down.  Please try the request again.</p>
<p>Your cache administrator is <a href="mailto:root?subject=CacheErrorInfo%20-%20ERR_CONNECT_FAIL&amp;body=CacheHost%3A%20squid2%0D%0AErrPage%3A%20ERR_CONNECT_FAIL%0D%0AErr%3A%20(111)%20Connection%20refused%0D%0ATimeStamp%3A%20Mon,%2017%20Dec%202018%2008%3A07%3A36%20GMT%0D%0A%0D%0AClientIP%3A%20192.168.13.14%0D%0AServerIP%3A%20127.0.0.1%0D%0A%0D%0AHTTP%20Request%3A%0D%0AGET%20%2F_cluster%2Fhealth%3Fpretty%20HTTP%2F1.1%0AUser-Agent%3A%20curl%2F7.29.0%0D%0AHost%3A%20localhost%3A9200%0D%0AAccept%3A%20*%2F*%0D%0AProxy-Connection%3A%20Keep-Alive%0D%0A%0D%0A%0D%0A">root</a>.</p>

<br>   
<hr> 
<div id="footer">Generated Mon, 17 Dec 2018 08:07:36 GMT by squid2 (squid/3.0.STABLE25)</div>
</body></html>

错误:无法检索请求的URL
错误
无法检索请求的URL

尝试检索URL时遇到以下错误:

连接到127.0.0.1失败

系统返回:(111)连接被拒绝

远程主机或网络可能已关闭。请重试该请求

您的缓存管理员是



squid2于2018年12月17日星期一08:07:36 GMT生成(squid/3.0.STABLE25)
#curl-XGET localhost:9200/_cat/index

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head>
<meta http-equiv="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<title>ERROR: The requested URL could not be retrieved</title>
<style type="text/css"><!--BODY{background-color:#ffffff;font-family:verdana,sans-serif}PRE{font-family:sans-serif}--></style>
</head><body>
<h1>ERROR</h1>
<h2>The requested URL could not be retrieved</h2>
<hr>
<p>The following error was encountered while trying to retrieve the URL: <a href="http://localhost:9200/_cat/indices">http://localhost:9200/_cat/indices</a></p>
<blockquote>
<p><b>Connection to 127.0.0.1 failed.</b></p>
</blockquote>

<p>The system returned: <i>(111) Connection refused</i></p>

<p>The remote host or network may be down.  Please try the request again.</p>
<p>Your cache administrator is <a href="mailto:root?subject=CacheErrorInfo%20-%20ERR_CONNECT_FAIL&amp;body=CacheHost%3A%20squid2%0D%0AErrPage%3A%20ERR_CONNECT_FAIL%0D%0AErr%3A%20(111)%20Connection%20refused%0D%0ATimeStamp%3A%20Mon,%2017%20Dec%202018%2008%3A10%3A09%20GMT%0D%0A%0D%0AClientIP%3A%20192.168.13.14%0D%0AServerIP%3A%20127.0.0.1%0D%0A%0D%0AHTTP%20Request%3A%0D%0AGET%20%2F_cat%2Findices%20HTTP%2F1.1%0AUser-Agent%3A%20curl%2F7.29.0%0D%0AHost%3A%20localhost%3A9200%0D%0AAccept%3A%20*%2F*%0D%0AProxy-Connection%3A%20Keep-Alive%0D%0A%0D%0A%0D%0A">root</a>.</p>

<br>   
<hr> 
<div id="footer">Generated Mon, 17 Dec 2018 08:10:09 GMT by squid2 (squid/3.0.STABLE25)</div>
</body></html>

错误:无法检索请求的URL
错误
无法检索请求的URL

尝试检索URL时遇到以下错误:

连接到127.0.0.1失败

系统返回:(111)连接被拒绝

远程主机或网络可能已关闭。请重试该请求

您的缓存管理员是



squid2于2018年12月17日星期一08:10:09 GMT生成(squid/3.0.STABLE25)
解决方案:-

我猜,这个错误很可能是由部署在服务器中的本地Squid返回的


因此,在用部署了ElasticSearch的本地ip替换本地主机后,它工作得很好。

集群/healthAPI可以做的远远超过大多数人看到的典型输出:

 $ curl -XGET 'localhost:9200/_cluster/health?pretty'
Elasticsearch中的大多数API都可以采用各种参数来增加其输出。这也适用于其他国家

例子 所有健康指数 所有碎片的健康
API还具有多种
等待*
选项,如果无法访问Elasticsearch群集(例如防火墙后),则API将等待各种状态更改,然后立即返回,或在指定的
超时后返回,但Kibana是:

Kibana=>DevTools=>Console:

GET /_cluster/health 

您的群集似乎已死亡?elasticsearch真的在运行吗?是的,curl-XGET和curl-XGET工作得很好。在我评论了#network.publish_host:localhost和#network.host:localhost之后,我发现它工作得很好。Wtf?您是否从默认设置更改了这些设置?如果您阅读了关于这些设置的文档(),那么您必须指定可解析的主机名或地址
localhost
两者都不是。感谢URL。这确实有效,但Kibana如何自动连接到ES?@HarishNarayanan,它不是自动的-它是默认的或通过配置。Kibana只是将那些
GET/_cluster/health
请求从UI附加到基本URL(例如
http://localhost:9200
)它用于连接Elasticsearch。使用Kibana的要点是,您甚至可能无法通过网络访问Elasticsearch(例如,未从集群中公开)-您仍然可以执行这些查询,只要您可以访问Kibana。明白@uvsmtid。我查看了config文件夹和相关的yml文件。获得了所需的信息。非常感谢
$ curl -XGET 'localhost:9200/_cluster/health?level=shards&pretty' | head -50
{
  "cluster_name" : "rdu-es-01",
  "status" : "green",
  "timed_out" : false,
  "number_of_nodes" : 9,
  "number_of_data_nodes" : 6,
  "active_primary_shards" : 1106,
  "active_shards" : 2213,
  "relocating_shards" : 0,
  "initializing_shards" : 0,
  "unassigned_shards" : 0,
  "delayed_unassigned_shards" : 0,
  "number_of_pending_tasks" : 0,
  "number_of_in_flight_fetch" : 0,
  "task_max_waiting_in_queue_millis" : 0,
  "active_shards_percent_as_number" : 100.0,
  "indices" : {
    "filebeat-6.5.1-2019.06.10" : {
      "status" : "green",
      "number_of_shards" : 3,
      "number_of_replicas" : 1,
      "active_primary_shards" : 3,
      "active_shards" : 6,
      "relocating_shards" : 0,
      "initializing_shards" : 0,
      "unassigned_shards" : 0,
      "shards" : {
        "0" : {
          "status" : "green",
          "primary_active" : true,
          "active_shards" : 2,
          "relocating_shards" : 0,
          "initializing_shards" : 0,
          "unassigned_shards" : 0
        },
        "1" : {
          "status" : "green",
          "primary_active" : true,
          "active_shards" : 2,
          "relocating_shards" : 0,
          "initializing_shards" : 0,
          "unassigned_shards" : 0
        },
        "2" : {
          "status" : "green",
          "primary_active" : true,
          "active_shards" : 2,
          "relocating_shards" : 0,
          "initializing_shards" : 0,
          "unassigned_shards" : 0
GET /_cluster/health