我正在尝试安装Elastic APM与Elasticsearch,Kibana和APM服务器作为3个服务与docker-compose。文件应该看起来像这样:
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 test output失败。
Elasticsearch和kibana运行良好。
1条答案
按热度按时间ubbxdtey1#
我最近遇到了类似的情况,我的解决方案是:
1将apm-server.yml中的主机更改为
["https://elasticsearch:9200"]
(仅适用于https)1.1(如果在docker-compose中你的elasticsearch容器名是es 01,你可以使用
["https://es01:9200"]
)2在apm-server.yml中将SSL验证设置为none**(仅用于开发目的)**
或
重新启动APM服务器,然后它可能会工作
之前:
之后:
如果未禁用SSL验证,* 它将连接 *,但您将看到:
希望能有所帮助