{"id":132391,"date":"2024-10-30T21:45:32","date_gmt":"2024-10-30T13:45:32","guid":{"rendered":"https:\/\/server.hk\/cnblog\/132391\/"},"modified":"2024-10-30T21:45:32","modified_gmt":"2024-10-30T13:45:32","slug":"redis%e7%b4%b0%e8%ab%87%e9%9d%a2%e5%90%91%e9%96%8b%e7%99%bc%e8%80%85%e7%9a%84%e6%8c%87%e5%8d%97%ef%bc%88redis%e8%a9%b3%e7%b4%b0%e8%a7%a3%e8%ae%80%ef%bc%89","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/132391\/","title":{"rendered":"Redis\u7d30\u8ac7\u9762\u5411\u958b\u767c\u8005\u7684\u6307\u5357\uff08redis\u8a73\u7d30\u89e3\u8b80\uff09"},"content":{"rendered":"<h1 id=\"redis%e7%b4%b0%e8%ab%87%e9%9d%a2%e5%90%91%e9%96%8b%e7%99%bc%e8%80%85%e7%9a%84%e6%8c%87%e5%8d%97%ef%bc%88redis%e8%a9%b3%e7%b4%b0%e8%a7%a3%e8%ae%80%ef%bc%89-RFVPQEVXef\">Redis\u7d30\u8ac7\u9762\u5411\u958b\u767c\u8005\u7684\u6307\u5357\uff08redis\u8a73\u7d30\u89e3\u8b80\uff09<\/h1>\n<p>\u5728\u7576\u4eca\u7684\u61c9\u7528\u7a0b\u5f0f\u958b\u767c\u4e2d\uff0c\u6578\u64da\u5b58\u5132\u7684\u9078\u64c7\u5c0d\u65bc\u6027\u80fd\u548c\u53ef\u64f4\u5c55\u6027\u81f3\u95dc\u91cd\u8981\u3002Redis\u4f5c\u70ba\u4e00\u7a2e\u9ad8\u6548\u7684\u9375\u503c\u5b58\u5132\u7cfb\u7d71\uff0c\u56e0\u5176\u5353\u8d8a\u7684\u6027\u80fd\u548c\u9748\u6d3b\u6027\u800c\u53d7\u5230\u5ee3\u6cdb\u95dc\u6ce8\u3002\u672c\u6587\u5c07\u6df1\u5165\u63a2\u8a0eRedis\u7684\u7279\u6027\u3001\u4f7f\u7528\u5834\u666f\u53ca\u5176\u5728\u958b\u767c\u4e2d\u7684\u61c9\u7528\u3002<\/p>\n<h2 id=\"%e4%bb%80%e9%ba%bc%e6%98%afredis%ef%bc%9f-RFVPQEVXef\">\u4ec0\u9ebc\u662fRedis\uff1f<\/h2>\n<p>Redis\uff08REmote DIctionary Server\uff09\u662f\u4e00\u500b\u958b\u6e90\u7684\u5167\u5b58\u6578\u64da\u7d50\u69cb\u5b58\u5132\u7cfb\u7d71\uff0c\u652f\u6301\u591a\u7a2e\u6578\u64da\u7d50\u69cb\uff0c\u5982\u5b57\u7b26\u4e32\u3001\u54c8\u5e0c\u3001\u5217\u8868\u3001\u96c6\u5408\u548c\u6709\u5e8f\u96c6\u5408\u3002\u5b83\u7684\u8a2d\u8a08\u76ee\u7684\u662f\u63d0\u4f9b\u9ad8\u6027\u80fd\u7684\u6578\u64da\u5b58\u53d6\uff0c\u4e26\u4e14\u652f\u6301\u6301\u4e45\u5316\uff0c\u9019\u4f7f\u5f97\u5b83\u5728\u9700\u8981\u5feb\u901f\u8b80\u53d6\u548c\u5beb\u5165\u7684\u5834\u666f\u4e2d\u975e\u5e38\u53d7\u6b61\u8fce\u3002<\/p>\n<h2 id=\"redis%e7%9a%84%e4%b8%bb%e8%a6%81%e7%89%b9%e6%80%a7-RFVPQEVXef\">Redis\u7684\u4e3b\u8981\u7279\u6027<\/h2>\n<ul>\n<li><strong>\u9ad8\u6027\u80fd\uff1a<\/strong>Redis\u80fd\u5920\u6bcf\u79d2\u8655\u7406\u6578\u5341\u842c\u6b21\u7684\u8b80\u53d6\u548c\u5beb\u5165\u64cd\u4f5c\uff0c\u9019\u4f7f\u5f97\u5b83\u6210\u70ba\u9ad8\u6d41\u91cf\u61c9\u7528\u7684\u7406\u60f3\u9078\u64c7\u3002<\/li>\n<li><strong>\u6578\u64da\u6301\u4e45\u5316\uff1a<\/strong>Redis\u652f\u6301RDB\u5feb\u7167\u548cAOF\uff08Append Only File\uff09\u5169\u7a2e\u6301\u4e45\u5316\u65b9\u5f0f\uff0c\u80fd\u5920\u5728\u7cfb\u7d71\u91cd\u555f\u5f8c\u6062\u5fa9\u6578\u64da\u3002<\/li>\n<li><strong>\u591a\u7a2e\u6578\u64da\u7d50\u69cb\uff1a<\/strong>\u9664\u4e86\u57fa\u672c\u7684\u9375\u503c\u5c0d\uff0cRedis\u9084\u652f\u6301\u8907\u96dc\u7684\u6578\u64da\u7d50\u69cb\uff0c\u9019\u4f7f\u5f97\u958b\u767c\u8005\u80fd\u5920\u9748\u6d3b\u5730\u9078\u64c7\u6700\u9069\u5408\u7684\u6578\u64da\u5b58\u5132\u65b9\u5f0f\u3002<\/li>\n<li><strong>\u539f\u5b50\u64cd\u4f5c\uff1a<\/strong>Redis\u63d0\u4f9b\u4e86\u591a\u7a2e\u539f\u5b50\u64cd\u4f5c\uff0c\u9019\u5c0d\u65bc\u9700\u8981\u9ad8\u4f75\u767c\u7684\u61c9\u7528\u975e\u5e38\u91cd\u8981\u3002<\/li>\n<li><strong>\u5206\u4f48\u5f0f\u652f\u6301\uff1a<\/strong>Redis Cluster\u5141\u8a31\u6578\u64da\u5728\u591a\u500bRedis\u5be6\u4f8b\u4e4b\u9593\u5206\u4f48\uff0c\u5f9e\u800c\u63d0\u9ad8\u53ef\u64f4\u5c55\u6027\u3002<\/li>\n<\/ul>\n<h2 id=\"redis%e7%9a%84%e4%bd%bf%e7%94%a8%e5%a0%b4%e6%99%af-RFVPQEVXef\">Redis\u7684\u4f7f\u7528\u5834\u666f<\/h2>\n<p>Redis\u7684\u9ad8\u6027\u80fd\u548c\u9748\u6d3b\u6027\u4f7f\u5176\u9069\u7528\u65bc\u591a\u7a2e\u5834\u666f\uff0c\u5305\u62ec\u4f46\u4e0d\u9650\u65bc\uff1a<\/p>\n<ul>\n<li><strong>\u7de9\u5b58\u7cfb\u7d71\uff1a<\/strong>Redis\u5e38\u7528\u4f5c\u7de9\u5b58\u5c64\uff0c\u4ee5\u6e1b\u5c11\u5c0d\u5f8c\u7aef\u6578\u64da\u5eab\u7684\u8acb\u6c42\uff0c\u63d0\u9ad8\u61c9\u7528\u7684\u97ff\u61c9\u901f\u5ea6\u3002<\/li>\n<li><strong>\u6703\u8a71\u5b58\u5132\uff1a<\/strong>\u5728Web\u61c9\u7528\u4e2d\uff0cRedis\u53ef\u4ee5\u7528\u4f86\u5b58\u5132\u7528\u6236\u6703\u8a71\u4fe1\u606f\uff0c\u56e0\u70ba\u5176\u5feb\u901f\u7684\u8b80\u53d6\u548c\u5beb\u5165\u6027\u80fd\u80fd\u5920\u6709\u6548\u652f\u6301\u9ad8\u4f75\u767c\u7684\u7528\u6236\u8a2a\u554f\u3002<\/li>\n<li><strong>\u5373\u6642\u6578\u64da\u5206\u6790\uff1a<\/strong>Redis\u7684\u6578\u64da\u7d50\u69cb\u548c\u539f\u5b50\u64cd\u4f5c\u4f7f\u5176\u975e\u5e38\u9069\u5408\u7528\u65bc\u5373\u6642\u6578\u64da\u5206\u6790\u548c\u7d71\u8a08\u3002<\/li>\n<li><strong>\u6d88\u606f\u968a\u5217\uff1a<\/strong>\u5229\u7528Redis\u7684\u5217\u8868\u7d50\u69cb\uff0c\u53ef\u4ee5\u8f15\u9b06\u5be6\u73fe\u6d88\u606f\u968a\u5217\u529f\u80fd\uff0c\u652f\u6301\u751f\u7522\u8005-\u6d88\u8cbb\u8005\u6a21\u5f0f\u3002<\/li>\n<\/ul>\n<h2 id=\"redis%e7%9a%84%e5%9f%ba%e6%9c%ac%e6%93%8d%e4%bd%9c-RFVPQEVXef\">Redis\u7684\u57fa\u672c\u64cd\u4f5c<\/h2>\n<p>\u4ee5\u4e0b\u662f\u4e00\u4e9bRedis\u7684\u57fa\u672c\u64cd\u4f5c\u793a\u4f8b\uff0c\u5e6b\u52a9\u958b\u767c\u8005\u5feb\u901f\u4e0a\u624b\uff1a<\/p>\n<pre><code> \n# \u9023\u63a5\u5230Redis\nredis-cli\n\n# \u8a2d\u7f6e\u9375\u503c\u5c0d\nSET mykey \"Hello, Redis!\"\n\n# \u7372\u53d6\u9375\u503c\nGET mykey\n\n# \u522a\u9664\u9375\nDEL mykey\n\n# \u4f7f\u7528\u5217\u8868\nLPUSH mylist \"item1\"\nLPUSH mylist \"item2\"\nLRANGE mylist 0 -1\n<\/code><\/pre>\n<h2 id=\"%e7%b5%90%e8%ab%96-RFVPQEVXef\">\u7d50\u8ad6<\/h2>\n<p>Redis\u4f5c\u70ba\u4e00\u500b\u9ad8\u6548\u7684\u5167\u5b58\u6578\u64da\u5b58\u5132\u7cfb\u7d71\uff0c\u70ba\u958b\u767c\u8005\u63d0\u4f9b\u4e86\u9748\u6d3b\u7684\u6578\u64da\u7d50\u69cb\u548c\u5353\u8d8a\u7684\u6027\u80fd\u3002\u7121\u8ad6\u662f\u5728\u7de9\u5b58\u3001\u6703\u8a71\u5b58\u5132\u9084\u662f\u5373\u6642\u6578\u64da\u5206\u6790\u4e2d\uff0cRedis\u90fd\u80fd\u5920\u767c\u63ee\u5176\u7368\u7279\u7684\u512a\u52e2\u3002\u96a8\u8457\u5c0d\u9ad8\u6027\u80fd\u6578\u64da\u5b58\u5132\u9700\u6c42\u7684\u589e\u52a0\uff0cRedis\u7684\u61c9\u7528\u5834\u666f\u5c07\u6703\u66f4\u52a0\u5ee3\u6cdb\u3002<\/p>\n<p>\u5982\u679c\u60a8\u6b63\u5728\u5c0b\u627e\u9ad8\u6548\u7684\u6578\u64da\u5b58\u5132\u89e3\u6c7a\u65b9\u6848\uff0c\u8003\u616e\u4f7f\u7528<a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a>\u4f86\u90e8\u7f72Redis\uff0c\u9019\u5c07\u70ba\u60a8\u7684\u61c9\u7528\u63d0\u4f9b\u7a69\u5b9a\u7684\u652f\u6301\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6df1\u5165\u63a2\u8a0eRedis\u7684\u529f\u80fd\u8207\u61c9\u7528\uff0c\u70ba\u958b\u767c\u8005\u63d0\u4f9b\u5168\u9762\u6307\u5357\uff0c\u52a9\u4f60\u638c\u63e1\u9ad8\u6548\u6578\u64da\u5b58\u5132\u8207\u7ba1\u7406\u6280\u5de7\u3002<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-132391","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/132391","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=132391"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/132391\/revisions"}],"predecessor-version":[{"id":132392,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/132391\/revisions\/132392"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=132391"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=132391"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=132391"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}