Help me set up a multi-server environment

I want to connect 3 external PCs.
Three internal devices tested have been connected correctly.
I want to set it to communicate with an external PC.

Testing Elasticsearch.yml on the internal network

--------------------- pc1 ----------------
cluster.name: "test-cluster"
node.name: "master"
node.master: true
node.data: false
transport.tcp.port: 9300
http.port: 9200
discovery.seed_hosts: ["192.168.0.x1:9300","192.168.0.x2:9301","192.168.0.x3:9302"]
cluster.initial_master_nodes: ["master"]
network.host: 0.0.0.0
--------------------- pc2 ----------------
cluster.name: "test-cluster"
node.name: "data1"
node.master: false
node.data: true
transport.tcp.port: 9301
http.port: 9201
discovery.seed_hosts: ["192.168.0.x1:9300","192.168.0.x2:9301","192.168.0.x3:9302"]
cluster.initial_master_nodes: ["master"]
network.host: 0.0.0.0
--------------------- pc3 ----------------
cluster.name: "test-cluster"
node.name: "data2"
node.master: false
node.data: true
transport.tcp.port: 9302
http.port: 9202
discovery.seed_hosts: ["192.168.0.x1:9300","192.168.0.x2:9301","192.168.0.x3:9302"]
cluster.initial_master_nodes: ["master"]
network.host: 0.0.0.0

This works very well.


but,
I want an external network connection, not an internal network connection.
218.xxx.xxx.xxx
Open port: 9200, 9300,5601
182.xxx.xxx.1
Open port: 9211,9212
182.xxx.xxx.2
Open port: 9311,9312

elasticsearch.yml
--------------------- 218.xxx.xxx.xxx----------------
cluster.name: "test-cluster"
node.name: "master"
node.master: true
node.data: false
transport.tcp.port: 9300
http.port: 9200
discovery.seed_hosts: ["218.xxx.xxx.xxx:9300","182.xxx.xxx.1:9311","182.xxx.xxx.2:9312"]
cluster.initial_master_nodes: ["master"]
network.host: 0.0.0.0
--------------------- 182.xxx.xxx.1----------------
cluster.name: "test-cluster"
node.name: "data1"
node.master: false
node.data: true
transport.tcp.port: 9311
http.port: 9211
discovery.seed_hosts: ["218.xxx.xxx.xxx:9300","182.xxx.xxx.1:9311","182.xxx.xxx.2:9312"]
cluster.initial_master_nodes: ["master"]
network.host: 0.0.0.0
--------------------- 182.xxx.xxx.2----------------
cluster.name: "test-cluster"
node.name: "data2"
node.master: false
node.data: true
transport.tcp.port: 9312
http.port: 9212
discovery.seed_hosts: ["218.xxx.xxx.xxx:9300","182.xxx.xxx.1:9311","182.xxx.xxx.2:9312"]
cluster.initial_master_nodes: ["master"]
network.host: 0.0.0.0

The process is running on each PC.
218.xxx.xxx.xxx Search 182.xxx:9211 on Google on PC
The Json format information screen that appears when executed is displayed.
However, when I index it, I get a warning message.
"master not discovered yet"

There is no port forwarding problem.
Please let me know if there are any settings I have missed.

Try the following config on each node:

--------------------- 182.xxx.xxx.2----------------
cluster.name: "test-cluster"
node.name: "data2"
node.master: false
node.data: true
transport.tcp.port: 9312
http.port: 9212
discovery.seed_hosts: ["218.xxx.xxx.xxx:9300","182.xxx.xxx.1:9311","182.xxx.xxx.2:9312"]
cluster.initial_master_nodes: ["218.xxx.xxx.xxx"]
network.host: 182.xxx.xxx.2

WARNING: it is not encouraged to expose elasticsearch nodes directly over the internet

1 Like

Thank you for your reply.
Thanks for the warning.
All of the above information is false information.

182.xxx.1 / 2 These two PCs are a vm environment.

network.host:ip:port

Can you write like this?

I don't understand, maybe the docs help you:

https://www.elastic.co/guide/en/elasticsearch/reference/current/network.host.html

https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-discovery-bootstrap-cluster.html

Thanks for the kind answer.
However, the link has already been confirmed. I didn't understand the link.

My question is wrong.
182.xxx.1
182.xxx.2 << ip was recorded incorrectly.

182.xxx.1 VM 10.0.2.15-docker-172.17.0.2 Port: 9211, 9311
182.xxx.1 VM 10.0.2.16-docker-172.17.0.2 Port: 9212, 9312

It is like this.

network.host: ??

How should I use it?

In this setting you can either write down the IP of the server or FQDN

IP:

network.host: 182.xxx.1

or FQDN:

network.host: my_server.my_domain.com

I solved it by adding 'network.publish_host:'.
Thank you so much