This article introduces the networking part of Elasticsearch. We look at the network topology of an Elasticsearch cluster, which connections are established between which nodes and how the different Java clients works. Finally, we look a bit closer on the communication channels between two nodes.

Node Topology

Elasticsearch nodes in a cluster form what is known as a full mesh topology, which means that each Elasticsearch node maintains a connection to each of the other nodes.

Full mesh topology with 6 cluster nodes

In order to simplify the code base, the connections are used as one-way connections, so the connection topology actually ends up looking like this:

6 cluster nodes with connections, each line represents a connection

Adding a Node

When a node starts up, it reads a list of seed nodes from its configuration using unicast, and sends multicastmessages looking for other nodes in the same cluster.

As the node discovers more instances in the same cluster, it connects to them one by one, asks them for information about all the nodes they know and then attempts to connect to them all and officially join the cluster. In this way, previously running instances assist in quickly getting fresh instances up to speed on the current nodes in a cluster.

Node Clients

Even “client” Elasticsearch nodes (i.e nodes configured with node.client: true or build with NodeBuilder.client(true)) connect to the cluster this way.

This implies that the client node becomes a full participant in the full mesh network. In other words, once it starts joining the cluster, all the existing nodes in the cluster will connect back to the instance. This means that both the client and server firewalls and publish hosts must be properly configured in order to allow this. Additionally, whenever a node client joins, leaves or experiences networking issues, it causes extra work for all the other nodes in the cluster, such as opening / closing network connections and updating the cluster state with the information about the node.

Node client connecting to a cluster

Transport Clients

On the other hand, “transport” clients work differently.

When a Transport client connects to one or more instances in a cluster, the instances do not connect back, nor is the existence of the transport client part of the cluster state. This means that a joining / leaving transport client causes minimum extra work for the other nodes in the cluster.

Transport client connecting to a cluster

Connections and Channels

What do we mean when we talk about the connection to a Node in Elasticsearch? In the sections above, we refrained from being specific about it and only used the term as a logical connection that allows communication between two nodes. Let’s go into more detail.

Usually, when we talk about connections in the context of networks, we refer to TCP-connections, which provide a reliable line of communication between two nodes.

Elasticsearch uses (by default) TCP for communication between nodes, but in order to prevent important traffic such as fault-detection and cluster state changes from being affected by far less important, slower moving traffic such as query/indexing requests, it creates multiple TCP connections between each node. For each of these connections, Elasticsearch uses the term channel, which encapsulates the serialization / deserialization of messages over a particular connection.

In earlier Elasticsearch versions there used to be three different classes of channels: lowmed and high. After a while, ping was added, and a recent change renamed these channels such that they are more descriptive about their intention. At of the time of writing, the following channel classes exist:

  • recovery: 2 channels for the recovery of indexes
  • bulk: 3 channels for low priority bulk based operations such as bulk indexing. Previously called low.
  • reg: 6 channels for medium priority regular operations such as queries. Previous called med.
  • state: 1 channel dedicated to state based operations such as changes to the cluster state. Previously called high.
  • ping: 1 channel dedicated to pings between the instances for fault detection.

The default number of channels in each of these class are configured with the configuration prefix of transport.connections_per_node.

All channels in a three-node cluster. Each line represents a single channel

Elasticsearch has support for TCP keepalive which is not explicitly set by default. This prevents unused or idle channels from being closed, which would otherwise cascade into a complete disconnect-reconnect cycle as explained above.

Adding an Instance

A consequence of the above is that adding a new instance to an existing cluster causes it to establish 13 connections to each node, and each node establishes 13 connections back to the new instance.

Linked Channels

If one of the 13 channels to a particular node is closed due to intermittent network errors for example, all the other channels to the same node are closed and the connections to the node is reconnected. This is done in order to maintain some internal invariants and to ensure the internal consistency of the communication between the nodes.

Ending Remarks

The fact that all the channels between two nodes in a cluster are linked makes it extra vulnerable to network issues, and this is one of the reasons why people are discouraged from trying to create a cluster between data centers that are far apart (and thus adding more sources of failure).

In this article we’ve shown the basic network topology of an Elasticsearch cluster and introduced the concept of channels that are used for communication between nodes. In a later article we’ll take a closer look at what goes on inside each of these channels.

