简单的集群管理
快速检查集群的健康状况
GET /_cat/health?v
{
"cluster_name": "es-log",
"status": "green",
"timed_out": false,
"number_of_nodes": 2,
"number_of_data_nodes": 2,
"active_primary_shards": 66,
"active_shards": 132,
"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
}
集群的健康状况
集群的健康状况使用green、yellow、red 3种颜色表示
green:每个索引的primary shard和replica shard都是active状态的
yellow:每个索引的primary shard都是active状态的,但是部分replica shard不是active状态,处于不可用的状态
red:不是所有索引的primary shard都是active状态的,部分索引有数据丢失了
索引管理
查看集群中有哪些索引
GET /_cat/indices?v
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
green open .monitoring-es-2-2017.08.04 3ge5x25mTb2__tr6Sleqhg 1 1 85733 798 86.1mb 43mb
green open .monitoring-es-2-2017.07.31 pYmUsT8rT7WK-yyBbLiWiA 1 1 32352 146 27.1mb 13.5mb
green open .monitoring-es-2-2017.07.28 oCq3rTWbSU-b8C7vuI3vaA 1 1 16473 273 14.9mb 7.4mb
green open .monitoring-kibana-2-2017.07.28 eJnF7v1bQJmRAcSg6ve6OA 1 1 195 0 281.1kb 140.5kb
green open .monitoring-kibana-2-2017.08.06 7DJqZ7i6TXqN8gU8xbuR0A 1 1 721 0 387.1kb 193.5kb
green open .kibana K3oCOVvAQS-7HItGeSN98w 1 1 99 67 456.6kb 228.3kb
green open .security ss49jo3ZTOux7-PFK68tjw 1 1 5 0 32.5kb 16.2kb
创建索引
PUT /test_index?pretty
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
green open test_index e8eqND3STmG-fzr1H_hnbQ 5 1 0 0 780b 260b
green open .monitoring-es-2-2017.08.04 3ge5x25mTb2__tr6Sleqhg 1 1 85733 798 86.1mb 43mb
删除索引
DELETE /test_index?pretty
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
green open .monitoring-es-2-2017.08.04 3ge5x25mTb2__tr6Sleqhg 1 1 85733 798 86.1mb 43mb