{"id":3391,"date":"2014-03-11T02:27:32","date_gmt":"2014-03-10T17:27:32","guid":{"rendered":"https:\/\/www.united-bears.co.jp\/blog\/?p=3391"},"modified":"2014-03-11T02:27:32","modified_gmt":"2014-03-10T17:27:32","slug":"%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab%e3%82%84-mysql-%e3%81%ae%e3%83%87%e3%83%bc%e3%82%bf%e3%82%92%e3%83%aa%e3%83%a2%e3%83%bc%e3%83%88%e3%81%ae%e3%82%b7%e3%82%b9%e3%83%86%e3%83%a0%e3%81%ab-ssh","status":"publish","type":"post","link":"https:\/\/www.united-bears.co.jp\/blog\/archives\/3391","title":{"rendered":"\u30d5\u30a1\u30a4\u30eb\u3084 MySQL \u306e\u30c7\u30fc\u30bf\u3092\u30ea\u30e2\u30fc\u30c8\u306e\u30b7\u30b9\u30c6\u30e0\u306b ssh \u7d4c\u7531\u3067\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u3059\u308b\u65b9\u6cd5"},"content":{"rendered":"<p>VPS(\u4eee\u60f3\u5c02\u7528\u30b5\u30fc\u30d0\u30fc)\u304c\u5b89\u304f\u306a\u3063\u305f\u306e\u3067\u3001\u975e\u5e38\u306b\u5b89\u4fa1\u306b\u516c\u958b\u30b5\u30fc\u30d0\u30fc\u3092\u69cb\u7bc9\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u3063\u305f\u3002\u3057\u304b\u3057\u3001\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u306f\u76f8\u5909\u308f\u3089\u305a\u982d\u3092\u60a9\u307e\u305b\u308b\u554f\u984c\u3068\u3057\u3066\u6b8b\u308b\u3002\u30c7\u30fc\u30bf\u3092\u81ea\u52d5\u7684\u306b\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u3059\u308b\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u8ffd\u52a0\u3059\u308c\u3070\u9ad8\u4fa1\u306b\u306a\u3063\u3066\u3057\u307e\u3046\u3057\u3001\u5b89\u4fa1\u306a VPS \u306e\u5834\u5408\u306f\u30b5\u30fc\u30d3\u30b9\u304c\u63d0\u4f9b\u3055\u308c\u3066\u3044\u306a\u3044\u3053\u3068\u3082\u591a\u3044\u3002\u30b5\u30fc\u30d0\u30fc\u3092\u501f\u308a\u305f\u9803\u306f\u3053\u307e\u3081\u306b\u3084\u3063\u3066\u3044\u305f\u624b\u52d5\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u3082\u3001\u624b\u9593\u304c\u304b\u304b\u308b\u305f\u3081\u5c11\u3057\u5fd9\u3057\u304f\u306a\u308b\u3068\u9593\u9694\u304c\u958b\u3044\u3066\u3057\u307e\u3046\u3002<br \/>\n\u305d\u3053\u3067\u3001LAN \u4e0a\u306b Linux \u30de\u30b7\u30f3\u3092\u7528\u610f\u3057\u3066 ssh \u7d4c\u7531\u3067\u81ea\u52d5\u7684\u306b\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u3092\u53d6\u5f97\u3059\u308b\u3053\u3068\u306b\u3057\u305f\u3002ssh \u7d4c\u7531\u3067\u884c\u3046\u306e\u306f\u3001\u901a\u4fe1\u5185\u5bb9\u3092\u6697\u53f7\u5316\u3059\u308b\u305f\u3081\u3060\u3002VPS \u306e\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u3092\u7591\u3046\u308f\u3051\u3067\u306f\u306a\u3044\u304c\u3001\u540c\u4e00\u30cf\u30fc\u30c9\u30a6\u30a7\u30a2\u4e0a\u306e\u30b7\u30b9\u30c6\u30e0\u3067\u901a\u4fe1\u3092\u508d\u53d7\u3055\u308c\u305f\u308a\u3001\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u4e0a\u3067\u901a\u4fe1\u5185\u5bb9\u3092\u508d\u53d7\u3055\u308c\u308b\u5371\u967a\u6027\u3092\u8003\u3048\u3066 ssh \u3092\u5229\u7528\u3059\u308b\u3053\u3068\u306b\u3057\u305f\u3002\u96e3\u3057\u3044\u3053\u3068\u3067\u306f\u306a\u3044\u304c\u3001\u30e1\u30e2\u3057\u3066\u304a\u304b\u306a\u3044\u3068\u5fd8\u308c\u3066\u3057\u307e\u3046\u306e\u3067\u30d6\u30ed\u30b0\u306e\u8a18\u4e8b\u306b\u3059\u308b\u3002<\/p>\n<h2>\u30d5\u30a1\u30a4\u30eb\u306e\u30d0\u30c3\u30af\u30a2\u30c3\u30d7<\/h2>\n<p>\u666e\u901a\u306e\u30d5\u30a1\u30a4\u30eb\u306f\u3001rsync \u3067\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u3092\u53d6\u5f97\u3057\u3066\u3044\u308b\u3002\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u306f\u3001\u4e3b\u306b\u30d6\u30ed\u30b0\u306b\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3057\u305f\u5199\u771f(\u4eca\u306e\u3068\u3053\u308d\u98df\u3079\u7269\u3070\u304b\u308a)\u3060\u3002\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u5bfe\u8c61\u306b\u306f Subversion \u306e\u30ea\u30dd\u30b8\u30c8\u30ea\u3082\u542b\u307e\u308c\u3066\u3044\u308b\u3002\u672c\u6765\u306f svnadmin \u3084 svn-hot-backup \u3092\u4f7f\u3046\u3079\u304d\u306a\u306e\u3060\u304c\u3001\u5229\u7528\u3057\u3066\u3044\u308b\u4eba\u6570\u304c\u5c11\u306a\u3044\u3053\u3068\u3001\u540c\u4e00\u306e\u30b7\u30b9\u30c6\u30e0\u306b\u623b\u3059\u3053\u3068\u3092\u60f3\u5b9a\u3057\u3066\u3044\u308b\u3053\u3068\u304b\u3089 rsync \u3067\u5358\u7d14\u306b\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u3057\u3066\u3044\u308b\u3002\u4ee5\u4e0b\u306f\u3001cron \u306b\u767b\u9332\u3057\u3066\u52d5\u304b\u3057\u3066\u3044\u308b rsync \u30b3\u30de\u30f3\u30c9\u306e\u4f8b\u3060\u3002<\/p>\n<pre>\r\n\/usr\/bin\/rsync -h -rptgoDv --delete --rsh=\"ssh -p [ssh \u306e\u30dd\u30fc\u30c8\u756a\u53f7] -i [\u79d8\u5bc6\u9375\u306e\u30d5\u30a1\u30a4\u30eb]\" [\u30e6\u30fc\u30b6\u30fc]@[\u30b5\u30fc\u30d0\u30fc\u306eIP\u30a2\u30c9\u30ec\u30b9]:[\u30bd\u30fc\u30b9(\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u3059\u308b)\u30c7\u30a3\u30ec\u30af\u30c8\u30ea] [\u30ed\u30fc\u30ab\u30eb\u306e\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u5148\u30c7\u30a3\u30ec\u30af\u30c8\u30ea]\r\n<\/pre>\n<p>\u5404\u30aa\u30d7\u30b7\u30e7\u30f3\u306e\u610f\u5473\u306f\u3001\u4ee5\u4e0b\u306e\u901a\u308a\u3002<\/p>\n<dl>\n<dt>-r<\/dt>\n<dd>\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u518d\u5e30\u7684\u306b\u305f\u3069\u308b<\/dd>\n<dt>-p<\/dt>\n<dd>\u30d1\u30fc\u30df\u30c3\u30b7\u30e7\u30f3\u306e\u4fdd\u6301<\/dd>\n<dt>-t<\/dt>\n<dd>\u66f4\u65b0\u65e5\u6642\u306e\u4fdd\u6301<\/dd>\n<dt>-g<\/dt>\n<dd>\u30b0\u30eb\u30fc\u30d7\u306e\u4fdd\u6301<\/dd>\n<dt>-o<\/dt>\n<dd>\u30d5\u30a1\u30a4\u30eb\u306e\u30aa\u30fc\u30ca\u30fc\u306e\u4fdd\u6301<\/dd>\n<dt>-D<\/dt>\n<dd>\u30c7\u30d0\u30a4\u30b9\u3084\u30b9\u30da\u30b7\u30e3\u30eb\u30d5\u30a1\u30a4\u30eb\u306e\u751f\u6210<\/dd>\n<dt>&#8211;delete<\/dt>\n<dd>\u9001\u4fe1\u5074\u306b\u306a\u3044\u30d5\u30a1\u30a4\u30eb\u3092\u524a\u9664<\/dd>\n<dt>&#8211;rsh<\/dt>\n<dd>rsh \u306e\u4ee3\u66ff\u3092\u6307\u5b9a<\/dd>\n<\/dl>\n<p>rsh \u306e\u4ee3\u66ff\u306b ssh \u3092\u6307\u5b9a\u3059\u308b\u3053\u3068\u3067\u3001ssh \u3092\u5229\u7528\u3057\u3066\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u3092\u5b9f\u73fe\u3057\u3066\u3044\u308b\u3002<br \/>\n\u30bd\u30fc\u30b9(\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u3059\u308b)\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u6307\u5b9a\u306f\u6ce8\u610f\u304c\u5fc5\u8981\u3060\u3002\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u540d\u306e\u5f8c\u306b\u30b9\u30e9\u30c3\u30b7\u30e5\u304c\u3064\u304f\u3068\u3001\u300c\u6307\u5b9a\u3057\u305f\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u4ee5\u4e0b\u306e\u30d5\u30a1\u30a4\u30eb\u300d\u3092\u30b3\u30d4\u30fc\u3059\u308b\u3002\u30b9\u30e9\u30c3\u30b7\u30e5\u3092\u3064\u3051\u306a\u3044\u3068\u3001\u300c\u6307\u5b9a\u3057\u305f\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u81ea\u4f53\u300d\u3092\u30b3\u30d4\u30fc\u3059\u308b\u3002\u3053\u306e\u9055\u3044\u306f\u3001&#8211;delete\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u4f7f\u3046\u3068\u304d\u306f\u3001\u7279\u306b\u6c17\u3092\u3064\u3051\u305f\u3044\u3002<\/p>\n<h2>MySQL \u306e\u30d0\u30c3\u30af\u30a2\u30c3\u30d7<\/h2>\n<p>MySQL \u306e\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u306f\u3001mysqldump \u3092\u5229\u7528\u3059\u308b\u3002ssh \u306f\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u7d50\u679c\u3092\u53d6\u5f97\u3067\u304d\u308b\u306e\u3067\u3001\u5358\u7d14\u306b ssh \u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u306b\u5b9f\u884c\u3059\u308b\u30b3\u30de\u30f3\u30c9 mysqldump \u3068\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u6e21\u3059\u3060\u3051\u3060\u3002<\/p>\n<p>mysqldump \u3092\u52d5\u4f5c\u3055\u305b\u308b\u305f\u3081\u306b\u306f\u3001\u30e6\u30fc\u30b6\u30fc\u306b\u300cSELECT,SHOW VIEW,LOCK, FILE\u300d\u306e\u6a29\u9650\u3092\u4e0e\u3048\u308b\u5fc5\u8981\u304c\u3042\u308b\u3002localhost \u304b\u3089\u63a5\u7d9a\u3059\u308b\u5f62\u306b\u306a\u308b\u306e\u3067\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u6a29\u9650\u3092\u4e0e\u3048\u3066\u3042\u308b\u3002<\/p>\n<pre>\r\nGRANT SELECT,SHOW VIEW,LOCK TABLES ON [\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u540d].* TO [\u30e6\u30fc\u30b6\u30fc\u540d]@localhost IDENTIFIED BY '[\u30d1\u30b9\u30ef\u30fc\u30c9]';\r\nGRANT FILE ON *.* TO [\u30e6\u30fc\u30b6\u30fc\u540d]@localhost;\r\n<\/pre>\n<p>\u4ee5\u4e0b\u306f\u3001cron \u306b\u767b\u9332\u3057\u3066\u3044\u308b mysqldump \u3092\u547c\u3073\u51fa\u3059 ssh \u30b3\u30de\u30f3\u30c9\u306e\u4f8b\u3060\u3002<\/p>\n<pre>\r\n\/usr\/bin\/ssh -p [ssh \u306e\u30dd\u30fc\u30c8\u756a\u53f7] -i [\u79d8\u5bc6\u9375\u306e\u30d5\u30a1\u30a4\u30eb] [\u30e6\u30fc\u30b6\u30fc]@[\u30b5\u30fc\u30d0\u30fc\u306eIP\u30a2\u30c9\u30ec\u30b9] \/usr\/bin\/mysqldump -u [mysql \u306e\u30e6\u30fc\u30b6\u30fc] --password='[mysql \u306e\u30d1\u30b9\u30ef\u30fc\u30c9]' [mysql \u306e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9] | \/bin\/gzip -c > mysqldump.sql.gz\r\n<\/pre>\n<p>\u5358\u7d14\u306b\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u3092\u53d6\u5f97\u3057\u3066\u3044\u308b\u3060\u3051\u306a\u306e\u3067\u3001\u30d1\u30a4\u30d7\u3092\u4f7f\u3063\u3066 gzip \u3067\u5727\u7e2e\u3057\u3066\u30d5\u30a1\u30a4\u30eb\u306b\u4fdd\u5b58\u3057\u3066\u3044\u308b\u304c\u3001\u30d5\u30a1\u30a4\u30eb\u540d\u306b\u65e5\u4ed8\u3084\u6570\u5b57\u3092\u542b\u3081\u308c\u3070\u4e16\u4ee3\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u3082\u53ef\u80fd\u3060\u3057\u3001mysql \u306b\u6e21\u305b\u3070 MySQL \u30b5\u30fc\u30d0\u30fc\u306b\u6d41\u3057\u8fbc\u3080\u3053\u3068\u3082\u3067\u304d\u308b\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>VPS(\u4eee\u60f3\u5c02\u7528\u30b5\u30fc\u30d0\u30fc)\u304c\u5b89\u304f\u306a\u3063\u305f\u306e\u3067\u3001\u975e\u5e38\u306b\u5b89\u4fa1\u306b\u516c\u958b\u30b5\u30fc\u30d0\u30fc\u3092\u69cb\u7bc9\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u3063\u305f\u3002\u3057\u304b\u3057\u3001\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u306f\u76f8\u5909\u308f\u3089\u305a\u982d\u3092\u60a9\u307e\u305b\u308b\u554f\u984c\u3068\u3057\u3066\u6b8b\u308b\u3002\u30c7\u30fc\u30bf\u3092\u81ea\u52d5\u7684\u306b\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u3059\u308b\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u8ffd\u52a0\u3059\u308c\u3070\u9ad8\u4fa1\u306b\u306a\u3063\u3066 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15],"tags":[],"class_list":["post-3391","post","type-post","status-publish","format-standard","hentry","category-server"],"_links":{"self":[{"href":"https:\/\/www.united-bears.co.jp\/blog\/wp-json\/wp\/v2\/posts\/3391","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.united-bears.co.jp\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.united-bears.co.jp\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.united-bears.co.jp\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.united-bears.co.jp\/blog\/wp-json\/wp\/v2\/comments?post=3391"}],"version-history":[{"count":8,"href":"https:\/\/www.united-bears.co.jp\/blog\/wp-json\/wp\/v2\/posts\/3391\/revisions"}],"predecessor-version":[{"id":3399,"href":"https:\/\/www.united-bears.co.jp\/blog\/wp-json\/wp\/v2\/posts\/3391\/revisions\/3399"}],"wp:attachment":[{"href":"https:\/\/www.united-bears.co.jp\/blog\/wp-json\/wp\/v2\/media?parent=3391"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.united-bears.co.jp\/blog\/wp-json\/wp\/v2\/categories?post=3391"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.united-bears.co.jp\/blog\/wp-json\/wp\/v2\/tags?post=3391"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}