<pre class="brush:cpp;toolbar:false">[root@localhost202redis-2.8.19]#/usr/local/redis/bin/redis-server&gt;&gt;/data/redis-start.txt#从定向到文件,方便我们查看,内容如下: [root@localhost202redis-2.8.19]#cat/data/redis-start.txt [6033]16Jan23:21:42.506#Warning:noconfigfilespecified,usingthedefaultconfig.Inordertospecifyaconfigfileuse/usr/local/redis/bin/redis-server/path/to/redis.conf [6033]16Jan23:21:42.508*Increasedmaximumnumberofopenfilesto10032(itwasoriginallysetto1024). [6033]16Jan23:21:42.509#Warning:32bitinstancedetectedbutnomemorylimitset.Setting3GBmaxmemorylimitwith&#39;noeviction&#39;policynow. _._ _.-``__&#39;&#39;-._ _.-```.`_.&#39;&#39;-._Redis2.8.19(00000000/0)32bit .-``.-```.```\/_.,_&#39;&#39;-._ (&#39;,.-`|`,)Runninginstandalonemode |`-._`-...-`__...-.``-._|&#39;`_.-&#39;|Port:6379 |`-._`._/_.-&#39;|PID:6033 `-._`-._`-./_.-&#39;_.-&#39; |`-._`-._`-.__.-&#39;_.-&#39;_.-&#39;| |`-._`-.__.-&#39;_.-&#39;|http://redis.io `-._`-._`-.__.-&#39;_.-&#39;_.-&#39; |`-._`-._`-.__.-&#39;_.-&#39;_.-&#39;| |`-._`-.__.-&#39;_.-&#39;| `-._`-._`-.__.-&#39;_.-&#39;_.-&#39; `-._`-.__.-&#39;_.-&#39; `-.__.-&#39; `-.__.-&#39; [6033]16Jan23:21:42.511#Serverstarted,Redisversion2.8.19 [6033]16Jan23:21:42.511#WARNINGovercommit_memoryissetto0!Backgroundsavemayfailunderlowmemorycondition.Tofixthisissueadd&#39;vm.overcommit_memory=1&#39;to/etc/sysctl.confandthenrebootorrunthecommand&#39;sysctlvm.overcommit_memory=1&#39;forthistotakeeffect. [6033]16Jan23:21:42.511#WARNING:TheTCPbacklogsettingof511cannotbeenforcedbecause/proc/sys/net/core/somaxconnissettothelowervalueof128. [6033]16Jan23:21:42.511*DBloadedfromdisk:0.000seconds [6033]16Jan23:21:42.511*Theserverisnowreadytoacceptconnectionsonport6379 [6033|signalhandler](1421421706)ReceivedSIGINTschedulingshutdown... [6033]16Jan23:21:46.643#Userrequestedshutdown... [6033]16Jan23:21:46.643*SavingthefinalRDBsnapshotbeforeexiting. [6033]16Jan23:21:46.663*DBsavedondisk [6033]16Jan23:21:46.663#Redisisnowreadytoexit,byebye...</pre><p><br/></p><p>1、增加配置文件</p><p>2、配置maxmemory</p><p>3、add &#39;vm.overcommit_memory = 1&#39; to /etc/sysctl.conf and then reboot or run the command &#39;sysctl vm.overcommit_memory=1&#39; for this to take effect.</p><p></p><p>配置:</p><p>为了防止内存爆满导致系统崩溃,需要设置/etc/redis/*.cnf中的maxmemory</p><p>防止报错,可以调整内存分配策略</p><p>/etc/sysctl.conf 这个是Redis日志中可以看到的建议:</p><p> 添加vm.overcommit_memory=1保存,并执行:sysctl vm.overcommit_memory=1使之生效</p><p>/proc/sys/vm/overcommit_memory,这个里面就是overcommit_memory值,这个可以被上面的设置更新.</p><p> 0, 表示内核将检查是否有足够的可用内存供应用进程使用;如果有足够的可用内存,内存申请允许;否则,内存申请失败,并把错误返回给应用进程。</p><p> 1, 表示内核允许分配所有的物理内存,而不管当前的内存状态如何。</p><p> 2, 表示内核允许分配超过所有物理内存和交换空间总和的内存</p><p></p>
T:0.004497s,M:239.71 KB
返回顶部 留言