从零开始,用Docker-compose打造SkyWalking、Elasticsearch和Spring Cloud的完美融合
以下是一个简化的Docker Compose配置示例,用于搭建SkyWalking、Elasticsearch和Spring Cloud服务的基础架构:
version: '3'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch-oss:6.8.10
environment:
- http.host=0.0.0.0
- transport.host=localhost
- network.host=0.0.0.0
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- esdata1:/usr/share/elasticsearch/data
ports:
- "9200:9200"
healthcheck:
test: ["CMD-SHELL", "curl --silent --fail localhost:9200/_cluster/health || exit 1"]
interval: 30s
timeout: 10s
retries: 3
oap:
image: apache/skywalking-oap-server:8.3.0
links:
- elasticsearch
depends_on:
- elasticsearch
ports:
- "11800:11800"
- "12800:12800"
environment:
- SW_STORAGE=elasticsearch
- SW_STORAGE_ES_CLUSTER_NODES=elasticsearch:9200
ui:
image: apache/skywalking-ui:8.3.0
links:
- oap
depends_on:
- oap
ports:
- "8080:8080"
environment:
- SW_OAP_ADDRESS=oap:12800
volumes:
esdata1:
driver: local
这个配置文件定义了三个服务:elasticsearch
、oap
和ui
。elasticsearch
服务使用Elasticsearch 6.8.10镜像,并通过Docker volume持久化数据。oap
服务链接到Elasticsearch,并通过环境变量配置连接信息。ui
服务链接到OAP服务,并通过环境变量配置OAP服务的地址。
请注意,这个配置是为了演示如何搭建基础的SkyWalking和Elasticsearch环境,并不包括生产环境的配置最佳实践,例如内存限制、网络配置等。在实际生产部署时,您需要根据自己的需求和服务器资源进行相应的调整。
评论已关闭