#### 安裝ES head插件
具體請參考github地址:https://github.com/mobz/elasticsearch-head
使用
安裝Install
# 在線安裝head插件
$ cd /letv/elasticsearch-1.7.3/bin
$ ./plugin --install mobz/elasticsearch-head
# 離線安裝head插件
# 從github下載head插件對應版本的zip包
$ cd /letv/elasticsearch-1.7.3/bin
$ ./plugin --install head --url file:///letv/elasticsearch-head-master.zip
集群中的es服務器都安裝一下。安裝完成之后,在瀏覽器輸入:http://ip:9200/_plugin/head/ ,可以查看顯示效果。如下圖:
主界面中可以看到集群的情況:
1.主分片與副本的區別是粗細邊框
2.界面的右邊有些按鈕,如:node stats, cluster nodes,這些是直接請求es的相關狀態的api,返回結果為json,如下圖:
【節點狀態】
curl http://localhost:8200/_cluster/nodes?pretty 結果:
{ "ok" : true, // 集群狀態 "cluster_name" : "if2c", //集群名稱 "nodes" : { "bT7UoS9nR4aVowpZ7KSQXQ" : { //節點UID "name" : "test123", //節點名稱 "transport_address" : "inet[10.0.2.226/10.0.2.226:8300]", TCP交流IP及端口 "hostname" : "memcached-2", //機器名稱 "version" : "0.90.9", ES版本 "http_address" : "inet[/10.0.2.226:8200]", //HTTP查詢端口,為插件提供監控 "attributes" : { "rack" : "racktest123", //機櫃ID,跨機櫃部署集群,以防某一個機櫃斷電影響ES服務 "master" : "true" //是否是主節點 } } } }
也可以查詢集群中某台機器的狀態:根據IP
curl http://localhost:8200/_cluster/nodes/10.0.2.226?pretty
也可以使用通配符查詢
curl http://localhost:8200/_cluster/nodes/10.0.2.2*?pretty
3.在索引下面有info和action兩個按鈕。info是可以查看索引的狀態和mapping的定義。action是對索引進行操作,如:添加別名、刷新、關閉索引,刪除索引等。
4.browser瀏覽界面,這個界面可以同時查看多個索引的數據,也可以查詢指定字段的數據。
5.Structured Query查詢界面,這個界面可以對某個索引進行一些復雜查詢,如下面這個例子是查詢product索引,構造boolquery,title字段里查詢“產品”關鍵詞,price范圍為10到100的記錄。
6.Any Request任意請求界面,這個界面可以說是個rest的客戶端,可以通過它來對es進行一些請求操作或測試api接口,下面這個例子是把product索引的副本數設置為1,更多的api可以到es官網查詢。