{"id":67663,"date":"2025-05-10T09:09:14","date_gmt":"2025-05-10T01:09:14","guid":{"rendered":"https:\/\/fwq.ai\/blog\/67663\/"},"modified":"2025-05-10T09:09:14","modified_gmt":"2025-05-10T01:09:14","slug":"redis2-6%e5%b0%86%e9%87%8a%e5%87%ba-%e6%96%b0%e5%8a%9f%e8%83%bd%e4%b8%80%e8%a7%88-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/67663\/","title":{"rendered":"Redis2.6\u5c06\u91ca\u51fa \u65b0\u529f\u80fd\u4e00\u89c8"},"content":{"rendered":"<p><b><\/b> <\/p>\n<h1>Redis2.6\u5c06\u91ca\u51fa \u65b0\u529f\u80fd\u4e00\u89c8<\/h1>\n<p><span style=\"cursor: pointer\"><i><\/i>\u6536\u85cf<\/span> <\/p>\n<p>\u6765\u5230golang\u5b66\u4e60\u7f51\u7684\u5927\u5bb6\uff0c\u76f8\u4fe1\u90fd\u662f\u7f16\u7a0b\u5b66\u4e60\u7231\u597d\u8005\uff0c\u5e0c\u671b\u5728\u8fd9\u91cc\u5b66\u4e60\u6570\u636e\u5e93\u76f8\u5173\u7f16\u7a0b\u77e5\u8bc6\u3002\u4e0b\u9762\u672c\u7bc7\u6587\u7ae0\u5c31\u6765\u5e26\u5927\u5bb6\u804a\u804a\u300aRedis2.6\u5c06\u91ca\u51fa \u65b0\u529f\u80fd\u4e00\u89c8\u300b\uff0c\u4ecb\u7ecd\u4e00\u4e0bRedis\u3001NoSQL\uff0c\u5e0c\u671b\u5bf9\u5927\u5bb6\u7684\u77e5\u8bc6\u79ef\u7d2f\u6709\u6240\u5e2e\u52a9\uff0c\u52a9\u529b\u5b9e\u6218\u5f00\u53d1\uff01<\/p>\n<p>Redis2.6 \u672c\u6765\u9884\u8ba1\u662f\u5728\u4eca\u5e74\u7b2c\u4e00\u5468\u5c31\u5e94\u8be5\u653e\u51fa\u7684\uff0c\u4f46\u662f\u73b0\u5728\u4e09\u4e2a\u6708\u5feb\u8fc7\u53bb\u7684\uff0c\u4f9d\u7136\u5728\u8df3\u7968\u4e2d\u3002\u4e8e\u662fRedis\u4f5c\u8005@antirez\u53d1\u8868\u6587\u7ae0\u5411\u5927\u5bb6\u89e3\u91ca\u4e86\u8df3\u7968\u7684\u539f\u56e0\uff0c\u5e76\u7ec6\u6570\u4e862.6\u7248\u672c\u4ee4\u4eba\u6fc0\u52a8\u7684\u65b0\u529f\u80fd\u3002<\/p>\n<p>\u5e9f\u8bdd\u4e0d\u591a\u8bf4\uff0c\u4e0b\u9762\u5c31\u662f\u5217\u4e3e\u5230\u7684\u65b0\u529f\u80fd\u3002<\/p>\n<p><strong>1.Lua\u811a\u672c\u652f\u6301<\/strong><\/p>\n<p>\u4e0d\u7528\u8bf4\uff0c\u5f88\u591a\u540c\u5b66\u90fd\u5df2\u7ecf\u671f\u5f85\u5f88\u4e45\u4e86\u3002\u800c\u8ddf\u8fd9\u4e2a\u529f\u80fd\u914d\u5957\u7684\uff0c\u8fd8\u6709\u5bf9JSON \u548c MessagePack \u7684\u539f\u751f\u652f\u6301\u3002\u4e0d\u5f97\u4e0d\u8bf4\u771f\u7684\u5f88\u8d34\u5fc3\u3002<\/p>\n<p><strong>2.\u6beb\u79d2\u7ea7\u7684\u8fc7\u671f\u65f6\u95f4\u8bbe\u5b9a<\/strong><\/p>\n<p>\u4f60\u5c06\u53ef\u4ee5\u8bbe\u5b9a\u6beb\u79d2\u7ea7\u7684\u8fc7\u671f\u65f6\u95f4\uff0c\u5728\u5b9e\u73b0\u4e0a\uff0c\u8bef\u5dee\u4e0d\u4f1a\u8d85\u8fc71ms\u3002\u5f53\u7136\uff0c\u8fd9\u662f\u901a\u8fc7PEXIRE, PTTL, PSETEX\u8fd9\u4e9b\u65b0\u7684\u8fc7\u671f\u8bbe\u7f6e\u547d\u4ee4\u6765\u5b9e\u73b0\u7684\u3002<\/p>\n<p><strong>3.\u653e\u5f00\u8fde\u63a5\u6570\u9650\u5236<\/strong><\/p>\n<p>\u5f7b\u5e95\u653e\u5f00\u4e86\u5bf9\u5ba2\u6237\u7aef\u8fde\u63a5\u6570\u7684\u9650\u5236\uff0c\u76ee\u524d\u4f60\u7684Redis\u8fde\u63a5\u80fd\u529b\u5c31\u53d6\u51b3\u4e8e\u4f60\u7cfb\u7edf\u7684\u5e76\u53d1\u80fd\u529b\u4e86\u3002<\/p>\n<p>4. AOF low level semantics is generally more sane, and especially when used in slaves. This is an uncommon use case, and the misbehavior was subtle, but now the implementation and behavior is definitely more sane.\uff08\u8fd9\u5757\u4e0d\u592a\u6e05\u695a\uff0c\u8c01\u80fd\u63d0\u4f9b\u4e0b\u89e3\u91ca\uff1f\uff09<\/p>\n<p><strong>5.\u5bf9\u8f93\u51fa\u7f13\u51b2\u533a\u7684\u5206\u7ea7<\/strong><\/p>\n<p>\u4f60\u53ef\u4ee5\u5bf9\u4e0d\u540c\u7684\u5ba2\u6237\u7aef\u6a21\u5f0f\u4e0b\u4e0d\u540c\u7684\u8f93\u51fa\u7f13\u51b2\u533a\u8fdb\u884c\u5927\u5c0f\u63a7\u5236\uff0c\u6bd4\u5982\u5728\u666e\u901a\u5ba2\u6237\u7aef\uff0cslave\u673a\u5668\u548cpubsub\u5ba2\u6237\u7aef\u4e0a\u5b9e\u65bd\u4e0d\u540c\u7684\u7b56\u7565\u3002<\/p>\n<p><strong>6.AOF\u65e5\u5fd7\u652f\u6301\u5408\u5e76\u547d\u4ee4<\/strong><\/p>\n<p>\u57282.4\u7248\u672c\u4e2dRedis\u5f15\u5165\u4e86\u7ec4\u5408\u5f0f\u547d\u4ee4\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7\u7ed9\u4e00\u4e2a\u5199\u64cd\u4f5c\u547d\u4ee4\u4f20\u9012\u591a\u4e2a\u53c2\u6570\u6765\u5b9e\u73b0\u591a\u4e2a\u503c\u7684\u5199\u5165\u3002\u800c\u5728\u4e00\u4e2a\u7a33\u5b9a\u7248\u7684\u8fc7\u6e21\u540e\uff0c\u76ee\u524dAOF\u6587\u4ef6\u4e5f\u652f\u6301\u4ee5\u8fd9\u6837\u7684\u65b9\u5f0f\u6765\u505arewrite\u4e86\uff0c\u53ef\u4ee5\u60f3\u8c61\uff0c\u5982\u679c\u4f60\u4f7f\u7528\u4e86\u9ad8\u7ea7\u7684\u6570\u636e\u7ed3\u6784\uff0c\u4e00\u4e2a\u6709N\u4e2a\u5143\u7d20\u7684\u7ed3\u6784\u5c31\u53ea\u9700\u8981\u4fdd\u5b58\u4e00\u6761AOF\u547d\u4ee4\u4e86\u3002<\/p>\n<p><strong>7.\u547d\u4ee4\u884c\u914d\u7f6e\u53c2\u6570<\/strong><\/p>\n<p>Redis\u4f5c\u8005\u7ec8\u4e8e\u6709\u7a7a\u6574\u7406\u4e00\u4e0b\u914d\u7f6e\u9879\u4e86\uff0c\u57282.6\u7248\u672c\u4e2d\uff0c\u6240\u6709\u5728redis.conf\u6587\u4ef6\u4e2d\u7684\u8bbe\u7f6e\u90fd\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u884c\u542f\u52a8\u65f6\u8bbe\u7f6e\u3002\u6bd4\u5982\u4f60\u53ef\u4ee5\u8fd9\u6837\u542f\u52a8\u4f60\u7684Redis\uff1a.\/redis-server \u2013slaveof 127.0.0.1 6379 \u2013port 6380<\/p>\n<p><strong>8.hash\u51fd\u6570\u79cd\u5b50\u968f\u673a\u5316<\/strong><\/p>\n<p>\u8fd9\u53ef\u4ee5\u8ba9hash\u51fd\u6570\u7ed3\u6784\u5206\u5e03\u66f4\u5177\u968f\u673a\u6027\uff0c\u6709\u6548\u9632\u6b62\u78b0\u649e\u3002<\/p>\n<p><strong>9.\u5927\u6570\u636e\u5b58\u50a8\u6027\u80fd\u4f18\u5316<\/strong><\/p>\n<p><strong>10.\u4ee3\u7801\u4f18\u5316<\/strong><\/p>\n<p>\u91cd\u6784\u4e86\u5927\u91cf\u7684\u6838\u5fc3\u4ee3\u7801\uff0c\u65b0\u7684\u5185\u90e8API\u4f1a\u8ba9cluster\u65b9\u6848\u66f4\u5bb9\u6613\u5b9e\u73b0\u3002\u57282.6\u7248\u672c\u4e2d\uff0c\u6240\u6709cluster\u76f8\u5173\u7684\u4ee3\u7801\u90fd\u53bb\u6389\u4e86\uff0ccluster\u529f\u80fd\u5c06\u4f1a\u662f3.0\u7248\u672c\u6700\u5927\u7684\u4eae\u70b9\u3002\u53e6\u5916\uff0c\u6240\u6709VM\u76f8\u5173\u7684\u4ee3\u7801\u5df2\u7ecf\u79fb\u9664\u3002<\/p>\n<p><strong>11.\u542f\u52a8\u753b\u9762\u6dfb\u52a0ASCII\u7684Redis logo\u56fe<\/strong><\/p>\n<p><strong>12.redis-benchmark\u811a\u672c\u589e\u5f3a<\/strong><\/p>\n<p>\u652f\u6301\u5b9a\u5236\u5316\u7684\u538b\u6d4b\uff0cCSV\u8f93\u51fa\u7b49\u529f\u80fd\u3002<\/p>\n<p><strong>13.redis-cli\u529f\u80fd\u589e\u5f3a<\/strong><\/p>\n<p>\u4f7f\u7528\u2013eval\u6307\u4ee4\u5b9e\u73b0Lua\u811a\u672c\u6267\u884c\uff0c\u8ba9\u7f16\u5199\u8c03\u8bd5\u66f4\u7b80\u5355\u3002<\/p>\n<p><strong>14.SHUTDOWN\u529f\u80fd\u589e\u5f3a<\/strong><\/p>\n<p>SHUTDOWN\u547d\u4ee4\u6dfb\u52a0SAVE\u548cNOSAVE\u4e24\u4e2a\u53c2\u6570\uff0c\u5206\u522b\u7528\u4e8e\u6307\u5b9aSHUTDOWN\u65f6\u7528\u4e0d\u7528\u6267\u884c\u5199RDB\u7684\u64cd\u4f5c\u3002<\/p>\n<p><strong>15.INFO\u547d\u4ee4\u7684\u8f93\u51fa\u4f18\u5316<\/strong><\/p>\n<p>\u589e\u52a0\u4e86\u4e00\u4e9b\u7edf\u8ba1\u9879\uff0c\u5e76\u4e14\u5c06\u8f93\u51fa\u5185\u5bb9\u5206\u5757\u5c55\u793a<\/p>\n<p><strong>16.SORT\u547d\u4ee4\u4f18\u5316<\/strong><\/p>\n<p>\u8ba9SORT\u547d\u4ee4\u7684\u590d\u6742\u5ea6\u53ef\u63a7<\/p>\n<p><strong>17.INCRBYFLOAT \u547d\u4ee4 HINCRBYFLOAT<\/strong><\/p>\n<p>\u7528\u4e8e\u5bf9\u503c\u8fdb\u884c\u6d6e\u70b9\u6570\u7684\u52a0\u51cf\u64cd\u4f5c<\/p>\n<p><strong>18.BUG\u4fee\u590d\uff0c\u6027\u80fd\u4f18\u5316\u76f8\u5173<\/strong><\/p>\n<p>\u82f1\u6587\uff1a<\/p>\n<p>\u539f\u6587\u94fe\u63a5\uff1a<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Redis2.6\u5c06\u91ca\u51fa \u65b0\u529f\u80fd\u4e00\u89c8 \u6536\u85cf \u6765\u5230golang\u5b66\u4e60\u7f51\u7684\u5927\u5bb6\uff0c\u76f8\u4fe1\u90fd\u662f\u7f16\u7a0b\u5b66\u4e60\u7231\u597d\u8005\uff0c\u5e0c\u671b\u5728\u8fd9\u91cc\u5b66\u4e60\u6570\u636e\u5e93\u76f8\u5173\u7f16\u7a0b\u77e5\u8bc6\u3002\u4e0b\u9762\u672c\u7bc7\u6587\u7ae0\u5c31\u6765\u5e26\u5927\u5bb6\u804a\u804a\u300aRedis2.6\u5c06\u91ca\u51fa \u65b0\u529f\u80fd\u4e00\u89c8\u300b\uff0c\u4ecb\u7ecd\u4e00\u4e0bRedis\u3001NoSQL\uff0c\u5e0c\u671b\u5bf9\u5927\u5bb6\u7684\u77e5\u8bc6\u79ef\u7d2f\u6709\u6240\u5e2e\u52a9\uff0c\u52a9\u529b\u5b9e\u6218\u5f00\u53d1\uff01 Redis2.6 \u672c\u6765\u9884\u8ba1\u662f\u5728\u4eca\u5e74\u7b2c\u4e00\u5468\u5c31\u5e94\u8be5\u653e\u51fa\u7684\uff0c\u4f46\u662f\u73b0\u5728\u4e09\u4e2a\u6708\u5feb\u8fc7\u53bb\u7684\uff0c\u4f9d\u7136\u5728\u8df3\u7968\u4e2d\u3002\u4e8e\u662fRedis\u4f5c\u8005@antirez\u53d1\u8868\u6587\u7ae0\u5411\u5927\u5bb6\u89e3\u91ca\u4e86\u8df3\u7968\u7684\u539f\u56e0\uff0c\u5e76\u7ec6\u6570\u4e862.6\u7248\u672c\u4ee4\u4eba\u6fc0\u52a8\u7684\u65b0\u529f\u80fd\u3002 \u5e9f\u8bdd\u4e0d\u591a\u8bf4\uff0c\u4e0b\u9762\u5c31\u662f\u5217\u4e3e\u5230\u7684\u65b0\u529f\u80fd\u3002 1.Lua\u811a\u672c\u652f\u6301 \u4e0d\u7528\u8bf4\uff0c\u5f88\u591a\u540c\u5b66\u90fd\u5df2\u7ecf\u671f\u5f85\u5f88\u4e45\u4e86\u3002\u800c\u8ddf\u8fd9\u4e2a\u529f\u80fd\u914d\u5957\u7684\uff0c\u8fd8\u6709\u5bf9JSON \u548c MessagePack \u7684\u539f\u751f\u652f\u6301\u3002\u4e0d\u5f97\u4e0d\u8bf4\u771f\u7684\u5f88\u8d34\u5fc3\u3002 2.\u6beb\u79d2\u7ea7\u7684\u8fc7\u671f\u65f6\u95f4\u8bbe\u5b9a \u4f60\u5c06\u53ef\u4ee5\u8bbe\u5b9a\u6beb\u79d2\u7ea7\u7684\u8fc7\u671f\u65f6\u95f4\uff0c\u5728\u5b9e\u73b0\u4e0a\uff0c\u8bef\u5dee\u4e0d\u4f1a\u8d85\u8fc71ms\u3002\u5f53\u7136\uff0c\u8fd9\u662f\u901a\u8fc7PEXIRE, PTTL, PSETEX\u8fd9\u4e9b\u65b0\u7684\u8fc7\u671f\u8bbe\u7f6e\u547d\u4ee4\u6765\u5b9e\u73b0\u7684\u3002 3.\u653e\u5f00\u8fde\u63a5\u6570\u9650\u5236 \u5f7b\u5e95\u653e\u5f00\u4e86\u5bf9\u5ba2\u6237\u7aef\u8fde\u63a5\u6570\u7684\u9650\u5236\uff0c\u76ee\u524d\u4f60\u7684Redis\u8fde\u63a5\u80fd\u529b\u5c31\u53d6\u51b3\u4e8e\u4f60\u7cfb\u7edf\u7684\u5e76\u53d1\u80fd\u529b\u4e86\u3002 4. AOF low level semantics is generally more sane, and especially when used in slaves. This is an uncommon use case, and the misbehavior was subtle, but now the implementation and behavior is definitely more sane.\uff08\u8fd9\u5757\u4e0d\u592a\u6e05\u695a\uff0c\u8c01\u80fd\u63d0\u4f9b\u4e0b\u89e3\u91ca\uff1f\uff09 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-67663","post","type-post","status-publish","format-standard","hentry","category-os"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/67663","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=67663"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/67663\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=67663"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=67663"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=67663"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}