之后启动容器,如果出现 Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf 日志,说明没有使用挂载到容器上的配置文件:
1 2 3 4 5 6 7 8
$ docker compose up [+] Running 2/2 ✔ Network redis-single-net Created 0.0s ✔ Container redis-single Created 0.1s Attaching to redis-single redis-single | 1:C 09 Oct 2024 06:05:24.554 * oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo redis-single | 1:C 09 Oct 2024 06:05:24.554 * Redis version=7.4.1, bits=64, commit=00000000, modified=0, pid=1, just started redis-single | 1:C 09 Oct 2024 06:05:24.554 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
如果使用了绑定挂载的配置文件,日志打印输出如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
$ docker compose up [+] Running 2/2 ✔ Network redis-single-net Created 0.0s ✔ Container redis-single Created 0.1s Attaching to redis-single redis-single | 1:C 09 Oct 2024 06:56:20.246 * oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo redis-single | 1:C 09 Oct 2024 06:56:20.246 * Redis version=7.4.1, bits=64, commit=00000000, modified=0, pid=1, just started redis-single | 1:C 09 Oct 2024 06:56:20.246 * Configuration loaded redis-single | 1:M 09 Oct 2024 06:56:20.246 * monotonic clock: POSIX clock_gettime redis-single | 1:M 09 Oct 2024 06:56:20.247 # Failed to write PID file: Permission denied redis-single | 1:M 09 Oct 2024 06:56:20.247 * Running mode=standalone, port=6379. redis-single | 1:M 09 Oct 2024 06:56:20.247 * Server initialized redis-single | 1:M 09 Oct 2024 06:56:20.247 * Loading RDB produced by version 7.4.1 redis-single | 1:M 09 Oct 2024 06:56:20.247 * RDB age 188 seconds redis-single | 1:M 09 Oct 2024 06:56:20.247 * RDB memory usage when created 1.14 Mb redis-single | 1:M 09 Oct 2024 06:56:20.247 * Done loading RDB, keys loaded: 0, keys expired: 0. redis-single | 1:M 09 Oct 2024 06:56:20.247 * DB loaded from disk: 0.000 seconds redis-single | 1:M 09 Oct 2024 06:56:20.247 * Ready to accept connections tcp
进入容器,执行 redis 命令:
1 2 3 4 5 6 7 8 9 10 11 12
$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 718f9724f472 redis:7.4-bookworm "docker-entrypoint.s…" 46 seconds ago Up 45 seconds 0.0.0.0:6379->6379/tcp redis-single $ docker exec -it 718f9724f472 /bin/bash
root@redis-single:/data# redis-cli -h 127.0.0.1 -p 6379 -a yourpassword Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe. 127.0.0.1:6379> set "key" "value" OK 127.0.0.1:6379> get "key" "value"
2024-10-10 14:32:34 1:C 10 Oct 2024 06:32:34.618 * oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo 2024-10-10 14:32:34 1:C 10 Oct 2024 06:32:34.618 * Redis version=7.4.1, bits=64, commit=00000000, modified=0, pid=1, just started 2024-10-10 14:32:34 1:C 10 Oct 2024 06:32:34.618 * Configuration loaded 2024-10-10 14:32:34 1:S 10 Oct 2024 06:32:34.618 * monotonic clock: POSIX clock_gettime 2024-10-10 14:32:34 1:S 10 Oct 2024 06:32:34.618 # Failed to write PID file: Permission denied 2024-10-10 14:32:34 1:S 10 Oct 2024 06:32:34.618 * Running mode=standalone, port=6379. 2024-10-10 14:32:34 1:S 10 Oct 2024 06:32:34.618 * Server initialized 2024-10-10 14:32:34 1:S 10 Oct 2024 06:32:34.618 * Ready to accept connections tcp 2024-10-10 14:32:34 1:S 10 Oct 2024 06:32:34.620 * Connecting to MASTER redis-master:6379 2024-10-10 14:32:34 1:S 10 Oct 2024 06:32:34.620 * MASTER <-> REPLICA sync started 2024-10-10 14:32:35 1:S 10 Oct 2024 06:32:35.657 * Non blocking connect for SYNC fired the event. 2024-10-10 14:32:35 1:S 10 Oct 2024 06:32:35.657 * Master replied to PING, replication can continue... 2024-10-10 14:32:35 1:S 10 Oct 2024 06:32:35.658 * Partial resynchronization not possible (no cached master) 2024-10-10 14:32:40 1:S 10 Oct 2024 06:32:40.690 * Full resync from master: 439d1a536f0cefb6980f59ef88f49e2e48cd0f2c:0 2024-10-10 14:32:40 1:S 10 Oct 2024 06:32:40.691 * MASTER <-> REPLICA sync: receiving streamed RDB from master with EOF to disk 2024-10-10 14:32:40 1:S 10 Oct 2024 06:32:40.691 * MASTER <-> REPLICA sync: Flushing old data 2024-10-10 14:32:40 1:S 10 Oct 2024 06:32:40.691 * MASTER <-> REPLICA sync: Loading DB in memory 2024-10-10 14:32:40 1:S 10 Oct 2024 06:32:40.699 * Loading RDB produced by version 7.4.1 2024-10-10 14:32:40 1:S 10 Oct 2024 06:32:40.699 * RDB age 0 seconds 2024-10-10 14:32:40 1:S 10 Oct 2024 06:32:40.699 * RDB memory usage when created 0.98 Mb 2024-10-10 14:32:40 1:S 10 Oct 2024 06:32:40.699 * Done loading RDB, keys loaded: 0, keys expired: 0. 2024-10-10 14:32:40 1:S 10 Oct 2024 06:32:40.699 * MASTER <-> REPLICA sync: Finished with success
在主节点新增字符串类型的键值对。
1 2 3 4
$ set"name""zyz" "OK" $ get name "zyadz"
在从节点中查询刚才设置的字符串。
1 2
$ get name "zyadz"
关于调用 redis-cli 的方式,可以选择直接进入容器:
1 2 3 4 5 6 7 8 9 10 11 12
$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 718f9724f472 redis:7.4-bookworm "docker-entrypoint.s…" 46 seconds ago Up 45 seconds 0.0.0.0:6379->6379/tcp redis-single $ docker exec -it 718f9724f472 /bin/bash
root@redis-single:/data# redis-cli -h 127.0.0.1 -p 6379 -a yourpassword Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe. 127.0.0.1:6379> set "name" "zyz" OK 127.0.0.1:6379> get "name" "zyadz"
2024-10-10 14:17:19 1:C 10 Oct 2024 06:17:19.299 * oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo 2024-10-10 14:17:19 1:C 10 Oct 2024 06:17:19.299 * Redis version=7.4.1, bits=64, commit=00000000, modified=0, pid=1, just started 2024-10-10 14:17:19 1:C 10 Oct 2024 06:17:19.299 * Configuration loaded 2024-10-10 14:17:19 1:S 10 Oct 2024 06:17:19.299 * monotonic clock: POSIX clock_gettime 2024-10-10 14:17:19 1:S 10 Oct 2024 06:17:19.299 # Failed to write PID file: Permission denied 2024-10-10 14:17:19 1:S 10 Oct 2024 06:17:19.299 * Running mode=standalone, port=6379. 2024-10-10 14:17:19 1:S 10 Oct 2024 06:17:19.299 * Server initialized 2024-10-10 14:17:19 1:S 10 Oct 2024 06:17:19.300 * Loading RDB produced by version 7.4.1 2024-10-10 14:17:19 1:S 10 Oct 2024 06:17:19.300 * RDB age 13 seconds 2024-10-10 14:17:19 1:S 10 Oct 2024 06:17:19.300 * RDB memory usage when created 1.28 Mb 2024-10-10 14:17:19 1:S 10 Oct 2024 06:17:19.300 * Done loading RDB, keys loaded: 1, keys expired: 0. 2024-10-10 14:17:19 1:S 10 Oct 2024 06:17:19.300 * DB loaded from disk: 0.000 seconds 2024-10-10 14:17:19 1:S 10 Oct 2024 06:17:19.300 * Before turning into a replica, using my own master parameters to synthesize a cached master: I may be able to synchronize with the new master with just a partial transfer. 2024-10-10 14:17:19 1:S 10 Oct 2024 06:17:19.300 * Ready to accept connections tcp 2024-10-10 14:17:19 1:S 10 Oct 2024 06:17:19.301 * Connecting to MASTER redis-master:6379 2024-10-10 14:17:19 1:S 10 Oct 2024 06:17:19.302 * MASTER <-> REPLICA sync started 2024-10-10 14:17:20 1:S 10 Oct 2024 06:17:20.365 * Non blocking connect for SYNC fired the event. 2024-10-10 14:17:20 1:S 10 Oct 2024 06:17:20.365 * Master replied to PING, replication can continue... 2024-10-10 14:17:20 1:S 10 Oct 2024 06:17:20.365 * Trying a partial resynchronization (request 4e188d217af6bd6171cdd17616a7ea6e6d7cab7d:8471). 2024-10-10 14:17:20 1:S 10 Oct 2024 06:17:20.365 * Successful partial resynchronization with master. 2024-10-10 14:17:20 1:S 10 Oct 2024 06:17:20.365 * Master replication ID changed to 2655da29ca3bd66b6b355bea39ee70bbf3fec2f7 2024-10-10 14:17:20 1:S 10 Oct 2024 06:17:20.365 * MASTER <-> REPLICA sync: Master accepted a Partial Resynchronization.
redis.clients.jedis.exceptions.JedisDataException: READONLY You can't write against a read only replica.
at redis.clients.jedis.Protocol.processError(Protocol.java:105) at redis.clients.jedis.Protocol.process(Protocol.java:162) at redis.clients.jedis.Protocol.read(Protocol.java:221) at redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:351) at redis.clients.jedis.Connection.getOne(Connection.java:333) at redis.clients.jedis.Connection.executeCommand(Connection.java:138) at redis.clients.jedis.Jedis.set(Jedis.java:4893) at cn.hutool.db.nosql.redis.RedisDS.setStr(RedisDS.java:170) at cn.z2huo.demo.redis.hutool.masterslave.MasterSlaveTest.slaveWrite(MasterSlaveTest.java:40) at cn.z2huo.demo.redis.hutool.masterslave.MasterSlaveTestTest.slaveWrite(MasterSlaveTestTest.java:32) at java.base/java.lang.reflect.Method.invoke(Method.java:580) at java.base/java.util.ArrayList.forEach(ArrayList.java:1596) at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
2024-10-14 17:58:01 16:C 14 Oct 2024 09:58:01.215 * oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo 2024-10-14 17:58:01 16:C 14 Oct 2024 09:58:01.215 * Redis version=7.4.1, bits=64, commit=00000000, modified=0, pid=16, just started 2024-10-14 17:58:01 16:C 14 Oct 2024 09:58:01.215 * Configuration loaded 2024-10-14 17:58:01 16:S 14 Oct 2024 09:58:01.216 * monotonic clock: POSIX clock_gettime 2024-10-14 17:58:01 16:S 14 Oct 2024 09:58:01.216 * Running mode=standalone, port=6379. 2024-10-14 17:58:01 16:S 14 Oct 2024 09:58:01.216 * Server initialized 2024-10-14 17:58:01 16:S 14 Oct 2024 09:58:01.216 * Loading RDB produced by version 7.4.1 2024-10-14 17:58:01 16:S 14 Oct 2024 09:58:01.216 * RDB age 801 seconds 2024-10-14 17:58:01 16:S 14 Oct 2024 09:58:01.216 * RDB memory usage when created 1.25 Mb 2024-10-14 17:58:01 16:S 14 Oct 2024 09:58:01.216 * Done loading RDB, keys loaded: 0, keys expired: 0. 2024-10-14 17:58:01 16:S 14 Oct 2024 09:58:01.216 * DB loaded from disk: 0.000 seconds 2024-10-14 17:58:01 16:S 14 Oct 2024 09:58:01.216 * Before turning into a replica, using my own master parameters to synthesize a cached master: I may be able to synchronize with the new master with just a partial transfer. 2024-10-14 17:58:01 16:S 14 Oct 2024 09:58:01.216 * Ready to accept connections tcp 2024-10-14 17:58:01 16:S 14 Oct 2024 09:58:01.218 * Connecting to MASTER 172.21.0.2:6379 2024-10-14 17:58:01 16:S 14 Oct 2024 09:58:01.218 * MASTER <-> REPLICA sync started 2024-10-14 17:58:01 16:S 14 Oct 2024 09:58:01.218 # Error condition on socket for SYNC: Connection refused 2024-10-14 17:58:02 16:S 14 Oct 2024 09:58:02.221 * Connecting to MASTER 172.21.0.2:6379 2024-10-14 17:58:02 16:S 14 Oct 2024 09:58:02.221 * MASTER <-> REPLICA sync started 2024-10-14 17:58:02 16:S 14 Oct 2024 09:58:02.221 * Non blocking connect for SYNC fired the event. 2024-10-14 17:58:02 16:S 14 Oct 2024 09:58:02.221 * Master replied to PING, replication can continue... 2024-10-14 17:58:02 16:S 14 Oct 2024 09:58:02.221 * Trying a partial resynchronization (request c9c7d9bec6f93681d73c36dacfd810430f7d3954:1012872). 2024-10-14 17:58:07 16:S 14 Oct 2024 09:58:07.357 * Full resync from master: a4c4b7ad56f8c6c962bb4ce20b62f5ccc133df22:1012871 2024-10-14 17:58:07 16:S 14 Oct 2024 09:58:07.358 * MASTER <-> REPLICA sync: receiving streamed RDB from master with EOF to disk 2024-10-14 17:58:07 16:S 14 Oct 2024 09:58:07.358 * Discarding previously cached master state. 2024-10-14 17:58:07 16:S 14 Oct 2024 09:58:07.358 * MASTER <-> REPLICA sync: Flushing old data 2024-10-14 17:58:07 16:S 14 Oct 2024 09:58:07.358 * MASTER <-> REPLICA sync: Loading DB in memory 2024-10-14 17:58:07 16:S 14 Oct 2024 09:58:07.377 * Loading RDB produced by version 7.4.1 2024-10-14 17:58:07 16:S 14 Oct 2024 09:58:07.377 * RDB age 0 seconds 2024-10-14 17:58:07 16:S 14 Oct 2024 09:58:07.377 * RDB memory usage when created 1.25 Mb 2024-10-14 17:58:07 16:S 14 Oct 2024 09:58:07.377 * Done loading RDB, keys loaded: 0, keys expired: 0. 2024-10-14 17:58:07 16:S 14 Oct 2024 09:58:07.377 * MASTER <-> REPLICA sync: Finished with success
2024-10-14 17:58:02 16:X 14 Oct 2024 09:58:02.017 * oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo 2024-10-14 17:58:02 16:X 14 Oct 2024 09:58:02.017 * Redis version=7.4.1, bits=64, commit=00000000, modified=0, pid=16, just started 2024-10-14 17:58:02 16:X 14 Oct 2024 09:58:02.017 * Configuration loaded 2024-10-14 17:58:02 16:X 14 Oct 2024 09:58:02.017 * monotonic clock: POSIX clock_gettime 2024-10-14 17:58:02 16:X 14 Oct 2024 09:58:02.017 * Running mode=sentinel, port=26379. 2024-10-14 17:58:02 16:X 14 Oct 2024 09:58:02.025 # Could not rename tmp config file (Device or resource busy) 2024-10-14 17:58:02 16:X 14 Oct 2024 09:58:02.025 # WARNING: Sentinel was not able to save the new configuration on disk!!!: Device or resource busy 2024-10-14 17:58:02 16:X 14 Oct 2024 09:58:02.025 * Sentinel ID is 82925708c40c814dadc6ead02a5aa8408526b5d3 2024-10-14 17:58:02 16:X 14 Oct 2024 09:58:02.025 # +monitor master redis-master 172.21.0.2 6379 quorum 2 2024-10-14 17:58:03 16:X 14 Oct 2024 09:58:03.827 * +sentinel sentinel 3ac66162d1056bbf9ac9a6bc54060ae7a141eb74 172.21.0.203 26379 @ redis-master 172.21.0.2 6379 2024-10-14 17:58:03 16:X 14 Oct 2024 09:58:03.839 # Could not rename tmp config file (Device or resource busy) 2024-10-14 17:58:03 16:X 14 Oct 2024 09:58:03.839 # WARNING: Sentinel was not able to save the new configuration on disk!!!: Device or resource busy 2024-10-14 17:58:03 16:X 14 Oct 2024 09:58:03.935 * +sentinel sentinel e75619eb9879f9f8c3c3188691eca1d81a0c472f 172.21.0.202 26379 @ redis-master 172.21.0.2 6379 2024-10-14 17:58:03 16:X 14 Oct 2024 09:58:03.947 # Could not rename tmp config file (Device or resource busy) 2024-10-14 17:58:03 16:X 14 Oct 2024 09:58:03.947 # WARNING: Sentinel was not able to save the new configuration on disk!!!: Device or resource busy 2024-10-14 17:58:12 16:X 14 Oct 2024 09:58:12.054 * +slave slave 172.21.0.4:6379 172.21.0.4 6379 @ redis-master 172.21.0.2 6379 2024-10-14 17:58:12 16:X 14 Oct 2024 09:58:12.063 # Could not rename tmp config file (Device or resource busy) 2024-10-14 17:58:12 16:X 14 Oct 2024 09:58:12.063 # WARNING: Sentinel was not able to save the new configuration on disk!!!: Device or resource busy 2024-10-14 17:58:12 16:X 14 Oct 2024 09:58:12.063 * +slave slave 172.21.0.3:6379 172.21.0.3 6379 @ redis-master 172.21.0.2 6379 2024-10-14 17:58:12 16:X 14 Oct 2024 09:58:12.071 # Could not rename tmp config file (Device or resource busy) 2024-10-14 17:58:12 16:X 14 Oct 2024 09:58:12.071 # WARNING: Sentinel was not able to save the new configuration on disk!!!: Device or resource busy
2024-10-14 18:00:01 16:X 14 Oct 2024 10:00:01.158 # Could not rename tmp config file (Device or resource busy) 2024-10-14 18:00:01 16:X 14 Oct 2024 10:00:01.158 # WARNING: Sentinel was not able to save the new configuration on disk!!!: Device or resource busy 2024-10-14 18:00:01 16:X 14 Oct 2024 10:00:01.158 # +new-epoch 1 2024-10-14 18:00:01 16:X 14 Oct 2024 10:00:01.166 # Could not rename tmp config file (Device or resource busy) 2024-10-14 18:00:01 16:X 14 Oct 2024 10:00:01.166 # WARNING: Sentinel was not able to save the new configuration on disk!!!: Device or resource busy 2024-10-14 18:00:01 16:X 14 Oct 2024 10:00:01.166 # +vote-for-leader e75619eb9879f9f8c3c3188691eca1d81a0c472f 1 2024-10-14 18:00:02 16:X 14 Oct 2024 10:00:02.019 # +sdown master redis-master 172.21.0.2 6379 2024-10-14 18:00:02 16:X 14 Oct 2024 10:00:02.102 # +odown master redis-master 172.21.0.2 6379 #quorum 3/2 2024-10-14 18:00:02 16:X 14 Oct 2024 10:00:02.102 * Next failover delay: I will not start a failover before Mon Oct 14 10:06:01 2024 2024-10-14 18:00:02 16:X 14 Oct 2024 10:00:02.210 # +config-update-from sentinel e75619eb9879f9f8c3c3188691eca1d81a0c472f 172.21.0.202 26379 @ redis-master 172.21.0.2 6379 2024-10-14 18:00:02 16:X 14 Oct 2024 10:00:02.210 # +switch-master redis-master 172.21.0.2 6379 172.21.0.3 6379 2024-10-14 18:00:02 16:X 14 Oct 2024 10:00:02.210 * +slave slave 172.21.0.4:6379 172.21.0.4 6379 @ redis-master 172.21.0.3 6379 2024-10-14 18:00:02 16:X 14 Oct 2024 10:00:02.210 * +slave slave 172.21.0.2:6379 172.21.0.2 6379 @ redis-master 172.21.0.3 6379 2024-10-14 18:00:02 16:X 14 Oct 2024 10:00:02.219 # Could not rename tmp config file (Device or resource busy) 2024-10-14 18:00:02 16:X 14 Oct 2024 10:00:02.219 # WARNING: Sentinel was not able to save the new configuration on disk!!!: Device or resource busy 2024-10-14 18:00:05 16:X 14 Oct 2024 10:00:05.289 # +sdown slave 172.21.0.2:6379 172.21.0.2 6379 @ redis-master 172.21.0.3 6379 2024-10-14 18:35:25 16:X 14 Oct 2024 10:35:25.222 # +tilt #tilt mode entered 2024-10-14 18:35:55 16:X 14 Oct 2024 10:35:55.296 # -tilt #tilt mode exited
2024-10-18 01:12:27 16:M 17 Oct 2024 17:12:27.605 * configEpoch set to 1 via CLUSTER SET-CONFIG-EPOCH 2024-10-18 01:12:28 16:M 17 Oct 2024 17:12:28.637 * Replica 192.168.65.1:6379 asks for synchronization 2024-10-18 01:12:28 16:M 17 Oct 2024 17:12:28.637 * Partial resynchronization not accepted: Replication ID mismatch (Replica asked for '67b3e36c7e56d0060096aa0c7df45d90588c1891', my replication IDs are '5134795e887fceda73a6c40a49349e94ba8c872c' and '0000000000000000000000000000000000000000') 2024-10-18 01:12:28 16:M 17 Oct 2024 17:12:28.637 * Replication backlog created, my new replication IDs are '0932a6740161a99749ae4c5d1b5ec3d91bf00e30' and '0000000000000000000000000000000000000000' 2024-10-18 01:12:28 16:M 17 Oct 2024 17:12:28.637 * Delay next BGSAVE for diskless SYNC 2024-10-18 01:12:28 16:M 17 Oct 2024 17:12:28.651 * Replica 192.168.65.1:6379 asks for synchronization 2024-10-18 01:12:28 16:M 17 Oct 2024 17:12:28.651 * Partial resynchronization not accepted: Replication ID mismatch (Replica asked for 'fccb064385e684753d063dbed416ea4309b7141b', my replication IDs are '0932a6740161a99749ae4c5d1b5ec3d91bf00e30' and '0000000000000000000000000000000000000000') 2024-10-18 01:12:28 16:M 17 Oct 2024 17:12:28.651 * Delay next BGSAVE for diskless SYNC 2024-10-18 01:12:28 16:M 17 Oct 2024 17:12:28.960 * Node ad79649ca4cc9222cee027be59812477f6e736ab () is no longer master of shard 342bd7d99314e6f6bead1cdecfde9af5cf75567c; removed all 0 slot(s) it used to own 2024-10-18 01:12:28 16:M 17 Oct 2024 17:12:28.960 * Node ad79649ca4cc9222cee027be59812477f6e736ab () is now part of shard def9b383c18f2779a2867ebb2e48a7a2f043411f 2024-10-18 01:12:30 16:M 17 Oct 2024 17:12:30.186 * Node 9c15644cc327af377abb6db6f0cd6595f322ef9f () is no longer master of shard 45bcbb94a91c3fd1d867a60f3b8cb665ee9a1fab; removed all 0 slot(s) it used to own 2024-10-18 01:12:30 16:M 17 Oct 2024 17:12:30.186 * Node 9c15644cc327af377abb6db6f0cd6595f322ef9f () is now part of shard def9b383c18f2779a2867ebb2e48a7a2f043411f 2024-10-18 01:12:30 16:M 17 Oct 2024 17:12:30.187 * Node 7203cc4f0874ecbb81025c30a0c9336b4f10df8d () is no longer master of shard 44827437b7474050f985f2e7562b5b0f557526f8; removed all 0 slot(s) it used to own 2024-10-18 01:12:30 16:M 17 Oct 2024 17:12:30.187 * Node 7203cc4f0874ecbb81025c30a0c9336b4f10df8d () is now part of shard 47b02087ea475a99443be252282038f6298ca388 2024-10-18 01:12:30 16:M 17 Oct 2024 17:12:30.998 * Node 5dab82fb367c00a2f338bbc96f35ac9ecccc401a () is no longer master of shard 0b52e8e41d1497457e4a69f285826b3a9cdbec32; removed all 0 slot(s) it used to own 2024-10-18 01:12:30 16:M 17 Oct 2024 17:12:30.999 * Node 5dab82fb367c00a2f338bbc96f35ac9ecccc401a () is now part of shard 47b02087ea475a99443be252282038f6298ca388 2024-10-18 01:12:31 16:M 17 Oct 2024 17:12:31.101 * Node 86fcf35973686e9b0d73b84da5c06a4d356a6aca () is no longer master of shard f36d165b2f4e61894e1d431bb96e8b1e738dd97a; removed all 0 slot(s) it used to own 2024-10-18 01:12:31 16:M 17 Oct 2024 17:12:31.101 * Node 86fcf35973686e9b0d73b84da5c06a4d356a6aca () is now part of shard d6d9be9f6c00e617c575e9fe7653a606e1382db9 2024-10-18 01:12:32 16:M 17 Oct 2024 17:12:32.630 * Cluster state changed: ok 2024-10-18 01:12:33 16:M 17 Oct 2024 17:12:33.249 * Node ee5c7f165b1bc578371424724e0bfa35815aaa3c () is no longer master of shard 1f007dd8d56b32bd3bf8a785a9017e025b8d1fac; removed all 0 slot(s) it used to own 2024-10-18 01:12:33 16:M 17 Oct 2024 17:12:33.249 * Node ee5c7f165b1bc578371424724e0bfa35815aaa3c () is now part of shard d6d9be9f6c00e617c575e9fe7653a606e1382db9 2024-10-18 01:12:33 16:M 17 Oct 2024 17:12:33.346 * Starting BGSAVE for SYNC with target: replicas sockets 2024-10-18 01:12:33 16:M 17 Oct 2024 17:12:33.347 * Background RDB transfer started by pid 33 2024-10-18 01:12:33 33:C 17 Oct 2024 17:12:33.348 * Fork CoW for RDB: current 0 MB, peak 0 MB, average 0 MB 2024-10-18 01:12:33 16:M 17 Oct 2024 17:12:33.348 * Diskless rdb transfer, done reading from pipe, 2 replicas still up. 2024-10-18 01:12:33 16:M 17 Oct 2024 17:12:33.356 * Background RDB transfer terminated with success 2024-10-18 01:12:33 16:M 17 Oct 2024 17:12:33.357 * Streamed RDB transfer with replica 192.168.65.1:6379 succeeded (socket). Waiting for REPLCONF ACK from replica to enable streaming 2024-10-18 01:12:33 16:M 17 Oct 2024 17:12:33.357 * Synchronization with replica 192.168.65.1:6379 succeeded 2024-10-18 01:12:33 16:M 17 Oct 2024 17:12:33.357 * Streamed RDB transfer with replica 192.168.65.1:6379 succeeded (socket). Waiting for REPLCONF ACK from replica to enable streaming 2024-10-18 01:12:33 16:M 17 Oct 2024 17:12:33.357 * Synchronization with replica 192.168.65.1:6379 succeeded
2024-10-18 01:12:27 15:M 17 Oct 2024 17:12:27.606 * configEpoch set to 2 via CLUSTER SET-CONFIG-EPOCH 2024-10-18 01:12:28 15:M 17 Oct 2024 17:12:28.649 * Replica 192.168.65.1:6379 asks for synchronization 2024-10-18 01:12:28 15:M 17 Oct 2024 17:12:28.649 * Partial resynchronization not accepted: Replication ID mismatch (Replica asked for 'c3c729a09166a36559fda6ca4cd91e04e547fd06', my replication IDs are 'bff3cfc5fc372b8abe6749762c74bf6a0c88eb15' and '0000000000000000000000000000000000000000') 2024-10-18 01:12:28 15:M 17 Oct 2024 17:12:28.649 * Replication backlog created, my new replication IDs are '7861dcb3043324385b8e60665d1c1efe72a0b31b' and '0000000000000000000000000000000000000000' 2024-10-18 01:12:28 15:M 17 Oct 2024 17:12:28.649 * Delay next BGSAVE for diskless SYNC 2024-10-18 01:12:28 15:M 17 Oct 2024 17:12:28.650 * Replica 192.168.65.1:6379 asks for synchronization 2024-10-18 01:12:28 15:M 17 Oct 2024 17:12:28.650 * Partial resynchronization not accepted: Replication ID mismatch (Replica asked for '6da5214c7af72d8d2b9ad7a6c0acccfee7b1a965', my replication IDs are '7861dcb3043324385b8e60665d1c1efe72a0b31b' and '0000000000000000000000000000000000000000') 2024-10-18 01:12:28 15:M 17 Oct 2024 17:12:28.650 * Delay next BGSAVE for diskless SYNC 2024-10-18 01:12:28 15:M 17 Oct 2024 17:12:28.960 * Node ad79649ca4cc9222cee027be59812477f6e736ab () is no longer master of shard 342bd7d99314e6f6bead1cdecfde9af5cf75567c; removed all 0 slot(s) it used to own 2024-10-18 01:12:28 15:M 17 Oct 2024 17:12:28.960 * Node ad79649ca4cc9222cee027be59812477f6e736ab () is now part of shard def9b383c18f2779a2867ebb2e48a7a2f043411f 2024-10-18 01:12:29 15:M 17 Oct 2024 17:12:29.061 * Node 86fcf35973686e9b0d73b84da5c06a4d356a6aca () is no longer master of shard f36d165b2f4e61894e1d431bb96e8b1e738dd97a; removed all 0 slot(s) it used to own 2024-10-18 01:12:29 15:M 17 Oct 2024 17:12:29.061 * Node 86fcf35973686e9b0d73b84da5c06a4d356a6aca () is now part of shard d6d9be9f6c00e617c575e9fe7653a606e1382db9 2024-10-18 01:12:31 15:M 17 Oct 2024 17:12:31.136 * Node 9c15644cc327af377abb6db6f0cd6595f322ef9f () is no longer master of shard 45bcbb94a91c3fd1d867a60f3b8cb665ee9a1fab; removed all 0 slot(s) it used to own 2024-10-18 01:12:31 15:M 17 Oct 2024 17:12:31.136 * Node 9c15644cc327af377abb6db6f0cd6595f322ef9f () is now part of shard def9b383c18f2779a2867ebb2e48a7a2f043411f 2024-10-18 01:12:31 15:M 17 Oct 2024 17:12:31.202 * Node 7203cc4f0874ecbb81025c30a0c9336b4f10df8d () is no longer master of shard 4194f3fb0e53f906a7b94ec41708f69b194713f4; removed all 0 slot(s) it used to own 2024-10-18 01:12:31 15:M 17 Oct 2024 17:12:31.202 * Node 7203cc4f0874ecbb81025c30a0c9336b4f10df8d () is now part of shard 47b02087ea475a99443be252282038f6298ca388 2024-10-18 01:12:32 15:M 17 Oct 2024 17:12:32.226 * Node ee5c7f165b1bc578371424724e0bfa35815aaa3c () is no longer master of shard 0ef08df161dec18db1f2b9e5f34020e015e32088; removed all 0 slot(s) it used to own 2024-10-18 01:12:32 15:M 17 Oct 2024 17:12:32.226 * Node ee5c7f165b1bc578371424724e0bfa35815aaa3c () is now part of shard d6d9be9f6c00e617c575e9fe7653a606e1382db9 2024-10-18 01:12:32 15:M 17 Oct 2024 17:12:32.630 * Cluster state changed: ok 2024-10-18 01:12:33 15:M 17 Oct 2024 17:12:33.139 * Starting BGSAVE for SYNC with target: replicas sockets 2024-10-18 01:12:33 15:M 17 Oct 2024 17:12:33.140 * Background RDB transfer started by pid 22 2024-10-18 01:12:33 22:C 17 Oct 2024 17:12:33.143 * Fork CoW for RDB: current 0 MB, peak 0 MB, average 0 MB 2024-10-18 01:12:33 15:M 17 Oct 2024 17:12:33.143 * Diskless rdb transfer, done reading from pipe, 2 replicas still up. 2024-10-18 01:12:33 15:M 17 Oct 2024 17:12:33.153 * Background RDB transfer terminated with success 2024-10-18 01:12:33 15:M 17 Oct 2024 17:12:33.153 * Streamed RDB transfer with replica 192.168.65.1:6379 succeeded (socket). Waiting for REPLCONF ACK from replica to enable streaming 2024-10-18 01:12:33 15:M 17 Oct 2024 17:12:33.153 * Synchronization with replica 192.168.65.1:6379 succeeded 2024-10-18 01:12:33 15:M 17 Oct 2024 17:12:33.153 * Streamed RDB transfer with replica 192.168.65.1:6379 succeeded (socket). Waiting for REPLCONF ACK from replica to enable streaming 2024-10-18 01:12:33 15:M 17 Oct 2024 17:12:33.153 * Synchronization with replica 192.168.65.1:6379 succeeded 2024-10-18 01:12:35 15:M 17 Oct 2024 17:12:35.090 * Node 5dab82fb367c00a2f338bbc96f35ac9ecccc401a () is no longer master of shard 0b52e8e41d1497457e4a69f285826b3a9cdbec32; removed all 0 slot(s) it used to own 2024-10-18 01:12:35 15:M 17 Oct 2024 17:12:35.090 * Node 5dab82fb367c00a2f338bbc96f35ac9ecccc401a () is now part of shard 47b02087ea475a99443be252282038f6298ca388
2024-10-21 23:04:12 16:M 21 Oct 2024 15:04:12.996 * A failover occurred in shard d32bb40dd4ddd7a95cf7e214fb78e819ef2dc654; node 7de54d48cf6815be86f99afd8e963b14a3a9fddb () lost 0 slot(s) to node d026b2a89a3bc70b9f62a1baad14cb74329249da () with a config epoch of 10 2024-10-21 23:04:13 16:M 21 Oct 2024 15:04:13.063 * Clear FAIL state for node 7de54d48cf6815be86f99afd8e963b14a3a9fddb ():replica is reachable again.
2024-10-12 10:33:06 *** FATAL CONFIG FILE ERROR (Redis 7.4.1) *** 2024-10-12 10:33:06 Reading the configuration file, at line 2308 2024-10-12 10:33:06 >>> '"usermod" "-g" "root" "redis"' 2024-10-12 10:33:06 Bad directive or wrong number of arguments
2024-10-12 10:49:38 1:X 12 Oct 2024 02:49:38.258 * oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo 2024-10-12 10:49:38 1:X 12 Oct 2024 02:49:38.258 * Redis version=7.4.1, bits=64, commit=00000000, modified=0, pid=1, just started 2024-10-12 10:49:38 1:X 12 Oct 2024 02:49:38.258 * Configuration loaded 2024-10-12 10:49:38 1:X 12 Oct 2024 02:49:38.259 * monotonic clock: POSIX clock_gettime 2024-10-12 10:49:38 1:X 12 Oct 2024 02:49:38.259 # Failed to write PID file: Permission denied 2024-10-12 10:49:38 1:X 12 Oct 2024 02:49:38.259 * Running mode=sentinel, port=26379. 2024-10-12 10:49:38 1:X 12 Oct 2024 02:49:38.262 # Could not create tmp config file (Permission denied) 2024-10-12 10:49:38 1:X 12 Oct 2024 02:49:38.262 # WARNING: Sentinel was not able to save the new configuration on disk!!!: Permission denied 2024-10-12 10:49:38 1:X 12 Oct 2024 02:49:38.262 * Sentinel ID is ad4de059803e1e177a79d9d66b5ba2aa841c54b3 2024-10-12 10:49:38 1:X 12 Oct 2024 02:49:38.262 # +monitor master redis-master redis-master 6379 quorum 2 2024-10-12 10:49:40 1:X 12 Oct 2024 02:49:40.461 * +sentinel sentinel e4a0c6a4feaff9c075ee9daf25d5e14cc9cb7290 172.21.0.6 26379 @ redis-master redis-master 6379 2024-10-12 10:49:40 1:X 12 Oct 2024 02:49:40.468 # Could not create tmp config file (Permission denied) 2024-10-12 10:49:40 1:X 12 Oct 2024 02:49:40.468 # WARNING: Sentinel was not able to save the new configuration on disk!!!: Permission denied 2024-10-12 10:49:40 1:X 12 Oct 2024 02:49:40.520 * +sentinel sentinel b042abc5b6ee84e0610beec286c9b530f5377eb8 172.21.0.7 26379 @ redis-master redis-master 6379 2024-10-12 10:49:40 1:X 12 Oct 2024 02:49:40.525 # Could not create tmp config file (Permission denied) 2024-10-12 10:49:40 1:X 12 Oct 2024 02:49:40.525 # WARNING: Sentinel was not able to save the new configuration on disk!!!: Permission denied 2024-10-12 10:49:48 1:X 12 Oct 2024 02:49:48.321 * +slave slave 172.21.0.2:6379 172.21.0.2 6379 @ redis-master redis-master 6379 2024-10-12 10:49:48 1:X 12 Oct 2024 02:49:48.328 # Could not create tmp config file (Permission denied) 2024-10-12 10:49:48 1:X 12 Oct 2024 02:49:48.328 # WARNING: Sentinel was not able to save the new configuration on disk!!!: Permission denied 2024-10-12 10:49:48 1:X 12 Oct 2024 02:49:48.328 * +slave slave 172.21.0.3:6379 172.21.0.3 6379 @ redis-master redis-master 6379 2024-10-12 10:49:48 1:X 12 Oct 2024 02:49:48.333 # Could not create tmp config file (Permission denied) 2024-10-12 10:49:48 1:X 12 Oct 2024 02:49:48.333 # WARNING: Sentinel was not able to save the new configuration on disk!!!: Permission denied 2024-10-12 10:50:11 1:X 12 Oct 2024 02:50:11.269 # +tilt #tilt mode entered
上面的日志中,有如下无权限的内容:
# Failed to write PID file: Permission denied
# Could not create tmp config file (Permission denied)
# WARNING: Sentinel was not able to save the new configuration on disk!!!: Permission denied
#!/bin/sh set -e # first arg is `-f` or `--some-option` # or first arg is `something.conf` if [ "${1#-}" != "$1" ] || [ "${1%.conf}" != "$1" ]; then set -- redis-server "$@" fi # allow the container to be started with `--user` if [ "$1" = 'redis-server' -a "$(id -u)" = '0' ]; then find . \! -user redis -exec chown redis '{}' + exec gosu redis "$0" "$@" fi # set an appropriate umask (if one isn't set already) # - https://github.com/docker-library/redis/issues/305 # - https://github.com/redis/redis/blob/bb875603fb7ff3f9d19aad906bd45d7db98d9a39/utils/systemd-redis_server.service#L37 um="$(umask)" if [ "$um" = '0022' ]; then umask 0077 fi