我已将Redis前哨配置为具有一个主机和一个从属。 师父和奴隶工作得很好,没有哨兵。但是当我开始哨兵时,母版首先与副本进行同步,然后母版变成其自身的副本。 Master的配置文件也被重写。
# Generated by CONFIG REWRITE
replicaof 10.234.35.240 6379
日志:
1:M 17 Jul 2019 15:51:47.393 * Replica 172.23.1.1:6380 asks for synchronization
1:M 17 Jul 2019 15:51:47.393 * Partial resynchronization not accepted: Replication ID mismatch (Replica asked for 'f10769f8acd415e88bcf08677c64060cd3374b82', my replication IDs are '388713afb5167b2d726b5abc24e9005b8094b357' and '0000000000000000000000000000000000000000')
1:M 17 Jul 2019 15:51:47.393 * Starting BGSAVE for SYNC with target: disk
1:M 17 Jul 2019 15:51:47.394 * Background saving started by pid 18
18:C 17 Jul 2019 15:51:47.397 * DB saved on disk
18:C 17 Jul 2019 15:51:47.397 * RDB: 0 MB of memory used by copy-on-write
1:M 17 Jul 2019 15:51:47.418 * Background saving terminated with success
1:M 17 Jul 2019 15:51:47.426 * Synchronization with replica 172.23.1.1:6380 succeeded
1:S 17 Jul 2019 15:52:35.603 # Connection with replica 172.23.1.1:6380 lost.
1:S 17 Jul 2019 15:52:35.604 * Before turning into a replica, using my master parameters to synthesize a cached master: I may be able to synchronize with the new master with just a partial transfer.
1:S 17 Jul 2019 15:52:35.604 * REPLICAOF 172.23.1.2:6379 enabled (user request from 'id=7 addr=172.23.1.1:33574 fd=11 name=sentinel-9d32796d-cmd age=10 idle=0 flags=x db=0 sub=0 psub=0 multi=3 qbuf=150 qbuf-free=32618 obl=36 oll=0 omem=0 events=r cmd=exec')
1:S 17 Jul 2019 15:52:35.610 # CONFIG REWRITE executed with success.
1:S 17 Jul 2019 15:52:35.997 * Connecting to MASTER 172.23.1.2:6379
1:S 17 Jul 2019 15:52:35.998 * MASTER <-> REPLICA sync started
1:S 17 Jul 2019 15:52:35.998 * Non blocking connect for SYNC fired the event.
1:S 17 Jul 2019 15:52:35.998 * Master replied to PING, replication can continue...
1:S 17 Jul 2019 15:52:35.998 * (Non critical) Master does not understand REPLCONF listening-port: -NOAUTH Authentication required.
1:S 17 Jul 2019 15:52:35.998 * (Non critical) Master does not understand REPLCONF capa: -NOAUTH Authentication required.
1:S 17 Jul 2019 15:52:35.998 * Trying a partial resynchronization (request 2a9a86780e1956452a0f4ebd194236c2596a6c9b:1152).
1:S 17 Jul 2019 15:52:35.998 # Unexpected reply to PSYNC from master: -NOAUTH Authentication required.
1:S 17 Jul 2019 15:52:35.998 * Discarding previously cached master state.
1:S 17 Jul 2019 15:52:35.998 * Retrying with SYNC...
1:S 17 Jul 2019 15:52:36.001 # MASTER aborted replication with an error: NOAUTH Authentication required.
这是我的问题Official website的正式解决方案,我使用以下命令设置了哨兵的配置,但它不起作用。
sentinel announce-ip 10.234.35.240
sentinel announce-port 6379
docker composefile
version: "3"
services:
fixredis-master:
image: redis:5.0.5
container_name: fixredismaster
ports:
- "6379:6379"
environment:
TZ: Asia/Tokyo
command: redis-server /usr/local/etc/redis/redis.conf
volumes:
- ./my/redis/config/redis.conf:/usr/local/etc/redis/redis.conf
- ./my/redis/data:/data
networks:
docker_bridge1:
ipv4_address: 172.23.1.2
fixredis-slave1:
image: redis:5.0.5
container_name: fixrediss1
ports:
- "6380:6379"
environment:
TZ: Asia/Tokyo
command: redis-server /usr/local/etc/redis/redis.conf
volumes:
- ./my/redis/config/redis_6380.conf:/usr/local/etc/redis/redis.conf
- ./my/redis/data:/data
networks:
docker_bridge1:
ipv4_address: 172.23.1.3
sentinel1:
image: redis:5.0.5
container_name: redissentinel1
command: redis-sentinel /usr/local/etc/redis/sentinel.conf
ports:
- "26379:26379"
volumes:
- ./my/redis/config/sentinelconfig/sentinel1.conf:/usr/local/etc/redis/sentinel.conf
- ./my/redis/data/sentinel:/data
networks:
docker_bridge1:
ipv4_address: 172.23.1.4
volumes:
redis-data:
driver: local
networks:
docker_bridge1:
driver: bridge
ipam:
config:
- subnet: 172.23.1.0/24