etcd配置就是官方example,很多文档都是集群k8s的,不能照搬,记录下官方试例的过程,
etcd配置如下:
version: "3"
services:
etcd:
image: bitnami/etcd:3.4.15
restart: always
volumes:
- ./etcd_data:/bitnami/etcd
environment:
ALLOW_NONE_AUTHENTICATION: "yes"
ETCD_ADVERTISE_CLIENT_URLS: "http://etcd:2379"
ETCD_LISTEN_CLIENT_URLS: "http://0.0.0.0:2379"
ports:
- "2379:2379/tcp"
networks:
apisix:
备份与恢复:
1 在./etcd_data目录下创建data,chmod 777,启动恢复时用
2 备份ETCDCTL_API=3 ?docker exec api_etcd_1 etcdctl --endpoints=":2379" snapshot save "/bitnami/etcd/backup.db"
3 恢复:
? ?1.?先停掉服务(apisix相关,只留下etcd docker)
? ?2. 删除./etcd_data下的data,执行
ETCDCTL_API=3? docker exec -it etcd etcdctl? snapshot restore? "/bitnami/etcd/backup.db" --endpoints=":2379" --data-dir=/bitnami/etcd/data, 然后chmod data 777
? ?3. 重启服务