我试图通过检查
curl -XGET 'http://localhost:9200/_cluster/health'
Run Code Online (Sandbox Code Playgroud)
但什么都没发生.似乎在等待什么.控制台没有回来.不得不用CTRL + C来杀死它.
我还尝试通过检查现有的指数
curl -XGET 'http://localhost:9200/_cat/indices?v'
Run Code Online (Sandbox Code Playgroud)
与上述行为相同.
eli*_*sah 32
要检查您需要使用的elasticsearch集群运行状况
curl localhost:9200/_cat/health
Run Code Online (Sandbox Code Playgroud)
更多关于猫API的信息.
我通常使用elasticsearch-head插件来可视化.
你可以在这里找到它的github项目.
它易于安装sudo $ES_HOME/bin/plugin -i mobz/elasticsearch-head
,然后您可以localhost:9200/_plugin/head/
在您的网络浏览器中打开.
你应该有这样的东西:
小智 26
您可以使用弹性搜索提供的(CURL)和Cluster API来检查elasticsearch集群运行状况:
$ curl -XGET 'localhost:9200/_cluster/health?pretty'
Run Code Online (Sandbox Code Playgroud)
这将为您提供所需的状态和其他相关数据.
{
"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
}
Run Code Online (Sandbox Code Playgroud)
slm*_*slm 11
该_cluster/health
API可以做的远远超过了典型的输出,大多数看到它:
$ curl -XGET 'localhost:9200/_cluster/health?pretty'
Run Code Online (Sandbox Code Playgroud)
Elasticsearch 中的大多数 API 可以采用各种参数来增强其输出。这也适用于Cluster Health API。
$ curl -XGET 'localhost:9200/_cluster/health?level=indices&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
},
"filebeat-6.5.1-2019.06.11" : {
"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
},
"filebeat-6.5.1-2019.06.12" : {
"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
},
"filebeat-6.5.1-2019.06.13" : {
"status" : "green",
"number_of_shards" : 3,
Run Code Online (Sandbox Code Playgroud)
所有碎片健康
$ 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
Run Code Online (Sandbox Code Playgroud)
API 还具有多种wait_*
选项,它会等待各种状态更改,然后立即或在某些指定的timeout
.
归档时间: |
|
查看次数: |
65752 次 |
最近记录: |