{"id":273,"date":"2014-08-26T13:34:34","date_gmt":"2014-08-26T13:34:34","guid":{"rendered":"http:\/\/blog.yyhcw.com\/post\/273.html"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T07:54:17","slug":"redis-config","status":"publish","type":"post","link":"http:\/\/blog.yyhcw.com\/post\/273.html","title":{"rendered":"redis\u914d\u7f6e\u6587\u4ef6\u8bf4\u660e"},"content":{"rendered":"<!--wp-compress-html--><!--wp-compress-html no compression--><p>&nbsp;\u4e4b\u524d\u8bf4\u4e86\u4e0b<a href=\"\/post\/272.html\" target=\"_self\">redis windows\u4e0b\u7684\u914d\u7f6e\u548cPHP\u7684\u4f7f\u7528<\/a>\uff0c\u8fd9\u6b21\u6211\u4eec\u8bf4\u4e0bredis\u914d\u7f6e\u6587\u4ef6\u7684\u8be6\u7ec6\u8bf4\u660e\u3002<\/p>\n<p>\u6307\u5b9a\u5305\u542b\u5176\u5b83\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u53ef\u4ee5\u5728\u540c\u4e00\u4e3b\u673a\u4e0a\u591a\u4e2aRedis\u5b9e\u4f8b\u4e4b\u95f4\u4f7f\u7528\u540c\u4e00\u4efd\u914d\u7f6e\u6587\u4ef6\uff0c\u800c\u540c\u65f6\u5404\u4e2a\u5b9e\u4f8b\u53c8\u62e5\u6709\u81ea\u5df1\u7684\u7279\u5b9a\u914d\u7f6e\u6587\u4ef6<\/p>\n<pre class=\"brush:php;toolbar:false\">#&nbsp;Redis&nbsp;configuration&nbsp;file&nbsp;example\r\n&nbsp;\r\n#&nbsp;Note&nbsp;on&nbsp;units:&nbsp;when&nbsp;memory&nbsp;size&nbsp;is&nbsp;needed,&nbsp;it&nbsp;is&nbsp;possible&nbsp;to&nbsp;specifiy\r\n#&nbsp;it&nbsp;in&nbsp;the&nbsp;usual&nbsp;form&nbsp;of&nbsp;1k&nbsp;5GB&nbsp;4M&nbsp;and&nbsp;so&nbsp;forth:\r\n#\r\n#&nbsp;1k&nbsp;=&gt;&nbsp;1000&nbsp;bytes\r\n#&nbsp;1kb&nbsp;=&gt;&nbsp;1024&nbsp;bytes\r\n#&nbsp;1m&nbsp;=&gt;&nbsp;1000000&nbsp;bytes\r\n#&nbsp;1mb&nbsp;=&gt;&nbsp;1024*1024&nbsp;bytes\r\n#&nbsp;1g&nbsp;=&gt;&nbsp;1000000000&nbsp;bytes\r\n#&nbsp;1gb&nbsp;=&gt;&nbsp;1024*1024*1024&nbsp;bytes\r\n#\r\n#&nbsp;units&nbsp;are&nbsp;case&nbsp;insensitive&nbsp;so&nbsp;1GB&nbsp;1Gb&nbsp;1gB&nbsp;are&nbsp;all&nbsp;the&nbsp;same.\r\n&nbsp;\r\n#&nbsp;By&nbsp;default&nbsp;Redis&nbsp;does&nbsp;not&nbsp;run&nbsp;as&nbsp;a&nbsp;daemon.&nbsp;Use&nbsp;&#39;yes&#39;&nbsp;if&nbsp;you&nbsp;need&nbsp;it.\r\n#&nbsp;Note&nbsp;that&nbsp;Redis&nbsp;will&nbsp;write&nbsp;a&nbsp;pid&nbsp;file&nbsp;in&nbsp;\/var\/run\/redis.pid&nbsp;when&nbsp;daemonized.\r\ndaemonize&nbsp;no&nbsp;&nbsp;\r\nRedis\u9ed8\u8ba4\u4e0d\u662f\u4ee5\u5b88\u62a4\u8fdb\u7a0b\u7684\u65b9\u5f0f\u8fd0\u884c\uff0c\u53ef\u4ee5\u901a\u8fc7\u8be5\u914d\u7f6e\u9879\u4fee\u6539\uff0c\u4f7f\u7528yes\u542f\u7528\u5b88\u62a4\u8fdb\u7a0b\r\n&nbsp;\r\n#&nbsp;When&nbsp;running&nbsp;daemonized,&nbsp;Redis&nbsp;writes&nbsp;a&nbsp;pid&nbsp;file&nbsp;in&nbsp;\/var\/run\/redis.pid&nbsp;by\r\n#&nbsp;default.&nbsp;You&nbsp;can&nbsp;specify&nbsp;a&nbsp;custom&nbsp;pid&nbsp;file&nbsp;location&nbsp;here.\r\npidfile&nbsp;\/var\/run\/redis.pid\r\n\u5f53Redis\u4ee5\u5b88\u62a4\u8fdb\u7a0b\u65b9\u5f0f\u8fd0\u884c\u65f6\uff0cRedis\u9ed8\u8ba4\u4f1a\u628apid\u5199\u5165\/var\/run\/redis.pid\u6587\u4ef6\uff0c\u53ef\u4ee5\u901a\u8fc7pidfile\u6307\u5b9a\r\n#&nbsp;Accept&nbsp;connections&nbsp;on&nbsp;the&nbsp;specified&nbsp;port,&nbsp;default&nbsp;is&nbsp;6379.\r\n#&nbsp;If&nbsp;port&nbsp;0&nbsp;is&nbsp;specified&nbsp;Redis&nbsp;will&nbsp;not&nbsp;listen&nbsp;on&nbsp;a&nbsp;TCP&nbsp;socket.\r\nport&nbsp;6379\r\n\u6307\u5b9aRedis\u76d1\u542c\u7aef\u53e3\uff0c\u9ed8\u8ba4\u7aef\u53e3\u4e3a6379\r\n#&nbsp;If&nbsp;you&nbsp;want&nbsp;you&nbsp;can&nbsp;bind&nbsp;a&nbsp;single&nbsp;interface,&nbsp;if&nbsp;the&nbsp;bind&nbsp;option&nbsp;is&nbsp;not\r\n#&nbsp;specified&nbsp;all&nbsp;the&nbsp;interfaces&nbsp;will&nbsp;listen&nbsp;for&nbsp;incoming&nbsp;connections.\r\n#\r\n#&nbsp;bind&nbsp;127.0.0.1\r\n\u7ed1\u5b9a\u7684\u4e3b\u673a\u5730\u5740\r\n#&nbsp;Specify&nbsp;the&nbsp;path&nbsp;for&nbsp;the&nbsp;unix&nbsp;socket&nbsp;that&nbsp;will&nbsp;be&nbsp;used&nbsp;to&nbsp;listen&nbsp;for\r\n#&nbsp;incoming&nbsp;connections.&nbsp;There&nbsp;is&nbsp;no&nbsp;default,&nbsp;so&nbsp;Redis&nbsp;will&nbsp;not&nbsp;listen\r\n#&nbsp;on&nbsp;a&nbsp;unix&nbsp;socket&nbsp;when&nbsp;not&nbsp;specified.\r\n#\r\n#&nbsp;unixsocket&nbsp;\/tmp\/redis.sock\r\n#&nbsp;unixsocketperm&nbsp;755\r\n&nbsp;\r\n#&nbsp;Close&nbsp;the&nbsp;connection&nbsp;after&nbsp;a&nbsp;client&nbsp;is&nbsp;idle&nbsp;for&nbsp;N&nbsp;seconds&nbsp;(0&nbsp;to&nbsp;disable)\r\ntimeout&nbsp;0\r\n\u5f53&nbsp;\u5ba2\u6237\u7aef\u95f2\u7f6e\u591a\u957f\u65f6\u95f4\u540e\u5173\u95ed\u8fde\u63a5\uff0c\u5982\u679c\u6307\u5b9a\u4e3a0\uff0c\u8868\u793a\u5173\u95ed\u8be5\u529f\u80fd\r\n#&nbsp;Set&nbsp;server&nbsp;verbosity&nbsp;to&nbsp;&#39;debug&#39;\r\n#&nbsp;it&nbsp;can&nbsp;be&nbsp;one&nbsp;of:\r\n#&nbsp;debug&nbsp;(a&nbsp;lot&nbsp;of&nbsp;information,&nbsp;useful&nbsp;for&nbsp;development\/testing)\r\n#&nbsp;verbose&nbsp;(many&nbsp;rarely&nbsp;useful&nbsp;info,&nbsp;but&nbsp;not&nbsp;a&nbsp;mess&nbsp;like&nbsp;the&nbsp;debug&nbsp;level)\r\n#&nbsp;notice&nbsp;(moderately&nbsp;verbose,&nbsp;what&nbsp;you&nbsp;want&nbsp;in&nbsp;production&nbsp;probably)\r\n#&nbsp;warning&nbsp;(only&nbsp;very&nbsp;important&nbsp;\/&nbsp;critical&nbsp;messages&nbsp;are&nbsp;logged)\r\nloglevel&nbsp;verbose\r\n\u6307\u5b9a\u65e5\u5fd7\u8bb0\u5f55\u7ea7\u522b\uff0cRedis\u603b\u5171\u652f\u6301\u56db\u4e2a\u7ea7\u522b\uff1adebug\u3001verbose\u3001notice\u3001warning\uff0c\u9ed8\u8ba4\u4e3averbose\r\n#&nbsp;Specify&nbsp;the&nbsp;log&nbsp;file&nbsp;name.&nbsp;Also&nbsp;&#39;stdout&#39;&nbsp;can&nbsp;be&nbsp;used&nbsp;to&nbsp;force\r\n#&nbsp;Redis&nbsp;to&nbsp;log&nbsp;on&nbsp;the&nbsp;standard&nbsp;output.&nbsp;Note&nbsp;that&nbsp;if&nbsp;you&nbsp;use&nbsp;standard\r\n#&nbsp;output&nbsp;for&nbsp;logging&nbsp;but&nbsp;daemonize,&nbsp;logs&nbsp;will&nbsp;be&nbsp;sent&nbsp;to&nbsp;\/dev\/null\r\nlogfile&nbsp;stdout\r\n\u65e5\u5fd7\u8bb0\u5f55\u65b9\u5f0f\uff0c\u9ed8\u8ba4\u4e3a\u6807\u51c6\u8f93\u51fa\uff0c\u5982\u679c\u914d\u7f6eRedis\u4e3a\u5b88\u62a4\u8fdb\u7a0b\u65b9\u5f0f\u8fd0\u884c\uff0c\u800c\u8fd9\u91cc\u53c8\u914d\u7f6e\u4e3a\u65e5\u5fd7\u8bb0\u5f55\u65b9\u5f0f\u4e3a\u6807\u51c6\u8f93\u51fa\uff0c\u5219\u65e5\u5fd7\u5c06\u4f1a\u53d1\u9001\u7ed9\/dev\/null\r\n#&nbsp;To&nbsp;enable&nbsp;logging&nbsp;to&nbsp;the&nbsp;system&nbsp;logger,&nbsp;just&nbsp;set&nbsp;&#39;syslog-enabled&#39;&nbsp;to&nbsp;yes,\r\n#&nbsp;and&nbsp;optionally&nbsp;update&nbsp;the&nbsp;other&nbsp;syslog&nbsp;parameters&nbsp;to&nbsp;suit&nbsp;your&nbsp;needs.\r\n#&nbsp;syslog-enabled&nbsp;no\r\n&nbsp;\r\n#&nbsp;Specify&nbsp;the&nbsp;syslog&nbsp;identity.\r\n#&nbsp;syslog-ident&nbsp;redis\r\n&nbsp;\r\n#&nbsp;Specify&nbsp;the&nbsp;syslog&nbsp;facility.&nbsp;&nbsp;Must&nbsp;be&nbsp;USER&nbsp;or&nbsp;between&nbsp;LOCAL0-LOCAL7.\r\n#&nbsp;syslog-facility&nbsp;local0\r\n&nbsp;\r\n#&nbsp;Set&nbsp;the&nbsp;number&nbsp;of&nbsp;databases.&nbsp;The&nbsp;default&nbsp;database&nbsp;is&nbsp;DB&nbsp;0,&nbsp;you&nbsp;can&nbsp;select\r\n#&nbsp;a&nbsp;different&nbsp;one&nbsp;on&nbsp;a&nbsp;per-connection&nbsp;basis&nbsp;using&nbsp;SELECT&nbsp;&lt;dbid&gt;&nbsp;where\r\n#&nbsp;dbid&nbsp;is&nbsp;a&nbsp;number&nbsp;between&nbsp;0&nbsp;and&nbsp;&#39;databases&#39;-1\r\ndatabases&nbsp;16\r\n\u8bbe\u7f6e\u6570\u636e\u5e93\u7684\u6570\u91cf\uff0c\u9ed8\u8ba4\u6570\u636e\u5e93\u4e3a0\uff0c\u53ef\u4ee5\u4f7f\u7528SELECT&nbsp;&lt;dbid&gt;\u547d\u4ee4\u5728\u8fde\u63a5\u4e0a\u6307\u5b9a\u6570\u636e\u5e93id\r\n################################&nbsp;SNAPSHOTTING&nbsp;&nbsp;#################################\r\n#\r\n#&nbsp;Save&nbsp;the&nbsp;DB&nbsp;on&nbsp;disk:\r\n#\r\n#&nbsp;&nbsp;&nbsp;save&nbsp;&lt;seconds&gt;&nbsp;&lt;changes&gt;\r\n#\r\n#&nbsp;&nbsp;&nbsp;Will&nbsp;save&nbsp;the&nbsp;DB&nbsp;if&nbsp;both&nbsp;the&nbsp;given&nbsp;number&nbsp;of&nbsp;seconds&nbsp;and&nbsp;the&nbsp;given\r\n#&nbsp;&nbsp;&nbsp;number&nbsp;of&nbsp;write&nbsp;operations&nbsp;against&nbsp;the&nbsp;DB&nbsp;occurred.\r\n#\r\n#&nbsp;&nbsp;&nbsp;In&nbsp;the&nbsp;example&nbsp;below&nbsp;the&nbsp;behaviour&nbsp;will&nbsp;be&nbsp;to&nbsp;save:\r\n#&nbsp;&nbsp;&nbsp;after&nbsp;900&nbsp;sec&nbsp;(15&nbsp;min)&nbsp;if&nbsp;at&nbsp;least&nbsp;1&nbsp;key&nbsp;changed\r\n#&nbsp;&nbsp;&nbsp;after&nbsp;300&nbsp;sec&nbsp;(5&nbsp;min)&nbsp;if&nbsp;at&nbsp;least&nbsp;10&nbsp;keys&nbsp;changed\r\n#&nbsp;&nbsp;&nbsp;after&nbsp;60&nbsp;sec&nbsp;if&nbsp;at&nbsp;least&nbsp;10000&nbsp;keys&nbsp;changed\r\n#\r\n#&nbsp;&nbsp;&nbsp;Note:&nbsp;you&nbsp;can&nbsp;disable&nbsp;saving&nbsp;at&nbsp;all&nbsp;commenting&nbsp;all&nbsp;the&nbsp;&quot;save&quot;&nbsp;lines.\r\n&nbsp;\r\nsave&nbsp;900&nbsp;1\r\nsave&nbsp;300&nbsp;10\r\nsave&nbsp;60&nbsp;10000\r\n\u5206\u522b\u8868\u793a900\u79d2\uff0815\u5206\u949f\uff09\u5185\u67091\u4e2a\u66f4\u6539\uff0c300\u79d2\uff085\u5206\u949f\uff09\u5185\u670910\u4e2a\u66f4\u6539\u4ee5\u53ca60\u79d2\u5185\u670910000\u4e2a\u66f4\u6539\u3002\r\n\u6307\u5b9a\u5728\u591a\u957f\u65f6\u95f4\u5185\uff0c\u6709\u591a\u5c11\u6b21\u66f4\u65b0\u64cd\u4f5c\uff0c\u5c31\u5c06\u6570\u636e\u540c\u6b65\u5230\u6570\u636e\u6587\u4ef6\uff0c\u53ef\u4ee5\u591a\u4e2a\u6761\u4ef6\u914d\u5408\r\n#&nbsp;Compress&nbsp;string&nbsp;objects&nbsp;using&nbsp;LZF&nbsp;when&nbsp;dump&nbsp;.rdb&nbsp;databases?\r\n#&nbsp;For&nbsp;default&nbsp;that&#39;s&nbsp;set&nbsp;to&nbsp;&#39;yes&#39;&nbsp;as&nbsp;it&#39;s&nbsp;almost&nbsp;always&nbsp;a&nbsp;win.\r\n#&nbsp;If&nbsp;you&nbsp;want&nbsp;to&nbsp;save&nbsp;some&nbsp;CPU&nbsp;in&nbsp;the&nbsp;saving&nbsp;child&nbsp;set&nbsp;it&nbsp;to&nbsp;&#39;no&#39;&nbsp;but\r\n#&nbsp;the&nbsp;dataset&nbsp;will&nbsp;likely&nbsp;be&nbsp;bigger&nbsp;if&nbsp;you&nbsp;have&nbsp;compressible&nbsp;values&nbsp;or&nbsp;keys.\r\nrdbcompression&nbsp;yes\r\n\u6307\u5b9a\u5b58\u50a8\u81f3\u672c\u5730\u6570\u636e\u5e93\u65f6\u662f\u5426\u538b\u7f29\u6570\u636e\uff0c\u9ed8\u8ba4\u4e3ayes\uff0cRedis\u91c7\u7528LZF\u538b\u7f29\uff0c\u5982\u679c\u4e3a\u4e86\u8282\u7701CPU\u65f6\u95f4\uff0c\u53ef\u4ee5\u5173\u95ed\u8be5\u9009\u9879\uff0c\u4f46\u4f1a\u5bfc\u81f4\u6570\u636e\u5e93\u6587\u4ef6\u53d8\u7684\u5de8\u5927\r\n#&nbsp;The&nbsp;filename&nbsp;where&nbsp;to&nbsp;dump&nbsp;the&nbsp;DB\r\ndbfilename&nbsp;dump.rdb\r\n\u6307\u5b9a\u672c\u5730\u6570\u636e\u5e93\u6587\u4ef6\u540d\uff0c\u9ed8\u8ba4\u503c\u4e3adump.rdb\r\n#&nbsp;The&nbsp;working&nbsp;directory.\r\n#\r\n#&nbsp;The&nbsp;DB&nbsp;will&nbsp;be&nbsp;written&nbsp;inside&nbsp;this&nbsp;directory,&nbsp;with&nbsp;the&nbsp;filename&nbsp;specified\r\n#&nbsp;above&nbsp;using&nbsp;the&nbsp;&#39;dbfilename&#39;&nbsp;configuration&nbsp;directive.\r\n#&nbsp;\r\n#&nbsp;Also&nbsp;the&nbsp;Append&nbsp;Only&nbsp;File&nbsp;will&nbsp;be&nbsp;created&nbsp;inside&nbsp;this&nbsp;directory.\r\n#&nbsp;\r\n#&nbsp;Note&nbsp;that&nbsp;you&nbsp;must&nbsp;specify&nbsp;a&nbsp;directory&nbsp;here,&nbsp;not&nbsp;a&nbsp;file&nbsp;name.\r\ndir&nbsp;.\/\r\n\u6307\u5b9a\u672c\u5730\u6570\u636e\u5e93\u5b58\u653e\u76ee\u5f55\r\n#################################&nbsp;REPLICATION&nbsp;#################################\r\n&nbsp;\r\n#&nbsp;Master-Slave&nbsp;replication.&nbsp;Use&nbsp;slaveof&nbsp;to&nbsp;make&nbsp;a&nbsp;Redis&nbsp;instance&nbsp;a&nbsp;copy&nbsp;of\r\n#&nbsp;another&nbsp;Redis&nbsp;server.&nbsp;Note&nbsp;that&nbsp;the&nbsp;configuration&nbsp;is&nbsp;local&nbsp;to&nbsp;the&nbsp;slave\r\n#&nbsp;so&nbsp;for&nbsp;example&nbsp;it&nbsp;is&nbsp;possible&nbsp;to&nbsp;configure&nbsp;the&nbsp;slave&nbsp;to&nbsp;save&nbsp;the&nbsp;DB&nbsp;with&nbsp;a\r\n#&nbsp;different&nbsp;interval,&nbsp;or&nbsp;to&nbsp;listen&nbsp;to&nbsp;another&nbsp;port,&nbsp;and&nbsp;so&nbsp;on.\r\n#\r\n#&nbsp;slaveof&nbsp;&lt;masterip&gt;&nbsp;&lt;masterport&gt;\r\nslaveof&nbsp;&lt;masterip&gt;&nbsp;&lt;masterport&gt;&nbsp;\u8bbe\u7f6e\u5f53\u672c\u673a\u4e3aslav\u670d\u52a1\u65f6\uff0c\u8bbe\u7f6emaster\u670d\u52a1\u7684IP\u5730\u5740\u53ca\u7aef\u53e3\uff0c\u5728Redis\u542f\u52a8\u65f6\uff0c\u5b83\u4f1a\u81ea\u52a8\u4ecemaster\u8fdb\u884c\u6570\u636e\u540c\u6b65\r\n#&nbsp;If&nbsp;the&nbsp;master&nbsp;is&nbsp;password&nbsp;protected&nbsp;(using&nbsp;the&nbsp;&quot;requirepass&quot;&nbsp;configuration\r\n#&nbsp;directive&nbsp;below)&nbsp;it&nbsp;is&nbsp;possible&nbsp;to&nbsp;tell&nbsp;the&nbsp;slave&nbsp;to&nbsp;authenticate&nbsp;before\r\n#&nbsp;starting&nbsp;the&nbsp;replication&nbsp;synchronization&nbsp;process,&nbsp;otherwise&nbsp;the&nbsp;master&nbsp;will\r\n#&nbsp;refuse&nbsp;the&nbsp;slave&nbsp;request.\r\n#\r\n#&nbsp;masterauth&nbsp;&lt;master-password&gt;\r\nmasterauth&nbsp;&lt;master-password&gt;&nbsp;\u5f53master\u670d\u52a1\u8bbe\u7f6e\u4e86\u5bc6\u7801\u4fdd\u62a4\u65f6\uff0cslav\u670d\u52a1\u8fde\u63a5master\u7684\u5bc6\u7801\r\n#&nbsp;When&nbsp;a&nbsp;slave&nbsp;lost&nbsp;the&nbsp;connection&nbsp;with&nbsp;the&nbsp;master,&nbsp;or&nbsp;when&nbsp;the&nbsp;replication\r\n#&nbsp;is&nbsp;still&nbsp;in&nbsp;progress,&nbsp;the&nbsp;slave&nbsp;can&nbsp;act&nbsp;in&nbsp;two&nbsp;different&nbsp;ways:\r\n#\r\n#&nbsp;1)&nbsp;if&nbsp;slave-serve-stale-data&nbsp;is&nbsp;set&nbsp;to&nbsp;&#39;yes&#39;&nbsp;(the&nbsp;default)&nbsp;the&nbsp;slave&nbsp;will\r\n#&nbsp;&nbsp;&nbsp;&nbsp;still&nbsp;reply&nbsp;to&nbsp;client&nbsp;requests,&nbsp;possibly&nbsp;with&nbsp;out&nbsp;of&nbsp;data&nbsp;data,&nbsp;or&nbsp;the\r\n#&nbsp;&nbsp;&nbsp;&nbsp;data&nbsp;set&nbsp;may&nbsp;just&nbsp;be&nbsp;empty&nbsp;if&nbsp;this&nbsp;is&nbsp;the&nbsp;first&nbsp;synchronization.\r\n#\r\n#&nbsp;2)&nbsp;if&nbsp;slave-serve-stale&nbsp;data&nbsp;is&nbsp;set&nbsp;to&nbsp;&#39;no&#39;&nbsp;the&nbsp;slave&nbsp;will&nbsp;reply&nbsp;with\r\n#&nbsp;&nbsp;&nbsp;&nbsp;an&nbsp;error&nbsp;&quot;SYNC&nbsp;with&nbsp;master&nbsp;in&nbsp;progress&quot;&nbsp;to&nbsp;all&nbsp;the&nbsp;kind&nbsp;of&nbsp;commands\r\n#&nbsp;&nbsp;&nbsp;&nbsp;but&nbsp;to&nbsp;INFO&nbsp;and&nbsp;SLAVEOF.\r\n#\r\nslave-serve-stale-data&nbsp;yes\r\n&nbsp;\r\n#&nbsp;Slaves&nbsp;send&nbsp;PINGs&nbsp;to&nbsp;server&nbsp;in&nbsp;a&nbsp;predefined&nbsp;interval.&nbsp;It&#39;s&nbsp;possible&nbsp;to&nbsp;change\r\n#&nbsp;this&nbsp;interval&nbsp;with&nbsp;the&nbsp;repl_ping_slave_period&nbsp;option.&nbsp;The&nbsp;default&nbsp;value&nbsp;is&nbsp;10\r\n#&nbsp;seconds.\r\n#\r\n#&nbsp;repl-ping-slave-period&nbsp;10\r\n&nbsp;\r\n#&nbsp;The&nbsp;following&nbsp;option&nbsp;sets&nbsp;a&nbsp;timeout&nbsp;for&nbsp;both&nbsp;Bulk&nbsp;transfer&nbsp;I\/O&nbsp;timeout&nbsp;and\r\n#&nbsp;master&nbsp;data&nbsp;or&nbsp;ping&nbsp;response&nbsp;timeout.&nbsp;The&nbsp;default&nbsp;value&nbsp;is&nbsp;60&nbsp;seconds.\r\n#\r\n#&nbsp;It&nbsp;is&nbsp;important&nbsp;to&nbsp;make&nbsp;sure&nbsp;that&nbsp;this&nbsp;value&nbsp;is&nbsp;greater&nbsp;than&nbsp;the&nbsp;value\r\n#&nbsp;specified&nbsp;for&nbsp;repl-ping-slave-period&nbsp;otherwise&nbsp;a&nbsp;timeout&nbsp;will&nbsp;be&nbsp;detected\r\n#&nbsp;every&nbsp;time&nbsp;there&nbsp;is&nbsp;low&nbsp;traffic&nbsp;between&nbsp;the&nbsp;master&nbsp;and&nbsp;the&nbsp;slave.\r\n#\r\n#&nbsp;repl-timeout&nbsp;60\r\n&nbsp;\r\n##################################&nbsp;SECURITY&nbsp;###################################\r\n&nbsp;\r\n#&nbsp;Require&nbsp;clients&nbsp;to&nbsp;issue&nbsp;AUTH&nbsp;&lt;PASSWORD&gt;&nbsp;before&nbsp;processing&nbsp;any&nbsp;other\r\n#&nbsp;commands.&nbsp;&nbsp;This&nbsp;might&nbsp;be&nbsp;useful&nbsp;in&nbsp;environments&nbsp;in&nbsp;which&nbsp;you&nbsp;do&nbsp;not&nbsp;trust\r\n#&nbsp;others&nbsp;with&nbsp;access&nbsp;to&nbsp;the&nbsp;host&nbsp;running&nbsp;redis-server.\r\n#\r\n#&nbsp;This&nbsp;should&nbsp;stay&nbsp;commented&nbsp;out&nbsp;for&nbsp;backward&nbsp;compatibility&nbsp;and&nbsp;because&nbsp;most\r\n#&nbsp;people&nbsp;do&nbsp;not&nbsp;need&nbsp;auth&nbsp;(e.g.&nbsp;they&nbsp;run&nbsp;their&nbsp;own&nbsp;servers).\r\n#&nbsp;\r\n#&nbsp;Warning:&nbsp;since&nbsp;Redis&nbsp;is&nbsp;pretty&nbsp;fast&nbsp;an&nbsp;outside&nbsp;user&nbsp;can&nbsp;try&nbsp;up&nbsp;to\r\n#&nbsp;150k&nbsp;passwords&nbsp;per&nbsp;second&nbsp;against&nbsp;a&nbsp;good&nbsp;box.&nbsp;This&nbsp;means&nbsp;that&nbsp;you&nbsp;should\r\n#&nbsp;use&nbsp;a&nbsp;very&nbsp;strong&nbsp;password&nbsp;otherwise&nbsp;it&nbsp;will&nbsp;be&nbsp;very&nbsp;easy&nbsp;to&nbsp;break.\r\n#\r\n#&nbsp;requirepass&nbsp;foobared\r\n&nbsp;requirepass&nbsp;foobared&nbsp;\u8bbe\u7f6eRedis\u8fde\u63a5\u5bc6\u7801\uff0c\u5982\u679c\u914d\u7f6e\u4e86\u8fde\u63a5\u5bc6\u7801\uff0c\u5ba2\u6237\u7aef\u5728\u8fde\u63a5Redis\u65f6\u9700\u8981\u901a\u8fc7AUTH&nbsp;&lt;password&gt;\u547d\u4ee4\u63d0\u4f9b\u5bc6\u7801\uff0c\u9ed8\u8ba4\u5173\u95ed\r\n#&nbsp;Command&nbsp;renaming.\r\n#\r\n#&nbsp;It&nbsp;is&nbsp;possilbe&nbsp;to&nbsp;change&nbsp;the&nbsp;name&nbsp;of&nbsp;dangerous&nbsp;commands&nbsp;in&nbsp;a&nbsp;shared\r\n#&nbsp;environment.&nbsp;For&nbsp;instance&nbsp;the&nbsp;CONFIG&nbsp;command&nbsp;may&nbsp;be&nbsp;renamed&nbsp;into&nbsp;something\r\n#&nbsp;of&nbsp;hard&nbsp;to&nbsp;guess&nbsp;so&nbsp;that&nbsp;it&nbsp;will&nbsp;be&nbsp;still&nbsp;available&nbsp;for&nbsp;internal-use\r\n#&nbsp;tools&nbsp;but&nbsp;not&nbsp;available&nbsp;for&nbsp;general&nbsp;clients.\r\n#\r\n#&nbsp;Example:\r\n#\r\n#&nbsp;rename-command&nbsp;CONFIG&nbsp;b840fc02d524045429941cc15f59e41cb7be6c52\r\n#\r\n#&nbsp;It&nbsp;is&nbsp;also&nbsp;possilbe&nbsp;to&nbsp;completely&nbsp;kill&nbsp;a&nbsp;command&nbsp;renaming&nbsp;it&nbsp;into\r\n#&nbsp;an&nbsp;empty&nbsp;string:\r\n#\r\n#&nbsp;rename-command&nbsp;CONFIG&nbsp;&quot;&quot;\r\n&nbsp;\r\n###################################&nbsp;LIMITS&nbsp;####################################\r\n&nbsp;\r\n#&nbsp;Set&nbsp;the&nbsp;max&nbsp;number&nbsp;of&nbsp;connected&nbsp;clients&nbsp;at&nbsp;the&nbsp;same&nbsp;time.&nbsp;By&nbsp;default&nbsp;there\r\n#&nbsp;is&nbsp;no&nbsp;limit,&nbsp;and&nbsp;it&#39;s&nbsp;up&nbsp;to&nbsp;the&nbsp;number&nbsp;of&nbsp;file&nbsp;descriptors&nbsp;the&nbsp;Redis&nbsp;process\r\n#&nbsp;is&nbsp;able&nbsp;to&nbsp;open.&nbsp;The&nbsp;special&nbsp;value&nbsp;&#39;0&#39;&nbsp;means&nbsp;no&nbsp;limits.\r\n#&nbsp;Once&nbsp;the&nbsp;limit&nbsp;is&nbsp;reached&nbsp;Redis&nbsp;will&nbsp;close&nbsp;all&nbsp;the&nbsp;new&nbsp;connections&nbsp;sending\r\n#&nbsp;an&nbsp;error&nbsp;&#39;max&nbsp;number&nbsp;of&nbsp;clients&nbsp;reached&#39;.\r\n#\r\n#&nbsp;maxclients&nbsp;128\r\nmaxclients&nbsp;128&nbsp;\u8bbe\u7f6e\u540c\u4e00\u65f6\u95f4\u6700\u5927\u5ba2\u6237\u7aef\u8fde\u63a5\u6570\uff0c\u9ed8\u8ba4\u65e0\u9650\u5236\uff0cRedis\u53ef\u4ee5\u540c\u65f6\u6253\u5f00\u7684\u5ba2\u6237\u7aef\u8fde\u63a5\u6570\u4e3aRedis\u8fdb\u7a0b\u53ef\u4ee5\u6253\u5f00\u7684\u6700\u5927\u6587\u4ef6\u63cf\u8ff0\u7b26\u6570\uff0c\u5982\u679c\u8bbe\u7f6e&nbsp;maxclients&nbsp;0\uff0c\u8868\u793a\u4e0d\u4f5c\u9650\u5236\u3002\u5f53\u5ba2\u6237\u7aef\u8fde\u63a5\u6570\u5230\u8fbe\u9650\u5236\u65f6\uff0cRedis\u4f1a\u5173\u95ed\u65b0\u7684\u8fde\u63a5\u5e76\u5411\u5ba2\u6237\u7aef\u8fd4\u56demax&nbsp;number&nbsp;of&nbsp;clients&nbsp;reached\u9519\u8bef\u4fe1\u606f\r\n#&nbsp;Don&#39;t&nbsp;use&nbsp;more&nbsp;memory&nbsp;than&nbsp;the&nbsp;specified&nbsp;amount&nbsp;of&nbsp;bytes.\r\n#&nbsp;When&nbsp;the&nbsp;memory&nbsp;limit&nbsp;is&nbsp;reached&nbsp;Redis&nbsp;will&nbsp;try&nbsp;to&nbsp;remove&nbsp;keys&nbsp;with&nbsp;an\r\n#&nbsp;EXPIRE&nbsp;set.&nbsp;It&nbsp;will&nbsp;try&nbsp;to&nbsp;start&nbsp;freeing&nbsp;keys&nbsp;that&nbsp;are&nbsp;going&nbsp;to&nbsp;expire\r\n#&nbsp;in&nbsp;little&nbsp;time&nbsp;and&nbsp;preserve&nbsp;keys&nbsp;with&nbsp;a&nbsp;longer&nbsp;time&nbsp;to&nbsp;live.\r\n#&nbsp;Redis&nbsp;will&nbsp;also&nbsp;try&nbsp;to&nbsp;remove&nbsp;objects&nbsp;from&nbsp;free&nbsp;lists&nbsp;if&nbsp;possible.\r\n#\r\n#&nbsp;If&nbsp;all&nbsp;this&nbsp;fails,&nbsp;Redis&nbsp;will&nbsp;start&nbsp;to&nbsp;reply&nbsp;with&nbsp;errors&nbsp;to&nbsp;commands\r\n#&nbsp;that&nbsp;will&nbsp;use&nbsp;more&nbsp;memory,&nbsp;like&nbsp;SET,&nbsp;LPUSH,&nbsp;and&nbsp;so&nbsp;on,&nbsp;and&nbsp;will&nbsp;continue\r\n#&nbsp;to&nbsp;reply&nbsp;to&nbsp;most&nbsp;read-only&nbsp;commands&nbsp;like&nbsp;GET.\r\n#\r\n#&nbsp;WARNING:&nbsp;maxmemory&nbsp;can&nbsp;be&nbsp;a&nbsp;good&nbsp;idea&nbsp;mainly&nbsp;if&nbsp;you&nbsp;want&nbsp;to&nbsp;use&nbsp;Redis&nbsp;as&nbsp;a\r\n#&nbsp;&#39;state&#39;&nbsp;server&nbsp;or&nbsp;cache,&nbsp;not&nbsp;as&nbsp;a&nbsp;real&nbsp;DB.&nbsp;When&nbsp;Redis&nbsp;is&nbsp;used&nbsp;as&nbsp;a&nbsp;real\r\n#&nbsp;database&nbsp;the&nbsp;memory&nbsp;usage&nbsp;will&nbsp;grow&nbsp;over&nbsp;the&nbsp;weeks,&nbsp;it&nbsp;will&nbsp;be&nbsp;obvious&nbsp;if\r\n#&nbsp;it&nbsp;is&nbsp;going&nbsp;to&nbsp;use&nbsp;too&nbsp;much&nbsp;memory&nbsp;in&nbsp;the&nbsp;long&nbsp;run,&nbsp;and&nbsp;you&#39;ll&nbsp;have&nbsp;the&nbsp;time\r\n#&nbsp;to&nbsp;upgrade.&nbsp;With&nbsp;maxmemory&nbsp;after&nbsp;the&nbsp;limit&nbsp;is&nbsp;reached&nbsp;you&#39;ll&nbsp;start&nbsp;to&nbsp;get\r\n#&nbsp;errors&nbsp;for&nbsp;write&nbsp;operations,&nbsp;and&nbsp;this&nbsp;may&nbsp;even&nbsp;lead&nbsp;to&nbsp;DB&nbsp;inconsistency.\r\n#\r\n#&nbsp;maxmemory&nbsp;&lt;bytes&gt;\r\n&nbsp;maxmemory&nbsp;&lt;bytes&gt;\u6307\u5b9aRedis\u6700\u5927\u5185\u5b58\u9650\u5236\uff0cRedis\u5728\u542f\u52a8\u65f6\u4f1a\u628a\u6570\u636e\u52a0\u8f7d\u5230\u5185\u5b58\u4e2d\uff0c\u8fbe\u5230\u6700\u5927\u5185\u5b58\u540e\uff0cRedis\u4f1a\u5148\u5c1d\u8bd5\u6e05\u9664\u5df2\u5230\u671f\u6216\u5373\u5c06\u5230\u671f\u7684Key\uff0c\u5f53\u6b64\u65b9\u6cd5\u5904\u7406&nbsp;\u540e\uff0c\u4ecd\u7136\u5230\u8fbe\u6700\u5927\u5185\u5b58\u8bbe\u7f6e\uff0c\u5c06\u65e0\u6cd5\u518d\u8fdb\u884c\u5199\u5165\u64cd\u4f5c\uff0c\u4f46\u4ecd\u7136\u53ef\u4ee5\u8fdb\u884c\u8bfb\u53d6\u64cd\u4f5c\u3002Redis\u65b0\u7684vm\u673a\u5236\uff0c\u4f1a\u628aKey\u5b58\u653e\u5185\u5b58\uff0cValue\u4f1a\u5b58\u653e\u5728swap\u533a\r\n#&nbsp;MAXMEMORY&nbsp;POLICY:&nbsp;how&nbsp;Redis&nbsp;will&nbsp;select&nbsp;what&nbsp;to&nbsp;remove&nbsp;when&nbsp;maxmemory\r\n#&nbsp;is&nbsp;reached?&nbsp;You&nbsp;can&nbsp;select&nbsp;among&nbsp;five&nbsp;behavior:\r\n#&nbsp;\r\n#&nbsp;volatile-lru&nbsp;-&gt;&nbsp;remove&nbsp;the&nbsp;key&nbsp;with&nbsp;an&nbsp;expire&nbsp;set&nbsp;using&nbsp;an&nbsp;LRU&nbsp;algorithm\r\n#&nbsp;allkeys-lru&nbsp;-&gt;&nbsp;remove&nbsp;any&nbsp;key&nbsp;accordingly&nbsp;to&nbsp;the&nbsp;LRU&nbsp;algorithm\r\n#&nbsp;volatile-random&nbsp;-&gt;&nbsp;remove&nbsp;a&nbsp;random&nbsp;key&nbsp;with&nbsp;an&nbsp;expire&nbsp;set\r\n#&nbsp;allkeys-&gt;random&nbsp;-&gt;&nbsp;remove&nbsp;a&nbsp;random&nbsp;key,&nbsp;any&nbsp;key\r\n#&nbsp;volatile-ttl&nbsp;-&gt;&nbsp;remove&nbsp;the&nbsp;key&nbsp;with&nbsp;the&nbsp;nearest&nbsp;expire&nbsp;time&nbsp;(minor&nbsp;TTL)\r\n#&nbsp;noeviction&nbsp;-&gt;&nbsp;don&#39;t&nbsp;expire&nbsp;at&nbsp;all,&nbsp;just&nbsp;return&nbsp;an&nbsp;error&nbsp;on&nbsp;write&nbsp;operations\r\n#&nbsp;\r\n#&nbsp;Note:&nbsp;with&nbsp;all&nbsp;the&nbsp;kind&nbsp;of&nbsp;policies,&nbsp;Redis&nbsp;will&nbsp;return&nbsp;an&nbsp;error&nbsp;on&nbsp;write\r\n#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;operations,&nbsp;when&nbsp;there&nbsp;are&nbsp;not&nbsp;suitable&nbsp;keys&nbsp;for&nbsp;eviction.\r\n#\r\n#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;At&nbsp;the&nbsp;date&nbsp;of&nbsp;writing&nbsp;this&nbsp;commands&nbsp;are:&nbsp;set&nbsp;setnx&nbsp;setex&nbsp;append\r\n#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;incr&nbsp;decr&nbsp;rpush&nbsp;lpush&nbsp;rpushx&nbsp;lpushx&nbsp;linsert&nbsp;lset&nbsp;rpoplpush&nbsp;sadd\r\n#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sinter&nbsp;sinterstore&nbsp;sunion&nbsp;sunionstore&nbsp;sdiff&nbsp;sdiffstore&nbsp;zadd&nbsp;zincrby\r\n#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;zunionstore&nbsp;zinterstore&nbsp;hset&nbsp;hsetnx&nbsp;hmset&nbsp;hincrby&nbsp;incrby&nbsp;decrby\r\n#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;getset&nbsp;mset&nbsp;msetnx&nbsp;exec&nbsp;sort\r\n#\r\n#&nbsp;The&nbsp;default&nbsp;is:\r\n#\r\n#&nbsp;maxmemory-policy&nbsp;volatile-lru\r\n&nbsp;\r\n#&nbsp;LRU&nbsp;and&nbsp;minimal&nbsp;TTL&nbsp;algorithms&nbsp;are&nbsp;not&nbsp;precise&nbsp;algorithms&nbsp;but&nbsp;approximated\r\n#&nbsp;algorithms&nbsp;(in&nbsp;order&nbsp;to&nbsp;save&nbsp;memory),&nbsp;so&nbsp;you&nbsp;can&nbsp;select&nbsp;as&nbsp;well&nbsp;the&nbsp;sample\r\n#&nbsp;size&nbsp;to&nbsp;check.&nbsp;For&nbsp;instance&nbsp;for&nbsp;default&nbsp;Redis&nbsp;will&nbsp;check&nbsp;three&nbsp;keys&nbsp;and\r\n#&nbsp;pick&nbsp;the&nbsp;one&nbsp;that&nbsp;was&nbsp;used&nbsp;less&nbsp;recently,&nbsp;you&nbsp;can&nbsp;change&nbsp;the&nbsp;sample&nbsp;size\r\n#&nbsp;using&nbsp;the&nbsp;following&nbsp;configuration&nbsp;directive.\r\n#\r\n#&nbsp;maxmemory-samples&nbsp;3\r\n&nbsp;\r\n##############################&nbsp;APPEND&nbsp;ONLY&nbsp;MODE&nbsp;###############################\r\n&nbsp;\r\n#&nbsp;By&nbsp;default&nbsp;Redis&nbsp;asynchronously&nbsp;dumps&nbsp;the&nbsp;dataset&nbsp;on&nbsp;disk.&nbsp;If&nbsp;you&nbsp;can&nbsp;live\r\n#&nbsp;with&nbsp;the&nbsp;idea&nbsp;that&nbsp;the&nbsp;latest&nbsp;records&nbsp;will&nbsp;be&nbsp;lost&nbsp;if&nbsp;something&nbsp;like&nbsp;a&nbsp;crash\r\n#&nbsp;happens&nbsp;this&nbsp;is&nbsp;the&nbsp;preferred&nbsp;way&nbsp;to&nbsp;run&nbsp;Redis.&nbsp;If&nbsp;instead&nbsp;you&nbsp;care&nbsp;a&nbsp;lot\r\n#&nbsp;about&nbsp;your&nbsp;data&nbsp;and&nbsp;don&#39;t&nbsp;want&nbsp;to&nbsp;that&nbsp;a&nbsp;single&nbsp;record&nbsp;can&nbsp;get&nbsp;lost&nbsp;you&nbsp;should\r\n#&nbsp;enable&nbsp;the&nbsp;append&nbsp;only&nbsp;mode:&nbsp;when&nbsp;this&nbsp;mode&nbsp;is&nbsp;enabled&nbsp;Redis&nbsp;will&nbsp;append\r\n#&nbsp;every&nbsp;write&nbsp;operation&nbsp;received&nbsp;in&nbsp;the&nbsp;file&nbsp;appendonly.aof.&nbsp;This&nbsp;file&nbsp;will\r\n#&nbsp;be&nbsp;read&nbsp;on&nbsp;startup&nbsp;in&nbsp;order&nbsp;to&nbsp;rebuild&nbsp;the&nbsp;full&nbsp;dataset&nbsp;in&nbsp;memory.\r\n#\r\n#&nbsp;Note&nbsp;that&nbsp;you&nbsp;can&nbsp;have&nbsp;both&nbsp;the&nbsp;async&nbsp;dumps&nbsp;and&nbsp;the&nbsp;append&nbsp;only&nbsp;file&nbsp;if&nbsp;you\r\n#&nbsp;like&nbsp;(you&nbsp;have&nbsp;to&nbsp;comment&nbsp;the&nbsp;&quot;save&quot;&nbsp;statements&nbsp;above&nbsp;to&nbsp;disable&nbsp;the&nbsp;dumps).\r\n#&nbsp;Still&nbsp;if&nbsp;append&nbsp;only&nbsp;mode&nbsp;is&nbsp;enabled&nbsp;Redis&nbsp;will&nbsp;load&nbsp;the&nbsp;data&nbsp;from&nbsp;the\r\n#&nbsp;log&nbsp;file&nbsp;at&nbsp;startup&nbsp;ignoring&nbsp;the&nbsp;dump.rdb&nbsp;file.\r\n#\r\n#&nbsp;IMPORTANT:&nbsp;Check&nbsp;the&nbsp;BGREWRITEAOF&nbsp;to&nbsp;check&nbsp;how&nbsp;to&nbsp;rewrite&nbsp;the&nbsp;append\r\n#&nbsp;log&nbsp;file&nbsp;in&nbsp;background&nbsp;when&nbsp;it&nbsp;gets&nbsp;too&nbsp;big.\r\n&nbsp;\r\nappendonly&nbsp;no\r\nappendonly&nbsp;no\u6307\u5b9a\u662f\u5426\u5728\u6bcf\u6b21\u66f4\u65b0\u64cd\u4f5c\u540e\u8fdb\u884c\u65e5\u5fd7\u8bb0\u5f55\uff0cRedis\u5728\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u662f\u5f02\u6b65\u7684\u628a\u6570\u636e\u5199\u5165\u78c1\u76d8\uff0c\u5982\u679c\u4e0d\u5f00\u542f\uff0c\u53ef\u80fd\u4f1a\u5728\u65ad\u7535\u65f6\u5bfc\u81f4\u4e00\u6bb5\u65f6\u95f4\u5185\u7684\u6570\u636e\u4e22\u5931\u3002\u56e0\u4e3a&nbsp;redis\u672c\u8eab\u540c\u6b65\u6570\u636e\u6587\u4ef6\u662f\u6309\u4e0a\u9762save\u6761\u4ef6\u6765\u540c\u6b65\u7684\uff0c\u6240\u4ee5\u6709\u7684\u6570\u636e\u4f1a\u5728\u4e00\u6bb5\u65f6\u95f4\u5185\u53ea\u5b58\u5728\u4e8e\u5185\u5b58\u4e2d\u3002\u9ed8\u8ba4\u4e3ano\r\n#&nbsp;The&nbsp;name&nbsp;of&nbsp;the&nbsp;append&nbsp;only&nbsp;file&nbsp;(default:&nbsp;&quot;appendonly.aof&quot;)\r\n#&nbsp;appendfilename&nbsp;appendonly.aof\r\n&nbsp;appendfilename&nbsp;appendonly.aof\u6307\u5b9a\u66f4\u65b0\u65e5\u5fd7\u6587\u4ef6\u540d\uff0c\u9ed8\u8ba4\u4e3aappendonly.aof\r\n#&nbsp;The&nbsp;fsync()&nbsp;call&nbsp;tells&nbsp;the&nbsp;Operating&nbsp;System&nbsp;to&nbsp;actually&nbsp;write&nbsp;data&nbsp;on&nbsp;disk\r\n#&nbsp;instead&nbsp;to&nbsp;wait&nbsp;for&nbsp;more&nbsp;data&nbsp;in&nbsp;the&nbsp;output&nbsp;buffer.&nbsp;Some&nbsp;OS&nbsp;will&nbsp;really&nbsp;flush&nbsp;\r\n#&nbsp;data&nbsp;on&nbsp;disk,&nbsp;some&nbsp;other&nbsp;OS&nbsp;will&nbsp;just&nbsp;try&nbsp;to&nbsp;do&nbsp;it&nbsp;ASAP.\r\n#\r\n#&nbsp;Redis&nbsp;supports&nbsp;three&nbsp;different&nbsp;modes:\r\n#\r\n#&nbsp;no:&nbsp;don&#39;t&nbsp;fsync,&nbsp;just&nbsp;let&nbsp;the&nbsp;OS&nbsp;flush&nbsp;the&nbsp;data&nbsp;when&nbsp;it&nbsp;wants.&nbsp;Faster.\r\n#&nbsp;always:&nbsp;fsync&nbsp;after&nbsp;every&nbsp;write&nbsp;to&nbsp;the&nbsp;append&nbsp;only&nbsp;log&nbsp;.&nbsp;Slow,&nbsp;Safest.\r\n#&nbsp;everysec:&nbsp;fsync&nbsp;only&nbsp;if&nbsp;one&nbsp;second&nbsp;passed&nbsp;since&nbsp;the&nbsp;last&nbsp;fsync.&nbsp;Compromise.\r\n#\r\n#&nbsp;The&nbsp;default&nbsp;is&nbsp;&quot;everysec&quot;&nbsp;that&#39;s&nbsp;usually&nbsp;the&nbsp;right&nbsp;compromise&nbsp;between\r\n#&nbsp;speed&nbsp;and&nbsp;data&nbsp;safety.&nbsp;It&#39;s&nbsp;up&nbsp;to&nbsp;you&nbsp;to&nbsp;understand&nbsp;if&nbsp;you&nbsp;can&nbsp;relax&nbsp;this&nbsp;to\r\n#&nbsp;&quot;no&quot;&nbsp;that&nbsp;will&nbsp;will&nbsp;let&nbsp;the&nbsp;operating&nbsp;system&nbsp;flush&nbsp;the&nbsp;output&nbsp;buffer&nbsp;when\r\n#&nbsp;it&nbsp;wants,&nbsp;for&nbsp;better&nbsp;performances&nbsp;(but&nbsp;if&nbsp;you&nbsp;can&nbsp;live&nbsp;with&nbsp;the&nbsp;idea&nbsp;of\r\n#&nbsp;some&nbsp;data&nbsp;loss&nbsp;consider&nbsp;the&nbsp;default&nbsp;persistence&nbsp;mode&nbsp;that&#39;s&nbsp;snapshotting),\r\n#&nbsp;or&nbsp;on&nbsp;the&nbsp;contrary,&nbsp;use&nbsp;&quot;always&quot;&nbsp;that&#39;s&nbsp;very&nbsp;slow&nbsp;but&nbsp;a&nbsp;bit&nbsp;safer&nbsp;than\r\n#&nbsp;everysec.\r\n#\r\n#&nbsp;If&nbsp;unsure,&nbsp;use&nbsp;&quot;everysec&quot;.\r\n&nbsp;\r\n#&nbsp;appendfsync&nbsp;always\r\nappendfsync&nbsp;everysec\r\n#&nbsp;appendfsync&nbsp;no\r\n\u6307\u5b9a\u66f4\u65b0\u65e5\u5fd7\u6761\u4ef6\uff0c\u5171\u67093\u4e2a\u53ef\u9009\u503c\uff1a\r\nno\uff1a\u8868\u793a\u7b49\u64cd\u4f5c\u7cfb\u7edf\u8fdb\u884c\u6570\u636e\u7f13\u5b58\u540c\u6b65\u5230\u78c1\u76d8\uff08\u5feb\uff09\r\nalways\uff1a\u8868\u793a\u6bcf\u6b21\u66f4\u65b0\u64cd\u4f5c\u540e\u624b\u52a8\u8c03\u7528fsync()\u5c06\u6570\u636e\u5199\u5230\u78c1\u76d8\uff08\u6162\uff0c\u5b89\u5168\uff09\r\neverysec\uff1a\u8868\u793a\u6bcf\u79d2\u540c\u6b65\u4e00\u6b21\uff08\u6298\u8877\uff0c\u9ed8\u8ba4\u503c\uff09\r\n#&nbsp;When&nbsp;the&nbsp;AOF&nbsp;fsync&nbsp;policy&nbsp;is&nbsp;set&nbsp;to&nbsp;always&nbsp;or&nbsp;everysec,&nbsp;and&nbsp;a&nbsp;background\r\n#&nbsp;saving&nbsp;process&nbsp;(a&nbsp;background&nbsp;save&nbsp;or&nbsp;AOF&nbsp;log&nbsp;background&nbsp;rewriting)&nbsp;is\r\n#&nbsp;performing&nbsp;a&nbsp;lot&nbsp;of&nbsp;I\/O&nbsp;against&nbsp;the&nbsp;disk,&nbsp;in&nbsp;some&nbsp;Linux&nbsp;configurations\r\n#&nbsp;Redis&nbsp;may&nbsp;block&nbsp;too&nbsp;long&nbsp;on&nbsp;the&nbsp;fsync()&nbsp;call.&nbsp;Note&nbsp;that&nbsp;there&nbsp;is&nbsp;no&nbsp;fix&nbsp;for\r\n#&nbsp;this&nbsp;currently,&nbsp;as&nbsp;even&nbsp;performing&nbsp;fsync&nbsp;in&nbsp;a&nbsp;different&nbsp;thread&nbsp;will&nbsp;block\r\n#&nbsp;our&nbsp;synchronous&nbsp;write(2)&nbsp;call.\r\n#\r\n#&nbsp;In&nbsp;order&nbsp;to&nbsp;mitigate&nbsp;this&nbsp;problem&nbsp;it&#39;s&nbsp;possible&nbsp;to&nbsp;use&nbsp;the&nbsp;following&nbsp;option\r\n#&nbsp;that&nbsp;will&nbsp;prevent&nbsp;fsync()&nbsp;from&nbsp;being&nbsp;called&nbsp;in&nbsp;the&nbsp;main&nbsp;process&nbsp;while&nbsp;a\r\n#&nbsp;BGSAVE&nbsp;or&nbsp;BGREWRITEAOF&nbsp;is&nbsp;in&nbsp;progress.\r\n#\r\n#&nbsp;This&nbsp;means&nbsp;that&nbsp;while&nbsp;another&nbsp;child&nbsp;is&nbsp;saving&nbsp;the&nbsp;durability&nbsp;of&nbsp;Redis&nbsp;is\r\n#&nbsp;the&nbsp;same&nbsp;as&nbsp;&quot;appendfsync&nbsp;none&quot;,&nbsp;that&nbsp;in&nbsp;pratical&nbsp;terms&nbsp;means&nbsp;that&nbsp;it&nbsp;is\r\n#&nbsp;possible&nbsp;to&nbsp;lost&nbsp;up&nbsp;to&nbsp;30&nbsp;seconds&nbsp;of&nbsp;log&nbsp;in&nbsp;the&nbsp;worst&nbsp;scenario&nbsp;(with&nbsp;the\r\n#&nbsp;default&nbsp;Linux&nbsp;settings).\r\n#&nbsp;\r\n#&nbsp;If&nbsp;you&nbsp;have&nbsp;latency&nbsp;problems&nbsp;turn&nbsp;this&nbsp;to&nbsp;&quot;yes&quot;.&nbsp;Otherwise&nbsp;leave&nbsp;it&nbsp;as\r\n#&nbsp;&quot;no&quot;&nbsp;that&nbsp;is&nbsp;the&nbsp;safest&nbsp;pick&nbsp;from&nbsp;the&nbsp;point&nbsp;of&nbsp;view&nbsp;of&nbsp;durability.\r\nno-appendfsync-on-rewrite&nbsp;no\r\n&nbsp;\r\n#&nbsp;Automatic&nbsp;rewrite&nbsp;of&nbsp;the&nbsp;append&nbsp;only&nbsp;file.\r\n#&nbsp;Redis&nbsp;is&nbsp;able&nbsp;to&nbsp;automatically&nbsp;rewrite&nbsp;the&nbsp;log&nbsp;file&nbsp;implicitly&nbsp;calling\r\n#&nbsp;BGREWRITEAOF&nbsp;when&nbsp;the&nbsp;AOF&nbsp;log&nbsp;size&nbsp;will&nbsp;growth&nbsp;by&nbsp;the&nbsp;specified&nbsp;percentage.\r\n#&nbsp;\r\n#&nbsp;This&nbsp;is&nbsp;how&nbsp;it&nbsp;works:&nbsp;Redis&nbsp;remembers&nbsp;the&nbsp;size&nbsp;of&nbsp;the&nbsp;AOF&nbsp;file&nbsp;after&nbsp;the\r\n#&nbsp;latest&nbsp;rewrite&nbsp;(or&nbsp;if&nbsp;no&nbsp;rewrite&nbsp;happened&nbsp;since&nbsp;the&nbsp;restart,&nbsp;the&nbsp;size&nbsp;of\r\n#&nbsp;the&nbsp;AOF&nbsp;at&nbsp;startup&nbsp;is&nbsp;used).\r\n#\r\n#&nbsp;This&nbsp;base&nbsp;size&nbsp;is&nbsp;compared&nbsp;to&nbsp;the&nbsp;current&nbsp;size.&nbsp;If&nbsp;the&nbsp;current&nbsp;size&nbsp;is\r\n#&nbsp;bigger&nbsp;than&nbsp;the&nbsp;specified&nbsp;percentage,&nbsp;the&nbsp;rewrite&nbsp;is&nbsp;triggered.&nbsp;Also\r\n#&nbsp;you&nbsp;need&nbsp;to&nbsp;specify&nbsp;a&nbsp;minimal&nbsp;size&nbsp;for&nbsp;the&nbsp;AOF&nbsp;file&nbsp;to&nbsp;be&nbsp;rewritten,&nbsp;this\r\n#&nbsp;is&nbsp;useful&nbsp;to&nbsp;avoid&nbsp;rewriting&nbsp;the&nbsp;AOF&nbsp;file&nbsp;even&nbsp;if&nbsp;the&nbsp;percentage&nbsp;increase\r\n#&nbsp;is&nbsp;reached&nbsp;but&nbsp;it&nbsp;is&nbsp;still&nbsp;pretty&nbsp;small.\r\n#\r\n#&nbsp;Specify&nbsp;a&nbsp;precentage&nbsp;of&nbsp;zero&nbsp;in&nbsp;order&nbsp;to&nbsp;disable&nbsp;the&nbsp;automatic&nbsp;AOF\r\n#&nbsp;rewrite&nbsp;feature.\r\n&nbsp;\r\nauto-aof-rewrite-percentage&nbsp;100\r\nauto-aof-rewrite-min-size&nbsp;64mb\r\n&nbsp;\r\n##################################&nbsp;SLOW&nbsp;LOG&nbsp;###################################\r\n&nbsp;\r\n#&nbsp;The&nbsp;Redis&nbsp;Slow&nbsp;Log&nbsp;is&nbsp;a&nbsp;system&nbsp;to&nbsp;log&nbsp;queries&nbsp;that&nbsp;exceeded&nbsp;a&nbsp;specified\r\n#&nbsp;execution&nbsp;time.&nbsp;The&nbsp;execution&nbsp;time&nbsp;does&nbsp;not&nbsp;include&nbsp;the&nbsp;I\/O&nbsp;operations\r\n#&nbsp;like&nbsp;talking&nbsp;with&nbsp;the&nbsp;client,&nbsp;sending&nbsp;the&nbsp;reply&nbsp;and&nbsp;so&nbsp;forth,\r\n#&nbsp;but&nbsp;just&nbsp;the&nbsp;time&nbsp;needed&nbsp;to&nbsp;actually&nbsp;execute&nbsp;the&nbsp;command&nbsp;(this&nbsp;is&nbsp;the&nbsp;only\r\n#&nbsp;stage&nbsp;of&nbsp;command&nbsp;execution&nbsp;where&nbsp;the&nbsp;thread&nbsp;is&nbsp;blocked&nbsp;and&nbsp;can&nbsp;not&nbsp;serve\r\n#&nbsp;other&nbsp;requests&nbsp;in&nbsp;the&nbsp;meantime).\r\n#&nbsp;\r\n#&nbsp;You&nbsp;can&nbsp;configure&nbsp;the&nbsp;slow&nbsp;log&nbsp;with&nbsp;two&nbsp;parameters:&nbsp;one&nbsp;tells&nbsp;Redis\r\n#&nbsp;what&nbsp;is&nbsp;the&nbsp;execution&nbsp;time,&nbsp;in&nbsp;microseconds,&nbsp;to&nbsp;exceed&nbsp;in&nbsp;order&nbsp;for&nbsp;the\r\n#&nbsp;command&nbsp;to&nbsp;get&nbsp;logged,&nbsp;and&nbsp;the&nbsp;other&nbsp;parameter&nbsp;is&nbsp;the&nbsp;length&nbsp;of&nbsp;the\r\n#&nbsp;slow&nbsp;log.&nbsp;When&nbsp;a&nbsp;new&nbsp;command&nbsp;is&nbsp;logged&nbsp;the&nbsp;oldest&nbsp;one&nbsp;is&nbsp;removed&nbsp;from&nbsp;the\r\n#&nbsp;queue&nbsp;of&nbsp;logged&nbsp;commands.\r\n&nbsp;\r\n#&nbsp;The&nbsp;following&nbsp;time&nbsp;is&nbsp;expressed&nbsp;in&nbsp;microseconds,&nbsp;so&nbsp;1000000&nbsp;is&nbsp;equivalent\r\n#&nbsp;to&nbsp;one&nbsp;second.&nbsp;Note&nbsp;that&nbsp;a&nbsp;negative&nbsp;number&nbsp;disables&nbsp;the&nbsp;slow&nbsp;log,&nbsp;while\r\n#&nbsp;a&nbsp;value&nbsp;of&nbsp;zero&nbsp;forces&nbsp;the&nbsp;logging&nbsp;of&nbsp;every&nbsp;command.\r\nslowlog-log-slower-than&nbsp;10000\r\n&nbsp;\r\n#&nbsp;There&nbsp;is&nbsp;no&nbsp;limit&nbsp;to&nbsp;this&nbsp;length.&nbsp;Just&nbsp;be&nbsp;aware&nbsp;that&nbsp;it&nbsp;will&nbsp;consume&nbsp;memory.\r\n#&nbsp;You&nbsp;can&nbsp;reclaim&nbsp;memory&nbsp;used&nbsp;by&nbsp;the&nbsp;slow&nbsp;log&nbsp;with&nbsp;SLOWLOG&nbsp;RESET.\r\nslowlog-max-len&nbsp;1024\r\n&nbsp;\r\n################################&nbsp;VIRTUAL&nbsp;MEMORY&nbsp;###############################\r\n&nbsp;\r\n###&nbsp;WARNING!&nbsp;Virtual&nbsp;Memory&nbsp;is&nbsp;deprecated&nbsp;in&nbsp;Redis&nbsp;2.4\r\n###&nbsp;The&nbsp;use&nbsp;of&nbsp;Virtual&nbsp;Memory&nbsp;is&nbsp;strongly&nbsp;discouraged.\r\n&nbsp;\r\n###&nbsp;WARNING!&nbsp;Virtual&nbsp;Memory&nbsp;is&nbsp;deprecated&nbsp;in&nbsp;Redis&nbsp;2.4\r\n###&nbsp;The&nbsp;use&nbsp;of&nbsp;Virtual&nbsp;Memory&nbsp;is&nbsp;strongly&nbsp;discouraged.\r\n&nbsp;\r\n#&nbsp;Virtual&nbsp;Memory&nbsp;allows&nbsp;Redis&nbsp;to&nbsp;work&nbsp;with&nbsp;datasets&nbsp;bigger&nbsp;than&nbsp;the&nbsp;actual\r\n#&nbsp;amount&nbsp;of&nbsp;RAM&nbsp;needed&nbsp;to&nbsp;hold&nbsp;the&nbsp;whole&nbsp;dataset&nbsp;in&nbsp;memory.\r\n#&nbsp;In&nbsp;order&nbsp;to&nbsp;do&nbsp;so&nbsp;very&nbsp;used&nbsp;keys&nbsp;are&nbsp;taken&nbsp;in&nbsp;memory&nbsp;while&nbsp;the&nbsp;other&nbsp;keys\r\n#&nbsp;are&nbsp;swapped&nbsp;into&nbsp;a&nbsp;swap&nbsp;file,&nbsp;similarly&nbsp;to&nbsp;what&nbsp;operating&nbsp;systems&nbsp;do\r\n#&nbsp;with&nbsp;memory&nbsp;pages.\r\n#\r\n#&nbsp;To&nbsp;enable&nbsp;VM&nbsp;just&nbsp;set&nbsp;&#39;vm-enabled&#39;&nbsp;to&nbsp;yes,&nbsp;and&nbsp;set&nbsp;the&nbsp;following&nbsp;three\r\n#&nbsp;VM&nbsp;parameters&nbsp;accordingly&nbsp;to&nbsp;your&nbsp;needs.\r\n&nbsp;\r\nvm-enabled&nbsp;no\r\n\u6307\u5b9a\u662f\u5426\u542f\u7528\u865a\u62df\u5185\u5b58\u673a\u5236\uff0c\u9ed8\u8ba4\u503c\u4e3ano\uff0c\u7b80\u5355\u7684\u4ecb\u7ecd\u4e00\u4e0b\uff0cVM\u673a\u5236\u5c06\u6570\u636e\u5206\u9875\u5b58\u653e\uff0c\u7531Redis\u5c06\u8bbf\u95ee\u91cf\u8f83\u5c11\u7684\u9875\u5373\u51b7\u6570\u636eswap\u5230\u78c1\u76d8\u4e0a\uff0c\u8bbf\u95ee\u591a\u7684\u9875\u9762\u7531\u78c1\u76d8\u81ea\u52a8\u6362\u51fa\u5230\u5185\u5b58\u4e2d\uff08\u5728\u540e\u9762\u7684\u6587\u7ae0\u6211\u4f1a\u4ed4\u7ec6\u5206\u6790Redis\u7684VM\u673a\u5236\uff09\r\n#&nbsp;vm-enabled&nbsp;yes\r\n&nbsp;\r\n#&nbsp;This&nbsp;is&nbsp;the&nbsp;path&nbsp;of&nbsp;the&nbsp;Redis&nbsp;swap&nbsp;file.&nbsp;As&nbsp;you&nbsp;can&nbsp;guess,&nbsp;swap&nbsp;files\r\n#&nbsp;can&#39;t&nbsp;be&nbsp;shared&nbsp;by&nbsp;different&nbsp;Redis&nbsp;instances,&nbsp;so&nbsp;make&nbsp;sure&nbsp;to&nbsp;use&nbsp;a&nbsp;swap\r\n#&nbsp;file&nbsp;for&nbsp;every&nbsp;redis&nbsp;process&nbsp;you&nbsp;are&nbsp;running.&nbsp;Redis&nbsp;will&nbsp;complain&nbsp;if&nbsp;the\r\n#&nbsp;swap&nbsp;file&nbsp;is&nbsp;already&nbsp;in&nbsp;use.\r\n#\r\n#&nbsp;The&nbsp;best&nbsp;kind&nbsp;of&nbsp;storage&nbsp;for&nbsp;the&nbsp;Redis&nbsp;swap&nbsp;file&nbsp;(that&#39;s&nbsp;accessed&nbsp;at&nbsp;random)&nbsp;\r\n#&nbsp;is&nbsp;a&nbsp;Solid&nbsp;State&nbsp;Disk&nbsp;(SSD).\r\n#\r\n#&nbsp;***&nbsp;WARNING&nbsp;***&nbsp;if&nbsp;you&nbsp;are&nbsp;using&nbsp;a&nbsp;shared&nbsp;hosting&nbsp;the&nbsp;default&nbsp;of&nbsp;putting\r\n#&nbsp;the&nbsp;swap&nbsp;file&nbsp;under&nbsp;\/tmp&nbsp;is&nbsp;not&nbsp;secure.&nbsp;Create&nbsp;a&nbsp;dir&nbsp;with&nbsp;access&nbsp;granted\r\n#&nbsp;only&nbsp;to&nbsp;Redis&nbsp;user&nbsp;and&nbsp;configure&nbsp;Redis&nbsp;to&nbsp;create&nbsp;the&nbsp;swap&nbsp;file&nbsp;there.\r\nvm-swap-file&nbsp;\/tmp\/redis.swap\r\n\u865a\u62df\u5185\u5b58\u6587\u4ef6\u8def\u5f84\uff0c\u9ed8\u8ba4\u503c\u4e3a\/tmp\/redis.swap\uff0c\u4e0d\u53ef\u591a\u4e2aRedis\u5b9e\u4f8b\u5171\u4eab\r\n#&nbsp;vm-max-memory&nbsp;configures&nbsp;the&nbsp;VM&nbsp;to&nbsp;use&nbsp;at&nbsp;max&nbsp;the&nbsp;specified&nbsp;amount&nbsp;of\r\n#&nbsp;RAM.&nbsp;Everything&nbsp;that&nbsp;deos&nbsp;not&nbsp;fit&nbsp;will&nbsp;be&nbsp;swapped&nbsp;on&nbsp;disk&nbsp;*if*&nbsp;possible,&nbsp;that\r\n#&nbsp;is,&nbsp;if&nbsp;there&nbsp;is&nbsp;still&nbsp;enough&nbsp;contiguous&nbsp;space&nbsp;in&nbsp;the&nbsp;swap&nbsp;file.\r\n#\r\n#&nbsp;With&nbsp;vm-max-memory&nbsp;0&nbsp;the&nbsp;system&nbsp;will&nbsp;swap&nbsp;everything&nbsp;it&nbsp;can.&nbsp;Not&nbsp;a&nbsp;good\r\n#&nbsp;default,&nbsp;just&nbsp;specify&nbsp;the&nbsp;max&nbsp;amount&nbsp;of&nbsp;RAM&nbsp;you&nbsp;can&nbsp;in&nbsp;bytes,&nbsp;but&nbsp;it&#39;s\r\n#&nbsp;better&nbsp;to&nbsp;leave&nbsp;some&nbsp;margin.&nbsp;For&nbsp;instance&nbsp;specify&nbsp;an&nbsp;amount&nbsp;of&nbsp;RAM\r\n#&nbsp;that&#39;s&nbsp;more&nbsp;or&nbsp;less&nbsp;between&nbsp;60&nbsp;and&nbsp;80%&nbsp;of&nbsp;your&nbsp;free&nbsp;RAM.\r\nvm-max-memory&nbsp;0\r\n\u5c06\u6240\u6709\u5927\u4e8evm-max-memory\u7684\u6570\u636e\u5b58\u5165\u865a\u62df\u5185\u5b58,\u65e0\u8bbavm-max-memory\u8bbe\u7f6e\u591a\u5c0f,\u6240\u6709\u7d22\u5f15\u6570\u636e\u90fd\u662f\u5185\u5b58\u5b58\u50a8\u7684(Redis\u7684\u7d22\u5f15\u6570\u636e&nbsp;\u5c31\u662fkeys),\u4e5f\u5c31\u662f\u8bf4,\u5f53vm-max-memory\u8bbe\u7f6e\u4e3a0\u7684\u65f6\u5019,\u5176\u5b9e\u662f\u6240\u6709value\u90fd\u5b58\u5728\u4e8e\u78c1\u76d8\u3002\u9ed8\u8ba4\u503c\u4e3a0\r\n#&nbsp;Redis&nbsp;swap&nbsp;files&nbsp;is&nbsp;split&nbsp;into&nbsp;pages.&nbsp;An&nbsp;object&nbsp;can&nbsp;be&nbsp;saved&nbsp;using&nbsp;multiple\r\n#&nbsp;contiguous&nbsp;pages,&nbsp;but&nbsp;pages&nbsp;can&#39;t&nbsp;be&nbsp;shared&nbsp;between&nbsp;different&nbsp;objects.\r\n#&nbsp;So&nbsp;if&nbsp;your&nbsp;page&nbsp;is&nbsp;too&nbsp;big,&nbsp;small&nbsp;objects&nbsp;swapped&nbsp;out&nbsp;on&nbsp;disk&nbsp;will&nbsp;waste\r\n#&nbsp;a&nbsp;lot&nbsp;of&nbsp;space.&nbsp;If&nbsp;you&nbsp;page&nbsp;is&nbsp;too&nbsp;small,&nbsp;there&nbsp;is&nbsp;less&nbsp;space&nbsp;in&nbsp;the&nbsp;swap\r\n#&nbsp;file&nbsp;(assuming&nbsp;you&nbsp;configured&nbsp;the&nbsp;same&nbsp;number&nbsp;of&nbsp;total&nbsp;swap&nbsp;file&nbsp;pages).\r\n#\r\n#&nbsp;If&nbsp;you&nbsp;use&nbsp;a&nbsp;lot&nbsp;of&nbsp;small&nbsp;objects,&nbsp;use&nbsp;a&nbsp;page&nbsp;size&nbsp;of&nbsp;64&nbsp;or&nbsp;32&nbsp;bytes.\r\n#&nbsp;If&nbsp;you&nbsp;use&nbsp;a&nbsp;lot&nbsp;of&nbsp;big&nbsp;objects,&nbsp;use&nbsp;a&nbsp;bigger&nbsp;page&nbsp;size.\r\n#&nbsp;If&nbsp;unsure,&nbsp;use&nbsp;the&nbsp;default&nbsp;:)\r\nvm-page-size&nbsp;32\r\nRedis&nbsp;swap\u6587\u4ef6\u5206\u6210\u4e86\u5f88\u591a\u7684page\uff0c\u4e00\u4e2a\u5bf9\u8c61\u53ef\u4ee5\u4fdd\u5b58\u5728\u591a\u4e2apage\u4e0a\u9762\uff0c\u4f46\u4e00\u4e2apage\u4e0a\u4e0d\u80fd\u88ab\u591a\u4e2a\u5bf9\u8c61\u5171\u4eab\uff0cvm-page-size\u662f\u8981\u6839\u636e\u5b58\u50a8\u7684&nbsp;\u6570\u636e\u5927\u5c0f\u6765\u8bbe\u5b9a\u7684\uff0c\u4f5c\u8005\u5efa\u8bae\u5982\u679c\u5b58\u50a8\u5f88\u591a\u5c0f\u5bf9\u8c61\uff0cpage\u5927\u5c0f\u6700\u597d\u8bbe\u7f6e\u4e3a32\u6216\u800564bytes\uff1b\u5982\u679c\u5b58\u50a8\u5f88\u5927\u5927\u5bf9\u8c61\uff0c\u5219\u53ef\u4ee5\u4f7f\u7528\u66f4\u5927\u7684page\uff0c\u5982\u679c\u4e0d&nbsp;\u786e\u5b9a\uff0c\u5c31\u4f7f\u7528\u9ed8\u8ba4\u503c\r\n#&nbsp;Number&nbsp;of&nbsp;total&nbsp;memory&nbsp;pages&nbsp;in&nbsp;the&nbsp;swap&nbsp;file.\r\n#&nbsp;Given&nbsp;that&nbsp;the&nbsp;page&nbsp;table&nbsp;(a&nbsp;bitmap&nbsp;of&nbsp;free\/used&nbsp;pages)&nbsp;is&nbsp;taken&nbsp;in&nbsp;memory,\r\n#&nbsp;every&nbsp;8&nbsp;pages&nbsp;on&nbsp;disk&nbsp;will&nbsp;consume&nbsp;1&nbsp;byte&nbsp;of&nbsp;RAM.\r\n#\r\n#&nbsp;The&nbsp;total&nbsp;swap&nbsp;size&nbsp;is&nbsp;vm-page-size&nbsp;*&nbsp;vm-pages\r\n#\r\n#&nbsp;With&nbsp;the&nbsp;default&nbsp;of&nbsp;32-bytes&nbsp;memory&nbsp;pages&nbsp;and&nbsp;134217728&nbsp;pages&nbsp;Redis&nbsp;will\r\n#&nbsp;use&nbsp;a&nbsp;4&nbsp;GB&nbsp;swap&nbsp;file,&nbsp;that&nbsp;will&nbsp;use&nbsp;16&nbsp;MB&nbsp;of&nbsp;RAM&nbsp;for&nbsp;the&nbsp;page&nbsp;table.\r\n#\r\n#&nbsp;It&#39;s&nbsp;better&nbsp;to&nbsp;use&nbsp;the&nbsp;smallest&nbsp;acceptable&nbsp;value&nbsp;for&nbsp;your&nbsp;application,\r\n#&nbsp;but&nbsp;the&nbsp;default&nbsp;is&nbsp;large&nbsp;in&nbsp;order&nbsp;to&nbsp;work&nbsp;in&nbsp;most&nbsp;conditions.\r\nvm-pages&nbsp;134217728\r\n\u8bbe\u7f6eswap\u6587\u4ef6\u4e2d\u7684page\u6570\u91cf\uff0c\u7531\u4e8e\u9875\u8868\uff08\u4e00\u79cd\u8868\u793a\u9875\u9762\u7a7a\u95f2\u6216\u4f7f\u7528\u7684bitmap\uff09\u662f\u5728\u653e\u5728\u5185\u5b58\u4e2d\u7684\uff0c\uff0c\u5728\u78c1\u76d8\u4e0a\u6bcf8\u4e2apages\u5c06\u6d88\u80171byte\u7684\u5185\u5b58\u3002\r\n#&nbsp;Max&nbsp;number&nbsp;of&nbsp;VM&nbsp;I\/O&nbsp;threads&nbsp;running&nbsp;at&nbsp;the&nbsp;same&nbsp;time.\r\n#&nbsp;This&nbsp;threads&nbsp;are&nbsp;used&nbsp;to&nbsp;read\/write&nbsp;data&nbsp;from\/to&nbsp;swap&nbsp;file,&nbsp;since&nbsp;they\r\n#&nbsp;also&nbsp;encode&nbsp;and&nbsp;decode&nbsp;objects&nbsp;from&nbsp;disk&nbsp;to&nbsp;memory&nbsp;or&nbsp;the&nbsp;reverse,&nbsp;a&nbsp;bigger\r\n#&nbsp;number&nbsp;of&nbsp;threads&nbsp;can&nbsp;help&nbsp;with&nbsp;big&nbsp;objects&nbsp;even&nbsp;if&nbsp;they&nbsp;can&#39;t&nbsp;help&nbsp;with\r\n#&nbsp;I\/O&nbsp;itself&nbsp;as&nbsp;the&nbsp;physical&nbsp;device&nbsp;may&nbsp;not&nbsp;be&nbsp;able&nbsp;to&nbsp;couple&nbsp;with&nbsp;many\r\n#&nbsp;reads\/writes&nbsp;operations&nbsp;at&nbsp;the&nbsp;same&nbsp;time.\r\n#\r\n#&nbsp;The&nbsp;special&nbsp;value&nbsp;of&nbsp;0&nbsp;turn&nbsp;off&nbsp;threaded&nbsp;I\/O&nbsp;and&nbsp;enables&nbsp;the&nbsp;blocking\r\n#&nbsp;Virtual&nbsp;Memory&nbsp;implementation.\r\nvm-max-threads&nbsp;4\r\n\u8bbe\u7f6e\u8bbf\u95eeswap\u6587\u4ef6\u7684\u7ebf\u7a0b\u6570,\u6700\u597d\u4e0d\u8981\u8d85\u8fc7\u673a\u5668\u7684\u6838\u6570,\u5982\u679c\u8bbe\u7f6e\u4e3a0,\u90a3\u4e48\u6240\u6709\u5bf9swap\u6587\u4ef6\u7684\u64cd\u4f5c\u90fd\u662f\u4e32\u884c\u7684\uff0c\u53ef\u80fd\u4f1a\u9020\u6210\u6bd4\u8f83\u957f\u65f6\u95f4\u7684\u5ef6\u8fdf\u3002\u9ed8\u8ba4\u503c\u4e3a4\r\n###############################&nbsp;ADVANCED&nbsp;CONFIG&nbsp;###############################\r\n&nbsp;\r\n#&nbsp;Hashes&nbsp;are&nbsp;encoded&nbsp;in&nbsp;a&nbsp;special&nbsp;way&nbsp;(much&nbsp;more&nbsp;memory&nbsp;efficient)&nbsp;when&nbsp;they\r\n#&nbsp;have&nbsp;at&nbsp;max&nbsp;a&nbsp;given&nbsp;numer&nbsp;of&nbsp;elements,&nbsp;and&nbsp;the&nbsp;biggest&nbsp;element&nbsp;does&nbsp;not\r\n#&nbsp;exceed&nbsp;a&nbsp;given&nbsp;threshold.&nbsp;You&nbsp;can&nbsp;configure&nbsp;this&nbsp;limits&nbsp;with&nbsp;the&nbsp;following\r\n#&nbsp;configuration&nbsp;directives.\r\nhash-max-zipmap-entries&nbsp;512\r\nhash-max-zipmap-value&nbsp;64\r\n\u6307\u5b9a\u5728\u8d85\u8fc7\u4e00\u5b9a\u7684\u6570\u91cf\u6216\u8005\u6700\u5927\u7684\u5143\u7d20\u8d85\u8fc7\u67d0\u4e00\u4e34\u754c\u503c\u65f6\uff0c\u91c7\u7528\u4e00\u79cd\u7279\u6b8a\u7684\u54c8\u5e0c\u7b97\u6cd5\r\n#&nbsp;Similarly&nbsp;to&nbsp;hashes,&nbsp;small&nbsp;lists&nbsp;are&nbsp;also&nbsp;encoded&nbsp;in&nbsp;a&nbsp;special&nbsp;way&nbsp;in&nbsp;order\r\n#&nbsp;to&nbsp;save&nbsp;a&nbsp;lot&nbsp;of&nbsp;space.&nbsp;The&nbsp;special&nbsp;representation&nbsp;is&nbsp;only&nbsp;used&nbsp;when\r\n#&nbsp;you&nbsp;are&nbsp;under&nbsp;the&nbsp;following&nbsp;limits:\r\nlist-max-ziplist-entries&nbsp;512\r\nlist-max-ziplist-value&nbsp;64\r\n&nbsp;\r\n#&nbsp;Sets&nbsp;have&nbsp;a&nbsp;special&nbsp;encoding&nbsp;in&nbsp;just&nbsp;one&nbsp;case:&nbsp;when&nbsp;a&nbsp;set&nbsp;is&nbsp;composed\r\n#&nbsp;of&nbsp;just&nbsp;strings&nbsp;that&nbsp;happens&nbsp;to&nbsp;be&nbsp;integers&nbsp;in&nbsp;radix&nbsp;10&nbsp;in&nbsp;the&nbsp;range\r\n#&nbsp;of&nbsp;64&nbsp;bit&nbsp;signed&nbsp;integers.\r\n#&nbsp;The&nbsp;following&nbsp;configuration&nbsp;setting&nbsp;sets&nbsp;the&nbsp;limit&nbsp;in&nbsp;the&nbsp;size&nbsp;of&nbsp;the\r\n#&nbsp;set&nbsp;in&nbsp;order&nbsp;to&nbsp;use&nbsp;this&nbsp;special&nbsp;memory&nbsp;saving&nbsp;encoding.\r\nset-max-intset-entries&nbsp;512\r\n&nbsp;\r\n#&nbsp;Similarly&nbsp;to&nbsp;hashes&nbsp;and&nbsp;lists,&nbsp;sorted&nbsp;sets&nbsp;are&nbsp;also&nbsp;specially&nbsp;encoded&nbsp;in\r\n#&nbsp;order&nbsp;to&nbsp;save&nbsp;a&nbsp;lot&nbsp;of&nbsp;space.&nbsp;This&nbsp;encoding&nbsp;is&nbsp;only&nbsp;used&nbsp;when&nbsp;the&nbsp;length&nbsp;and\r\n#&nbsp;elements&nbsp;of&nbsp;a&nbsp;sorted&nbsp;set&nbsp;are&nbsp;below&nbsp;the&nbsp;following&nbsp;limits:\r\nzset-max-ziplist-entries&nbsp;128\r\nzset-max-ziplist-value&nbsp;64\r\n&nbsp;\r\n#&nbsp;Active&nbsp;rehashing&nbsp;uses&nbsp;1&nbsp;millisecond&nbsp;every&nbsp;100&nbsp;milliseconds&nbsp;of&nbsp;CPU&nbsp;time&nbsp;in\r\n#&nbsp;order&nbsp;to&nbsp;help&nbsp;rehashing&nbsp;the&nbsp;main&nbsp;Redis&nbsp;hash&nbsp;table&nbsp;(the&nbsp;one&nbsp;mapping&nbsp;top-level\r\n#&nbsp;keys&nbsp;to&nbsp;values).&nbsp;The&nbsp;hash&nbsp;table&nbsp;implementation&nbsp;redis&nbsp;uses&nbsp;(see&nbsp;dict.c)\r\n#&nbsp;performs&nbsp;a&nbsp;lazy&nbsp;rehashing:&nbsp;the&nbsp;more&nbsp;operation&nbsp;you&nbsp;run&nbsp;into&nbsp;an&nbsp;hash&nbsp;table\r\n#&nbsp;that&nbsp;is&nbsp;rhashing,&nbsp;the&nbsp;more&nbsp;rehashing&nbsp;&quot;steps&quot;&nbsp;are&nbsp;performed,&nbsp;so&nbsp;if&nbsp;the\r\n#&nbsp;server&nbsp;is&nbsp;idle&nbsp;the&nbsp;rehashing&nbsp;is&nbsp;never&nbsp;complete&nbsp;and&nbsp;some&nbsp;more&nbsp;memory&nbsp;is&nbsp;used\r\n#&nbsp;by&nbsp;the&nbsp;hash&nbsp;table.\r\n#&nbsp;\r\n#&nbsp;The&nbsp;default&nbsp;is&nbsp;to&nbsp;use&nbsp;this&nbsp;millisecond&nbsp;10&nbsp;times&nbsp;every&nbsp;second&nbsp;in&nbsp;order&nbsp;to\r\n#&nbsp;active&nbsp;rehashing&nbsp;the&nbsp;main&nbsp;dictionaries,&nbsp;freeing&nbsp;memory&nbsp;when&nbsp;possible.\r\n#\r\n#&nbsp;If&nbsp;unsure:\r\n#&nbsp;use&nbsp;&quot;activerehashing&nbsp;no&quot;&nbsp;if&nbsp;you&nbsp;have&nbsp;hard&nbsp;latency&nbsp;requirements&nbsp;and&nbsp;it&nbsp;is\r\n#&nbsp;not&nbsp;a&nbsp;good&nbsp;thing&nbsp;in&nbsp;your&nbsp;environment&nbsp;that&nbsp;Redis&nbsp;can&nbsp;reply&nbsp;form&nbsp;time&nbsp;to&nbsp;time\r\n#&nbsp;to&nbsp;queries&nbsp;with&nbsp;2&nbsp;milliseconds&nbsp;delay.\r\n#\r\n#&nbsp;use&nbsp;&quot;activerehashing&nbsp;yes&quot;&nbsp;if&nbsp;you&nbsp;don&#39;t&nbsp;have&nbsp;such&nbsp;hard&nbsp;requirements&nbsp;but\r\n#&nbsp;want&nbsp;to&nbsp;free&nbsp;memory&nbsp;asap&nbsp;when&nbsp;possible.\r\nactiverehashing&nbsp;yes\r\n&nbsp;\r\n##################################&nbsp;INCLUDES&nbsp;###################################\r\n&nbsp;\r\n#&nbsp;Include&nbsp;one&nbsp;or&nbsp;more&nbsp;other&nbsp;config&nbsp;files&nbsp;here.&nbsp;&nbsp;This&nbsp;is&nbsp;useful&nbsp;if&nbsp;you\r\n#&nbsp;have&nbsp;a&nbsp;standard&nbsp;template&nbsp;that&nbsp;goes&nbsp;to&nbsp;all&nbsp;redis&nbsp;server&nbsp;but&nbsp;also&nbsp;need\r\n#&nbsp;to&nbsp;customize&nbsp;a&nbsp;few&nbsp;per-server&nbsp;settings.&nbsp;&nbsp;Include&nbsp;files&nbsp;can&nbsp;include\r\n#&nbsp;other&nbsp;files,&nbsp;so&nbsp;use&nbsp;this&nbsp;wisely.\r\n#\r\n#&nbsp;include&nbsp;\/path\/to\/local.conf\r\n#&nbsp;include&nbsp;\/path\/to\/other.conf<\/pre>\n<p><\/p>\n<!--wp-compress-html no compression--><!--wp-compress-html-->","protected":false},"excerpt":{"rendered":"&nbsp;\u4e4b\u524d\u8bf4\u4e86\u4e0bredis windows\u4e0b\u7684\u914d\u7f6e\u548cPHP\u7684\u4f7f\u7528\uff0c\u8fd9\u6b21\u6211\u4eec\u8bf4\u4e0bredis\u914d\u7f6e\u6587\u4ef6\u7684\u8be6\u7ec6\u8bf4 \u00b7\u00b7\u00b7","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[6],"tags":[],"views":411,"_links":{"self":[{"href":"http:\/\/blog.yyhcw.com\/api\/wp\/v2\/posts\/273"}],"collection":[{"href":"http:\/\/blog.yyhcw.com\/api\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.yyhcw.com\/api\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.yyhcw.com\/api\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.yyhcw.com\/api\/wp\/v2\/comments?post=273"}],"version-history":[{"count":0,"href":"http:\/\/blog.yyhcw.com\/api\/wp\/v2\/posts\/273\/revisions"}],"wp:attachment":[{"href":"http:\/\/blog.yyhcw.com\/api\/wp\/v2\/media?parent=273"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.yyhcw.com\/api\/wp\/v2\/categories?post=273"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.yyhcw.com\/api\/wp\/v2\/tags?post=273"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}