I have set up 2 nodes. Both are in the same machine (VM). The first node is in my host os (windows server 2016) and the second node is in the docker container. The nodes work well individually, but, failed to be in the same cluster.
- I ran the first node in my host OS server before running the node in the docker container
- Can a docker container connect to a cluster that is in the host os?
- Is my config correct?
Here is my config for the first node that is in the host os (WS 2016)
cluster.name: elasticsearch node.name: node-1 node.master: true node.data: true node.ingest: true path.data: C:\ProgramData\Elastic\elasticsearch-7.6.2\data path.logs: C:\ProgramData\Elastic\elasticsearch-7.6.2\logs network.host: 0.0.0.0 http.port: 9200 transport.tcp.port: 9300 discovery.seed_hosts: ["127.0.0.1:9300","127.0.0.1:9301"] cluster.initial_master_nodes: ["node-1","node-2"] discovery.zen.minimum_master_nodes: 1 node.max_local_storage_nodes: 2
Here is my config for the second node that is in the docker container
network.host: 0.0.0.0 cluster.name: elasticsearch node.master: true node.data: true node.ingest: false node.name: node-2 path.logs: C:\Elasticsearch\data path.data: C:\Elasticsearch\logs cluster.initial_master_nodes: ["node-1", "node-2"] discovery.seed_hosts: ["127.0.0.1:9300","127.0.0.1:9301"] discovery.zen.minimum_master_nodes: 1 node.max_local_storage_nodes: 2 http.port: 9201 transport.tcp.port: 9301
This is how I run my docker image
docker run -d -p 9201:9200 -p 9301:9300 --name elasticsearch <imageid>
Really appreciate your help!
I ran this command instead
docker run -d -p 9200:9201 -p 9300:9301 --name elasticsearch <imageid>
And received this error
Error response from daemon: failed to create endpoint elasticsearch on network nat: HNS failed with error : Unspecified error.
Anyone care to help?