elasticsearch.yml配置参数说明

2020-06-17  本文已影响0人  愤愤的有痣青年

elasticsearch.yml配置文件默认路径为/usr/share/elasticsearch/config/elasticsearch.yml,所有参数均设置有默认值,大多数情况下能满足需求,若不满足需求的,可以酌情修改.所有的参数值都可使用环境变量来设置,使用$ {变量名}的格式.

cluster.name: od-fts1

node.name: "od-fts1a"

node.master: true

node.data: true

常见配置如下

node.master:false
node.data:true
node.master:true
node.data:false
node.master:false
node.data:false

node.rack: rack314

node.max_local_storage_nodes: 1

默认情况下,允许多个节点从同一安装位置启动

index.number_of_shards: 2

索引的默认分片数,一个索引的数据将会分成这么多片进行存储,降低单文件的大小.分片数量可以增强索引的性能,并能发挥多设备的优势.

index.number_of_replicas: 1

设置索引的副本(附加副本)数量(默认为1),此数量可以提高搜索性能.此参数可以后期动态修改

index.number_of_shards: 1
index.number_of_replicas: 0

path.conf: /path/to/conf

包含配置文件目录的路径

path.data: /path/to/data

存放数据的目录

path.work: /path/to/work

临时文件的路径

path.logs: /path/to/logs

日志路径

path.plugins: /path/to/plugins

插件路径

plugin.mandatory: mapper-attachments,lang-groovy

如果没有为节点安装此处的插件,节点将不能启动

bootstrap.mlockall: true

是否需要锁定内存.由于系统会将不常使用的数据放到swp中,这将降低使用时的速度

network.bind_host: 192.168.0.1

绑定的IP

network.publish_host: 192.168.0.1

设置与其他节点通信的地址,如果不指定,其将自动生成.这个地址必须是实际的IP地址

network.host: 192.168.0.1

设置'bind_host'和'publish_host'

transport.tcp.port: 9300

监听的端口

transport.tcp.compress: true

压缩节点之间的通信数据,默认是关闭的

http.port: 9200

设置一个自定义端口以侦听HTTP流量

http.max_content_length: 100mb

设置自定义允许的内容长度

http.enabled: false

完全禁用HTTP,只用https

gateway.type: local

默认网关类型为“本地”网关(推荐)

gateway.recover_after_nodes: 1

在集群中的N个节点启动后,允许恢复过程

gateway.recover_after_time: 10m

Set the timeout to initiate the recovery process, once the N nodes from previous setting are up (accepts time value):

gateway.expected_nodes: 2

Set how many nodes are expected in this cluster. Once these N nodes are up (and recover_after_nodes is met), begin recovery process immediately (without waiting for recover_after_time to expire):

action.auto_create_index: false

需要显式创建索引

action.disable_close_all_indices: true

禁止关闭所有索引

action.disable_delete_all_indices: true

禁止删除所有索引

action.disable_shutdown: true

http.cors.allow-origin: "*"

http.cors.enabled: true

跨域

############################# Recovery Throttling #############################

These settings allow to control the process of shards allocation between

nodes during initial recovery, replica allocation, rebalancing,

or when adding and removing nodes.

Set the number of concurrent recoveries happening on a node:

1. During the initial recovery

cluster.routing.allocation.node_initial_primaries_recoveries: 4

2. During adding/removing nodes, rebalancing, etc

cluster.routing.allocation.node_concurrent_recoveries: 2

Set to throttle throughput when recovering (eg. 100mb, by default 20mb):

indices.recovery.max_bytes_per_sec: 100mb

Set to limit the number of open concurrent streams when

recovering a shard from a peer:

indices.recovery.concurrent_streams: 5

################################## Discovery ##################################

Discovery infrastructure ensures nodes can be found within a cluster

and master node is elected. Multicast discovery is the default.

Set to ensure a node sees N other master eligible nodes to be considered

operational within the cluster. Its recommended to set it to a higher value

than 1 when running more than 2 nodes in the cluster.

discovery.zen.minimum_master_nodes: 1

Set the time to wait for ping responses from other nodes when discovering.

Set this option to a higher value on a slow or congested network

to minimize discovery failures:

discovery.zen.ping.timeout: 3s

For more information, see

http://elasticsearch.org/guide/en/elasticsearch/reference/current/modules-discovery-zen.html

Unicast discovery allows to explicitly control which nodes will be used

to discover the cluster. It can be used when multicast is not present,

or to restrict the cluster communication-wise.

1. Disable multicast discovery (enabled by default):

discovery.zen.ping.multicast.enabled: false

2. Configure an initial list of master nodes in the cluster

to perform discovery when new nodes (master or data) are started:

discovery.zen.ping.unicast.hosts: ["host1", "host2:port"]

EC2 discovery allows to use AWS EC2 API in order to perform discovery.

You have to install the cloud-aws plugin for enabling the EC2 discovery.

For more information, see

http://elasticsearch.org/guide/en/elasticsearch/reference/current/modules-discovery-ec2.html

See http://elasticsearch.org/tutorials/elasticsearch-on-ec2/

for a step-by-step tutorial.

################################## Slow Log ##################################

Shard level query and fetch threshold logging.

index.search.slowlog.threshold.query.warn: 10s

index.search.slowlog.threshold.query.info: 5s

index.search.slowlog.threshold.query.debug: 2s

index.search.slowlog.threshold.query.trace: 500ms

index.search.slowlog.threshold.fetch.warn: 1s

index.search.slowlog.threshold.fetch.info: 800ms

index.search.slowlog.threshold.fetch.debug: 500ms

index.search.slowlog.threshold.fetch.trace: 200ms

index.indexing.slowlog.threshold.index.warn: 10s

index.indexing.slowlog.threshold.index.info: 5s

index.indexing.slowlog.threshold.index.debug: 2s

index.indexing.slowlog.threshold.index.trace: 500ms

################################## GC Logging ################################

monitor.jvm.gc.ParNew.warn: 1000ms

monitor.jvm.gc.ParNew.info: 700ms

monitor.jvm.gc.ParNew.debug: 400ms

monitor.jvm.gc.ConcurrentMarkSweep.warn: 10s

monitor.jvm.gc.ConcurrentMarkSweep.info: 5s

monitor.jvm.gc.ConcurrentMarkSweep.debug: 2s

上一篇 下一篇

猜你喜欢

热点阅读