docker配redis主从Failed load the MASTER synchronization DB from..
docker里配了下redis的主从
配置也是很简单,slave似乎重复复制(出错了还在返回重试)
docker-compose
version: '3'
services:
redis-master:
image: redis:3.2.12-alpine
volumes:
- ./master/redis.conf:/usr/local/etc/redis/redis.conf
- ./master/data:/tmp
ports:
- 6455:6455
command: [ "redis-server", "/usr/local/etc/redis/redis.conf" ]
redis-slave:
image: redis:3.2.12-alpine
depends_on:
- redis-master
volumes:
- ./slave/redis.conf:/usr/local/etc/redis/redis.conf
- ./slave/data:/tmp
ports:
- 6458:6458
command: [ "redis-server", "/usr/local/etc/redis/redis.conf" ]
master/redis.conf
bind 0.0.0.0
protected-mode no
port 6455
tcp-backlog 511
timeout 0
tcp-keepalive 300
daemonize no
supervised no
pidfile /var/run/redis_6379.pid
loglevel notice
logfile ""
databases 16
save 900 1
save 300 10
save 60 10000
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
dir /tmp
appendonly yes
appendfilename "data.aof"
slave/redis.conf
bind 0.0.0.0
protected-mode no
port 6458
tcp-backlog 511
timeout 0
tcp-keepalive 300
daemonize no
supervised no
pidfile /var/run/redis_6379.pid
loglevel notice
logfile ""
databases 16
save 900 1
save 300 10
save 60 10000
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
dir /tmp
appendonly yes
appendfilename "data.aof"
slaveof redis-master 6455
结果
17:C 26 Jul 08:00:11.973 * DB saved on disk
redis-master_1 | 17:C 26 Jul 08:00:11.974 * RDB: 0 MB of memory used by copy-on-write
redis-master_1 | 1:M 26 Jul 08:00:12.074 * Background saving terminated with success
redis-slave_1 | 1:S 26 Jul 08:00:12.075 * MASTER <-> SLAVE sync: receiving 77 bytes from master
redis-master_1 | 1:M 26 Jul 08:00:12.076 * Synchronization with slave 172.21.0.3:6458 succeeded
redis-slave_1 | 1:S 26 Jul 08:00:12.080 * MASTER <-> SLAVE sync: Flushing old data
redis-slave_1 | 1:S 26 Jul 08:00:12.080 * MASTER <-> SLAVE sync: Loading DB in memory
redis-slave_1 | 1:S 26 Jul 08:00:12.080 # Failed trying to load the MASTER synchronization DB from disk
redis-master_1 | 1:M 26 Jul 08:00:12.081 # Connection with slave 172.21.0.3:6458 lost.
同步失败了,Failed trying to load the MASTER synchronization DB from disk
,然后slave又不断在重试,有人遇到过嘛??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
遇到了同样的问题, win10 的docker 下主从失败不停重试, 报
Failed trying to load the MASTER synchronization DB from disk
有趣的是, 当我再开一个slave 并且把rdb 路径设置和slave_1 相同时, 就特么成功了
Failed trying to load the MASTER synchronization DB from disk
我遇到这样的问题 是因为主从的版本不一致
现在我也遇到了这个问题,我发现是从机volume data卷的问题。 如果使用匿名卷,不bind到宿主机就是对的。但是我又想使用命名卷 目前还没有找到方法。