1.node概述

Any time that you start an instance of Elasticsearch, you are starting a node. A collection of connected nodes is called a cluster. If you are running a single node of Elasticsearch, then you have a cluster of one node.Every node in the cluster can handle HTTP and Transport traffic by default. The transport layer is used exclusively for communication between nodes and the Java TransportClient; the HTTP layer is used only by external REST clients.

All nodes know about all the other nodes in the cluster and can forward client requests to the appropriate node. Besides that, each node serves one or more purpose:Master-eligible node
A node that has node.master set to true (default), which makes it eligible to be elected as the master node, which controls the cluster.
Data node
A node that has node.data set to true (default). Data nodes hold data and perform data related operations such as CRUD, search, and aggregations.
Ingest node
A node that has node.ingest set to true (default). Ingest nodes are able to apply an ingest pipeline to a document in order to transform and enrich the document before indexing. With a heavy ingest load, it makes sense to use dedicated ingest nodes and to mark the master and data nodes as node.ingest: false.
Tribe node
A tribe node, configured via the tribe.* settings, is a special type of coordinating only node that can connect to multiple clusters and perform search and other operations across all connected clusters.
By default a node is a master-eligible node and a data node, plus it can pre-process documents through ingest pipelines. This is very convenient for small clusters but, as the cluster grows, it becomes important to consider separating dedicated master-eligible nodes from dedicated data nodes.

2.配置Node类

/*** A node represent a node within a cluster ({@code cluster.name}). The {@link #client()} can be used* in order to use a {@link Client} to perform actions/operations against the cluster.*/public static final Setting<Boolean> WRITE_PORTS_FILE_SETTING =Setting.boolSetting("node.portsfile", false, Property.NodeScope);public static final Setting<Boolean> NODE_DATA_SETTING = Setting.boolSetting("node.data", true, Property.NodeScope);public static final Setting<Boolean> NODE_MASTER_SETTING =Setting.boolSetting("node.master", true, Property.NodeScope);public static final Setting<Boolean> NODE_INGEST_SETTING =Setting.boolSetting("node.ingest", true, Property.NodeScope);

3.node通信 :NodeClient.java

    private <    Request extends ActionRequest,Response extends ActionResponse> TransportAction<Request, Response> transportAction(Action<Response> action) {if (actions == null) {throw new IllegalStateException("NodeClient has not been initialized");}TransportAction<Request, Response> transportAction = actions.get(action);if (transportAction == null) {throw new IllegalStateException("failed to find action [" + action + "] to execute");}return transportAction;}

4.TransportAction.java(node之间通信,走tcp)

    /*** Execute the transport action on the local node, returning the {@link Task} used to track its execution and accepting a* {@link TaskListener} which listens for the completion of the action.*/public final Task execute(Request request, TaskListener<Response> listener) {Task task = taskManager.register("transport", actionName, request);execute(task, request, new ActionListener<Response>() {@Overridepublic void onResponse(Response response) {if (task != null) {taskManager.unregister(task);}listener.onResponse(task, response);}@Overridepublic void onFailure(Exception e) {if (task != null) {taskManager.unregister(task);}listener.onFailure(task, e);}});return task;}

转载于:https://www.cnblogs.com/davidwang456/p/10114434.html

elasticSearch6源码分析(7)node相关推荐

  1. elasticSearch6源码分析(1)启动过程

    1.找到bin目录,下面有elasticSearch的sh文件,查看执行过程 exec \"$JAVA" \$ES_JAVA_OPTS \-Des.path.home=" ...

  2. elasticSearch6源码分析(6)http和transport模块

    1.http模块概述 The http module allows to expose Elasticsearch APIs over HTTP.The http mechanism is compl ...

  3. elasticSearch6源码分析(12)DiscoveryModule

    1.DiscoveryModule概述 /*** A module for loading classes for node discovery.*/ 2.discovery The discover ...

  4. elasticSearch6源码分析(10)SettingsModule

    1.SettingsModule概述 /*** A module that binds the provided settings to the {@link Settings} interface. ...

  5. elasticSearch6源码分析(8)RepositoriesModule模块

    1.RepositoriesModule概述 Sets up classes for Snapshot/Restore 1.1 snapshot概述 A snapshot is a backup ta ...

  6. elasticSearch6源码分析(5)gateway模块

    1.gateway概述 The local gateway module stores the cluster state and shard data across full cluster res ...

  7. elasticSearch6源码分析(4)indices模块

    1.indices概述 The indices module controls index-related settings that are globally managed for all ind ...

  8. elasticSearch6源码分析(3)cluster模块

    1. cluser概述 One of the main roles of the master is to decide which shards to allocate to which nodes ...

  9. elasticSearch6源码分析(2)模块化管理

    elasticsearch里面的组件基本都是用Guice的Injector进行注入与获取实例方式进行模块化管理. 在node的构造方法中 /*** Constructs a node** @param ...

最新文章

  1. 谁会为小扎的AI管家配音:网民选了这位老帅哥
  2. C++中如何区分引用和取地址符号?
  3. 《python核心编程》读书笔记--第15章 正则表达式
  4. Linux操作系统中内存buffer和cache的区别--从free命令说起(转)
  5. Windows+VS2015编译caffe+py-faster-rcnn
  6. 信息学奥赛一本通 1188:菲波那契数列(2) | OpenJudge NOI 2.3 1760:菲波那契数列(2)
  7. Sql中对大数据量的判断
  8. (1)JavaScript入门
  9. leetcode题解227-基本计算器 II
  10. devc中文注释显示问号_Python零基础入门-(如何让人读懂你的代码)文档注释
  11. 没有ADC的MCU如何实现音频播放?
  12. Laravel文档梳理1、安装与初步配置
  13. 在ADS仿真或者查看S参数的方法
  14. 力扣题:904.水果成篮
  15. 玩游戏计算机虚拟内存怎么设置,【新手指导】电脑虚拟内存设置
  16. 纵横算法之二:社招如何面对算法面试
  17. 带语音通话功能的华为ME909s-821a使用方法
  18. OJ之AAABBBCCC与ABCABCABC
  19. 循序渐进学SAP系列(一):--SAP该如何入门
  20. Hive 数据同步ClickHouse

热门文章

  1. echarts搭配MySQL_Echarts连接Mysql使用心得
  2. tcp/ip 协议栈Linux源码分析二 IPv4分片报文重组分析二
  3. net-snmp交叉编译出现 undefined reference to dlopen,dlsym,dlclose错误
  4. java如何调windows框_java – JDialog.setAlwaysOnTop(true)将所有对话框带到Windows下的前面...
  5. python 排名函数_一个危险的Python函数,不推荐使用
  6. 今日头条安卓_今日头条加入“常用”小程序窗口,小游戏或将再次崛起?
  7. oracle游标理解,oracle游标的使用方法
  8. aes sample java,python-AES加密java解密
  9. python 控件显示时间_设置tkinter标签以显示倒计时时间
  10. 图像识别python cnn_MINIST深度学习识别:python全连接神经网络和pytorch LeNet CNN网络训练实现及比较(一)...