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四月天 51CTO博客,原文链接:http://blog.51cto.com/msiyuetian/1917310,如需转载请自行联系原作者