您的位置:首页 > 其它

elasticsearch 集群的搭建

2016-06-23 16:42 274 查看
1. 首先要确定每台linux 主机的防火墙以关闭了。可以通过 service iptables  stop  命令来关闭防火墙。

2. 要坚持这个原则,在es的config 下的配置文件xxx.yml 文件最好不要有太多的改动。即使改动也要在配置文件的基础上改动,意思是比如(es配置一部分)

# The default list of hosts is ["127.0.0.1", "[::1]"]

#

 discovery.zen.ping.unicast.hosts: ["192.168.136.129", "192.168.136.130"]

#

# Prevent the "split brain" by configuring the majority of nodes (total number of nodes / 2 + 1):

#

 如果想增加直接去掉# 就行 因为所以的配置 这里面都有,只要去掉#开启就行,不需要自己手动增加,在这里开启了discovery.zen.ping.unicast.hosts: ["192.168.136.129", "192.168.136.130"] 配置

3.要知道改什么配置项。

前两点好做

在第三点上该一下几点:

1. cluste.name 必须每个节点相同。在这里用的是my-application

#

 cluster.name: my-application

#

# ------------------------------------ Node ------------------------------------

#

2.增加node 节点名 。在这里每个节点必须不同。 你可以用node-1 ,node-2 ...

# Use a descriptive name for the node:

#

 node.name: node-2

#

# Add custom attributes to the node:

#

3. 增加ip地址,该地址为该主机(节点)的ip地址

Set the bind address to a specific IP (IPv4 or IPv6):

#

 network.host: 192.168.136.130

#

# Set a custom port for HTTP:

#

4  增加节点的ip (比如你在129 ,和130 都开启了es 那么在这里都配上) 并且每个es 的都需要配置该项(都一样)

# The default list of hosts is ["127.0.0.1", "[::1]"]

#

 discovery.zen.ping.unicast.hosts: ["192.168.136.129", "192.168.136.130"]

#

# Prevent the "split brain" by configuring the majority of nodes (total number of nodes / 2 + 1):

#

这样起每个es 节点就行了。 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: