基于docker-compose搭建 Skywalking
调整系统参数
$ vi /etc/sysctl.conf
# 调整参数
vm.max_map_count=262144
# 刷新参数
sysctl -p
编辑写docker-compose.yml文件
docker-compose.yml文件
version: '3.3'
services:
elasticsearch:
image: elasticsearch:7.5.1
container_name: elasticsearch
restart: always
ports:
- 9200:9200
environment:
discovery.type: single-node
TZ: Asia/Shanghai
volumes:
- /docker/elasticsearch/logs:/usr/share/elasticsearch/logs
- /docker/elasticsearch/data:/usr/share/elasticsearch/data
oap:
image: apache/skywalking-oap-server:6.6.0-es7
container_name: skywalking-oap
depends_on:
- elasticsearch
links:
- elasticsearch
restart: always
ports:
- 11800:11800
- 12800:12800
environment:
SW_STORAGE: elasticsearch # 指定ES
SW_STORAGE_ES_CLUSTER_NODES: elasticsearch:9200
TZ: Asia/Shanghai
ui:
image: apache/skywalking-ui:6.6.0
container_name: sykwolking-ui
depends_on:
- sykwolking-oap
links:
- sykwolking-oap
restart: always
ports:
- 8088:8080
environment:
SW_OAP_ADDRESS: oap:12800
TZ: Asia/Shanghai
创建用于持久化的目录
mkdir -p /docker/elasticsearch
先预先启动elasticsearch,并从elasticsearch容器中拷贝数出来的主机目录,用于持久化
# 不用挂载任何目录,快速启动es
docker run -d --name=es7 \
-p 9200:9200 -p 9300:9300 \
-e "discovery.type=single-node" elasticsearch:7.5.1
# 重容器中,拷贝数据出来
mkdir -p /data/elasticsearch
docker cp es7:/usr/share/elasticsearch/data /docker/elasticsearch/
docker cp es7:/usr/share/elasticsearch/logs /docker/elasticsearch/
docker rm -f es7
开始启动 elasticsearch、oap、ui
$ docker-compose up -d
Creating network "skywalking_default" with the default driver
Creating elasticsearch ... done
Creating skywalking-oap ... done
Creating skywalking-ui ... done
# 查看启动情况
$ docker-compose ps
Name Command State Ports
----------------------------------------------------------------------------------------------------------------------
elasticsearch /usr/local/bin/docker-entr ... Up 0.0.0.0:9200->9200/tcp, 9300/tcp
skywalking-oap bash docker-entrypoint.sh Up 0.0.0.0:11800->11800/tcp, 1234/tcp, 0.0.0.0:12800->12800/tcp
skywalking-ui bash docker-entrypoint.sh Up 0.0.0.0:8088->8080/tcp
正常启动