1

我有一个使用 spring-data-redis 的后端进程。与retwis clone类似,它使用StringRedisTemplate。在我的 Digital Ocean droplet 上运行大约 3-4 小时后,它神秘地停止了持久化新密钥。我的日志表明我的 redis 持久性代码正在被调用,它只是在 spring-data-redis/jedis 层以某种方式停止工作,没有任何错误迹象。

到目前为止已完成故障排除

  1. 我有足够的内存。Redis 只用了 6mb。

  2. 我重新启动了后端进程,一切都再次按预期工作,正在插入键值。

  3. 我检查了 redis-server.log。这与我对 spring-data-redis/jedis 失败的假设一致。这些条目在我插入最后一个密钥的同时停止。2015 年 8 月 9 日的条目是它神秘失败的时候。第二天,2015 年 8 月 10 日的条目是我重新启动它的时间。

    [2267] 09 Aug 19:20:51.094 * 1 changes in 300 seconds. Saving...
    [2267] 09 Aug 19:20:51.096 * Background saving started by pid 6611
    [6611] 09 Aug 19:20:51.348 * DB saved on disk
    [6611] 09 Aug 19:20:51.350 * RDB: 4 MB of memory used by copy-on-write
    [2267] 09 Aug 19:20:51.397 * Background saving terminated with success
    [2267] 09 Aug 19:25:52.043 * 1 changes in 300 seconds. Saving...
    [2267] 09 Aug 19:25:52.045 * Background saving started by pid 6706
    [6706] 09 Aug 19:25:52.417 * DB saved on disk
    [6706] 09 Aug 19:25:52.418 * RDB: 4 MB of memory used by copy-on-write
    [2267] 09 Aug 19:25:52.451 * Background saving terminated with success
    [2267] 10 Aug 05:01:38.204 * 1 changes in 300 seconds. Saving...
    [2267] 10 Aug 05:01:38.206 * Background saving started by pid 12252
    [12252] 10 Aug 05:01:38.647 * DB saved on disk
    [12252] 10 Aug 05:01:38.648 * RDB: 6 MB of memory used by copy-on-write
    [2267] 10 Aug 05:01:38.716 * Background saving terminated with success
    [2267] 10 Aug 05:06:39.054 * 1 changes in 300 seconds. Saving...
    [2267] 10 Aug 05:06:39.055 * Background saving started by pid 12263
    [12263] 10 Aug 05:06:39.193 * DB saved on disk
    [12263] 10 Aug 05:06:39.194 * RDB: 6 MB of memory used by copy-on-write
    [2267] 10 Aug 05:06:39.258 * Background saving terminated with success
    [2267] 10 Aug 05:11:40.082 * 1 changes in 300 seconds. Saving...
    [2267] 10 Aug 05:11:40.084 * Background saving started by pid 12272
    [12272] 10 Aug 05:11:40.342 * DB saved on disk
    [12272] 10 Aug 05:11:40.344 * RDB: 6 MB of memory used by copy-on-write
    [2267] 10 Aug 05:11:40.385 * Background saving terminated with success
    
  4. 我自己的应用程序日志没有显示异常。spring-data-redis 和 jedis 也没有记录器。所以他们没有抛出异常(因为我没有捕捉到任何异常)并且他们没有日志输出。显然,正在向 spring-data-redis 发出请求,并且 spring-data-redis 毫无例外地返回到我的代码。

故障排除的后续步骤?

spring-data-redis 及其底层 redis 驱动程序“Jedis”中的日志记录量非常少。我已经在 2 上启用了日志记录,看看当/如果问题再次发生时是否有帮助。

我也考虑过调试它,但我认为此时宁愿切换到不同的驱动程序/项目。

4

0 回答 0