redis哨兵启动
能够编排管理3个容器,php,redis,nginx
version: "3.6"
services: #服务
master:
image: redis
container_name: master
networks:
redis-network:
ipv4_address: 192.168.1.11 #设置ip地址
working_dir: /usr/src/redis #工作目录
stdin_open: true
tty: true
ports:
- "7001:6379"
volumes:
- /usr/docker/test/redis/master:/usr/src/redis
slave:
image: redis
container_name: slave
networks:
redis-network:
ipv4_address: 192.168.1.12 #设置ip地址
working_dir: /usr/src/redis #工作目录
stdin_open: true
links:
- master
tty: true
ports:
- "7002:6379"
volumes:
- /usr/docker/test/redis/slave:/usr/src/redis
slave2:
image: redis
container_name: slave2
networks:
redis-network:
ipv4_address: 192.168.1.13 #设置ip地址
working_dir: /usr/src/redis #工作目录
stdin_open: true
links:
- master
tty: true
ports:
- "7003:6379"
volumes:
- /usr/docker/test/redis/slave2:/usr/src/redis
sentinel:
image: redis
container_name: sentinel
networks:
redis-network:
ipv4_address: 192.168.1.14 #设置ip地址
working_dir: /usr/src/redis #工作目录
stdin_open: true
links:
- master
tty: true
ports:
- "7004:26379"
volumes:
- /usr/docker/test/redis/sentinel:/usr/src/redis
command: ["redis-sentinel","/usr/src/redis/conf/sentinel.conf"]
sentinel2:
image: redis
container_name: sentinel2
networks:
redis-network:
ipv4_address: 192.168.1.15 #设置ip地址
working_dir: /usr/src/redis #工作目录
stdin_open: true
links:
- master
tty: true
ports:
- "7005:26379"
volumes:
- /usr/docker/test/redis/sentinel2:/usr/src/redis
command: ["redis-sentinel","/usr/src/redis/conf/sentinel.conf"]
sentinel3:
image: redis
container_name: sentinel3
networks:
redis-network:
ipv4_address: 192.168.1.16 #设置ip地址
working_dir: /usr/src/redis #工作目录
stdin_open: true
links:
- master
tty: true
ports:
- "7006:26379"
volumes:
- /usr/docker/test/redis/sentinel3:/usr/src/redis
command: ["redis-sentinel","/usr/src/redis/conf/sentinel.conf"]
设置网络环境
networks:
引用外部预先定义好的网段
redis-network:
external:
name: redis-network
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· DeepSeek 开源周回顾「GitHub 热点速览」
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了