elasticsearch 跨网段组集群

elasticsearch 是非常流行的全文搜索引擎,但网上的教程多是初次使用,并没有一些高级用法demo。这次遇到需要跨网段组网问题,自己摸索了文档很久,发现确实可行,于是着手做了个实验,最终实验成功。在跨网段下实现了自动发现和组网。

总共运行了三个节点,一个节点IP是192.168.45.67,另外两个节点IP都是172.20.5.161三个文件的配置文件都改为如下配置文件,先后启动三个节点,记录日志在后面。

192.168.45.67节点启动后,自动用9300作为通信端口,将自身作为master节点存在。

172.20.5.161节点启动后,自动用9300作为通信端口,发现hosts列表中有master存在,master将其加入集群中。

172.20.5.161节点启动后,发现9300被占用,自动用9301作为通信端口,发现hosts列表中有master存在,master将其加入集群中。

192.168.45.67:9300添加日志

172.20.5.161:9300添加日志

172.20.5.161:9301添加

elasticsearch-1.5.2/config/elasticsearch.yml需要修改部分为

discovery.zen.ping.multicast.enabled和discovery.zen.ping.unicast.hosts,修改如下:

################################## Discovery ##################################

# Discovery infrastructure ensures nodes can be found within a cluster
# and master node is elected. Multicast discovery is the default.

# Set to ensure a node sees N other master eligible nodes to be considered
# operational within the cluster. This should be set to a quorum/majority of
# the master-eligible nodes in the cluster.
#
#discovery.zen.minimum_master_nodes: 1

# Set the time to wait for ping responses from other nodes when discovering.
# Set this option to a higher value on a slow or congested network
# to minimize discovery failures:
#
#discovery.zen.ping.timeout: 3s

# For more information, see
# <http://elasticsearch.org/guide/en/elasticsearch/reference/current/modules-discovery-zen.html>

# Unicast discovery allows to explicitly control which nodes will be used
# to discover the cluster. It can be used when multicast is not present,
# or to restrict the cluster communication-wise.
#
# 1. Disable multicast discovery (enabled by default):
#
discovery.zen.ping.multicast.enabled: false
#
# 2. Configure an initial list of master nodes in the cluster
#    to perform discovery when new nodes (master or data) are started:
#
discovery.zen.ping.unicast.hosts: ["192.168.45.67", "172.20.5.161:9300"]

# EC2 discovery allows to use AWS EC2 API in order to perform discovery.
#
# You have to install the cloud-aws plugin for enabling the EC2 discovery.
#
# For more information, see
# <http://elasticsearch.org/guide/en/elasticsearch/reference/current/modules-discovery-ec2.html>
#
# See <http://elasticsearch.org/tutorials/elasticsearch-on-ec2/>
# for a step-by-step tutorial.

# GCE discovery allows to use Google Compute Engine API in order to perform discovery.
#
# You have to install the cloud-gce plugin for enabling the GCE discovery.
#
# For more information, see <https://github.com/elasticsearch/elasticsearch-cloud-gce>.

# Azure discovery allows to use Azure API in order to perform discovery.
#
# You have to install the cloud-azure plugin for enabling the Azure discovery.
#
# For more information, see <https://github.com/elasticsearch/elasticsearch-cloud-azure>.

配置的中文注释请看:

http://www.tuicool.com/articles/Nryu2i

时间: 2024-08-26 13:21:50

elasticsearch 跨网段组集群的相关文章

【拆分版】Docker-compose构建Elasticsearch 7.1.0集群

写在前边 搞了两三天了,一直有个问题困扰着我,ES集群中配置怎么能正确映射到主机上,这边经常报ClusterFormationFailureHelper master not discovered or elected yet.原因是容器中的ES节点没有正确的映射到主机上,而且容器内ip是易变的,我该怎么配置呢? 临下班了,终于想到个法子,固定容器ip--使用network_mode: host 看到主机模式的我眼前一亮,容器就相当于一个主机服务,你占哪个端口就是哪个,没有必要再去自己指定por

elasticsearch + kibana + x-pack + logstash_集群部署安装

