
Redis 6.0.8 釋出郵件:
https://groups.google.com/g/redis-db/c/Wmf0RB25PmY/m/d7hVkerfBQAJ
以下是主要内容預覽:
難道 Redis 出現了嚴重漏洞不成?棧長來解讀一下這封郵件内容!
除了以上提到的受影響的内容之外,還有以下三方面的更新:
1、問題修複:
通過 Redis 的 CONFIG SET 指令設定 oom-score-adj-values 參數值,或者通過在配置檔案中加載的時候,将生成一個損壞的配置檔案導緻 Redis 啟動失敗;(好吧!不是漏洞,是 Redis 的一個 bug 而已!)
修改 MacOS 系統下一個 redis-cli --pipe 使用問題;
修複了當不存在的鍵時,使用 HKEYS/HVALS 指令的響應問題;
其他各種小錯誤的修複;
2、新特性/改變
移除設定 madvise 時的 THP 警告;
允許在叢集的隻讀副本上執行讀取指令;
為 redis-cli --cluster 指令增加 masters/replicas 選項;
3、子產品API
增加 RedisModule_ThreadSafeContextTryLock 子產品(線程安全的鎖);
重點來看一下這個導緻重大問題的 oom-score-adj-values 參數的用處:
https://github.com/redis/redis/pull/1690/files############################ KERNEL OOM CONTROL ##############################
# On Linux, it is possible to hint the kernel OOM killer on what processes
# should be killed first when out of memory.
#
# Enabling this feature makes Redis actively control the oom_score_adj value
# for all its processes, depending on their role. The default scores will
# attempt to have background child processes killed before all others, and
# replicas killed before masters.
oom-score-adj no
# When oom-score-adj is used, this directive controls the specific values used
# for master, replica and background child processes. Values range -1000 to
# 1000 (higher means more likely to be killed).
#
# Unprivileged processes (not root, and without CAP_SYS_RESOURCE capabilities)
# can freely increase their value, but not decrease it below its initial
# settings.
#
# Values are used relative to the initial value of oom_score_adj when the server
# starts. Because typically the initial value is 0, they will often match the
# absolute values.
oom-score-adj-values 0 200 800
這個 oom-score-adj 參數是用來 Linux 核心控制調優的,在 Linux 系統中,當記憶體溢出時,可以提示核心 OOM killer 應該首先殺死哪些程序。
預設 oom-score-adj-values 不設定的情況下會優先殺死背景子程序,然後主從節點優先優先殺死從節點。
是以這 3 個值分别用來設定主、從、背景子程序的分值的,分值範圍從 -1000 ~ 1000,分值越高越有可能被先殺死。
PS: 軟體嘛,總避免不了bug,是以,各位開發、運維的同學,如果有用到這個的,請盡快更新保平安。
最後,歡迎大家關注微信公衆号:Java技術棧,可以閱讀棧長我寫的往期 Redis 系列教程,後續更多幹貨陸續奉上。
覺得有用,歡迎在看、轉發支援下,感謝了!