聊聊Elasticsearch的集群状态的管理和维护

版权声明 本站原创文章 由 萌叔 发表 转载请注明 萌叔 | http://vearne.cc 注意 本文参考的ES 5.0.1的源码 1. 查看集群状态 可以通过API查看集群状态 GET /_cluster/state 大致可以得到如下内容 version 集群状态数字版本号 每次更新version + 1 集群重启version不会置0(只会单调增) state_uuid 是集群状态字符串版本号(UUID) master_node master节点 nodes 该版本中的所有节点信息 routing_table 和 routing_nodes 都是描述不同index上的shard在node上的分布关系 2. 集群状态的维护 ES源码中集群状态的对应类为ClusterState.java The cluster state can be updated only on the master node. All updates are performed by on a single thread and controlled by the {@link ClusterService}. After every update the {@link Discovery#publish} method publishes new version of the cluster state to all other nodes in the cluster. In the Zen Discovery it is handled in the {@link PublishClusterStateAction#publish} method ...

July 12, 2018 · 2 min