无法从 Elasticsearch 节点检索版本信息。请求超时

Unable to retrieve version information from Elasticsearch nodes. Request timed out

我正在按照 link Install Kibana with Docker

中提到的说明安装 Kibana 和 elasticsearch 7.15.1 版

我使用的命令是

docker network create elastic
docker pull docker.elastic.co/elasticsearch/elasticsearch:7.15.1
docker run -d --name es01-test --net elastic -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:7.15.1

docker pull docker.elastic.co/kibana/kibana:7.15.1
docker run -d --name kib01-test --net elastic -p 5601:5601 -e "ELASTICSEARCH_HOSTS=http://es01-test:9200" docker.elastic.co/kibana/kibana:7.15.1
To access Kibana, go to http://localhost:5601.

我正在收到 elasticsearch 的回复

anshuman@anshuman:~$ curl http://localhost:9200
{
  "name" : "ac2f811ab55e",
  "cluster_name" : "docker-cluster",
  "cluster_uuid" : "9HbzlMw0QFurysYIVYWfsA",
  "version" : {
    "number" : "7.15.1",
    "build_flavor" : "default",
    "build_type" : "docker",
    "build_hash" : "83c34f456ae29d60e94d886e455e6a3409bba9ed",
    "build_date" : "2021-10-07T21:56:19.031608185Z",
    "build_snapshot" : false,
    "lucene_version" : "8.9.0",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

但是我从 kibana 收到错误消息

anshuman@anshuman:~$ curl http://localhost:5601
Kibana server is not ready yet

在 kibana 日志中,我看到以下错误

{"type":"log","@timestamp":"2021-10-31T23:58:42+00:00","tags":["error","savedobjects-service"],"pid":1219,"message":"Unable to retrieve version information from Elasticsearch nodes. Request timed out"}

在 elasticsearch 日志中,我看到以下错误

WARNING: A terminally deprecated method in java.lang.System has been called
WARNING: System::setSecurityManager has been called by org.elasticsearch.bootstrap.Elasticsearch (file:/usr/share/elasticsearch/lib/elasticsearch-7.15.1.jar)
WARNING: Please consider reporting this to the maintainers of org.elasticsearch.bootstrap.Elasticsearch
WARNING: System::setSecurityManager will be removed in a future release
WARNING: A terminally deprecated method in java.lang.System has been called
WARNING: System::setSecurityManager has been called by org.elasticsearch.bootstrap.Security (file:/usr/share/elasticsearch/lib/elasticsearch-7.15.1.jar)
WARNING: Please consider reporting this to the maintainers of org.elasticsearch.bootstrap.Security
WARNING: System::setSecurityManager will be removed in a future release
{"type": "server", "timestamp": "2021-11-01T00:49:56,864Z", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "docker-cluster", "node.name": "8666cedc7085", "message": "JVM arguments [-Xshare:auto, -Des.networkaddress.cache.ttl=60, -Des.networkaddress.cache.negative.ttl=10, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -XX:+ShowCodeDetailsInExceptionMessages, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dio.netty.allocator.numDirectArenas=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Djava.locale.providers=SPI,COMPAT, --add-opens=java.base/java.io=ALL-UNNAMED, -XX:+UseG1GC, -Djava.io.tmpdir=/tmp/elasticsearch-8550956835462737955, -XX:+HeapDumpOnOutOfMemoryError, -XX:HeapDumpPath=data, -XX:ErrorFile=logs/hs_err_pid%p.log, -Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m, -Des.cgroups.hierarchy.override=/, -Xms7798m, -Xmx7798m, -XX:MaxDirectMemorySize=4089446400, -XX:G1HeapRegionSize=4m, -XX:InitiatingHeapOccupancyPercent=30, -XX:G1ReservePercent=15, -Des.path.home=/usr/share/elasticsearch, -Des.path.conf=/usr/share/elasticsearch/config, -Des.distribution.flavor=default, -Des.distribution.type=docker, -Des.bundled_jdk=true]" }
{"type": "server", "timestamp": "2021-11-01T00:50:32,754Z", "level": "ERROR", "component": "o.e.i.g.GeoIpDownloader", "cluster.name": "docker-cluster", "node.name": "8666cedc7085", "message": "exception during geoip databases update", "cluster.uuid": "cFfg1C69SU20aq_Hdu-trA", "node.id": "PK7tnmg6Tk-icw0SElkK4A" , 

我的系统详细信息是

anshuman@anshuman:~$ docker -v
Docker version 20.10.8, build 3967b7d28e
anshuman@anshuman:~$ uname -a
Linux anshuman 5.13.0-20-generic #20-Ubuntu SMP Fri Oct 15 14:21:35 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
anshuman@anshuman:~$ neofetch
 OS: Ubuntu 21.10 x86_64 
 Kernel: 5.13.0-20-generic 
 CPU: Intel i5-2520M (4) @ 3.200GHz 
 GPU: NVIDIA GeForce 610M 
 GPU: Intel 2nd Generation Core Processor Family 
 Memory: 10773MiB / 15596MiB 

完成Kibana logs

完成elasticsearch logs

有什么建议吗?

您的 kibana 服务缺少有关 elasticsearch 的信息 user/password。

几天前,我尝试创建简约的 swarm 堆栈,结果如下:

docker-compose.yml

version: "3.8"
services:
  elasticsearch:
    image: elasticsearch:7.15.1
    volumes:
      - /opt/apps/elk/elasticsearch:/usr/share/elasticsearch/data
    environment:
      - cluster.name=elasticsearch
      - network.host=0
      - discovery.type=single-node
      - xpack.license.self_generated.type=basic
      - xpack.security.enabled=true
      - xpack.monitoring.collection.enabled=true

  kibana:
    image: kibana:7.15.1
    ports:
      - 5601:5601
    volumes:
      - /opt/apps/elk/kibana/kibana.yml:/opt/kibana/config/kibana.yml

  logstash:
    image: logstash:7.15.1
    ports:
      # Java gelf listener
      - 12201:12201
    volumes:
      - /opt/apps/elk/logstash:/usr/share/logstash/pipeline

kibana.yml

server.host: "0.0.0.0"
server.shutdownTimeout: "5s"

elasticsearch.hosts: [ "http://elasticsearch:9200" ]
elasticsearch.username: "kibana_system"
elasticsearch.password: "<TO-BE-CREATED>"

xpack.security.enabled: "true"
# generate custom password with min length 32
xpack.encryptedSavedObjects.encryptionKey: RANDOM-PASSWORD
xpack.reporting.encryptionKey: RANDOM-PASSWORD
xpack.security.encryptionKey: RANDOM-PASSWORD

# optional
xpack.reporting.capture.browser.chromium.disableSandbox: false
xpack.reporting.roles.enabled: false

现在你必须:

  1. 开始整个堆栈(例如docker stack deploy -c docker-compose.yml elk

  2. “登录”到 运行 elasticsearch 服务(例如 docker exec -it elk_elasticsearch.1....... bash

  3. 为内部用户生成新密码并保存

    bin/elasticsearch-setup-passwords auto --batch --url http://elasticsearch:9200

  4. 停止整个麋鹿堆栈(例如docker stack rm elk

  5. 根据生成的密码

    编辑kibana.ymlelasticsearch.password
  6. 再次启动整个堆栈并使用 http://SERVER-IP:5601/

    登录服务器

PS:我知道这不是创建 ELK 堆栈的最佳方法,但它可以在不执行中间步骤的情况下工作。同样在此示例中,没有 HTTPS 支持,因为我的所有实例都 运行 落后于 Traefik 代理(排除)

我必须为网桥连接显式设置选项 com.docker.network.bridge.enable_icc。现在它工作正常。我正在分享决赛 docker-compose.yml.

version: '2.2'
services:
  es01:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.15.2
    container_name: es01
    environment:
      - node.name=es01
      - cluster.name=es-docker-cluster
      - discovery.seed_hosts=es02,es03
      - cluster.initial_master_nodes=es01,es02,es03
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - data01:/usr/share/elasticsearch/data
    ports:
      - 9200:9200
    networks:
      - elastic

  es02:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.15.2
    container_name: es02
    environment:
      - node.name=es02
      - cluster.name=es-docker-cluster
      - discovery.seed_hosts=es01,es03
      - cluster.initial_master_nodes=es01,es02,es03
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - data02:/usr/share/elasticsearch/data
    networks:
      - elastic

  es03:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.15.2
    container_name: es03
    environment:
      - node.name=es03
      - cluster.name=es-docker-cluster
      - discovery.seed_hosts=es01,es02
      - cluster.initial_master_nodes=es01,es02,es03
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - data03:/usr/share/elasticsearch/data
    networks:
      - elastic

  kib01:
    image: docker.elastic.co/kibana/kibana:7.15.2
    container_name: kib01
    ports:
      - 5601:5601
    environment:
      ELASTICSEARCH_URL: http://es01:9200
      ELASTICSEARCH_HOSTS: '["http://es01:9200","http://es02:9200","http://es03:9200"]'
    networks:
      - elastic

volumes:
  data01:
    driver: local
  data02:
    driver: local
  data03:
    driver: local

networks:
  elastic:
    driver: bridge
    driver_opts:
      com.docker.network.bridge.enable_icc: "true"