无法通过 运行 OpenSearch docker 撰写获取 OpenSearch 仪表板

Unable to get OpenSearch dashboard by running OpenSearch docker compose

我是 windows 用户。我为 Linux [wsl2] 安装了 Windows 子系统,然后使用它安装了 docker。然后我尝试开始使用 OpenSearch,所以我遵循了给定 link 中的文档 https://opensearch.org/downloads.html 和 运行 docker-组合起来,在 shell 中,我收到类似

的错误消息

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"}

在端口 http://localhost:5601/ 我收到类似

的消息

OpenSearch Dashboards server is not ready yet

我还在 docker-desktop 中将内存的资源首选项更改为 5GB,但它仍然不起作用。有人可以帮我解决这个问题吗?

在 Windows 10:

中使用 Docker 在本地测试 opensearch 和 opensearch dasboard 时,打开“http://localhost:5601/”时出现相同的错误消息
  • OpenSearch Dashboards 服务器尚未就绪
  • opensearch-dashboards | {"type":"log","@timestamp":"2022-02-10T12:29:35Z","tags":["error","opensearch","data"],"pid":1, “消息”:[连接错误]: getaddrinfo EAI_AGAIN opensearch-node1 opensearch-node1:9200"}

但是在查看日志时我还发现了另一个错误:

  • opensearch-node1 | [1]: max virtual memory areas vm.max_map_count [65530] 太低,至少增加到 [262144]

对我有用的 3 部分解决方案是:

第 1 部分

在每个 opensearch 节点上更新文件:

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

并添加行:

plugins.security.disabled: true

安全插件之前:

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

我在opensearch官方上找到了资料documentation

第 2 部分

将 docker 桌面的分配内存设置为 4GB 进入 .wslconfig 更多信息,请点击此处: opendistrocommunity discussion

使用以下命令确保分配的内存设置正确(您必须重新启动 docker 桌面):docker info 并检查“Total Memory”行,它应该设置为 4GB (大约,在我的例子中,它已设置为 3.84GiB)

第 3 部分

同时增加vm.max_map_count:

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

信息成立here on github discussion

在使用 opensearch 出现问题 5 天后,我发现了一些适合我的东西:

  • 将docker内存设置为4GB
  • 和docker vm.max_map_count = 262144

我用的是以前版本的opensearch,因为最新的好像不太稳定:

  • opensearchproject/opensearch:1.2.3
  • opensearchproject/opensearch-仪表板:1.1.0
  • opensearchproject/logstash-oss-with-opensearch-output-plugin:7.16.2

这是我的 docker-compose.yml 文件:

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: