1.解压es的zip压缩包,解压出来三份
2.配置每份的elasticsearch.yml
配置文件
cluster.name: my-application
node.name: node-1
node.master: true
node.data: true
path.data: .\path\to\data
path.logs: .\path\to\logs
network.host: 0.0.0.0
http.port: 9200
transport.tcp.port: 9300
discovery.zen.ping.unicast.hosts: ["localhost:9300", "localhost:9301","localhost:9302"]
discovery.zen.minimum_master_nodes: 2
cluster.name: my-application
node.name: node-2
node.master: true
node.data: true
path.data: .\path\to\data
path.logs: .\path\to\logs
network.host: 0.0.0.0
http.port: 9201
transport.tcp.port: 9301
discovery.zen.ping.unicast.hosts: ["localhost:9300", "localhost:9301","localhost:9302"]
discovery.zen.minimum_master_nodes: 2
cluster.name: my-application
node.name: node-3
node.master: true
node.data: true
path.data: .\path\to\data
path.logs: .\path\to\logs
network.host: 0.0.0.0
http.port: 9202
transport.tcp.port: 9302
discovery.zen.ping.unicast.hosts: ["localhost:9300", "localhost:9301","localhost:9302"]
discovery.zen.minimum_master_nodes: 2
3.启动即可
4.配置文件解释
#指定集群名称
cluster.name: my-application
#指定节点名称
node.name: node-3
#指定节点是否可以是master,默认不配置也是true
node.master: true
#指定节点是否可以存储数据,默认不配置也是true
node.data: true
#数据存储位置
path.data: .\path\to\data
#日志存储位置
path.logs: .\path\to\logs
#通过哪个ip可以访问到es
network.host: 0.0.0.0
#RESTful接口的端口
http.port: 9202
#节点节互相通信的端口
transport.tcp.port: 9302
#种子节点八卦节点,配置master-eligible节点
discovery.zen.ping.unicast.hosts: ["localhost:9300", "localhost:9301","localhost:9302"]
#最小的master-eligible节点存活数量,小于这个值,集群不可写操作
discovery.zen.minimum_master_nodes: 2