CentOS 7 es 7.x 集群搭建
1、准备三台虚拟机
10.0.6.56(主节点)
10.0.6.57
10.0.6.58
安装连接:
https://blog.csdn.net/weixin_45441740/article/details/119779886?spm=1001.2014.3001.5502
2、进入10.0.6.56机器配置es核心配置文件
vim elasticsearch.yml
# 每一个节点的名称,必须不一样
node.name: node-01
path.data: /usr/local/elasticsearch-7.8.1/data # 数据目录位置
path.logs: /usr/local/elasticsearch-7.8.1/logs #日志目录位置
network.host: 0.0.0.0 # 绑定到0.0.0.0,允许任何ip来访问(默认是只有本机访问# cluster.initial_master_nodes: ["es-node1"]
# http端口(使用默认即可)
http.port: 9201
# 启动的时候使用一个master节点
cluster.initial_master_nodes: ["node-01"]
# 配置集群名称,保证每个节点的名称相同,如此就能都处于一个集群之内了
cluster.name: merleWang-es-cluster
# 主节点,作用主要是用于来管理整个集群,负责创建或删除索引,管理其他非master节点(相当于企业老总)
node.master: true
# 数据节点,用于对文档数据的增删改查
node.data: true
# 集群列表
discovery.seed_hosts: ["10.0.6.56", "10.0.6.57", "10.0.6.58"]
http.cors.enabled: true
http.cors.allow-origin: "*"
另外两台的配置
vim elasticsearch.yml
node.name: node-03
path.data: /usr/local/elasticsearch-7.8.1/data # 数据目录位置
path.logs: /usr/local/elasticsearch-7.8.1/logs #日志目录位置
network.host: 0.0.0.0 # 绑定到0.0.0.0,允许任何ip来访问(默认是只有本机访问# cluster.initial_master_nodes: ["es-node1"]
cluster.initial_master_nodes: ["node-01"]
cluster.name: merleWang-es-cluster
node.master: true
node.data: true
discovery.seed_hosts: ["10.0.6.56", "10.0.6.57", "10.0.6.58"]
http.cors.enabled: true
http.cors.allow-origin: "*"
vim elasticsearch.yml
node.name: node-04
path.data: /usr/local/elasticsearch-7.8.1/data # 数据目录位置
path.logs: /usr/local/elasticsearch-7.8.1/logs #日志目录位置
network.host: 0.0.0.0 # 绑定到0.0.0.0,允许任何ip来访问(默认是只有本机访问# cluster.initial_master_nodes: ["es-node1"]
cluster.initial_master_nodes: ["node-01"]
cluster.name: merleWang-es-cluster
node.master: true
node.data: true
discovery.seed_hosts: ["10.0.6.56", "10.0.6.57", "10.0.6.58"]
http.cors.enabled: true
http.cors.allow-origin: "*"