解決Redis啟動(dòng)警告問題
如果啟動(dòng)前不對(duì)linux內(nèi)核做任何更改,那么redis啟動(dòng)會(huì)報(bào)出警告,共三個(gè):如下圖所示
第一個(gè)警告:The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
意思是:TCP backlog設(shè)置值,511沒有成功,因?yàn)?/proc/sys/net/core/somaxconn這個(gè)設(shè)置的是更小的128.
臨時(shí)解決方法:(即下次啟動(dòng)還需要修改此值)
echo 511 > /proc/sys/net/core/somaxconn
永久解決方法:(即以后啟動(dòng)還需要修改此值)
將其寫入/etc/rc.local文件中。
baklog參數(shù)實(shí)際控制的是已經(jīng)3次握手成功的還在accept queue的大小。
第二個(gè)警告:overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to/etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
意思是:overcommit_memory參數(shù)設(shè)置為0!在內(nèi)存不足的情況下,后臺(tái)程序save可能失敗。建議在文件 /etc/sysctl.conf 中將overcommit_memory修改為1。
臨時(shí)解決方法:echo "vm.overcommit_memory=1" > /etc/sysctl.conf
永久解決方法:將其寫入/etc/sysctl.conf文件中。
參考:有關(guān)linux下redis overcommit_memory的問題
第三個(gè)警告:you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix thisissue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain thesetting after a reboot. Redis must be restarted after THP is disabled.
意思是:你使用的是透明大頁,可能導(dǎo)致redis延遲和內(nèi)存使用問題。執(zhí)行 echo never > /sys/kernel/mm/transparent_hugepage/enabled
修復(fù)該問題。
臨時(shí)解決方法:
echo never > /sys/kernel/mm/transparent_hugepage/enabled
。
永久解決方法:
將其寫入/etc/rc.local文件中。
參考透明大頁介紹。
到此這篇關(guān)于解決Redis啟動(dòng)警告問題的文章就介紹到這了。希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
Redis不是一直號(hào)稱單線程效率也很高嗎,為什么又采用多線程了?
這篇文章主要介紹了Redis不是一直號(hào)稱單線程效率也很高嗎,為什么又采用多線程了的相關(guān)資料,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2021-03-03SpringSession+Redis實(shí)現(xiàn)集群會(huì)話共享的方法
為了保證WEB應(yīng)用的承載能力, 需要對(duì)WEB應(yīng)用進(jìn)行集群處理.這篇文章主要介紹了SpringSession+Redis實(shí)現(xiàn)集群會(huì)話共享的方法,需要的朋友參考下吧2018-08-08Redis報(bào)錯(cuò):無法連接Redis服務(wù)的解決方法
在Linux系統(tǒng)上運(yùn)行Redis服務(wù)時(shí),有時(shí)會(huì)遇到“無法連接Redis服務(wù)”的報(bào)錯(cuò),本文就詳細(xì)的介紹一下解決方法,具有一定的參考價(jià)值,感興趣的可以了解一下2023-09-09?Redis 串行生成順序編碼的方法實(shí)現(xiàn)
本文主要介紹了?Redis 串行生成順序編碼的方法實(shí)現(xiàn),文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2022-04-04