前言

这是整个ElasticSearch搭建的最后一篇文章,其实对我而言ElasticSearch在Linux上搭建集群写这篇文章意义并不大,只是为了补充这个空白而已,所以这篇文章并不会讲解很详细!前置可以先看看Linux安装ElasticSearchWindows搭建ElasticSearch集群这两篇文章,先将这个搞定,在来搞集群!这篇文章只介绍重点!

搭建

用户创建
按照Linux搭建ElasticSearch这篇文章中的创建即可

目录权限修改
将Linux搭建ElasticSearch这篇文章的ElasticSearch软件包复制三份出来!
Linux搭建ElasticSearch集群_其他
对这上个文件夹中的权限按照Linux搭建ElasticSearch这篇文章中的来三次!

配置文件修改
node1

 cluster.name: my-application
 node.name: node-1
 node.master: true
 node.data: true
 http.host: 0.0.0.0
 http.port: 9201
 transport.tcp.port: 9301
 http.cors.enabled: true
 http.cors.allow-origin: "*"

node2

 cluster.name: my-application
 node.name: node-2
 node.master: true
 node.data: true
 http.host: 0.0.0.0
 http.port: 9202
 transport.tcp.port: 9302
 discovery.seed_hosts: ["localhost:9301"]
 discovery.zen.fd.ping_timeout: 1m
 discovery.zen.fd.ping_retries: 5
 http.cors.enabled: true
 http.cors.allow-origin: "*"

node3

 cluster.name: my-application
 node.name: node-3
 node.master: true
 node.data: true
 http.host: 0.0.0.0
 http.port: 9203
 transport.tcp.port: 9303
 discovery.seed_hosts: ["localhost:9301", "localhost:9302"]
 discovery.zen.fd.ping_timeout: 1m
 discovery.zen.fd.ping_retries: 5
 http.cors.enabled: true
 http.cors.allow-origin: "*"

按照node1、node2、node3的顺序启动即可

Linux搭建ElasticSearch集群_linux安装_02