How to bind the public IP?

Hi All,
I have 4 node prepare to 1 master (172.20.9.45, 192.168.1.1) and 3 data node (192.168.1.11 ~13). The 172.20.9.x is public LAN, 192.168.1.x is private LAN by hub. The ES version : 7.4.0

these is my elasticsearch.yml for per node.
Master node:
node.name: oaelk2-em01
node.master: true
node.data: false
network.host: oaelk2-em01
discovery.seed_hosts: ["oaelk2-em01", "oaelk2-ed01", "oaelk2-ed02", "oaelk2-ed03"]
cluster.initial_master_nodes: ["oaelk2-em01", "oaelk2-ed01", "oaelk2-ed02", "oaelk2-ed03"]

Data node (oaelk2-ed01)
node.name: oaelk2-ed01
node.master: false
node.data: true
network.host: oaelk2-ed01
discovery.seed_hosts: ["oaelk2-em01", "oaelk2-ed01", "oaelk2-ed02", "oaelk2-ed03"]
cluster.initial_master_nodes: ["oaelk2-em01", "oaelk2-ed01", "oaelk2-ed02", "oaelk2-ed03"]

Data node (oaelk2-ed02)
node.name: oaelk2-ed02
node.master: false
node.data: true
network.host: oaelk2-ed02
discovery.seed_hosts: ["oaelk2-em01", "oaelk2-ed01", "oaelk2-ed02", "oaelk2-ed03"]
cluster.initial_master_nodes: ["oaelk2-em01", "oaelk2-ed01", "oaelk2-ed02", "oaelk2-ed03"]

Data node (oaelk2-ed03)
node.name: oaelk2-ed03
node.master: false
node.data: true
network.host: oaelk2-ed03
discovery.seed_hosts: ["oaelk2-em01", "oaelk2-ed01", "oaelk2-ed02", "oaelk2-ed03"]
cluster.initial_master_nodes: ["oaelk2-em01", "oaelk2-ed01", "oaelk2-ed02", "oaelk2-ed03"]

These is /etc/hosts for per node (master & data node)
192.168.1.1 OAELK2-EM01
192.168.1.11 OAELK2-ED01
192.168.1.12 OAELK2-ED02
192.168.1.13 OAELK2-ED03

But just only use 192.168.1.1 can connect to ES Master, 172.20.9.45 Can't to connect .

[root@OAELK2-EM01 data]# curl http://192.168.1.1:9200/_cat/nodes?v
ip heap.percent ram.percent cpu load_1m load_5m load_15m node.role master name
192.168.1.12 2 25 0 0.00 0.01 0.05 dil - oaelk2-ed02
192.168.1.11 2 24 0 0.00 0.01 0.05 dil - oaelk2-ed01
192.168.1.13 2 25 0 0.00 0.01 0.05 dil - oaelk2-ed03
192.168.1.1 2 24 0 0.00 0.01 0.05 ilm * oaelk2-em01
[root@OAELK2-EM01 data]# curl http://172.20.9.45:9200/_cat/nodes?v
curl: (7) Failed connect to 172.20.9.45:9200; Connection refused

How to bind the public IP??? Thank a lot.

your /etc/hosts only contains 192.168 ips, you bind to hosts mentioned in the /etc/hosts - can you explain why you then expect to bind to another IP address that has not been specified anywhere? Maybe I am missing something in the configuration setup.

You can set the network.host setting to be bound to an interface or simply 0.0.0.0 to listen to all interfaces.

Hi,
Thank for your reply. Because all node in private LAN, just only master node need to accept request from outside, so the master node have 2 IP (172.20.9.45, 192.168.1.1) .
I has try to add the public IP in /etc/hosts and change network.host to 0.0.0.0 for per node. but it still not successful. the data node can't discover master node.

/etc/hosts (per node)
172.20.9.45 OAELK2-EM01
192.168.1.1 OAELK2-EM01
192.168.1.11 OAELK2-ED01
192.168.1.12 OAELK2-ED02
192.168.1.13 OAELK2-ED03
Master node
cluster.name: es_c2
node.name: oaelk2-em01
node.master: true
node.data: false
network.host: 0.0.0.0
discovery.seed_hosts: ["oaelk2-em01", "oaelk2-ed01", "oaelk2-ed02", "oaelk2-ed03"]
cluster.initial_master_nodes: ["oaelk2-em01", "oaelk2-ed01", "oaelk2-ed02", "oaelk2-ed03"]
Data node (oaelk2-ed01)
cluster.name: es_c2
node.name: oaelk2-ed01
node.master: false
node.data: true
network.host: 0.0.0.0
discovery.seed_hosts: ["oaelk2-em01", "oaelk2-ed01", "oaelk2-ed02", "oaelk2-ed03"]
cluster.initial_master_nodes: ["oaelk2-em01", "oaelk2-ed01", "oaelk2-ed02", "oaelk2-ed03"]
Data node can't discover master node.
[root@OAELK2-EM01 data]# curl http://172.20.9.45:9200/_cat/nodes?v
ip heap.percent ram.percent cpu load_1m load_5m load_15m node.role master name
172.20.9.45 1 24 0 0.01 0.06 0.06 ilm * oaelk2-em01
[root@OAELK2-EM01 data]# curl http://192.168.1.1:9200/_cat/nodes?v
ip heap.percent ram.percent cpu load_1m load_5m load_15m node.role master name
172.20.9.45 1 24 0 0.01 0.06 0.06 ilm * oaelk2-em01
Data node log:
[2019-11-12T17:20:55,306][WARN ][o.e.c.c.ClusterFormationFailureHelper] [oaelk2-ed01] master not discovered yet: have discovered [{oaelk2-ed01}{_0R4mR4aS1-aPfJAUYK1ww}{x-Bo4flrQjy2flKQ_a00YQ}{192.168.1.11}{192.168.1.11:9300}{dil}{ml.machine_memory=152102723584, xpack.installed=true, ml.max_open_jobs=20}]; discovery will continue using [192.168.1.1:9300, 172.20.9.45:9300, 192.168.1.12:9300, 192.168.1.13:9300] from hosts providers and from last-known cluster state; node term 17, last-accepted version 78 in term 17

Hi,
I had resolved my issue. Add the network.bind_host and network.publish_host in master node. it's work.
network.bind_host: ["192.168.1.1","172.20.9.45"]
network.publish_host: 192.168.1.1

Thank a lot.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.