Elasticsearch Internals: Networking Introduction An Overview of the Network Topology的更多相关文章

  1. 小样本学习最新综述 A Survey on Few-shot Learning | Introduction and Overview

    目录 01 Introduction Bridging this gap between AI and humans is an important direction. FSL can also h ...

  2. [Machine Learning] Probabilistic Graphical Models:一、Introduction and Overview(1、Overview and Motivation)

    一.PGM用来做什么 1.  医学诊断:从各种病症分析病人得了什么病,该用什么手段治疗 2.  图像分割:从一张百万像素级的图片中分析每个像素点对应的是什么东西 两个共同点:(1)有非常多不同的输入变 ...

  3. [Machine Learning] Probabilistic Graphical Models:一、Introduction and Overview(2、Factors)

    一.什么是factors? 类似于function,将一个自变量空间投影到新空间.这个自变量空间叫做scope. 二.例子 如概率论中的联合分布,就是将不同变量值的组合映射到一个概率,概率和为1. 三 ...

  4. ElasticSearch 2 (11) - 节点调优(ElasticSearch性能)

    ElasticSearch 2 (11) - 节点调优(ElasticSearch性能) 摘要 一个ElasticSearch集群需要多少个节点很难用一种明确的方式回答,但是,我们可以将问题细化成一下 ...

  5. OpenStack Networking overview

    原文地址:http://docs.openstack.org/newton/install-guide-ubuntu/neutron-concepts.html Networking service ...

  6. Monitoring and Tuning the Linux Networking Stack: Receiving Data

    http://blog.packagecloud.io/eng/2016/06/22/monitoring-tuning-linux-networking-stack-receiving-data/ ...

  7. 微软职位内部推荐-Sr. SW Engineer for Azure Networking

    微软近期Open的职位: Senior SW Engineer The world is moving to cloud computing. Microsoft is betting Windows ...

  8. Docker部署Elasticsearch集群

    http://blog.sina.com.cn/s/blog_8ea8e9d50102wwik.html Docker部署Elasticsearch集群 参考文档: https://hub.docke ...

  9. Virtual Networking

    How the virtual networks used by guests work Networking using libvirt is generally fairly simple, an ...

随机推荐

  1. maven 构建 war文件&&Glassfish运行+部署war文件+访问(命令行模式)

    Glassfish常用命令 asadmin  start-domain  --verbose                 #启动Glassfish服务器(默认domain1) ,并在终端显示相关信 ...

  2. SEO:网站改版

    网站改版分为2种:前端页面改版(不使用301 ),链接结构发生变化(必须使用301) 1.确定一定以及肯定使用301永久重定向,不要使用302跳转 2.非常十分以及极其要求使用百度站长平台的“网站改版 ...

  3. HPU第四次积分赛-K :方框(水题,打印图形)

    方框 描述 用'*'打印出一个nxn的字符图形(1<=n<=100). 输入 多组输入.每行输入一个n,输入EOF结束文件. 输出 输出一个满足题意的图形. 输入样例 1  1 2 5 6 ...

  4. Linux下安装Blender

    Blender在Windows下,可以在官方直接下载免安装的版本,下载解压缩就能用. 在Linux下稍微麻烦一点点. 如下3步安装的blender不一定是最新版本,且安装完成后发现设置中文会变为方块. ...

  5. [洛谷P1417 烹调方案]贪心+dp

    http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3211Dream City Time Limit: 1 Second     ...

  6. 自动化-python介绍与基础

    1.1-python的介绍: 简单点来说吧,python这玩意儿是一个叫做Guido van Rossum的程序猿在1989年的圣诞打发时间而决心去开发的一个脚本编程语言.它之前的名字是以abc语言的 ...

  7. 100 webhook implementations

    转自: https://streamdata.io/blog/100-webhook-implementations/  很不错的整理 What is the scope of the event-d ...

  8. sqler sql 转rest api 源码解析(四)macro 的执行

    macro 说明 macro 是sqler 的核心,当前的处理流程为授权处理,数据校验,依赖执行(include),聚合处理,数据转换 处理,sql 执行以及sql 参数绑定 授权处理 这个是通过go ...

  9. ksonnet 一个简化编写以及部署kubernetes的工具

    ksonnet 是一个基于jsonnet的快速简化kubernetes yaml 配置的工具,可以实现配置的复用 同时也包含一个registry 的概念,可以实现可复用组件的分发,同时支持helm 环 ...

  10. 替换元素(replace,replace_if,replace_copy,replace_copy_if)

    replace 审阅range中的每个元素,把old_value替换为new_value template <class ForwardIterator,class T> void rep ...