集羣名稱,默認爲elasticsearch:
cluster.name: elasticsearch
html
設置一個節點的併發數量,有兩種狀況,一種是在初始復甦過程當中:
cluster.routing.allocation.node_initial_primaries_recoveries: 4
另外一種是在添加、刪除節點及調整時:
cluster.routing.allocation.node_concurrent_recoveries: 2
node
node.name: elasticsearch-01
是否容許做爲主節點,默認值爲true:
node.master: true
git
是否存儲數據,即存儲索引片斷,默認值爲true:
node.data: true
github
注意:
master和data同時配置會產生一些奇異的效果: bootstrap
- 當master爲false,而data爲true時,會對該節點產生嚴重負荷;
- 當master爲true,而data爲false時,該節點做爲一個協調者;
- 當master爲false,data也爲false時,該節點就變成了一個負載均衡器。
你能夠經過鏈接http://localhost:9200/_cluster/health或者http://localhost:9200/_cluster/nodes,或者使用插件http://github.com/lukas-vlcek/bigdesk或http://mobz.github.com/elasticsearch-head來查看集羣狀態。網絡
節點自定義屬性,可用於後期集羣進行碎片分配時的過濾:
node.rack: rack-01
併發
index.number_of_shards: 5
index.number_of_replicas: 1
當你不須要分佈式時,可進行以下設置:app
index.number_of_shards: 1 index.number_of_replicas: 0
- 1
- 2
上述兩個屬性的設置直接影響集羣中索引和搜索操做的執行,假設有足夠的機器來持有碎片和副本,那麼能夠按以下規則設置這兩個值:
- 擁有更多的碎片能夠提高索引執行能力,並容許經過機器分發一個大型的索引;
- 擁有更多的副本可以提高搜索執行能力以及集羣能力,但副本增多會下降插入和刪除操做的效率。負載均衡- 對於一個索引來講,number_of_shards一旦設置將不能修改,而number_of_replicas可使用索引更新設置API在任什麼時候候被增長或者減小;
ElasticSearch關注加載均衡、遷移、從節點彙集結果等等,能夠嘗試多種設計來完成這些功能,能夠鏈接http://localhost:9200/A/_status來檢測索引的狀態。elasticsearch
path.conf: /path/to/conf
path.data: /path/to/data
能夠可選擇的包含一個以上的位置,使得數據在文件級別跨越位置,這樣在建立時就有更多的自由路徑,如:
path.data: /path/to/data1,/path/to/data2
path.work: /path/to/work
path.logs: /path/to/logs
path.plugins: /path/to/plugins
plugin.mandatory: mapper-attachments,lang-groovy
bootstrap.mlockall: true
請確保ES_MIN_MEM和ES_MAX_MEM的值是同樣的,而且可以爲ElasticSearch分配足夠的內在,併爲系統操做保留足夠的內存。
network.bind_host: 192.168.0.1
network.publish_host: 192.168.0.1
network.host: 192.168.0.1
transport.tcp.port: 9300
transport.tcp.compress: true
http.port: 9200
http.max_content_length: 100mb
http.enabled: false
gateway.type: local
gateway.recover_after_nodes: 1
gateway.recover_after_time: 5m
gateway.expected_nodes: 2
indices.recovery.max_size_per_sec: 0
indices.recovery.concurrent_streams: 5
discovery.zen.minimum_master_nodes: 1
discovery.zen.ping.timeout: 3s
上有更多關於discovery的設置。
discovery.zen.ping.multicast.enabled: false
discovery.zen.ping.unicast.hosts: ["host1", "host2:port", "host3[portX-portY]"]
node.max_local_storage_nodes: 1
action.destructive_requires_name: true
--------------------- 做者:Yashon1990 來源:CSDN 原文:https://blog.csdn.net/hyx1990/article/details/52892026?utm_source=copy 來源聲明