1

我正在尝试通过使用 opensearch 网站 https://opensearch.org/docs/latest/opensearch/install/docker/中的示例来建立一个 opensearch 集群

version: '3'
services:
  opensearch-node1:
    image: opensearchproject/opensearch:1.2.3
    container_name: opensearch-node1
    environment:
      - cluster.name=opensearch-cluster
      - node.name=opensearch-node1
      - discovery.seed_hosts=opensearch-node1,opensearch-node2
      - cluster.initial_master_nodes=opensearch-node1,opensearch-node2
      - 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-node2:
    image: opensearchproject/opensearch:1.2.3
    container_name: opensearch-node2
    environment:
      - cluster.name=opensearch-cluster
      - node.name=opensearch-node2
      - discovery.seed_hosts=opensearch-node1,opensearch-node2
      - cluster.initial_master_nodes=opensearch-node1,opensearch-node2
      - 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-dashboards:
    image: opensearchproject/opensearch-dashboards:1.2.0
    container_name: opensearch-dashboards
    ports:
      - 5601:5601
    expose:
      - "5601"
    environment:
      OPENSEARCH_HOSTS: '["https://opensearch-node1:9200","https://opensearch-node2:9200"]' # must be a string with no spaces when specified as an environment variable
    networks:
      - opensearch-net

volumes:
  opensearch-data1:
  opensearch-data2:

networks:
  opensearch-net:

但是 opensearch 仪表板无法启动并显示以下错误消息。如果我从打开的搜索节点检查日志,我得到“无法解析主机”,谁能指出我出了什么问题?

打开搜索仪表板错误:


[2021-12-30T00:28:19,773][WARN ][o.o.d.SeedHostsResolver  ] [opensearch-node1] failed to resolve host [opensearch-node2]

java.net.UnknownHostException: opensearch-node2

at java.net.InetAddress$CachedAddresses.get(InetAddress.java:800) ~[?:?]

at java.net.InetAddress.getAllByName0(InetAddress.java:1507) ~[?:?]

at java.net.InetAddress.getAllByName(InetAddress.java:1366) ~[?:?]

at java.net.InetAddress.getAllByName(InetAddress.java:1300) ~[?:?]

at org.opensearch.transport.TcpTransport.parse(TcpTransport.java:605) ~[opensearch-1.2.0.jar:1.2.0]

at org.opensearch.transport.TcpTransport.addressesFromString(TcpTransport.java:547) ~[opensearch-1.2.0.jar:1.2.0]

at org.opensearch.transport.TransportService.addressesFromString(TransportService.java:999) ~[opensearch-1.2.0.jar:1.2.0]

at org.opensearch.discovery.SeedHostsResolver.lambda$resolveHostsLists$0(SeedHostsResolver.java:177) ~[opensearch-1.2.0.jar:1.2.0]

at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]

at org.opensearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:733) ~[opensearch-1.2.0.jar:1.2.0]

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130) [?:?]

打开搜索节点错误:

[2021-12-30T00:28:19,773][WARN ][o.o.d.SeedHostsResolver  ] [opensearch-node1] failed to resolve host [opensearch-node2]

java.net.UnknownHostException: opensearch-node2

at java.net.InetAddress$CachedAddresses.get(InetAddress.java:800) ~[?:?]

at java.net.InetAddress.getAllByName0(InetAddress.java:1507) ~[?:?]

at java.net.InetAddress.getAllByName(InetAddress.java:1366) ~[?:?]

at java.net.InetAddress.getAllByName(InetAddress.java:1300) ~[?:?]

at org.opensearch.transport.TcpTransport.parse(TcpTransport.java:605) ~[opensearch-1.2.0.jar:1.2.0]

at org.opensearch.transport.TcpTransport.addressesFromString(TcpTransport.java:547) ~[opensearch-1.2.0.jar:1.2.0]

at org.opensearch.transport.TransportService.addressesFromString(TransportService.java:999) ~[opensearch-1.2.0.jar:1.2.0]

at org.opensearch.discovery.SeedHostsResolver.lambda$resolveHostsLists$0(SeedHostsResolver.java:177) ~[opensearch-1.2.0.jar:1.2.0]

at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]

at org.opensearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:733) ~[opensearch-1.2.0.jar:1.2.0]

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130) [?:?]


4

1 回答 1

0

我在mac上遇到了同样的问题。但是当我增加 docker-desktop 中的内存大小时它得到了解决

于 2022-01-16T09:45:43.587 回答