以elasticssearch 6.5.1版本为例
# ======================== 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:
#
#cluster.name: my-application //集群名称,以此判断是否为一个集群
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
#node.name: node-1 //节点名称,以此判断同一集群不同节点。ps如果这个不指定的话,他就会随机的命名一个node.name
#
# Add custom attributes to the node:
#
#node.attr.rack: r1
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
#path.data: /path/to/data //数据存储地址
#
# Path to log files:
#
#path.logs: /path/to/logs //日志存储地址 博客地址www.z88j.com转发请注明来源。
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
#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.
#
# Elasticsearch performs poorly when the system is swapping the memory.
#
# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6)://对外提供服务配置地址和端口相关
#
#network.host: 192.168.0.1 //网络地址
#
# Set a custom port for HTTP:
#
#http.port: 9200 //网络端口
#
# For more information, consult the network module documentation.
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when new node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
#discovery.zen.ping.unicast.hosts: ["host1", "host2"]
#
# Prevent the "split brain" by configuring the majority of nodes (total number of master-eligible nodes / 2 + 1):
#
#discovery.zen.minimum_master_nodes: 3
#
# For more information, consult the zen discovery module documentation.
#
# ---------------------------------- Gateway -----------------------------------
#
# Block initial recovery after a full cluster restart until N nodes are started:
#
#gateway.recover_after_nodes: 3
#
# For more information, consult the gateway module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: true
如果上面看着费力,我贴了一下配置图片:
上面基本就是常用到的elasticsearch.yml的配置。
还有一点elasticsearch 有两种模式分别是开发者模式(Development)和生产模式(Production)
这两种模式的区别就是:development启动时会以warning的 方式进行提示配置检查异常。
prodection启动时候会以error方式进行提示配置异常检查并进行退出。
配置修改不只是可以在elasticsearch.yml文件中进行更改配置 。还可以用命令行 。比如:bin/elasticsearch -Ehttp.port=8001
原创文章,作者:星辰,如若转载,请注明出处:http://www.z88j.com/151.html