好久没用 Elasticsearch 集群了,参考以前写的《大数据学习初级入门教程(八) —— Elasticsearch 7.6.2 单节点的安装、启动和测试_elasticsearch 7.6.2需要专属网络_孟郎郎的博客-CSDN博客》、《大数据学习初级入门教程(九) —— Elasticsearch 7.6.2 伪分布式集群的安装、配置、启动和测试_孟郎郎的博客-CSDN博客》和《大数据学习初级入门教程(十) —— Elasticsearch 7.6.2 完全分布式集群的安装、配置、启动和测试_初始化es7.6.2 searchdao_孟郎郎的博客-CSDN博客》,下载了目前官网最新的版本 elasticsearch-8.7.0-linux-x86_64 再重温下集群部署。按步骤部署过程中,发现不少和老版本不一致的地方,这里记录一下。
老版本配置中很多配置项在新版本中无法识别而报错,新版本的配置文件如下:
# ======================== 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: mllcluster-es870
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: es111
#
# Add custom attributes to the node:
#
#node.attr.rack: r1
node.roles: [master,data]
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
path.data: /data/elasticsearch/elasticsearch-8.7.0
#
# 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:
#
network.host: 192.168.220.111
#
# 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: ["node111", "node112", "node113", "node114", "node115"]
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
cluster.initial_master_nodes: ["es111", "es112", "es113", "es114", "es115"]
#
# For more information, consult the discovery and cluster formation module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Allow wildcard deletion of indices:
#
#action.destructive_requires_name: false#----------------------- BEGIN SECURITY AUTO CONFIGURATION -----------------------
#
# The following settings, TLS certificates, and keys have been automatically
# generated to configure Elasticsearch security features on 24-04-2023 07:30:33
#
# --------------------------------------------------------------------------------# Enable security features
xpack.security.enabled: falsexpack.security.enrollment.enabled: true
# Enable encryption for HTTP API client connections, such as Kibana, Logstash, and Agents
xpack.security.http.ssl:
enabled: false
keystore.path: certs/http.p12# Enable encryption and mutual authentication between cluster nodes
xpack.security.transport.ssl:
enabled: true
verification_mode: certificate
keystore.path: certs/transport.p12
truststore.path: certs/transport.p12
#----------------------- END SECURITY AUTO CONFIGURATION -------------------------
目前对安全验证等配置都已注释掉,后续抽空再研究。另外如果集群节点只剩下一个,启动节点后集群一直处于异常状态,无法自动恢复。
Good Luck!