{"id":212622,"date":"2021-03-15T09:07:07","date_gmt":"2021-03-15T01:07:07","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=212622"},"modified":"2021-03-02T09:46:51","modified_gmt":"2021-03-02T01:46:51","slug":"redis-key","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/redis-key.html","title":{"rendered":"Redis Key\u8d44\u6e90\u5360\u7528\u60c5\u51b5\u7684\u53ef\u89c6\u5316\u5206\u6790"},"content":{"rendered":"
\nRedis \u5728\u65e5\u5e38\u7684\u5f00\u53d1\u4e2d\uff0c\u4f1a\u79ef\u7d2f\u5927\u91cf\u7684 Key\uff0c\u5360\u7528\u4e0d\u5c11\u5185\u5b58\u7a7a\u95f4\u3002\u6709\u65f6\u5019\uff0c\u6211\u4eec\u60f3\u77e5\u9053\u5f53\u524d Redis \u91cc\u9762\u6709\u591a\u5c11\u4e2a Key\uff0c\u662f\u54ea\u4e2a Key \u5360\u7528\u4e86\u6700\u5927\u7684\u5185\u5b58\u3002<\/p>\n
\u4f46\u662f\uff0c\u6211\u4eec\u77e5\u9053\uff0c\u7531\u4e8e Redis \u662f\u5355\u7ebf\u7a0b\u6570\u636e\u5e93\uff0c\u6240\u4ee5\u5728\u7ebf\u4e0a\u73af\u5883\u662f\u7edd\u5bf9\u7981\u6b62\u4f7f\u7528keys *\u8fd9\u79cd\u547d\u4ee4\u7684\uff0c\u56e0\u4e3a\u5b83\u4f1a\u82b1\u8d39\u5f88\u957f\u65f6\u95f4\u626b\u63cf\u6240\u6709\u7684 Key\uff0c\u5728\u8fd9\u4e2a\u8fc7\u7a0b\u4e2d\uff0cRedis \u4f1a\u5361\u6b7b\uff0c\u65e0\u6cd5\u5904\u7406\u5176\u4ed6\u7684\u8bfb\u5199\u64cd\u4f5c\u3002<\/p>\n
\u90a3\u4e48\uff0c\u6211\u4eec\u5e94\u8be5\u600e\u4e48\u77e5\u9053\u5f53\u524d\u6709\u591a\u5c11\u4e2a Key \u5462?\u6709\u540c\u5b66\u8bf4\u53ef\u4ee5\u4f7f\u7528scan\u547d\u4ee4\u3002\u4f46\u8fd9\u4e2a\u547d\u4ee4\u4e00\u65b9\u9762\u662f\u9700\u8981\u5199\u7a0b\u5e8f\u6765\u8fed\u4ee3\uff0c\u53e6\u4e00\u65b9\u9762\u662f\u5b83\u7ed9\u51fa\u7684\u7ed3\u679c\u53ef\u80fd\u662f\u4e0d\u51c6\u786e\u7684\u3002<\/p>\n
\u4e5f\u6709\u540c\u5b66\u4f1a\u8bf4\uff0c\u53ef\u4ee5\u4f7f\u7528info keyspace\u547d\u4ee4\uff0c\u8fd0\u884c\u6548\u679c\u5982\u4e0b\u56fe\u6240\u793a\uff1a<\/p>\n
<\/p>\n
\u786e\u5b9e\u53ef\u4ee5\u770b\u5230\u6709\u591a\u5c11\u4e2a Key\u3002\u4e0d\u8fc7\u53e6\u4e00\u4e2a\u95ee\u9898\u662f\uff0c\u600e\u4e48\u77e5\u9053\u54ea\u4e2a Key \u5360\u7528\u7684\u5185\u5b58\u7a7a\u95f4\u6700\u5927?<\/p>\n
\u8fd8\u6709\u65f6\u5019\uff0cRedis \u91cc\u9762\u53ef\u80fd\u6709\u51e0\u4e07\u5341\u51e0\u4e07\u4e2a Key\uff0c\u91cc\u9762\u6709\u4e9b Key \u662f\u53ef\u4ee5\u5220\u6389\u7684\u3002\u4f46\u662f\u7531\u4e8e\u6211\u4eec\u4e0d\u80fd\u4f7f\u7528keys\u547d\u4ee4\u67e5\u770b\u5f53\u524d\u6709\u54ea\u4e9b Key\uff0c\u6240\u4ee5\u4e0d\u77e5\u9053\u8fd9\u4e9b\u53ef\u4ee5\u5220\u6389\u7684 Key \u7adf\u7136\u8fd8\u5728\u3002<\/p>\n
\u5b9e\u9645\u4e0a\uff0c\u8fd9\u4e9b\u95ee\u9898\uff0c\u6211\u4eec\u4f7f\u7528\u4e00\u4e2a\u53eb\u505aRDR[1]\u7684\u5de5\u5177\uff0c\u90fd\u53ef\u4ee5\u89e3\u51b3\u3002\u5728 RDR \u7684 Github \u4e0a\uff0c\u53ef\u4ee5\u627e\u5230\u5bf9\u5e94\u7cfb\u7edf\u7684\u53ef\u6267\u884c\u6587\u4ef6\u3002\u6211\u4eec\u4ee5 Linux \u7248\u672c\u4e3a\u4f8b\u6765\u8fdb\u884c\u8bf4\u660e\u3002Linux \u7248\u672c\u7684\u53ef\u6267\u884c\u6587\u4ef6\u5730\u5740\u4e3a\uff1ahttps:\/\/github.com\/xueqiu\/rdr\/releases\/download\/v0.0.1\/rdr-linux\uff0c\u4e0b\u8f7d\u4ee5\u540e\uff0c\u8d4b\u4e88\u53ef\u6267\u884c\u6743\u9650\uff1a<\/p>\n
\r\ncd ~ \r\nwget https:\/\/github.com\/xueqiu\/rdr\/releases\/download\/v0.0.1\/rdr-linux \r\nchmod +x rdr-linux \r\n<\/pre>\n\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u9700\u8981\u627e\u5230dump.rdb\u6587\u4ef6\u3002<\/p>\n
Redis \u9ed8\u8ba4\u5f00\u542f\u4e86RDB\u65b9\u5f0f\u7684\u6301\u4e45\u5316\u50a8\u5b58\u3002\u6ee1\u8db3\u4e00\u5b9a\u6761\u4ef6\u65f6\uff0cRedis \u4f1a\u628a\u5185\u5b58\u4e2d\u7684\u6570\u636e\u5b58\u653e\u5230\u786c\u76d8\u4e2d\uff0c\u9632\u6b62\u7531\u4e8e\u7a81\u7136\u65ad\u7535\u5bfc\u81f4\u6570\u636e\u4e22\u5931\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cRDB \u6587\u4ef6\u5728\/var\/lib\/redis\/dump.rdb\uff0c\u8fd9\u4e2a\u6587\u4ef6\u53ea\u6709 root \u7528\u6237\u53ef\u4ee5\u8bfb\u53d6\u3002<\/p>\n
\u5982\u679c\u4f60\u73b0\u5728\u4e0d\u662f root \u7528\u6237\uff0c\u90a3\u4e48\u4f60\u53ef\u4ee5\u628a\u5b83\u590d\u5236\u51fa\u6765\uff0c\u4fee\u6539\u6210\u5f53\u524d\u7528\u6237\uff0c\u6211\u7684 Linux \u7cfb\u7edf\u5f53\u524d\u7528\u6237\u540d\u53eb\u505a kingname\uff0c\u6240\u5728\u7684\u7528\u6237\u7ec4\u4e5f\u53eb kingname\uff0c\u6240\u4ee5\u53ef\u4ee5\u6267\u884c\u5982\u4e0b shell \u547d\u4ee4\uff1a<\/p>\n
\r\ncd ~ \r\nsudo cp \/var\/lib\/redis\/dump.rdb .\/ \r\nsudo chown kingname:kinganme dump.rdb \r\n<\/pre>\n\u4fee\u6539\u4e86\u7528\u6237\u4ee5\u540e\uff0c\u73b0\u5728\u6211\u4eec\u8ba9 RDR \u6765\u8bfb\u53d6\u8fd9\u4e2aRDB \u6587\u4ef6\uff1a<\/p>\n
\r\n.\/rdr-linux show -p 8766 dump.rdb \r\n<\/pre>\n\u8fd0\u884c\u6548\u679c\u5982\u4e0b\u56fe\u6240\u793a\uff1a<\/p>\n
<\/p>\n
\u73b0\u5728\uff0c\u6253\u5f00\u6d4f\u89c8\u5668\uff0c\u6253\u5f00http:\/\/IP:8766\uff0c\u5c31\u53ef\u4ee5\u770b\u5230\u5f53\u524d Redis \u7684\u5404\u4e2a Key \u7684\u7edf\u8ba1\u4fe1\u606f\uff1a<\/p>\n
<\/p>\n
\u4e0d\u4ec5\u53ef\u4ee5\u770b\u5230Redis \u6709\u54ea\u4e9b Key\uff0c\u8fd8\u80fd\u770b\u5230\u6bcf\u4e2a Key \u91cc\u9762\u6709\u591a\u5c11\u5143\u7d20\uff0c\u5927\u5c0f\u662f\u591a\u5c11\u3002<\/p>\n
\u800c\u4e14\u7531\u4e8e\u662f\u5206\u6790\u7684 RDB \u6587\u4ef6\uff0c\u6240\u4ee5\u4e5f\u5b8c\u5168\u4e0d\u9700\u8981\u62c5\u5fc3\u5bf9\u7ebf\u4e0a\u6570\u636e\u9020\u6210\u4efb\u4f55\u5f71\u54cd\u3002<\/p>\n
\u6709\u4e86\u8fd9\u4e2a\u5de5\u5177\u4ee5\u540e\uff0c\u8981\u627e\u51fa\u5360\u7528\u7a7a\u95f4\u6700\u5927\u7684 Key\uff0c\u5c31\u975e\u5e38\u7b80\u5355\u4e86\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"
Redis \u5728\u65e5\u5e38\u7684\u5f00\u53d1\u4e2d\uff0c\u4f1a\u79ef\u7d2f\u5927\u91cf\u7684 Key\uff0c\u5360\u7528\u4e0d\u5c11\u5185\u5b58\u7a7a\u95f4\u3002\u6709\u65f6\u5019\uff0c\u6211\u4eec\u60f3\u77e5\u9053\u5f53\u524d Redis \u91cc\u9762\u6709 […]<\/p>\n","protected":false},"author":1898,"featured_media":212628,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[656],"class_list":["post-212622","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread","tag-redis-key"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/212622","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1898"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=212622"}],"version-history":[{"count":1,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/212622\/revisions"}],"predecessor-version":[{"id":212627,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/212622\/revisions\/212627"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/212628"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=212622"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=212622"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=212622"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}