elasticsearch 集群的搭建


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 节点就行了。 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值