First, Cluster API detailed
1, cluster health (get the status of the cluster)
Cluster Status:
Green: It means that all the fragments are assigned
Yellow: Yellow indicates that the primary fragment is assigned, but the copy is not
Red: Indicates that a specific fragment is not allocated in the cluster
Request parameters
Level:cluster,indices,shards
Wait_for_status:green,yellow,red
[Email protected] ~]# Curl-xget ' http://10.2.11.225:9200/_cluster/health/tomcat-access-log-2017.05.11?level= Shards&pretty '-U adminname-p
2. Index status (cluster state)
2.1) nodes (node state)
2.2) Show primary node status (Master_node)
3. Cluster data (cluster stats)
[Email protected] ~]# curl-xget ' Http://10.2.11.225:9200/_cluster/stats?human&pretty '-u adminname-p
Enter host password for user ' AdminName ':
{
"Timestamp": 1494680352006,
"Cluster_Name": "Myelk",
"Status": "Green",
"Indices": {
"Count": 5,
"Shards": {
"Total": 42,
"Primaries": 21,
"Replication": 1.0,
"Index": {
"Shards": {
"Min": 2,
"Max": 10,
"AVG": 8.4
},
"Primaries": {
"Min": 1,
"Max": 5,
"AVG": 4.2
},
"Replication": {
"Min": 1.0,
"Max": 1.0,
"AVG": 1.0
}
}
},
"Docs": {
"Count": 11047,
"deleted": 0
},
"Store": {
"Size": "6.4MB",
"Size_in_bytes": 6802156,
"throttle_time": "0s",
"Throttle_time_in_millis": 0
},
"Fielddata": {
"Memory_size": "0b",
"Memory_size_in_bytes": 0,
"Evictions": 0
},
"Query_cache": {
"Memory_size": "0b",
"Memory_size_in_bytes": 0,
"Total_count": 144823,
"Hit_count": 0,
"Miss_count": 144823,
"Cache_size": 0,
"Cache_count": 0,
"Evictions": 0
},
"Completion": {
"Size": "0b",
"Size_in_bytes": 0
},
"Segments": {
"Count": 213,
"Memory": "1.3MB",
"Memory_in_bytes": 1367681,
"Terms_memory": "1MB",
"Terms_memory_in_bytes": 1049853,
"Stored_fields_memory": "65.7kb",
"Stored_fields_memory_in_bytes": 67360,
"Term_vectors_memory": "0b",
"Term_vectors_memory_in_bytes": 0,
"Norms_memory": "199.3KB",
"Norms_memory_in_bytes": 204096,
"Doc_values_memory": "45.2KB",
"Doc_values_memory_in_bytes": 46372,
"Index_writer_memory": "0b",
"Index_writer_memory_in_bytes": 0,
"Index_writer_max_memory": "20.5MB",
"Index_writer_max_memory_in_bytes": 21504000,
"Version_map_memory": "0b",
"Version_map_memory_in_bytes": 0,
"Fixed_bit_set": "0b",
"Fixed_bit_set_memory_in_bytes": 0
},
"Percolate": {
"Total": 0,
"Time": "0s",
"Time_in_millis": 0,
"Current": 0,
"Memory_size_in_bytes":-1,
"Memory_size": " -1b",
"Queries": 0
}
},
"Nodes": {
"Count": {
"Total": 3,
"Master_only": 0,
"Data_only": 0,
"Master_data": 3,
"Client": 0
},
"Versions": ["2.3.3"],
"OS": {
"Available_processors": 3,
"Allocated_processors": 3,
"Mem": {
"Total": "312.1MB",
"Total_in_bytes": 327274496
},
"Names": [{
"Name": "Linux",
"Count": 3
} ]
},
"Process": {
"CPU": {
"Percent": 0
},
"Open_file_descriptors": {
"Min": 266,
"Max": 281,
"AVG": 272
}
},
"JVM": {
"Max_uptime": "2.1d",
"Max_uptime_in_millis": 188337407,
"Versions": [{
"Version": "1.8.0_111",
"Vm_name": "Java HotSpot (TM) 64-bit Server vm",
"Vm_version": "25.111-b14",
"Vm_vendor": "Oracle Corporation",
"Count": 3
} ],
"Mem": {
"heap_used": "203.7MB",
"Heap_used_in_bytes": 213674160,
"Heap_max": "2.9GB",
"Heap_max_in_bytes": 3195076608
},
"Threads": 88
},
"FS": {
"Total": "40.7GB",
"Total_in_bytes": 43701583872,
"Free": "27.1GB",
"Free_in_bytes": 29138677760,
"Available": "25GB",
"Available_in_bytes": 26898292736,
"Spins": "true"
},
"Plugins": [{
"Name": "Head",
"Version": "Master",
"description": "Head-a Web front end for a elastic search cluster",
"url": "/_plugin/head/",
"JVM": false,
"Site": True
}, {
"Name": "License",
"Version": "2.3.3",
"description": "Internal Elasticsearch Licensing Plugin",
"JVM": true,
"ClassName": "Org.elasticsearch.license.plugin.LicensePlugin",
"Isolated": false,
"Site": false
}, {
"Name": "Shield",
"Version": "2.3.3",
"description": "Elasticsearch Shield (Security)",
"JVM": true,
"ClassName": "Org.elasticsearch.shield.ShieldPlugin",
"Isolated": false,
"Site": false
} ]
}
}
[[email protected] ~]# curl-xget ' Http://10.2.11.225:9200/_nodes/stats/indices?pretty '-u adminname-p----Statistics node information
Second, CAT API
1, Master---Find the master node
[Email protected] ~]# curl-xget ' http://10.2.11.225:9200/_cat/master?pretty&v '-u adminname-p
Enter host password for user ' AdminName ':
ID host IP Node
PBIOPQXTST6QDZ5X9OO9DW 10.2.11.230 10.2.11.230 elk01
2, Nodes---node information
View Help:?
Specify the appropriate columns:? h= column names such as:GET /_cat/nodes? V&h=ID,IP,port,v,m
3. Indices index
4. Health
[[email protected] ~]# curl-xget ' http://10.2.11.225:9200/_cat/health?v '-u adminname-p
Enter Host Password for user ' AdminName ':
epoch timestamp cluster status Node.total node.data Shards pri relo init unassign pending_tasks max_task_wait_time active_shards_percent
1494682040 21:27:20 myelk green 3 3 42 21 0 0 0 0 - 100.0%
5, shard--shard information
[Email protected] ~]# curl-xget ' http://10.2.11.225:9200/_cat/shards?v '-u adminname-p
Enter host password for user ' AdminName ':
Index shard prirep State Docs store IP node
tomcat-system-message-2017.05.11 2 P STARTED 1459 345.7kb 10.2.11.231 elk02
tomcat-system-message-2017.05.11 2 R STARTED 1459 345.5kb 10.2.11.225 elk03
tomcat-system-message-2017.05.11 3 R STARTED 1395 316.6kb 10.2.11.225 elk03
tomcat-system-message-2017.05.11 3 p STARTED 1395 316.6kb 10.2.11.230 elk01
tomcat-system-message-2017.05.11 4 R STARTED 1468 338.8kb 10.2.11.231 elk02
tomcat-system-message-2017.05.11 4 p STARTED 1468 340.5kb 10.2.11.230 elk01
tomcat-system-message-2017.05.11 1 R STARTED 1434 346kb 10.2.11.225 elk03
tomcat-system-message-2017.05.11 1 P STARTED 1434 346kb 10.2.11.230 elk01
tomcat-system-message-2017.05.11 0 P STARTED 1426 313.4kb 10.2.11.231 elk02
tomcat-system-message-2017.05.11 0 R STARTED 1426 336.1kb 10.2.11.225 elk03
6. View common information (plugins)
[Email protected] ~]# curl-xget ' http://10.2.11.225:9200/_cat/plugins?v '-u adminname-p
Enter host password for user ' AdminName ':
Name component version type URL
ELK03 License 2.3.3 J
Elk03 Shield 2.3.3 J
ELK01 Head Master S/_plugin/head/
ELK01 License 2.3.3 J
Elk01 Shield 2.3.3 J
ELK02 Head Master S/_plugin/head/
ELK02 License 2.3.3 J
Elk02 Shield 2.3.3 J
Third, Search APIs
1. Search
[Email protected] ~]# curl-xget ' Http://10.2.11.225:9200/tomcat-access-log-2017.05.11/_search?v&pretty '-u Adminname-p
Elasticsearch in the API