skip to Main Content

I am a windows user. I installed Windows Subsystem for Linux [wsl2] and then installed docker using it. Then I tried to get started with OpenSearch so I followed the documentation in the given link
https://opensearch.org/downloads.html and run docker-compose up, In the shell, I am getting an error message like

opensearch-dashboards | {"type":"log","@timestamp":"2022-01-18T16:31:18Z","tags":["error","opensearch","data"],"pid":1,"message":"[ConnectionError]: getaddrinfo EAI_AGAIN opensearch-node1 opensearch-node1:9200"}

In the port http://localhost:5601/ I am getting messages like

OpenSearch Dashboards server is not ready yet

I also changed resources preference for memory to 5GB in docker-desktop but it still doesn’t work. Can somebody help me with this?

4

Answers


  1. I had the same error message when opening "http://localhost:5601/" while testing opensearch and opensearch dasboard locally using Docker in Windows 10:

    • OpenSearch Dashboards server is not ready yet
    • opensearch-dashboards |
      {"type":"log","@timestamp":"2022-02-10T12:29:35Z","tags":["error","opensearch","data"],"pid":1,"message":"[ConnectionError]:
      getaddrinfo EAI_AGAIN opensearch-node1 opensearch-node1:9200"}

    But when looking into the log I also found this other error:

    • opensearch-node1 | [1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

    The 3 part solution working for me was:

    Part 1

    On each opensearch nodes update the file:

    /usr/share/opensearch/config/opensearch.yml
    

    And add line:

    plugins.security.disabled: true
    

    Before the security plugins:

    cks. "Single-node" mode disables them again.
    #discovery.type: single-node
    
    plugins.security.disabled: true
    
    ######## Start OpenSearch Security Demo Configuration ########
    # WARNING: revise all the lines below before you go into production
    plugins.security.ssl.transport.pemcert_filepath: esnode.pem
    

    I found the information on opensearch official documentation

    Part 2

    Setting allocated memory for docker desktop to 4GB into .wslconfig more information here:
    opendistrocommunity discussion
    stackoverflow aloocate memory

    Make sure your allocated memory is well set up (you have to restart docker desktop) with this command: docker info and check the line "Total Memory" it should be set to 4GB (approximately, in my case it has be set to 3.84GiB)

    Part 3

    And also increase vm.max_map_count:

    • open powershell
    • wsl -d docker-desktop
    • echo "vm.max_map_count = 262144" > /etc/sysctl.d/99-docker-desktop.conf

    The info was founded here on github discussion

    Login or Signup to reply.
  2. After 5 days having issues with opensearch I’ve found something working fine for me:

    • Set docker memory to 4GB
    • And docker vm.max_map_count = 262144

    Then I use previous versions of opensearch because the latest does not seems stable:

    • opensearchproject/opensearch:1.2.3
    • opensearchproject/opensearch-dashboards:1.1.0
    • opensearchproject/logstash-oss-with-opensearch-output-plugin:7.16.2

    Here is my docker-compose.yml file:

    version: '3'
    services:
      opensearch-node1A:
        image: opensearchproject/opensearch:1.2.3
        container_name: opensearch-node1A
        environment:
          - cluster.name=opensearch-cluster
          - node.name=opensearch-node1A
          - discovery.seed_hosts=opensearch-node1A,opensearch-node2A
          - cluster.initial_master_nodes=opensearch-node1A,opensearch-node2A
          - bootstrap.memory_lock=true # along with the memlock settings below, disables swapping
          - "OPENSEARCH_JAVA_OPTS=-Xms512m -Xmx512m" # minimum and maximum Java heap size, recommend setting both to 50% of system RAM
        ulimits:
          memlock:
            soft: -1
            hard: -1
          nofile:
            soft: 65536 # maximum number of open files for the OpenSearch user, set to at least 65536 on modern systems
            hard: 65536
        volumes:
          - opensearch-data1:/usr/share/opensearch/data
        ports:
          - 9200:9200
          - 9600:9600 # required for Performance Analyzer
        networks:
          - opensearch-net
      opensearch-node2A:
        image: opensearchproject/opensearch:1.2.3
        container_name: opensearch-node2A
        environment:
          - cluster.name=opensearch-cluster
          - node.name=opensearch-node2A
          - discovery.seed_hosts=opensearch-node1A,opensearch-node2A
          - cluster.initial_master_nodes=opensearch-node1A,opensearch-node2A
          - bootstrap.memory_lock=true
          - "OPENSEARCH_JAVA_OPTS=-Xms512m -Xmx512m"
        ulimits:
          memlock:
            soft: -1
            hard: -1
          nofile:
            soft: 65536
            hard: 65536
        volumes:
          - opensearch-data2:/usr/share/opensearch/data
        networks:
          - opensearch-net
      opensearch-dashboardsA:
        image: opensearchproject/opensearch-dashboards:1.1.0
        container_name: opensearch-dashboardsA
        ports:
          - 5601:5601
        expose:
          - "5601"
        environment:
          OPENSEARCH_HOSTS: '["https://opensearch-node1A:9200","https://opensearch-node2A:9200"]'
        networks:
          - opensearch-net
      logstash-with-plugin:
        image: opensearchproject/logstash-oss-with-opensearch-output-plugin:7.16.2
        container_name: logstash-with-plugin
        networks:
          - opensearch-net
    
    volumes:
      opensearch-data1:
      opensearch-data2:
    
    networks:
      opensearch-net:
    
    Login or Signup to reply.
  3. I had the same issue with my Opensearch-dashboards instance installed on VM without Docker usage. The problem was caused by wrong setting for connection to search engine in the opensearch-dashboards.yml file. I mixed up https and http protocols here (there was mismatch between settings of opensearch and opensearch-dashboards):

    opensearch.hosts: [https://localhost:9200]

    Login or Signup to reply.
  4. Incase if this helps some1,

    I had no luck following official doc (especially with multi-nodes) and ended up setting it up manually with my limited Docker knowledge.

    Below is my setup

    • WSL2:Alpine#3.17.0 on Win 11
    • Standard Docker Engine + Cli setup on WLS2:Alpine

    opensearch:1.3.8 (single node) server setup

    • run opensearch single node :

      docker run -d -p 9200:9200 -p 9600:9600 -e "discovery.type=single-node" opensearchproject/opensearch:1.3.8

    • ensure its up & running

      docker ps

    • ensure you are able to hit api with login creds,

    defaults are https://localhost:9200 uname: admin pass: admin

    • inspect container to get Gateway :

      docker inspect <containerName> or <containerId> to grab NetworkSettings.Gateway property, note it down somewhere, will be required to setup opensearch-dashboard. For me it was something like 172.17.117.1

    opensearch-dashboard:1.3.8 setup

    • create a custom custom-opensearch-dashboards.yml file somewhere in your WLS2 home directory with below contents
    server.host: '0.0.0.0'
    server.port: 5601
    opensearch.hosts: [https://yourGatewayIpHere:9200]
    opensearch.ssl.verificationMode: none
    opensearch.username: uiuser1
    opensearch.password: uipass1
    opensearch.requestHeadersWhitelist: [authorization, securitytenant]
    opensearch_security.multitenancy.enabled: false
    opensearch_security.multitenancy.tenants.preferred: [Private, Global]
    opensearch_security.readonly_mode.roles: [kibana_read_only]
    opensearch_security.cookie.secure: false
    
    • pull opensearch-dashboards image :

      docker pull opensearchproject/opensearch-dashboards:1.3.8

    • run opensearch-dashboards with customized config:

      docker run -d -p 5601:5601 -v /fullPath/of/custom-opensearch-dashboards.yml:/usr/share/opensearch-dashboards/config/opensearch_dashboards.yml

    • ensure its up & running

      docker ps

    • on your browser see if you can load http://localhost:5601/ and log in with opensearch.username opensearch.password creds

    Other useful Docker commands

    • view logs

      docker logs <containerName> or <containerId>

    • sh to container to check config or ping required apis :

      docker exec -it <containerName> or <containerId> sh

    Good luck !

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search