0

我正在尝试使用 ElasticSearch 后端在 docker 上运行 Apache Skywalking,但在让它保持正常运行和连接时遇到问题。

我根据他们的 github repo 使用了 docker compose 文件和环境变量值

https://github.com/apache/skywalking-docker/tree/master/compose

# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

version: '3.8'
services:
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:${ES_VERSION}
    container_name: elasticsearch
    restart: always
    ports:
      - 9200:9200
    healthcheck:
      test: ["CMD-SHELL", "curl --silent --fail localhost:9200/_cluster/health || exit 1"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 40s
    environment:
      - discovery.type=single-node
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - data:/usr/share/elasticsearch/data
  oap:
    image: apache/skywalking-oap-server:${SW_VERSION}-${IMAGE_TAG}
    container_name: oap
    depends_on:
      - elasticsearch
    links:
      - elasticsearch
    restart: always
    ports:
      - 11800:11800
      - 12800:12800
    healthcheck:
      test: ["CMD-SHELL", "/skywalking/bin/swctl ch"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 40s
    environment:
      SW_STORAGE: elasticsearch
      SW_STORAGE_ES_CLUSTER_NODES: elasticsearch:9200
      SW_HEALTH_CHECKER: default
      SW_TELEMETRY: prometheus
      JAVA_OPTS: "-Xms2048m -Xmx2048m"
  ui:
    image: apache/skywalking-ui:${SW_VERSION}
    container_name: ui
    depends_on:
      - oap
    links:
      - oap
    restart: always
    ports:
      - 8080:8080
    environment:
      SW_OAP_ADDRESS: http://oap:12800

volumes:
  data:
    driver: local

然后使用这两个 env 值中的任何一个

ES_VERSION=6.8.8
SW_STORAGE=elasticsearch
IMAGE_TAG=es6
___
ES_VERSION=7.5.0
SW_STORAGE=elasticsearch7
IMAGE_TAG=es7

所有 3 个容器都出现了,我可以导航到 ElasticSearch 容器以及 SkyWalking UI 容器,但是在连接被拒绝和超时的日志中抛出了大量错误。

我确保它们都在同一个桥接 docker 网络上运行,以便您可以通过它们的名称访问容器。docker compose 定义创建了一个名为 skywalking_default 的网络

我看到的错误

在 OAP 容器上

2021-08-04 12:12:15,959 - org.apache.skywalking.oap.server.starter.OAPServerBootstrap -11018 [main] ERROR [] - 'boolean org.elasticsearch.client.RestHighLevelClient.ping(org.apache.http.Header[])'
java.lang.NoSuchMethodError: 'boolean org.elasticsearch.client.RestHighLevelClient.ping(org.apache.http.Header[])'
    at org.apache.skywalking.oap.server.library.client.elasticsearch.ElasticSearchClient.connect(ElasticSearchClient.java:152) ~[library-client-8.5.0.jar:8.5.0]
    at org.apache.skywalking.oap.server.storage.plugin.elasticsearch.StorageModuleElasticsearchProvider.start(StorageModuleElasticsearchProvider.java:214) ~[storage-elasticsearch-plugin-8.5.0.jar:8.5.0]
    at org.apache.skywalking.oap.server.library.module.BootstrapFlow.start(BootstrapFlow.java:49) ~[library-module-8.5.0.jar:8.5.0]
    at org.apache.skywalking.oap.server.library.module.ModuleManager.init(ModuleManager.java:60) ~[library-module-8.5.0.jar:8.5.0]
    at org.apache.skywalking.oap.server.starter.OAPServerBootstrap.start(OAPServerBootstrap.java:43) [server-bootstrap-8.5.0.jar:8.5.0]
    at org.apache.skywalking.oap.server.starter.OAPServerStartUp.main(OAPServerStartUp.java:27) [server-starter-es7-8.5.0.jar:8.5.0]

Skywalking UI 容器

Caused by: java.lang.RuntimeException: org.apache.http.conn.ConnectTimeoutException: Connect to oap:12800 [oap/192.168.32.3] failed: connect timed out

at rx.exceptions.Exceptions.propagate(Exceptions.java:58)

at rx.observables.BlockingObservable.blockForSingle(BlockingObservable.java:464)

at rx.observables.BlockingObservable.single(BlockingObservable.java:341)

at com.netflix.client.AbstractLoadBalancerAwareClient.executeWithLoadBalancer(AbstractLoadBalancerAwareClient.java:112)

... 129 common frames omitted

我经常提到的主要问题之一是确保您正确定义了 SW_STORAGE,具体取决于您使用的是 ElasticSearch 6 还是 7,但我有

我正在运行 Docker 版本 20.10.6,在 MacOS 10.15.6 上构建 370c289

任何帮助将不胜感激谢谢

4

0 回答 0