Elasticsearch 8 集群配置

一、安装

Centos 8 安装 Elasticsearch 8

二、准备

ES集群至少需要三台服务器:

192.168.100.230   master
192.168.100.231   slave1
192.168.100.232   slave2

三、配置

1、192.168.100.230 master 配置

cluster.name: es-sassycoder   #配置elasticsearch的集群名称,默认是my-application。建议修改成一个有意义的名称。
node.name: es-node-230       #节点名,通常一台物理服务器就是一个节点,es会默认随机指定一个名字,建议指定一个有意义的名称,方便管理
network.host: 0.0.0.0      #绑定ip地址
http.port: 9200  	       #暴露的http端口
transport.profiles.default.port: 9300    #内部通信端口
path.data: /usr/local/elasticsearch-8.3.1/data   #索引目录
path.logs: /usr/local/elasticsearch-8.3.1/logs   #日志目录
# 允许通配符删除索引
action.destructive_requires_name: true
# 配置集群初始时,作为master的主机,单节点时配置本节点名称(node.name)
# 必须使用完整的 node.name
# 重新启动集群或向现有集群添加新节点时,不要使用此设置
cluster.initial_master_nodes: ["es-node-230"]
# 配置启动时要发现的master列表(IP 或 可解析的域名),端口默认为9300
# 单节点时不用配置或配置为本节点IP
discovery.seed_hosts: ["192.168.100.230:9300","192.168.100.231:9300","192.168.100.232:9300"]
#使用head等插件监控集群信息,需要打开以下配置项
http.cors.enabled: true
http.cors.allow-origin: "*"
http.cors.allow-headers: Authorization,X-Requested-With,Content-Length,Content-Type

#----------------------- BEGIN SECURITY AUTO CONFIGURATION -----------------------
#
# The following settings, TLS certificates, and keys have been automatically      
# generated to configure Elasticsearch security features on 04-07-2022 09:25:53
#
# --------------------------------------------------------------------------------

# Enable security features
xpack.security.enabled: false

xpack.security.enrollment.enabled: false

# 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: false
  verification_mode: certificate
  keystore.path: certs/transport.p12
  truststore.path: certs/transport.p12
#----------------------- END SECURITY AUTO CONFIGURATION -------------------------

2、192.168.100.231 slave1配置

cluster.name: es-sassycoder   #配置elasticsearch的集群名称,默认是my-application。建议修改成一个有意义的名称。
node.name: es-node-231       #节点名,通常一台物理服务器就是一个节点,es会默认随机指定一个名字,建议指定一个有意义的名称,方便管理
network.host: 0.0.0.0      #绑定ip地址
http.port: 9200  	       #暴露的http端口
transport.profiles.default.port: 9300    #内部通信端口
path.data: /usr/local/elasticsearch-8.3.1/data   #索引目录
path.logs: /usr/local/elasticsearch-8.3.1/logs   #日志目录
# 允许通配符删除索引
action.destructive_requires_name: true
# 配置集群初始时,作为master的主机,单节点时配置本节点名称(node.name)
# 必须使用完整的 node.name
# 重新启动集群或向现有集群添加新节点时,不要使用此设置
#cluster.initial_master_nodes: ["es-node-230","es-node-231","es-node-232"]
# 配置启动时要发现的master列表(IP 或 可解析的域名),端口默认为9300
# 单节点时不用配置或配置为本节点IP
discovery.seed_hosts: ["192.168.100.230:9300","192.168.100.231:9300","192.168.100.232:9300"]
#使用head等插件监控集群信息,需要打开以下配置项
http.cors.enabled: true
http.cors.allow-origin: "*"
http.cors.allow-headers: Authorization,X-Requested-With,Content-Length,Content-Type

#----------------------- BEGIN SECURITY AUTO CONFIGURATION -----------------------
#
# The following settings, TLS certificates, and keys have been automatically      
# generated to configure Elasticsearch security features on 04-07-2022 09:25:53
#
# --------------------------------------------------------------------------------

# Enable security features
xpack.security.enabled: false

xpack.security.enrollment.enabled: false

# 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: false
  verification_mode: certificate
  keystore.path: certs/transport.p12
  truststore.path: certs/transport.p12
#----------------------- END SECURITY AUTO CONFIGURATION -------------------------

3、192.168.100.232 slave2配置

cluster.name: es-sassycoder   #配置elasticsearch的集群名称,默认是my-application。建议修改成一个有意义的名称。
node.name: es-node-232       #节点名,通常一台物理服务器就是一个节点,es会默认随机指定一个名字,建议指定一个有意义的名称,方便管理
network.host: 0.0.0.0      #绑定ip地址
http.port: 9200  	       #暴露的http端口
transport.profiles.default.port: 9300    #内部通信端口
path.data: /usr/local/elasticsearch-8.3.1/data   #索引目录
path.logs: /usr/local/elasticsearch-8.3.1/logs   #日志目录
# 允许通配符删除索引
action.destructive_requires_name: true
# 配置集群初始时,作为master的主机,单节点时配置本节点名称(node.name)
# 必须使用完整的 node.name
# 重新启动集群或向现有集群添加新节点时,不要使用此设置
#cluster.initial_master_nodes: ["es-node-232"]
# 配置启动时要发现的master列表(IP 或 可解析的域名),端口默认为9300
# 单节点时不用配置或配置为本节点IP
discovery.seed_hosts: ["192.168.100.230:9300","192.168.100.231:9300","192.168.100.232:9300"]
#使用head等插件监控集群信息,需要打开以下配置项
http.cors.enabled: true
http.cors.allow-origin: "*"
http.cors.allow-headers: Authorization,X-Requested-With,Content-Length,Content-Type

#----------------------- BEGIN SECURITY AUTO CONFIGURATION -----------------------
#
# The following settings, TLS certificates, and keys have been automatically      
# generated to configure Elasticsearch security features on 05-07-2022 07:55:16
#
# --------------------------------------------------------------------------------

# Enable security features
xpack.security.enabled: false

xpack.security.enrollment.enabled: false

# 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: false
  verification_mode: certificate
  keystore.path: certs/transport.p12
  truststore.path: certs/transport.p12
#----------------------- END SECURITY AUTO CONFIGURATION -------------------------

启动过程如果有报错,先把elasticsearch/data目录下的文件全部删除,再试试。

你可能感兴趣的:(Elasticsearch,服务器搭建,elasticsearch,搜索引擎,大数据)