ES集群配置

ES集群步骤:

1,需要几个ES节点,安装几个ES服务,同一台机器设置对外暴露的Http端口和ES交互的TCP端口需要不一致

2,每个ES服务如下增加ES配置,有中文说明,可自行更改

​
# ======================== Elasticsearch Configuration =========================
#
# NOTE: Elasticsearch comes with reasonable defaults for most settings.
#       Before you set out to tweak and tune the configuration, make sure you
#       understand what are you trying to accomplish and the consequences.
#
# The primary way of configuring a node is via this file. This template lists
# the most important settings you may want to configure for a production cluster.
#
# Please consult the documentation for further information on configuration options:
# https://www.elastic.co/guide/en/elasticsearch/reference/index.html
#
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
# 配置es的集群名称,默认是elasticsearch
cluster.name: test_es
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
# 节点名称 
node.name: node-2
#
# es是默认集群中的第一台机器为master,如果这台机挂了就会重新选举master。
#
node.master: true
node.data: true

#node.attr.rack: r1
#
# ----------------------------------- Paths ------------------------------------
#
# 设置索引数据的存储路径,默认是es根目录下的data文件夹
#
path.data: 自定义(最好是es目录下新建一个data)
#
# 设置日志文件路劲
#
path.logs: 自定义(最好是es目录下新建一个log)
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
bootstrap.memory_lock: false
# 是否锁住内存 
bootstrap.system_call_filter: false
#
# Make sure that the heap size is set to about half the memory available
# on the system and that the owner of the process is allowed to use this
# limit.
#
# Elasticsearch performs poorly when the system is swapping the memory.
#
# ---------------------------------- Network -----------------------------------
#
# 绑定ip
#
network.host: 机器ip
#
# Set a custom port for HTTP:
# 设置对外服务的http端口
#
http.port: 对外暴漏的端口

# 设置节点间交互的tcp端口 和 http端口不能一致
transport.tcp.port: 自定义
# For more information, consult the network module documentation.
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when new node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
# 设置集群中master节点的初始列表,可以通过这些节点来自动发现新加入集群的节点
#
discovery.zen.ping.unicast.hosts: [根据实际情况添加格式 "ip:对外暴漏的端口","ip:对外暴漏的端口"]
discovery.zen.ping_timeout: 3s
#
# 设置这个参数来保证集群中的节点可以知道其它N个有master资格的节点
discovery.zen.minimum_master_nodes: 2

#
# For more information, consult the zen discovery module documentation.
#
# ---------------------------------- Gateway -----------------------------------
#
# Block initial recovery after a full cluster restart until N nodes are started:
#
#gateway.recover_after_nodes: 3
#
# For more information, consult the gateway module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: true

​

3,启动每个ES的节点后,访问其中一台es服务,带 * 号的是es选举的主节点

http://ip:http端口/_cat/nodes?pretty

4,至此,ES集群搭建完成,如果需要将MYSQL的数据同步到ES中,可以通过小编之前写的通过Logstash以配置文件的形式将mysql数据同步到es中;注: es集群一旦搭建好,只要将mysql的数据同步到其中一个节点,es其他节点会根据副本容错机制,将mysql灌入的es节点数据自动同步到其他节点上。

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

、小H

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值