ELK7版本搭建参考:https://www.cnblogs.com/minseo/p/10948632.html

  node-1已经安装配置好  

  配置文件如下

[root@salt-test conf.d]# sed '/#/d' /etc/elasticsearch/elasticsearch.yml
cluster.name: my-es
node.name: node-1
path.data: /data/es-data
path.logs: /var/log/elasticsearch
network.host: 0.0.0.0
http.port: 9200
#discovery.seed_hosts: ["192.168.1.4", "192.168.1.5"]
cluster.initial_master_nodes: ["node-1"]
http.cors.enabled: true
http.cors.allow-origin: "*"

  

  新建主机node-2修改elasticsearch配置文件

/etc/elasticsearch/elasticsearch.yml

  

#集群名需要和node-1一致
cluster.name: my-es
#node名
node.name: node-2
path.data: /data/es-data
path.logs: /var/log/elasticsearch
network.host: 0.0.0.0
http.port: 9200
#集群中两个节点的IP
discovery.seed_hosts: ["192.168.1.4", "192.168.1.5"]
cluster.initial_master_nodes: ["node-1"]
http.cors.enabled: true
http.cors.allow-origin: "*"

  启动elasticsearch

  查看节点1和2

ELK之elasticsearch7版本集群设置-LMLPHP

ELK之elasticsearch7版本集群设置-LMLPHP

  数据会自动从节点1同步至节点2

  在head查看

ELK之elasticsearch7版本集群设置-LMLPHP

05-26 00:02