参考网上博客,留作后续学习只用,侵权速删
此配置基于 es 7.13.2版本,之前很多老的配置都已经没有了。
# ======================== Elasticsearch Configuration =========================
#
# NOTE: Elasticsearch comes with reasonable defaults for most settings.
# Before you set out to tweak and tune the configuration, make sure you
# understand what are you trying to accomplish and the consequences.
#
# The primary way of configuring a node is via this file. This template lists
# the most important settings you may want to configure for a production cluster.
#
# Please consult the documentation for further information on configuration options:
# https://www.elastic.co/guide/en/elasticsearch/reference/index.html
#
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
# 集群名称 默认是elasticsearch es会自动发现在同一网段下的es,如果在同一网段下有多个集群,就可以用这个属性来区分不同的集群。
cluster.name: my-application
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
# 节点名称 默认随机指定一个name列表中名字,该列表在es的jar包中config文件夹里name.txt文件中,其中有很多作者添加的有趣名字。
# 7.13.2版本的config目录已经么有了name.txt文件
node.name: node-1
#
# Add custom attributes to the node:
# 节点服务器所在的机柜信息,此配置可不设
node.attr.rack: r1
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
# 指定es的数据存储目录,默认存储在es_home/data目录下
path.data: /path/to/data
#
# Path to log files:
# es的日志存储目录,默认存储在es_home/logs目录下
path.logs: /path/to/logs
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
# 锁定物理内存地址,防止elasticsearch内存被交换出去,也就是避免es使用swap交换分区
bootstrap.memory_lock: true
# 确保堆内存参数设置为系统可用内存的一半左右
# Make sure that the heap size is set to about half the memory available
# on the system and that the owner of the process is allowed to use this
# limit.
# 当系统进行内存交换的时候,es的性能很差
# Elasticsearch performs poorly when the system is swapping the memory.
#
# ---------------------------------- Network -----------------------------------
#
# By default Elasticsearch is only accessible on localhost. Set a different
# address here to expose this node on the network:
# 为es设置ip绑定,默认是localhost才能访问
network.host: 172.31.186.236
#
# By default Elasticsearch listens for HTTP traffic on the first free port it
# finds starting at 9200. Set a specific HTTP port here:
# 为es设置自定义端口,默认是9200
# 注意:在同一个服务器中启动多个es节点的话,默认监听的端口号会自动加1:例如:9200,9201,9202...
http.port: 9200
#
# For more information, consult the network module documentation.
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when this node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
# 服务发现种子主机:
# 在开发环境中,服务发现主机名不需要设置,
# Elasticsearch默认会从本机的9300-9305端口尝试去连接其它节点,这提供了自动集群的体验,不需要任何配置。
# 但在正式环境中,每个节点理论上都是不同的机器,这时候需要配置discovery.seed_hosts,discovery.seed_hosts
# 可以是
# 1. ip;
# 2. ip:端口;
# 3. 域名
# 4. ip v6地址形式
# 如果配置是ip,Elasticsearch默认会使用transport.profiles.default.port配置项的端口,
# 该端口默认为9300;如果配置是域名,且该域名下绑定了多个ip,ES会尝试去连接多个ip。
# 举个例子:
# discovery.seed_hosts:
# - 192.168.1.10:9300
# - 192.168.1.11
# - seeds.mydomain.com
# - [2001:0db8:85a3:0000:0000:8a2e:0370:7334]:9300
discovery.seed_hosts: ["host1", "host2"]
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
# 初始主节点:
# 当开启一个全新的集群时,会有一个集群的引导步骤,这步骤用来确定哪些节点参与第一次的主节点选举。在开发模式下,
# 这个步骤由节点自动完成,这种模式本质上是不安全的,因为不是所有节点都适合做主节点,主节点关系到集群的稳定性。
# 因此在生产模式下,集群第一次启动时,需要有一个适合作为主节点的节点列表,这个列表就是通过cluster.initial_master_nodes来配置,
# 在配置中需要写出具体的节点名称,对应node.name配置项。
cluster.initial_master_nodes: ["node-1"]
#
# For more information, consult the discovery and cluster formation module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
# 设置是否可以通过正则或者_all删除或者关闭索引库,默认true表示必须需要显式指定索引库名称
# 生产环境建议设置为true,删除索引库的时候必须显式指定,否则可能会误删索引库中的索引库。
action.destructive_requires_name: true
参考博客:
https://blog.youkuaiyun.com/qq_27512271/article/details/89647017
https://blog.youkuaiyun.com/wumeng2012/article/details/103777093
......