Elasticsearch 7.12.1 集群简单配置

下载 & 安装 & 启动

  • 下载地址
  • 安装:解压即可,集群的话就多 Copy 几份
  • 启动:${软件根目录}/bin/elasticsearch

配置

# ======================== 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: elasticsearch
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
# 当前 Node 的名称,每个节点不同
node.name: node-1
node.master: true
node.data: true
#
# 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
#
# ----------------------------------- 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 -----------------------------------
#
# By default Elasticsearch is only accessible on localhost. Set a different
# address here to expose this node on the network:
# 
# 其他节点改成对应的节点所在 hostname 即可
network.host: [node-1]
# 其他节点改成对应的端口号即可,同一台机器端口号不可相同
http.port: 9201
# 其他节点改成对应的端口号即可,同一台机器端口号不可相同
transport.tcp.port: 9301

# head 插件需要这打开这两个配置
http.cors.allow-origin: "*"
http.cors.enabled: true
http.max_content_length: 200mb
#
#
# By default Elasticsearch listens for HTTP traffic on the first free port it
# finds starting at 9200. Set a specific HTTP port here:
#
#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]"]
#
#discovery.seed_hosts: ["host1", "host2"]
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
cluster.initial_master_nodes: ["node-1", "node-2", "node-3"]
# 开箱即用,无需任何网络配置,Elasticsearch 将绑定到可用的回送地址,并将扫描本地端口 9300 至 9305,以尝试连接到在同一服务器上运行的其他节点,这里 ES 提供了自动群集检查,而无需进行
# 任何配置。
# # 如果要与其他主机上的节点组成集群,则必须设置 discovery.seed_hosts,提供集群中其他主机的列表,这些节点都具备主机资格,并且可能在其中处于活动状态并可以联系,以便为发现过程。此设# 通常应包含群集中所有符合主机条件的节点的地址,是主机地址数组或逗号分隔的字符串。每个值都采用 host:port 或者 host 形式(其中 port 默认设置为 transport.profiles.default.port,如果# 设置则返回 transport.port)。注意,IPV6 主机放在方括号里。默认值是: 127.0.0.1, [::1].
discovery.seed_hosts: ["node-1:9301","node-2:9302","node-3:9303"]
#network.tcp.keep_alive: true
#network.tcp.no_delay: true
#transport.tcp.compress: true
#
#
# For more information, consult the discovery and cluster formation module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: true

配置完毕之后各节点重启即可。

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值