elasticsearch其實就是一個分佈式系統,須要知足分佈式系統具有的高可用性和可擴展性html
-E cluster.name=geektime
進行設定-E node.name=node1
指定不一樣的節點承擔了不一樣的角色java
節點類型 | 配置參數 | 默認值 |
---|---|---|
master eligible | node.master | true |
data | node.data | true |
ingest | node.ingest | true |
coordinating only | 無 | 每一個節點默認都是coordinate節點。設置其餘類型爲false |
machine learning | node.ml | true(需設置 enable x-pack) |
主分片,用以解決數據水平擴展的問題。經過主分片,能夠將數據分佈到集羣內的全部節點之上node
副本,用以解決數據高可用的問題,分片是主分片的拷貝git
一個三節點的集羣中,blogs
索引的分片分佈狀況github
一個主分片分散到三個節點上,每一個節點存在一個副本分片json
GET _cluster/health
bash
{
"cluster_name" : "elasticsearch",
"status" : "yellow",
"timed_out" : false,
"number_of_nodes" : 1,
"number_of_data_nodes" : 1,
"active_primary_shards" : 6,
"active_shards" : 6,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 1,
"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" : 85.71428571428571
}
複製代碼
建議經過github先下載文件(下載地址:github.com/lmenezes/ce…),而後進行安裝服務器
tar zxvf cerebro-0.8.4.tgz
cd cerebro-0.8.4
複製代碼
啓動架構
bin/cerebro
app
訪問網址:http://ip:9000
集羣中目前只有一個工做節點
get _cat/nodes?v
GET /_nodes/es7_01,es7_02
GET /_cat/nodes?v
GET /_cat/nodes?v&h=id,ip,port,v,m
GET _cluster/health
GET _cluster/health?level=shards
GET /_cluster/health/kibana_sample_data_ecommerce,kibana_sample_data_flights
GET /_cluster/health/kibana_sample_data_flights?level=shards
#### cluster state
The cluster state API allows access to metadata representing the state of the whole cluster. This includes information such as
GET /_cluster/state
#cluster get settings
GET /_cluster/settings
GET /_cluster/settings?include_defaults=true
GET _cat/shards
GET _cat/shards?h=index,shard,prirep,state,unassigned.reason
複製代碼