添加Data节点至Elasticsearch单节点集群失败,报master未发现错误
Elasticsearch新数据节点无法加入集群:超时/主节点未发现问题
报错信息
新节点启动后无法加入集群,日志报错:
timed out while waiting for initial discovery state - timeout: 30 master not discovered yet: have discovered [{db3}...
节点配置
新数据节点(db3)配置
cluster.name: cluster_test node.name: db3 network.host: 10.0.0.3 discovery.seed_hosts: ["10.0.0.1"] cluster.initial_master_nodes: ["10.0.0.1"] node.master: false node.data: true
现有主节点(db1)配置
cluster.name: cluster_test node.name: db1 network.host: 10.0.0.1 cluster.initial_master_nodes: ["10.0.0.1"]
解决步骤
排查网络连通性
- 确保新节点(10.0.0.3)与主节点(10.0.0.1)能双向ping通
- 检查Elasticsearch节点间通信端口9300是否开放,用命令测试:
nc -zv 10.0.0.1 9300,端口不通会直接导致发现失败
移除新节点的
cluster.initial_master_nodes配置- 该参数仅用于集群首次初始化启动,现有集群已运行时,新加入的节点不需要配置这个参数。删除新节点配置中的这一行:
cluster.initial_master_nodes: ["10.0.0.1"] - 原因:保留这个参数会让新节点尝试参与初始主节点选举,与已存在的主节点集群逻辑冲突,导致发现超时
- 该参数仅用于集群首次初始化启动,现有集群已运行时,新加入的节点不需要配置这个参数。删除新节点配置中的这一行:
补充主节点的
discovery.seed_hosts配置(可选但推荐)- 主节点当前未配置
discovery.seed_hosts,单节点集群运行无问题,但为了后续扩展稳定,建议在主节点配置中添加:discovery.seed_hosts: ["10.0.0.1"]
- 主节点当前未配置
验证角色与集群名称一致性
- 两个节点
cluster.name均为cluster_test,无冲突 - 新节点
node.master: false、node.data: true,符合数据节点角色定位;主节点默认兼具master和data角色,配置正常
- 两个节点
修复后新节点配置示例
cluster.name: cluster_test node.name: db3 network.host: 10.0.0.3 discovery.seed_hosts: ["10.0.0.1"] node.master: false node.data: true
完成配置修改后,重启新节点,通过主节点执行GET _cat/nodes?v命令验证节点是否成功加入集群。
内容的提问来源于stack exchange,提问作者goodfella
相关产品推荐
相关产品推荐

