1.测试 Elasticsearch 是否启动成功,可以打开另一个终端,执行以下操作:
[root@192.168.127.134 bin]#curl 'http://localhost:9200/?pretty'
{
"name" : "node-1",
"cluster_name" : "elasticsearch-cluster",
"cluster_uuid" : "5_rNIFRDR2Siz7p1OBzfHQ",
"version" : {
"number" : "6.4.2",
"build_flavor" : "default",
"build_type" : "tar",
"build_hash" : "04711c2",
"build_date" : "2018-09-26T13:34:09.098244Z",
"build_snapshot" : false,
"lucene_version" : "7.4.0",
"minimum_wire_compatibility_version" : "5.6.0",
"minimum_index_compatibility_version" : "5.0.0"
},
"tagline" : "You Know, for Search"
}
2.查看集群健康状态
[root@192.168.127.134 ~]#curl localhost:9200/_cluster/health
{"cluster_name":"elasticsearch-cluster","status":"green","timed_out":false,"number_of_nodes":2,"number_of_data_nodes":2,"active_primary_shards":0,"active_shards":0,"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}
3.查看集群master信息
[root@192.168.127.134 ~]#curl localhost:9200/_cat/master?v
id host ip node
WJcro7CCSY2lGDWDFr4s_A 192.168.127.134 192.168.127.134 node-1
4.列出所有索引
curl localhost:9200/_cat/indices
5.删除索引megacorp
curl -X DELETE localhost:9200/megacorp