Files
compose-anything/src/tidb/docker-compose.yaml
2025-11-10 19:55:44 +08:00

106 lines
2.7 KiB
YAML

x-defaults: &defaults
restart: unless-stopped
logging:
driver: json-file
options:
max-size: 100m
max-file: "3"
services:
pd:
<<: *defaults
image: ${GLOBAL_REGISTRY:-}pingcap/pd:${TIDB_VERSION:-v8.5.0}
command:
- --name=pd
- --client-urls=http://0.0.0.0:2379
- --peer-urls=http://0.0.0.0:2380
- --advertise-client-urls=http://pd:2379
- --advertise-peer-urls=http://pd:2380
- --data-dir=/data
environment:
TZ: ${TZ:-UTC}
volumes:
- pd_data:/data
ports:
- "${TIDB_PD_PORT_OVERRIDE:-2379}:2379"
deploy:
resources:
limits:
cpus: ${TIDB_PD_CPU_LIMIT:-1.0}
memory: ${TIDB_PD_MEMORY_LIMIT:-1G}
reservations:
cpus: ${TIDB_PD_CPU_RESERVATION:-0.25}
memory: ${TIDB_PD_MEMORY_RESERVATION:-512M}
healthcheck:
test: ["CMD-SHELL", "wget -q -O - http://localhost:2379/health || exit 1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
tikv:
<<: *defaults
image: ${GLOBAL_REGISTRY:-}pingcap/tikv:${TIDB_VERSION:-v8.5.0}
command:
- --addr=0.0.0.0:20160
- --advertise-addr=tikv:20160
- --pd=http://pd:2379
- --data-dir=/data
environment:
TZ: ${TZ:-UTC}
volumes:
- tikv_data:/data
ports:
- "${TIDB_TIKV_PORT_OVERRIDE:-20160}:20160"
depends_on:
pd:
condition: service_healthy
deploy:
resources:
limits:
cpus: ${TIDB_TIKV_CPU_LIMIT:-2.0}
memory: ${TIDB_TIKV_MEMORY_LIMIT:-2G}
reservations:
cpus: ${TIDB_TIKV_CPU_RESERVATION:-0.5}
memory: ${TIDB_TIKV_MEMORY_RESERVATION:-1G}
healthcheck:
test: ["CMD-SHELL", "wget -q -O - http://localhost:20180/status || exit 1"]
interval: 30s
timeout: 10s
retries: 5
start_period: 60s
tidb:
<<: *defaults
image: ${GLOBAL_REGISTRY:-}pingcap/tidb:${TIDB_VERSION:-v8.5.0}
command:
- --store=tikv
- --path=pd:2379
- --advertise-address=tidb
environment:
TZ: ${TZ:-UTC}
ports:
- "${TIDB_PORT_OVERRIDE:-4000}:4000"
- "${TIDB_STATUS_PORT_OVERRIDE:-10080}:10080"
depends_on:
tikv:
condition: service_healthy
deploy:
resources:
limits:
cpus: ${TIDB_CPU_LIMIT:-2.0}
memory: ${TIDB_MEMORY_LIMIT:-2G}
reservations:
cpus: ${TIDB_CPU_RESERVATION:-0.5}
memory: ${TIDB_MEMORY_RESERVATION:-512M}
healthcheck:
test: ["CMD-SHELL", "wget -q -O - http://localhost:10080/status || exit 1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
volumes:
pd_data:
tikv_data: