gpt4 book ai didi

docker - 如何使用 elasticsearch 配置 Jaeger?

转载 作者:行者123 更新时间:2023-11-29 02:48:05 31 4
gpt4 key购买 nike

我尝试执行此 docker 命令以使用 elasticsearch 设置 Jaeger 代理和 jaeger 收集器。

sudo docker run \
-p 5775:5775/udp \
-p 6831:6831/udp \
-p 6832:6832/udp \
-p 5778:5778 \
-p 16686:16686 \
-p 14268:14268 \
-e SPAN_STORAGE_TYPE=elasticsearch \
--name=jaeger \
jaegertracing/all-in-one:latest

但是这个命令给出了下面的错误。如何使用 ElasticSearch 配置 Jaeger?

"msg":"Failed to init storage factory","error":"health check timeout: no Elasticsearch node available","errorVerbose":"no Elasticsearch node available\

最佳答案

找了一段时间解决方案后,我找到了一个docker-compose.yml文件,里面有Jaeger Query、Agent、collector和Elasticsearch的配置。

docker-compose.yml

  version: "3"

services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:6.3.1
networks:
- elastic-jaeger
ports:
- "127.0.0.1:9200:9200"
- "127.0.0.1:9300:9300"
restart: on-failure
environment:
- cluster.name=jaeger-cluster
- discovery.type=single-node
- http.host=0.0.0.0
- transport.host=127.0.0.1
- ES_JAVA_OPTS=-Xms512m -Xmx512m
- xpack.security.enabled=false
volumes:
- esdata:/usr/share/elasticsearch/data

jaeger-collector:
image: jaegertracing/jaeger-collector
ports:
- "14269:14269"
- "14268:14268"
- "14267:14267"
- "9411:9411"
networks:
- elastic-jaeger
restart: on-failure
environment:
- SPAN_STORAGE_TYPE=elasticsearch
command: [
"--es.server-urls=http://elasticsearch:9200",
"--es.num-shards=1",
"--es.num-replicas=0",
"--log-level=error"
]
depends_on:
- elasticsearch

jaeger-agent:
image: jaegertracing/jaeger-agent
hostname: jaeger-agent
command: ["--collector.host-port=jaeger-collector:14267"]
ports:
- "5775:5775/udp"
- "6831:6831/udp"
- "6832:6832/udp"
- "5778:5778"
networks:
- elastic-jaeger
restart: on-failure
environment:
- SPAN_STORAGE_TYPE=elasticsearch
depends_on:
- jaeger-collector

jaeger-query:
image: jaegertracing/jaeger-query
environment:
- SPAN_STORAGE_TYPE=elasticsearch
- no_proxy=localhost
ports:
- "16686:16686"
- "16687:16687"
networks:
- elastic-jaeger
restart: on-failure
command: [
"--es.server-urls=http://elasticsearch:9200",
"--span-storage.type=elasticsearch",
"--log-level=debug"
]
depends_on:
- jaeger-agent

volumes:
esdata:
driver: local

networks:
elastic-jaeger:
driver: bridge

The docker-compose.yml file installs the elasticsearch, Jaeger collector,query and agent.

Install docker and docker compose firsthttps://docs.docker.com/compose/install/#install-compose

Then, execute these commands in order

 
1. sudo docker-compose up -d elasticsearch

2. sudo docker-compose up -d

3. sudo docker ps -a

启动所有 docker 容器 - Jaeger agent、collector、query 和 elasticsearch。

sudo docker 启动容器 id

访问 -> http://localhost:16686/

关于docker - 如何使用 elasticsearch 配置 Jaeger?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51785812/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com