{"id":268,"date":"2023-02-24T06:24:06","date_gmt":"2023-02-23T22:24:06","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=268"},"modified":"2023-04-30T15:17:15","modified_gmt":"2023-04-30T07:17:15","slug":"redis-data-backup-and-recovery","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/02\/24\/redis-data-backup-and-recovery\/","title":{"rendered":"Redis \u6570\u636e\u5907\u4efd\u4e0e\u6062\u590d"},"content":{"rendered":"<h2>\u5907\u4efd\u6570\u636e<\/h2>\n<p>Redis SAVE \u547d\u4ee4\u7528\u4e8e\u521b\u5efa\u5f53\u524d\u6570\u636e\u5e93\u7684\u5907\u4efd<\/p>\n<pre><code class=\"language-bash\">redis 127.0.0.1:6379&gt; SAVE \nOK<\/code><\/pre>\n<p><!-- more --><\/p>\n<p>\u8be5\u547d\u4ee4\u5c06\u5728 Redis \u5b89\u88c5\u76ee\u5f55\u4e2d\u521b\u5efa<code>dump.rdb<\/code>\u6587\u4ef6<\/p>\n<h2>\u6062\u590d\u6570\u636e<\/h2>\n<p>\u5982\u679c\u9700\u8981\u6062\u590d\u6570\u636e\uff0c\u53ea\u9700\u5c06\u5907\u4efd\u6587\u4ef6 (<code>dump.rdb<\/code>) \u79fb\u52a8\u5230 Redis \u5b89\u88c5\u76ee\u5f55\u5e76\u542f\u52a8\u670d\u52a1\u5373\u53ef\u3002\u83b7\u53d6 Redis \u76ee\u5f55\u53ef\u4ee5\u4f7f\u7528 CONFIG \u547d\u4ee4\uff0c\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<pre><code class=\"language-bash\">redis 127.0.0.1:6379&gt; CONFIG GET dir\n1) &quot;dir&quot;\n2) &quot;\/usr\/local\/redis\/bin&quot;<\/code><\/pre>\n<p>\u4ee5\u4e0a\u547d\u4ee4<code>CONFIG GET dir<\/code>\u8f93\u51fa\u7684 Redis \u5b89\u88c5\u76ee\u5f55\u4e3a<code>\/usr\/local\/redis\/bin<\/code><\/p>\n<h2>Bgsave<\/h2>\n<p>\u521b\u5efa Redis \u5907\u4efd\u6587\u4ef6\u4e5f\u53ef\u4ee5\u4f7f\u7528\u547d\u4ee4 BGSAVE\uff0c\u8be5\u547d\u4ee4\u5728\u540e\u53f0\u6267\u884c<\/p>\n<pre><code class=\"language-bash\">127.0.0.1:6379&gt; BGSAVE\n\nBackground saving started<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u5907\u4efd\u6570\u636e Redis SAVE \u547d\u4ee4\u7528\u4e8e\u521b\u5efa\u5f53\u524d\u6570\u636e\u5e93\u7684\u5907\u4efd redis 127.0.0.1:6379&gt; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14],"tags":[],"class_list":["post-268","post","type-post","status-publish","format-standard","hentry","category-redis"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/268","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=268"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/268\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=268"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=268"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=268"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}