集群名称,默认为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 来源声明