2

我是 Windows 用户。我为 Linux [wsl2] 安装了 Windows 子系统,然后使用它安装了 docker。然后我尝试开始使用 OpenSearch,所以我按照给定链接 https://opensearch.org/downloads.html中的文档并运行 docker-compose up,在 shell 中,我收到一条错误消息,例如

开放搜索仪表板| {"type":"log","@timestamp":"2022-01-18T16:31:18Z","tags":["error","opensearch","data"],"pid":1, “消息”:“[连接错误]:getaddrinfo EAI_AGAIN opensearch-node1 opensearch-node1:9200”}

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

OpenSearch Dashboards 服务器尚未准备好

我还在 docker-desktop 中将内存的资源偏好更改为 5GB,但它仍然不起作用。有人可以帮我吗?

4

2 回答 2

0

在 Windows 10 中使用 Docker 在本地测试 opensearch 和 opensearch dasboard 时打开“http://localhost:5601/”时出现相同的错误消息:

  • OpenSearch Dashboards 服务器尚未准备好
  • 开放搜索仪表板| {"type":"log","@timestamp":"2022-02-10T12:29:35Z","tags":["error","opensearch","data"],"pid":1, “消息”:“[连接错误]:getaddrinfo EAI_AGAIN opensearch-node1 opensearch-node1:9200”}

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

  • 开放搜索节点1 | [1]:最大虚拟内存区域 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官方文档上找到了信息

第2部分

将 docker 桌面的分配内存设置为 .wslconfig 中的 4GB 更多信息: opendistrocommunity 讨论 stackoverflow aloocate memory

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

第 3 部分

并增加 vm.max_map_count:

  • 打开电源外壳
  • wsl -d 码头工人桌面
  • 回声“vm.max_map_count = 262144”> /etc/sysctl.d/99-docker-desktop.conf

该信息是在github讨论上建立的

于 2022-02-10T13:58:07.027 回答
0

在遇到 opensearch 问题 5 天后,我发现有些东西对我来说很好用:

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

我使用以前版本的 opensearch,因为最新版本似乎不稳定:

  • opensearchproject/opensearch:1.2.3
  • opensearchproject/opensearch-dashboards: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:
于 2022-02-15T10:57:12.910 回答