Docker中的APM服务器配置与Elasticsearch和Kibana组成
我正在尝试使用 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.
Elasticsearch and kibana are ruuning fine.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我最近面临类似的情况,我的解决方案是:
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 (仅出于开发目的)
或
重新启动您的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)
or
Restart your APM Server and then it probably will work
Before:
After:
If SSL verification is not disabled, it will connect, but you will see:
Hope it helps