Der Redis-Slave wird nicht mit dem Master synchronisiert.
Ich kann mich bei der Ausgabe mit dem Master verbinden
Host_NAME=fakehost
redis-cli -h $Host_NAME
Überprüfen Sie den Master-Status mit einem Befehl wie INFO
, sodass Konnektivität kein Problem darstellt.
Aus der Sklavenbox habe ich ausgegeben
SLAVEOF $Host_NAME 6379
Und erhielt eine OK
.
Wenn ich den Befehl INFO
auf dem Slave ausstelle, bekomme ich
# Replication
role:slave
master_Host:<removed>
master_port:6379
master_link_status:down
master_last_io_seconds_ago:-1
master_sync_in_progress:0
master_link_down_since_seconds:1379450797
slave_priority:100
slave_read_only:1
connected_slaves:0
Auf der Master-Box gebe ich info
ab und bekomme
# Replication
role:master
connected_slaves:0
Also bin ich offensichtlich nicht verbunden.
[11225] 17 Sep 14:31:33.225 * Connecting to MASTER...
[11225] 17 Sep 14:31:33.226 * MASTER <-> SLAVE sync started
[11225] 17 Sep 14:31:33.226 * Non blocking connect for SYNC fired the event.
[11225] 17 Sep 14:31:33.226 * Master replied to PING, replication can continue...
[11225] 17 Sep 14:31:33.227 # MASTER aborted replication with an error: ERR Unable to perform background save
Testen Sie, dass dump.rdb auf BGSAVE erstellt wird
BGSAVE
> OK
Testen Sie, dass dump.rdb auf SAVE erstellt wird
SAVE
> OK
Danke im Voraus.
Ich bin heute einer ähnlichen Situation begegnet. Anscheinend müssen Sie für Systeme, die sysctl
verwenden, Folgendes tun:
sysctl vm.overcommit_memory=1
und starten Sie den Slave-Redis-Server neu. Dieser Link könnte helfen.
Diese Ausgabe ist etwas knifflig,
der Grund, aus dem der Slave nicht synchronisieren kann, liegt im Master selbst.
achten Sie auf die Protokollausgabe: MASTERReplikation mit Fehler abgebrochen: ERR Hintergrundspeicherung nicht möglich
dies bedeutet, dass der Master aufgrund einer geringen Speicherreserve auf dem Master-Rechner keine Hintergrundspeicherung durchführen kann
um dieses Problem zu lösen, habe ich den Master-Redis-Server neu gestartet. . Alle Slaves wurden von sich selbst synchronisiert.
Ich habe das gleiche Problem gefunden und mein Grund ist, dass meine Server nicht denselben redis version
verwenden. Lassen Sie uns Ihre Version auf beiden Servern überprüfen:
127.0.0.1:6379> info server
# Server
redis_version:3.2.8
Für mich war es, weil ich requirepass
gesetzt hatte, aber keine masterauth
-Einstellung gesetzt hatte.
meine Standardeinstellungen in redis.conf haben requirepass aktiviert, das Ausführen von "masterauth [passwordOfMaster]" im Slave-Terminal vor "SLAVEOF" behebt dieses Problem.
In meinem Fall hatte es mit SELINUX zu tun, das Ändern des Modus in den zulässigen Modus löste das Problem.
Ich habe folgendes korrigiert :
Sudo -i
service redis-server stop
apt remove --purge redis-server
rm /var/lib/redis/dump.rdb
apt install redis-server
systemctl enable redis-server
service redis-server start
# i have not tried, but it is possible this is enough
service redis-server stop
rm /var/lib/redis/dump.rdb
service redis-server start
Ich habe festgestellt, dass der geschützte Modus aktiviert ist, als ich versuchte, ihn mit Redis 5.0.5 einzurichten. Als ich mich beim mutmaßlichen Master über dessen eth0-Schnittstelle angemeldet habe (im Gegensatz zum Loopback- oder UNIX-Socket), wurde folgende Meldung angezeigt, als ich versuchte, "INFO" auszuführen:
IP_ADDRESS_REDACTED:6379> info
DENIED Redis is running in protected mode because protected mode is
enabled, no bind address was specified, no authentication password
is requested to clients. In this mode connections are only accepted
from the loopback interface. If you want to connect from external
computers to Redis you may adopt one of the following solutions:
1) Just disable protected mode sending the command 'CONFIG SET
protected-mode no' from the loopback interface by connecting to Redis
from the same Host the server is running, however MAKE SURE Redis is
not publicly accessible from internet if you do so. Use CONFIG REWRITE
to make this change permanent. 2) Alternatively you can just disable
the protected mode by editing the Redis configuration file, and
setting the protected mode option to 'no', and then restarting the
server. 3) If you started the server manually just for testing,
restart it with the '--protected-mode no' option. 4) Setup a bind
address or an authentication password. NOTE: You only need to do one
of the above things in order for the server to start accepting
connections from the outside.
Ich befolgte die Anweisungen und der Sklave schloss sich sofort an.