Docker中的APM服务器配置与Elasticsearch和Kibana组成

发布于 2025-01-18 09:57:26 字数 2332 浏览 4 评论 0原文

我正在尝试使用 docker-compose 将 Elastic APM 与 Elasticsearch、Kibana 和 APM 服务器安装为 3 个服务。该文件应如下所示:

version: "2.2"

services:

  setup:
    image: docker.elastic.co/elasticsearch/elasticsearch:${STACK_VERSION}
  
  es01:
    depends_on:
      setup:
        condition: service_healthy
    image: docker.elastic.co/elasticsearch/elasticsearch:${STACK_VERSION}
    volumes:
      - certs:/usr/share/elasticsearch/config/certs
      - esdata01:/usr/share/elasticsearch/data
    ports:
      - ${ES_PORT}:9200
    environment:
      - node.name=es01
      - cluster.name=${CLUSTER_NAME}
      - cluster.initial_master_nodes=es01
      - ELASTIC_PASSWORD=${ELASTIC_PASSWORD}
      - bootstrap.memory_lock=true
     #xpack security
    mem_limit: ${MEM_LIMIT}
    ulimits:
      memlock:
        soft: -1
        hard: -1
    healthcheck:
      test:
        [
          "CMD-SHELL",
          "curl -s --cacert config/certs/ca/ca.crt https://localhost:9200 | grep -q 'missing authentication credentials'",
        ]
      interval: 10s
      timeout: 10s
      retries: 120

  apm-server:
    image: docker.elastic.co/apm/apm-server:8.0.0
    cap_add: ["CHOWN", "DAC_OVERRIDE", "SETGID", "SETUID"]
    cap_drop: ["ALL"]
    ports:
      - 8200:8200
    command: >
      apm-server -e
        -E apm-server.rum.enabled=true
        -E setup.kibana.host=kibana:5601
        -E setup.template.settings.index.number_of_replicas=0
        -E apm-server.kibana.enabled=true
        -E apm-server.kibana.host=172.29.143.107:5601
        -E apm-server.kibana.username=elastic
        -E apm-server.kibana.password=elastic
        -E output.elasticsearch.hosts=["172.29.143.107:9200"] # ["es01:9200"] results the same
        -E output.elasticsearch.username=elastic
        -E output.elasticsearch.password=elastic
    healthcheck:
      interval: 10s
      retries: 12
      test: curl --write-out 'HTTP %{http_code}' --fail --silent --output /dev/null http://localhost:8200/

volumes:
  certs:
    driver: local
  esdata01:
    driver: local
  kibanadata:
    driver: local

Docker 容器已启动,但在 APM 容器内运行时apm-server 测试输出失败。

输入图片此处描述

Elasticsearch 和 kibana 运行良好。

I'm trying to install the Elastic APM with Elasticsearch, Kibana and the APM server as 3 services with docker-compose. The file should look like this:

version: "2.2"

services:

  setup:
    image: docker.elastic.co/elasticsearch/elasticsearch:${STACK_VERSION}
  
  es01:
    depends_on:
      setup:
        condition: service_healthy
    image: docker.elastic.co/elasticsearch/elasticsearch:${STACK_VERSION}
    volumes:
      - certs:/usr/share/elasticsearch/config/certs
      - esdata01:/usr/share/elasticsearch/data
    ports:
      - ${ES_PORT}:9200
    environment:
      - node.name=es01
      - cluster.name=${CLUSTER_NAME}
      - cluster.initial_master_nodes=es01
      - ELASTIC_PASSWORD=${ELASTIC_PASSWORD}
      - bootstrap.memory_lock=true
     #xpack security
    mem_limit: ${MEM_LIMIT}
    ulimits:
      memlock:
        soft: -1
        hard: -1
    healthcheck:
      test:
        [
          "CMD-SHELL",
          "curl -s --cacert config/certs/ca/ca.crt https://localhost:9200 | grep -q 'missing authentication credentials'",
        ]
      interval: 10s
      timeout: 10s
      retries: 120

  apm-server:
    image: docker.elastic.co/apm/apm-server:8.0.0
    cap_add: ["CHOWN", "DAC_OVERRIDE", "SETGID", "SETUID"]
    cap_drop: ["ALL"]
    ports:
      - 8200:8200
    command: >
      apm-server -e
        -E apm-server.rum.enabled=true
        -E setup.kibana.host=kibana:5601
        -E setup.template.settings.index.number_of_replicas=0
        -E apm-server.kibana.enabled=true
        -E apm-server.kibana.host=172.29.143.107:5601
        -E apm-server.kibana.username=elastic
        -E apm-server.kibana.password=elastic
        -E output.elasticsearch.hosts=["172.29.143.107:9200"] # ["es01:9200"] results the same
        -E output.elasticsearch.username=elastic
        -E output.elasticsearch.password=elastic
    healthcheck:
      interval: 10s
      retries: 12
      test: curl --write-out 'HTTP %{http_code}' --fail --silent --output /dev/null http://localhost:8200/

volumes:
  certs:
    driver: local
  esdata01:
    driver: local
  kibanadata:
    driver: local

Docker container starts but apm-server test output fails when running inside APM container.

enter image description here

Elasticsearch and kibana are ruuning fine.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

清君侧 2025-01-25 09:57:26

我最近面临类似的情况,我的解决方案是:

1将apm-server.yml中的主机更改为[“ https:// elasticsearch:9200:9200”](仅与https)1.1(如果使用https)

1.1(如果在docker-compose中,您的elasticsearch容器名称是es01,您可以使用[“ https:// es01:9200”]

2中的apm-server.yml in none (仅出于开发目的)

output.elasticsearch.ssl.verification_mode: none

output.elasticsearch:
 ssl.verification_mode: none

重新启动您的APM服务器,然后它可能会

在以下之前工作:

“在此处输入图像说明”

之后:

“

如果未禁用SSL验证,则它将连接,但您会看到:

”在此处输入图像描述

希望它有帮助

I was facing a similar scenario recently and my solution was:

1 change the host in apm-server.yml to ["https://elasticsearch:9200"] (only worked with https)

1.1 (if in docker-compose your elasticsearch container name is es01, you can use ["https://es01:9200"])

2 in your apm-server.yml set SSL verification to none (only for development purposes)

output.elasticsearch.ssl.verification_mode: none

or

output.elasticsearch:
 ssl.verification_mode: none

Restart your APM Server and then it probably will work

Before:

enter image description here

After:

enter image description here

If SSL verification is not disabled, it will connect, but you will see:

enter image description here

Hope it helps

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文