一、安装
Centos 8 安装 Elasticsearch 8
二、准备
ES集群至少需要三台服务器:文章来源:https://www.toymoban.com/news/detail-526251.html
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目录下的文件全部删除,再试试。文章来源地址https://www.toymoban.com/news/detail-526251.html
到了这里,关于Elasticsearch 8 集群配置的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!