反映到程序运行过程如下: redis-sentinel-2 | 1:X 05 Feb 2020 04:55:35.594 * +sentinel sentinel a7c0f682c34f0dd338540fe394ad0548acbf78fd 05 Feb 2020 04:55:35.708 * +slave slave 172.19.0.2:6379 172.19.0.2 6379 @ mymaster 172.19.0.3 6380 redis-sentinel # +sdown sentinel 55b3e9ab3d7135b608a64da0e2dcc29b4ce72518 172.19.0.5 0 @ mymaster 172.19.0.3 6380 redis-sentinel # +sdown sentinel 40c09e7c2c35c48331f9770d06f8b4e9f5a5e560 172.19.0.6 0 @ mymaster 172.19.0.3 6380 redis-sentinel redis/sentinel.conf depends_on: - slave2 sentinel2: image: redis container_name: redis-sentinel
sentinel-slave1从节点 version: '3.7' services: sentinel2: image: redis container_name: redis-sentinel sentinel-slave2从节点 version: '3.7' services: sentinel3: image: redis container_name: redis-sentinel
必须和 Sentinel 配置一致 nodes: -redis-sentinel-0:26379 -redis-sentinel-1:26379 -redis-sentinel "redis://redis-sentinel-1:26379", "redis://redis-sentinel
sentinel1.conf:/usr/local/etc/redis/sentinel.conf sentinel2: image: redis container_name: redis-sentinel docker-entrypoint.s…" 58 minutes ago Up 57 minutes 6379/tcp, 0.0.0.0:26380->26379/tcp redis-sentinel
sentinel.conf ports: - 26379:26379 sentinel2: image: 'redis:5.0.9' container_name: redis-sentinel sentinel.conf ports: - 26379:26379 sentinel2: image: 'redis:5.0.9' container_name: redis-sentinel
docker-entrypoint.s…" 2 hours ago Up 2 hours 6379/tcp, 0.0.0.0:26380->26379/tcp redis-sentinel
sentinel1.conf:/usr/local/etc/redis/sentinel.conf sentinel2: image: redis container_name: redis-sentinel redis-sentinel-2 | 1:X 07 Dec 2020 01:58:05.459 # +sdown master mymaster 172.28.0.3 6379 ...... .....
sentinel1.conf:/usr/local/etc/redis/sentinel.conf sentinel2: image: redis:7.0.4 container_name: redis-sentinel
: - redis-network # Redis 哨兵配置 sentinel-2: image: myredis:latest container_name: redis-sentinel
sentinel.conf ports: - 26379:26379 sentinel2: image: 'redis:5.0.9' container_name: redis-sentinel sentinel.conf ports: - 26379:26379 sentinel2: image: 'redis:5.0.9' container_name: redis-sentinel
sentinel1.conf:/usr/local/etc/redis/sentinel.conf sentinel2: image: redis container_name: redis-sentinel
26379:26379" networks: - default sentinel2: image: 'redis:7.2' container_name: redis-sentinel
比如定义一个名字是Redis-Sentinel的StatefulSet,指定创建三个Pod,那么创建出来的Pod名字就为Redis-Sentinel-0、Redis-Sentinel-1、Redis-Sentinel