elasticsearch 部分总体描述: 1.elasticsearch 的概念及特点.概念:elasticsearch 是一个基于 lucene 的搜索服务器.lucene 是全文搜索的一个框架.特点: - 分布式,可扩展,高可用 - 能够实时搜索分析数据. - 复杂的 RESTful API.总结:是一个采用RESTful API 标准,实现分布式,可扩展以及高可用的实时数据存储分析的全文搜索工具. 2.elasticsearch 涉及的相关概念.(关系菲关系对比)相关概念: -Node:

Docker 搭建一个Elasticsearch 7.5.1集群+kibana 7.5.1

1.docker安装elasticsearch 7.5.1 拉取镜像 docker pull elasticsearch:7.5.1 创建网络 如果需要安装kibana等其他,需要创建一个网络,名字任意取,让他们在同一个网络,使得es和kibana通信 docker network create esnet(这个名字可以自定义,但是注意启动kibana是名字保持一致) 创建数据卷 此处为了docker容器删除或者其他异常情况,将ES的重要数据挂载到宿主机 # 查看当前数据局列表 docker v

Elasticsearch(二)集群设置

Elasticsearch支持多播和单播自动发现节点,但多播已经不被大多数操作系统支持,并且安全性不高,这里主要用单播发现节点,配置如下 discovery.zen.ping.multicast.enabled: false  #关闭多播 discovery.zen.ping.unicast.hosts: ["192.168.31.163:9300","192.168.31.160:9300","192.168.31.161:9300",&quo

Elasticsearch 学习笔记2 集群和数据

集群术语 - 节点: 一个elasticsearch实例(一个elasticsearch进程)就是一个节点 - 集群: 由一个或者多个elasticsearch节点组成 - 主节点: 临时管理集群级别变更:新建/删除索引,新建/移除节点,不参与文档级别变更或者搜索,当数据量增长时,不会成为集群瓶颈,集群只有一个主节点,通过各个节点选举产生 - 分片(shard):是最小级别工作单元,它只是保存了索引中所有数据的一部分 - 主分片:每个文档属于一个单独主分片,主分片数量可以在创建索引时指定,默认个

Linux安装ElasticSearch与MongoDB分布式集群环境下数据同步

ElasticSearch有一个叫做river的插件式模块,可以将外部数据源中的数据导入elasticsearch并在上面建立索引.River在集群上是单例模式的,它被自动分配到一个节点上,当这个节点挂掉后,river会被自动分配到另外的一个节点上.目前支持的数据源包括:Wikipedia, MongoDB, CouchDB, RabbitMQ, RSS, Sofa, JDBC, FileSystem,Dropbox等.River有一些指定的规范,依照这些规范可以开发适合于自己的应用数据的插件.

ElasticSearch 在3节点集群的启动

ElasticSearch的启动分前台和后台启动 先介绍前台启动: 先在master节点上启动 可以看到已经启动了 同时在slave1.slave2节点上也启动 可以看到都已经启动了! 在浏览器分别打开每个节点的状况观察,这里需要等待变成green状态才算是可以 这个是master节点的状况 这个是slave1节点的状况 这个是slave2节点的状况 这个是整个集群的健康状况 现在启动kibana 在浏览器打开测试页面(我这里只能在火狐浏览器打开,为什么我自己也不清楚) 前台启动到这里就结束了,

elasticsearch与mongodb分布式集群环境下数据同步

1.ElasticSearch是什么 ElasticSearch 是一个基于Lucene构建的开源.分布式,RESTful搜索引擎.它的服务是为具有数据库和Web前端的应用程序提供附加的组件(即可搜索的存储库).ElasticSearch为应用程序提供搜索算法和相关的基础架构,用户只需要将应用程序中的数据上载到ElasticSearch数据存储中,就可以通过RESTful URL与其交互.ElasticSearch的架构明显不同于它之前的其他搜索引擎架构,因为它是通过水平伸缩的方式来构建的.不同

ElasticSearch学习笔记-02集群相关操作_cat参数

_cat参数允许你查看集群的一些相关信息,如集群是否健康,有哪些节点,以及索引的情况等的. 检测集群是否健康 curl localhost:9200/_cat/health?v 说明: curl 是一个利用URL语法在命令行下工作的文件传输工具 9200 访问集群的端口号,可以修改.通过配置文件更改,一般不建议更改 _cat 前缀 _ 是URL参数的一个习惯 ?v 通过?v会显示每一列的含义 下面的返回的响应信息: epoch      timestamp cluster       statu