使用es7.1.1 搭建 集群,network.host 监听内网ip时一切正常,但当监听0.0.0.0时,却无法组成集群。
报错如下:
[2019-07-04T10:11:52,814][WARN ][o.e.c.c.ClusterFormationFailureHelper] [node-2] master not discovered yet, this node has not previously joined a bootstrapped (v7+) cluster, and this node must discover master-eligible nodes [node-3] to bootstrap a cluster: have discovered ; discovery will continue using [10.20.0.6:9300, 10.20.0.7:9300, 10.20.0.8:9300] from hosts providers and [{node-2}{qdHd5pwDQA6x2rL6zLBUbQ}{wtGok7oLS-mAaPh_qxKo9A}{1xx.xx.24.23x}{1xx.xx.24.23x:9300}{ml.machine_memory=16709562368, xpack.installed=true, ml.max_open_jobs=20}] from last-known cluster state; node term 0, last-accepted version 0 in term 0
详细配置如下:
master节点:
cluster.name: es-test
#
node.name: node-3
node.master: true
node.data: true
#
path.data: /data/es/data
path.logs: /data/es/logs
#
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
#
network.host: 0.0.0.0
#
http.port: 9200
discovery.seed_hosts: ["10.20.0.6","10.20.0.7", "10.20.0.8"]
cluster.initial_master_nodes: ["node-3"]
# 是否支持跨域
http.cors.enabled: true
# *表示支持所有域名
http.cors.allow-origin: "*"
其他节点:
cluster.name: es-test
#
node.name: node-2
node.master: true
node.data: true
#
path.data: /data/es/data
path.logs: /data/es/logs
#
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
#
network.host: 0.0.0.0
#
http.port: 9200
discovery.seed_hosts: ["10.20.0.6","10.20.0.7", "10.20.0.8"]
cluster.initial_master_nodes: ["node-3"]
#
# 是否支持跨域
http.cors.enabled: true
# *表示支持所有域名
http.cors.allow-origin: "*"
ps:尝试过 将init的写成ip 或写多个,但都不行。。
查看集群状态,只能查看到一个node,其他的就是加不进去。。
curl -XGET 'http://10.20.0.8:9200/_cat/health?v'
epoch timestamp cluster status node.total node.data shards pri relo init unassign pending_tasks max_task_wait_time active_shards_percent
1562206789 02:19:49 es-test green 1 1 0 0 0 0 0 0 - 100.0%
报错如下:
[2019-07-04T10:11:52,814][WARN ][o.e.c.c.ClusterFormationFailureHelper] [node-2] master not discovered yet, this node has not previously joined a bootstrapped (v7+) cluster, and this node must discover master-eligible nodes [node-3] to bootstrap a cluster: have discovered ; discovery will continue using [10.20.0.6:9300, 10.20.0.7:9300, 10.20.0.8:9300] from hosts providers and [{node-2}{qdHd5pwDQA6x2rL6zLBUbQ}{wtGok7oLS-mAaPh_qxKo9A}{1xx.xx.24.23x}{1xx.xx.24.23x:9300}{ml.machine_memory=16709562368, xpack.installed=true, ml.max_open_jobs=20}] from last-known cluster state; node term 0, last-accepted version 0 in term 0
详细配置如下:
master节点:
cluster.name: es-test
#
node.name: node-3
node.master: true
node.data: true
#
path.data: /data/es/data
path.logs: /data/es/logs
#
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
#
network.host: 0.0.0.0
#
http.port: 9200
discovery.seed_hosts: ["10.20.0.6","10.20.0.7", "10.20.0.8"]
cluster.initial_master_nodes: ["node-3"]
# 是否支持跨域
http.cors.enabled: true
# *表示支持所有域名
http.cors.allow-origin: "*"
其他节点:
cluster.name: es-test
#
node.name: node-2
node.master: true
node.data: true
#
path.data: /data/es/data
path.logs: /data/es/logs
#
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
#
network.host: 0.0.0.0
#
http.port: 9200
discovery.seed_hosts: ["10.20.0.6","10.20.0.7", "10.20.0.8"]
cluster.initial_master_nodes: ["node-3"]
#
# 是否支持跨域
http.cors.enabled: true
# *表示支持所有域名
http.cors.allow-origin: "*"
ps:尝试过 将init的写成ip 或写多个,但都不行。。
查看集群状态,只能查看到一个node,其他的就是加不进去。。
curl -XGET 'http://10.20.0.8:9200/_cat/health?v'
epoch timestamp cluster status node.total node.data shards pri relo init unassign pending_tasks max_task_wait_time active_shards_percent
1562206789 02:19:49 es-test green 1 1 0 0 0 0 0 0 - 100.0%
2 个回复
remainsu
赞同来自: tianyaguozhe
需要加入如下的一行配置,用作集群内各机器见通信使用。
network.publish_host: 10.20.0.8 (内网ip)
ps: 可能是我的机器的某些配置影响的,因为我看了很多案例,包括es官网的介绍,都没说这个是必须的。而且也都是可以正常运行的
Ombres
赞同来自: tianyaguozhe
在启动成功后会在控制台输出当前transport绑定的地址。
如下所示
[2019-07-04T11:32:24,334][INFO ][o.e.t.TransportService ] [node-1] publish_address {192.168.1.69:9300}, bound_addresses {[::]:9300}
这里说一下publish_host,引用官方文档。
如果不清楚是否配置正确的情况下,那么现在排查这个问题就有一个比较好的思路,首先查看服务启动时绑定的host和port;其次呢需要检查discovery.seed_hosts,是否能访问到;再次呢,检查其他节点指向的master的指向的host,也就是cluster.initial_master_nodes这个参数对应的地址;然后对比host是否一致。
各个节点间的通信基础是tranport维护,而上述的配置目的是保证节点能够通过tranpost正确的连接到其他节点。(简单的这样理解)
最终基本就能得出结论了。