Elasticsearch多节点集群配置文件
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Elasticsearch多节点集群配置文件相关的知识,希望对你有一定的参考价值。
192.168.18.186 安装一个Elasticsearch节点
192.168.18.187 安装两个Elasticsearch节点
主机1安装一个节点的配置文件(192.168.18.186 )
/usr/local/elasticsearch-1.7.3/config/elasticsearch.yml
cluster.name: elastic-product node.name: "node18.186" bootstrap.mlockall: true network.host: 192.168.18.186 discovery.zen.ping.timeout: 60s discovery.zen.fd.ping_timeout: 60s discovery.zen.minimum_master_nodes: 2 discovery.zen.ping.multicast.enabled: false discovery.zen.ping.unicast.hosts: ["192.168.18.186","192.168.18.187","192.168.18.187:9301"] index.cache.field.max_size: 50000 index.cache.field.expire: 10m index.cache.field.type: soft indices.fielddata.cache.size: 10% #path.data: /path/to/data |
说明:为了防止“脑裂”出现,discovery.zen.minimum_master_nodes参数设置的数字=(集群中节点数/2)+1,如两台或者三台主机则配置,如果只有一个节点,此配置可去掉或配置1。
主机2安装两个节点的配置文件(192.168.18.187)
1、节点一
/usr/local/elasticsearch-1.7.3/config/elasticsearch.yml
cluster.name: elastic-product node.name: "node18.187" bootstrap.mlockall: true network.host: 192.168.18.187 discovery.zen.ping.timeout: 60s discovery.zen.fd.ping_timeout: 60s discovery.zen.minimum_master_nodes: 2 discovery.zen.ping.multicast.enabled: false discovery.zen.ping.unicast.hosts: ["192.168.18.186","192.168.18.187","192.168.18.187:9301"] index.cache.field.max_size: 50000 index.cache.field.expire: 10m index.cache.field.type: soft indices.fielddata.cache.size: 10% #path.data: /path/to/data |
2、节点二
/usr/local/elasticsearch-1.7.3-rep2/config/elasticsearch.yml
cluster.name: elastic-product node.name: "node18.187-rep2" bootstrap.mlockall: true network.host: 192.168.18.187 discovery.zen.ping.timeout: 60s discovery.zen.fd.ping_timeout: 60s discovery.zen.minimum_master_nodes: 2 discovery.zen.ping.multicast.enabled: false discovery.zen.ping.unicast.hosts: ["192.168.18.186","192.168.18.187","192.168.18.187:9301"] transport.tcp.port: 9301 http.port: 9201 index.cache.field.max_size: 50000 index.cache.field.expire: 10m index.cache.field.type: soft indices.fielddata.cache.size: 10% #path.data: /path/to/data |
添加为开机自启方法:
sudo vim /etc/rc.local
/usr/local/elasticsearch-1.7.3-2/bin/elasticsearch -d /usr/local/elasticsearch-1.7.3-2/conf/elasticsearch.yml |
本文出自 “M四月天” 博客,请务必保留此出处http://msiyuetian.blog.51cto.com/8637744/1917310
以上是关于Elasticsearch多节点集群配置文件的主要内容,如果未能解决你的问题,请参考以下文章
mac 下搭建Elasticsearch 5.4.3分布式集群
Elasticsearch:使用 Docker compose 来一键部署 Elastic Stack 8.x
Elasticsearch:在多个机器上创建多节点的 Elasticsearch 集群 - Elastic Stack 8.0