溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

如何解決redis啟動(dòng)時(shí)的三個(gè)警告

發(fā)布時(shí)間:2021-07-07 16:45:30 來(lái)源:億速云 閱讀:764 作者:chen 欄目:編程語(yǔ)言

這篇文章主要介紹“如何解決redis啟動(dòng)時(shí)的三個(gè)警告”,在日常操作中,相信很多人在如何解決redis啟動(dòng)時(shí)的三個(gè)警告問題上存在疑惑,小編查閱了各式資料,整理出簡(jiǎn)單好用的操作方法,希望對(duì)大家解答”如何解決redis啟動(dòng)時(shí)的三個(gè)警告”的疑惑有所幫助!接下來(lái),請(qǐng)跟著小編一起來(lái)學(xué)習(xí)吧!

Redis安裝后直接啟動(dòng)會(huì)提示三個(gè)錯(cuò)誤,如下:

[lb@centos-linux src]$ ./redis-server
1988:C 19 Apr 2021 00:33:16.869 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
1988:C 19 Apr 2021 00:33:16.869 # Redis version=6.2.1, bits=64, commit=00000000, modified=0, pid=1988, just started
1988:C 19 Apr 2021 00:33:16.869 # Warning: no config file specified, using the default config. In order to specify a config file use ./redis-server /path/to/redis.conf
1988:M 19 Apr 2021 00:33:16.870 # You requested maxclients of 10000 requiring at least 10032 max file descriptors.
1988:M 19 Apr 2021 00:33:16.870 # Server can't set maximum open files to 10032 because of OS error: Operation not permitted.
1988:M 19 Apr 2021 00:33:16.870 # Current maximum open files is 4096. maxclients has been reduced to 4064 to compensate for low ulimit. If you need higher maxclients increase 'ulimit -n'.
1988:M 19 Apr 2021 00:33:16.870 * monotonic clock: POSIX clock_gettime
                _._
           _.-``__ ''-._
      _.-``    `.  `_.  ''-._           Redis 6.2.1 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 1988
  `-._    `-._  `-./  _.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |           http://redis.io
  `-._    `-._`-.__.-'_.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |
  `-._    `-._`-.__.-'_.-'    _.-'
      `-._    `-.__.-'    _.-'
          `-._        _.-'
              `-.__.-'

1988:M 19 Apr 2021 00:33:16.872 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
1988:M 19 Apr 2021 00:33:16.872 # Server initialized
1988:M 19 Apr 2021 00:33:16.872 # WARNING 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.
1988:M 19 Apr 2021 00:33:16.872 * Ready to accept connections

為解決這個(gè)問題,可已通過如下配置進(jìn)行解決,具體操作如下:

  1. 修改linux系統(tǒng)配置

[root@centos-linux lb]# vim /etc/sysctl.conf
  1. 添加配置

net.core.somaxconn = 1024
vm.overcommit_memory = 1
  1. 添加完成后,刷新內(nèi)核參數(shù),立即生效

[redis-5.0.8]$ /sbin/sysctl -p

到此,關(guān)于“如何解決redis啟動(dòng)時(shí)的三個(gè)警告”的學(xué)習(xí)就結(jié)束了,希望能夠解決大家的疑惑。理論與實(shí)踐的搭配能更好的幫助大家學(xué)習(xí),快去試試吧!若想繼續(xù)學(xué)習(xí)更多相關(guān)知識(shí),請(qǐng)繼續(xù)關(guān)注億速云網(wǎng)站,小編會(huì)繼續(xù)努力為大家?guī)?lái)更多實(shí)用的文章!

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI