我尝试执行此docker命令,以设置带有Elasticsearch的Jaeger Agent和Jaeger Collector。
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\
答案 0 :(得分:2)
搜索解决方案一段时间后,我发现了一个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
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
docker-compose.yml文件安装了elasticsearch,Jaeger收集器,查询和代理。
首先安装docker,然后docker组成 https://docs.docker.com/compose/install/#install-compose
然后依次执行这些命令
1. sudo docker-compose up -d elasticsearch
2. sudo docker-compose up -d
3. sudo docker ps -a
启动所有docker容器-Jaeger代理,收集器,查询和elasticsearch。
sudo docker start container-id
答案 1 :(得分:1)
如果您想将Jaeger与Elasticsearch和Kibana一起部署以快速验证并检查堆栈,例如实物或Minikube,以下代码段可能会对您有所帮助。
put
答案 2 :(得分:0)
如果需要在Kubernetes集群中将Jaeger设置为舵图,则可以使用以下命令:https://github.com/jaegertracing/helm-charts/tree/master/charts/jaeger 它可以将Elasticsearch或Cassandara部署为存储后端。只是将正确的值传递到图表中即可。
storage:
type: elasticsearch
答案 3 :(得分:0)
对于使用OpenTelemetry,Jaeger和Elasticsearch的人们,这就是方法。
请注意,所使用的图像为jaegertracing/jaeger-opentelemetry-collector
和jaegertracing/jaeger-opentelemetry-agent
。
version: '3.8'
services:
collector:
image: otel/opentelemetry-collector:latest
command: ["--config=/conf/opentelemetry-collector.config.yaml", "--log-level=DEBUG"]
volumes:
- ./opentelemetry-collector.config.yaml:/conf/opentelemetry-collector.config.yaml
ports:
- "9464:9464"
- "55680:55680"
- "55681:55681"
depends_on:
- jaeger-collector
jaeger-collector:
image: jaegertracing/jaeger-opentelemetry-collector
command: ["--es.num-shards=1", "--es.num-replicas=0", "--es.server-urls=http://elasticsearch:9200", "--collector.zipkin.host-port=:9411"]
ports:
- "14250"
- "14268"
- "9411"
environment:
- SPAN_STORAGE_TYPE=elasticsearch
- LOG_LEVEL=debug
restart: on-failure
depends_on:
- elasticsearch
jaeger-agent:
image: jaegertracing/jaeger-opentelemetry-agent
command: ["--config=/config/otel-agent-config.yml", "--reporter.grpc.host-port=jaeger-collector:14250"]
volumes:
- ./:/config/:ro
ports:
- "6831/udp"
- "6832/udp"
- "5778"
restart: on-failure
depends_on:
- jaeger-collector
jaeger-query:
image: jaegertracing/jaeger-query
command: ["--es.num-shards=1", "--es.num-replicas=0", "--es.server-urls=http://elasticsearch:9200"]
ports:
- "16686:16686"
- "16687"
environment:
- SPAN_STORAGE_TYPE=elasticsearch
- LOG_LEVEL=debug
restart: on-failure
depends_on:
- elasticsearch
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch-oss:7.9.0
environment:
- discovery.type=single-node
ports:
- "9200/tcp"
然后只需要
docker-compose up -d
答案 4 :(得分:0)
正如我在上面关于OP的第一个答案的评论中所提到的那样,在完全按照给定的方式运行docker-compose时出现错误:
Error: unknown flag: --collector.host-port
我认为自编写该答案以来,Jaeger伙计已弃用此CLI标志。因此,我在jaeger-agent文档中进行了一些拨弄:
我做了一些小的修改:
"14250:14250"
添加到了jaeger-collector端口command: ["--reporter.grpc.host-port=jaeger-collector:14250"]
image
标签中的弹性搜索版本更新为他们目前提供的最新版本(尽管我怀疑这是必需的)。更新后的docker-compose.yaml:
version: "3"
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.9.3
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"
- "14250:14250"
- "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: ["--reporter.grpc.host-port=jaeger-collector:14250"]
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