{"id":50,"date":"2019-12-31T17:18:20","date_gmt":"2019-12-31T09:18:20","guid":{"rendered":"http:\/\/blog.ohmmx.com\/?p=50"},"modified":"2019-12-31T17:18:20","modified_gmt":"2019-12-31T09:18:20","slug":"%e6%95%b0%e6%8d%ae%e5%ba%93%e8%87%aa%e5%8a%a8%e5%a4%87%e4%bb%bd","status":"publish","type":"post","link":"http:\/\/blog.ohmmx.com\/?p=50","title":{"rendered":"\u6570\u636e\u5e93\u81ea\u52a8\u5907\u4efd"},"content":{"rendered":"\n<p>\u5148\u8bbe\u7f6e\u597d\u9ed8\u8ba4\u7684\u7528\u6237\u540d\u548c\u5bc6\u7801\uff0c\u907f\u514d\u5728\u811a\u672c\u91cc\u5199\u5bc6\u7801<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vim ~\/.my.cnf<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;mysqldump]\nuser=&#91;username]\npassword=&#91;password]<\/code><\/pre>\n\n\n\n<p>\u5199\u4e00\u4e2a\u811a\u672c\u628a\u5907\u4efd\u811a\u672c\u5199\u8fdb\u53bb<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vim dbbackup.sh<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>NOW=$(date +\"%Y%m%d%H%M%S\")\nmysqldump -h &#91;host] -P &#91;port] &#91;dbname] | xz > &#91;path]\/db_&#91;dbname]_$NOW.sql.xz<\/code><\/pre>\n\n\n\n<p>\u7ed9\u811a\u672c\u6dfb\u52a0\u6267\u884c\u6743\u9650<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>chmod +x dbbackup.sh<\/code><\/pre>\n\n\n\n<p>\u5907\u4efd\u591a\u4e2a\u5e93\u53ef\u4ee5\u5199\u591a\u6761 mysqldump\uff0c\u540e\u9762\u7684\u65f6\u5206\u79d2 %H%M%S \u53ef\u4ee5\u914c\u60c5\u53bb\u6389\u3002<\/p>\n\n\n\n<p>\u6dfb\u52a0\u5b9a\u65f6\u4efb\u52a1<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>crontab -e<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>0 3 * * * &#91;path]\/dbbackup.sh<\/code><\/pre>\n\n\n\n<p>\u7cfb\u7edf\u7684\u5b9a\u65f6\u4efb\u52a1\u6700\u5c0f\u5355\u4f4d\u662f\u79d2\uff0c\u8fd9\u91cc\u4f1a\u5728\u6bcf\u5929\u76843\u70b90\u5206\u6267\u884c\u4e00\u6b21\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5148\u8bbe\u7f6e\u597d\u9ed8\u8ba4\u7684\u7528\u6237\u540d\u548c\u5bc6\u7801\uff0c\u907f\u514d\u5728\u811a\u672c\u91cc\u5199\u5bc6\u7801 \u5199\u4e00\u4e2a\u811a\u672c\u628a\u5907\u4efd\u811a\u672c\u5199\u8fdb\u53bb \u7ed9\u811a &hellip; <a href=\"http:\/\/blog.ohmmx.com\/?p=50\">\u7ee7\u7eed\u9605\u8bfb <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17],"tags":[18,8],"class_list":["post-50","post","type-post","status-publish","format-standard","hentry","category-17","tag-18","tag-8"],"_links":{"self":[{"href":"http:\/\/blog.ohmmx.com\/index.php?rest_route=\/wp\/v2\/posts\/50","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/blog.ohmmx.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.ohmmx.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.ohmmx.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.ohmmx.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=50"}],"version-history":[{"count":1,"href":"http:\/\/blog.ohmmx.com\/index.php?rest_route=\/wp\/v2\/posts\/50\/revisions"}],"predecessor-version":[{"id":51,"href":"http:\/\/blog.ohmmx.com\/index.php?rest_route=\/wp\/v2\/posts\/50\/revisions\/51"}],"wp:attachment":[{"href":"http:\/\/blog.ohmmx.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=50"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.ohmmx.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=50"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.ohmmx.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=50"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}