How can I access elasticsearch cluster created by docker compose by using actual ip address?

Hi Community.

I am following the instructions in this tutorial -- Start a multi-node cluster with Docker:

I could access Elasticsearch by using this command "curl --cacert ca.crt -u elastic:rogerfan https://localhost:9200" with the ca.crt file under "/usr/share/elasticsearch/config/certs/ca/ca.crt" either from the docker container or the host.

However, when I changed the localhost to its actual IP 192.168.xxx.xxx, it shows:

[root@localhost ~]# curl --cacert certs/ca/ca.crt https://192.168.39.12:9200
curl: (51) Unable to communicate securely with peer: requested domain name does not match the server's certificate.

I wonder if this is caused by the ca-certificates, I tried to find the location of http_ca.crt but just ca.crt was found... So I am not quite sure what is the reason and how can I resolve it.

Thanks

Hi
After changing the instance.yml file into this:
elasticsearch@d407cef250af:~/config/certs$ cat instances.yml
instances:

  • name: es01
    dns:
    • es01
    • localhost
      ip:
    • 127.0.0.1
    • 192.168.39.12
  • name: es02
    dns:
    • es02
    • localhost
      ip:
    • 127.0.0.1
    • 192.168.39.12
  • name: es03
    dns:
    • es03
    • localhost
      ip:
    • 127.0.0.1
    • 192.168.39.12

I could use ca.crt to access https://192.168.39.12:9200 by "curl --cacert certs/ca/ca.crt https://192.168.39.12:9200"

But am I doing the right thing?

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