使用的系统
[root@node1 ~]# uname -a
Linux node1 6.12.0-55.32.1.el10_0.x86_64 #1 SMP PREEMPT_DYNAMIC Sun Sep 14 14:26:10 UTC 2025 x86_64 GNU/Linux
[root@node1 ~]# cat /etc/redhat-release
Rocky Linux release 10.0 (Red Quartz)
我们使用三台rocky10的系统部署,节点IP信息如下
| 主机名 | IP |
|---|---|
| node1 | 192.168.0.27 |
| node2 | 192.168.0.13 |
| node3 | 192.168.0.14 |
前置设置
三台服务器要都关上防火墙
systemctl stop firewalld
systemctl disable firewalld
下载ElasticSearch
注意: ES不能以root启动,因此我们需要先创建一个用户,三台服务器都创建用户
useradd gillbert
切换到非root用户,三台服务器都执行,后面我们执行的操作都以此用户执行。
su gillbert
下载8.x版本进行部署,在三台服务器上都下载,下载到/home/gillbert目录中
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.19.6-linux-x86_64.tar.gz
解压
三台服务器都进行解压
tar -xf elasticsearch-8.19.6-linux-x86_64.tar.gz
修改配置文件
配置文件为elasticsearch-8.19.6/config/elasticsearch.yml
node1 配置
# 服务器启动时绑定的IP地址
network.host: 192.168.0.27
# 自动发现设置,可以通过这些节点自动发现集群的节点
discovery.seed_hosts: ["192.168.0.27", "192.168.0.13", "192.168.0.14"]
# 集群中可以参与选举master的节点列表
cluster.initial_master_nodes: ["192.168.0.27", "192.168.0.13", "192.168.0.14"]
# 关闭 X-Pack 安全功能,关闭后任何人都可以访问集群(生产不安全,需要开启)
xpack.security.enabled: false
node2配置
# 服务器启动时绑定的IP地址
network.host: 192.168.0.13
# 自动发现设置,可以通过这些节点自动发现集群的节点
discovery.seed_hosts: ["192.168.0.27", "192.168.0.13", "192.168.0.14"]
# 集群中可以参与选举master的节点列表
cluster.initial_master_nodes: ["192.168.0.27", "192.168.0.13", "192.168.0.14"]
# 关闭 X-Pack 安全功能,关闭后任何人都可以访问集群(生产不安全,需要开启)
xpack.security.enabled: false
node3配置
# 服务器启动时绑定的IP地址
network.host: 192.168.0.14
# 自动发现设置,可以通过这些节点自动发现集群的节点
discovery.seed_hosts: ["192.168.0.27", "192.168.0.13", "192.168.0.14"]
# 集群中可以参与选举master的节点列表
cluster.initial_master_nodes: ["192.168.0.27", "192.168.0.13", "192.168.0.14"]
# 关闭 X-Pack 安全功能,关闭后任何人都可以访问集群(生产不安全,需要开启)
xpack.security.enabled: false
启动ES
启动ES,三台服务器都执行(注意启动时候要以非root启动,否则会有报错启动失败)。如果加-d参数的话为后台启动
./elasticsearch-8.19.6/bin/elasticsearch
测试
请求接口查看节点信息
[root@node1 ~]# curl http://192.168.0.27:9200/_cat/nodes?v
ip heap.percent ram.percent cpu load_1m load_5m load_15m node.role master name
192.168.0.13 14 91 4 0.12 0.15 0.08 cdfhilmrstw - node2
192.168.0.27 20 92 4 0.19 0.30 0.26 cdfhilmrstw * node1
192.168.0.14 13 91 3 0.16 0.18 0.08 cdfhilmrstw - node3
遇到的问题
问题一: 启动时候报错
[2025-11-06T23:58:39,438][ERROR][o.e.b.Elasticsearch ] [node-1] node validation exception
[1] bootstrap checks failed. You must address the points described in the following [1] lines before starting Elasticsearch. For more information see [https://www.elastic.co/guide/en/elasticsearch/reference/8.19/bootstrap-checks.html]
bootstrap check failure [1] of [1]: Transport SSL must be enabled if security is enabled. Please set [xpack.security.transport.ssl.enabled] to [true] or disable security by setting [xpack.security.enabled] to [false]; for more information see [https://www.elastic.co/guide/en/elasticsearch/reference/8.19/bootstrap-checks-xpack.html#bootstrap-checks-tls]
按照错误提示,在配置文件中添加如下配置
xpack.security.enabled: false
问题二: 节点无法加入集群
解决办法: 关闭防火墙即可