码迷,mamicode.com
首页 > 其他好文 > 详细

Elasticsearch多节点集群配置文件

时间:2017-04-20 12:05:34      阅读:220      评论:0      收藏:0      [点我收藏+]

标签: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多节点集群配置文件

标签:elasticsearch

原文地址:http://msiyuetian.blog.51cto.com/8637744/1917310

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!