1. 程式人生 > 實用技巧 >7. GitHub新增遠端倉庫並連線本地

7. GitHub新增遠端倉庫並連線本地

轉自:https://www.jianshu.com/p/a86e0248af58

情景描述

我在CentOS 7.2中安裝完redis,初次啟動時出現了三個警告:

三個警告.png

第一個警告:The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
第二個警告: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.

第三個警告: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.

解決方案

考慮到redis一般都是部署在伺服器上作為服務存在的。所以,本文的解決方案都是永續性配置,不是臨時配置。

第一個警告

net.core.somaxconn = 1024新增到/etc/sysctl.conf中,然後執行sysctl -p生效配置。

第二個警告

vm.overcommit_memory = 1新增到/etc/sysctl.conf中,然後執行sysctl -p生效配置。

第三個警告

echo never > /sys/kernel/mm/transparent_hugepage/enabled新增到/etc/rc.local中,然後執行source /etc/rc.local生效配置。

總結

redis想的挺周全的,其實解決方案已經寫在警告裡了,除了第一個警告的解決方案稍作了一些修改外,其他警告的解決方案其實只是對redis的提示做了一個精簡。