{"id":468,"date":"2013-10-16T20:59:01","date_gmt":"2013-10-16T11:59:01","guid":{"rendered":"http:\/\/www.sambuichi.jp\/?p=468"},"modified":"2015-03-09T15:35:18","modified_gmt":"2015-03-09T06:35:18","slug":"aws-s3%e3%81%b8%e3%81%ae%e3%83%90%e3%83%83%e3%82%af%e3%82%a2%e3%83%83%e3%83%97","status":"publish","type":"post","link":"https:\/\/www.sambuichi.jp\/?p=468","title":{"rendered":"AWS S3\u3078\u306es3cmd\u30d0\u30c3\u30af\u30a2\u30c3\u30d7"},"content":{"rendered":"<p>Views: 117<\/p><style type=\"text\/css\">\n<!--\npre {\n \tmargin:0;\n \tpadding:0;\n \toverflow:auto;\n \twhite-space:pre-wrap;\n \tword-wrap:break-word;\n        background: #fefefe;\n}\n.codex {\n \tfont-family:\"Monaco\",\"Courier\",monospace;\n \tborder:solid 1px #DfDfDF;\n  \tpadding:10px;\n  \tbackground:#fefefe;\n  \tline-height:18px;\n \tmargin-top:0px;\n \tmargin-bottom:20px;\n \tfont-size:14px;\n \tbox-shadow: 0px 5px 10px rgba(0, 0, 0, 0.5);\n \t-webkit-box-shadow: 0px 5px 10px rgba(0, 0, 0, 0.5);\n \t-moz-box-shadow: 0px 5px 10px rgba(0, 0, 0, 0.5);\n}\ncode,\nspan.title {\n \tfont-family:\"Monaco\",\"Courier\",monospace;\n \tfont-size:12px;\n  \tcolor:#000;\n  \tbackground:#fefefe;\n}\n--><\/style>\n<h2>\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u74b0\u5883\u3092\u6574\u5099\u3057\u305f\u969b\u306e\u30e1\u30e2<\/h2>\n<p>\u53c2\u8003\uff1a<br \/>\npost1 <a href=\"http:\/\/qiita.com\/hilotter\/items\/94765ee7be61e30ba67f\">s3cmd\u3092\u4f7f\u3063\u3066EC2\u304b\u3089S3\u306bDB\u30d0\u30c3\u30af\u30a2\u30c3\u30d7<\/a><br \/>\npost2 <a href=\"http:\/\/xoxo-infra.hatenablog.com\/entry\/2013\/02\/06\/020930\">AWS S3 s3cmd \u3067 WARNING: Upload failed \u304c\u51fa\u3066\u30d5\u30a1\u30a4\u30eb\u304c\u30a2\u30c3\u30d7\u3067\u304d\u306a\u3044\u4ef6<\/a><br \/>\n\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u3092\u53d6\u5f97\u3057\u3001S\uff13\u3078\u3082\u8ee2\u9001\u3057\u3066\u3044\u307e\u3059\u3002<br \/>\n\u307b\u3068\u3093\u3069\u3001post1\u306e\u624b\u9806\u3067\u826f\u304b\u3063\u305f\u306e\u3067\u3059\u304c\u3001zip\u30d5\u30a1\u30a4\u30eb\u304cUS\u306b\u8ee2\u9001\u3055\u308c\u3066\u3057\u307e\u3044\u3001\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3002post2\u3092\u53c2\u8003\u306b\u8a2d\u5b9a\u5909\u66f4\u3057\u5bfe\u5fdc\u3057\u307e\u3057\u305f\u3002<br \/>\n<!--more--><\/p>\n<h1>1. \u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u7528\u306eS3\u30d0\u30b1\u30c3\u30c8\u4f5c\u6210<\/h1>\n<h2>1-1. \u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u4fdd\u5b58\u7528\u306e\u30d0\u30b1\u30c3\u30c8\u4f5c\u6210<\/h2>\n<p>AWS\u30de\u30cd\u30fc\u30b8\u30e1\u30f3\u30c8\u30b3\u30f3\u30bd\u30fc\u30eb\u306eS3\u30e1\u30cb\u30e5\u30fc\u306b\u30a2\u30af\u30bb\u30b9\u3057\u3066\u3001\u300cCreate Bucket\u300d\u3092\u9078\u629e<\/p>\n<div class=\"codex\">\n<pre><code>Bucket Name: backup\r\nRegion: Tokyo\r\n<\/code><\/pre>\n<\/div>\n<p>\u300cSet Up Logging\u300d\u3092\u9078\u629e\u3057\u3066\u30ed\u30b0\u306e\u8a2d\u5b9a<\/p>\n<div class=\"codex\">\n<pre><code>Enabled: \u30c1\u30a7\u30c3\u30af\u3092on\u306b\r\nTarget Buckt: backup-xyz  # \u30d0\u30c3\u30b1\u30c8\u540d\u79f0\u306fS3\u5185\u3067\u30e6\u30cb\u30fc\u30af\u306a\u306e\u3067\u3001\u500b\u5225\u306e\u540d\u79f0\u306b\u5909\u66f4\r\nTarget Prefix: log\/       # log\/\u4ee5\u4e0b\u306b\u30ed\u30b0\u304c\u4fdd\u5b58\u3055\u308c\u308b\r\n<\/code><\/pre>\n<\/div>\n<h2>1-2. \u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u30d0\u30b1\u30c3\u30c8\u7528\u30b0\u30eb\u30fc\u30d7\u4f5c\u6210<\/h2>\n<p>AWS\u30de\u30cd\u30fc\u30b8\u30e1\u30f3\u30c8\u30b3\u30f3\u30bd\u30fc\u30eb\u306eIAM\u30e1\u30cb\u30e5\u30fc\u306b\u30a2\u30af\u30bb\u30b9\u3057\u3066\u3001\u300cGroups\u300d\u3001\u300cCreate New Group\u300d\u3092\u9078\u629e<br \/>\nSet Permissions\u306e\u8a2d\u5b9a\u3067\u306f\u4f5c\u6210\u3057\u305f\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u30d0\u30b1\u30c3\u30c8\u306b\u5bfe\u3057\u3066\u306e\u307f\u5168\u6a29\u9650\u3092\u6301\u3064backup\u30b0\u30eb\u30fc\u30d7\u3092\u8ffd\u52a0\u3057\u307e\u3059<br \/>\n\u300cPolicy Generator\u300d\u3092\u9078\u629e\u3057\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b3\u3064\u306e\u6a29\u9650\u3092\u8a2d\u5b9a\uff08\u4e0b\u56f3\u53c2\u7167\uff09<br \/>\nbackup-xyz\u306f\u3001\u30d0\u30b1\u30c3\u30c8\u540d\u3001\u4efb\u610f\u306e\u5024\u3060\u304c\u30e6\u30cb\u30fc\u30af\u3067\u306a\u3044\u3068\u767b\u9332\u3067\u304d\u306a\u3044<\/p>\n<div class=\"codex\">\n<pre><code># 1\u3064\u76ee\r\nEffect: Allow\r\nAWS Service: Amazon S3\r\nActions: All Actions Selected\r\nAmazon Resource Name(ARN): arn:aws:s3:::backup-xyz\r\n\r\n# 2\u3064\u76ee\r\nEffect: Allow\r\nAWS Service: Amazon S3\r\nActions: All Actions Selected\r\nAmazon Resource Name(ARN): arn:aws:s3:::backup-xyz\/*\r\n\r\n# 3\u3064\u76ee\r\nEffect: Allow\r\nAWS Service: Amazon S3\r\nActions: ListAllMyBuckets\r\nAmazon Resource Name(ARN): arn:aws:s3:::*\r\n<\/code><\/pre>\n<\/div>\n<h2>1-3. \u30d0\u30c3\u30af\u30a2\u30c3\u30d7S3\u30d0\u30b1\u30c3\u30c8\u7528\u30e6\u30fc\u30b6\u4f5c\u6210<\/h2>\n<p>IAM\u30e1\u30cb\u30e5\u30fc\u306b\u30a2\u30af\u30bb\u30b9\u3057\u3066\u300cUsers\u300d\u3001\u300cCreate New Users\u300d\u3092\u9078\u629e<\/p>\n<div class=\"codex\">\n<pre><code>Enter User Names: backup\r\n<\/code><\/pre>\n<\/div>\n<p>\u30e6\u30fc\u30b6\u4f5c\u6210\u6642\u306b\u8868\u793a\u3055\u308c\u308b Access Key ID \u3068 Secret Access Key \u3092\u30e1\u30e2\u3057\u3066\u304a\u304d\u307e\u3059<br \/>\n\u30e6\u30fc\u30b6\u4f5c\u6210\u5f8c\u3001\u30e6\u30fc\u30b6\u540d\u3092\u30af\u30ea\u30c3\u30af\u3057\u3066\u8a73\u7d30\u30e1\u30cb\u30e5\u30fc\u3092\u8868\u793a<br \/>\n\u30bf\u30d6\u30e1\u30cb\u30e5\u30fc\u306e\u300cGroups\u300d\u304b\u3089\u3001\u300cAdd User to Groups\u300d\u3092\u9078\u629e\u3057\u3066\u30e6\u30fc\u30b6\u3092backup\u30b0\u30eb\u30fc\u30d7\u306b\u5272\u308a\u5f53\u3066\u307e\u3059\u3002<\/p>\n<h1>2. s3cmd\u8a2d\u5b9a<\/h1>\n<h2>2-1. s3cmd\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h2>\n<div class=\"codex\">\n<pre><code>sudo yum --enablerepo epel install s3cmd<\/code><\/pre>\n<\/div>\n<h2>2-2. \u30a2\u30af\u30bb\u30b9\u30ad\u30fc\u3001\u30b7\u30fc\u30af\u30ec\u30c3\u30c8\u30ad\u30fc\u8a2d\u5b9a<\/h2>\n<p>s3cmd &#8211;configure\u3092\u5b9f\u884c<br \/>\n\u57fa\u672c\u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u3067Enter<br \/>\nUse HTTPS protocol\u306e\u307fYes\u306b<\/p>\n<div class=\"codex\">\n<pre><code>s3cmd --configure\r\n\r\nAccess Key: \u30e6\u30fc\u30b6\u4f5c\u6210\u6642\u306b\u30e1\u30e2\u3057\u3066\u304a\u3044\u305fAccess Key ID\r\nSecret Key: \u30e6\u30fc\u30b6\u4f5c\u6210\u6642\u306b\u30e1\u30e2\u3057\u3066\u304a\u3044\u305fSecret Access Key\r\n\r\nEncryption password: \u4f55\u3082\u5165\u529b\u305b\u305a\u306bEnter\r\nPath to GPG program [\/usr\/bin\/gpg]:\u4f55\u3082\u5165\u529b\u305b\u305a\u306bEnter\r\nUse HTTPS protocol [No]:Yes\r\nHTTP proxy server name: \u4f55\u3082\u5165\u529b\u305b\u305a\u306bEnter\r\nTest access with supplied credentials? [Y\/n] y\r\nSave settings? [y\/N] y<\/code><\/pre>\n<\/div>\n<p>\u300c\u203b 1-2.\u3067 s3:ListAllMyBuckets\u3092\u8a31\u53ef\u3057\u3066\u3044\u306a\u3044\u5834\u5408\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u30a8\u30e9\u30fc\u306b\u306a\u308b\u306e\u3067\u6ce8\u610f\u300d\u3068\u66f8\u304b\u308c\u3066\u3044\u307e\u3057\u305f\u3002<br \/>\n\u79c1\u306e\u5834\u5408\u3001root\u3067\u4f5c\u696d\u3057\u3066\u3044\u305f\u306e\u3067\u3001\u5225\u306e\u3068\u3053\u308d\u306b.s3cfg\u30d5\u30a1\u30a4\u30eb\u304c\u3067\u304d\u3066\u304a\u308a\u3001ec2-user\u3067s3cmd\u5b9f\u884c\u3057\u305f\u3068\u3053\u308d\u3001\u540c\u3058\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f\u3002\u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306e\u5185\u5bb9\u306f\u3001\u5f8c\u3067\u5909\u66f4\u3059\u308b\u5fc5\u8981\u304c\u3042\u3063\u305f\u304c\u3001\u307e\u305a\u306fec2-user\u3067\u518d\u5ea6s3cmd &#8211;configure\u3092\u5b9f\u884c\u3057\u307e\u3057\u305f\u3002<\/p>\n<h2>2-3 .s3cfg\u30d5\u30a1\u30a4\u30eb\u4fee\u6b63<\/h2>\n<p>\u6b21\u306e\u30a8\u30e9\u30fc\u3068\u306a\u308b\u305f\u3081\u3001\u4fee\u6b63<\/p>\n<div class=\"codex\">\n<pre><code>Test access with supplied credentials? [Y\/n] y\r\nPlease wait...\r\nERROR: Test failed: 403 (AccessDenied): Access Denied<\/code><\/pre>\n<\/div>\n<p>\u4fee\u6b63\u306f\u3001\u6b21\u306e\uff14\u30ab\u6240\u3067\u3059\u3002<\/p>\n<div class=\"codex\">\n<pre><code>bucket_location = ap-northeast-1\r\nhost_base = s3-ap-northeast-1.amazonaws.com\r\nhost_bucket = %(bucket)s.s3-ap-northeast-1.amazonaws.com\r\nsimpledb_host = sdb.ap-northeast-1.amazonaws.com<\/code><\/pre>\n<\/div>\n<h2>2-4. \u30b5\u30f3\u30d7\u30eb\u3092\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3057\u3066\u307f\u308b<\/h2>\n<div class=\"codex\">\n<pre><code>vi sample.txt\r\ns3cmd put sample.txt s3:\/\/backup-xyz\/<\/code><\/pre>\n<\/div>\n<p>\u4e0a\u8a18\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u5f8c\u3001\u30d0\u30b1\u30c3\u30c8\u3092\u898b\u308b\u3068sample.txt\u304c\u8ffd\u52a0\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<h1>3. \u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u3092\u767b\u9332<\/h1>\n<h2>MySQL<\/h2>\n<p><span class=\"title\">dump_mysql.sh<\/span><\/p>\n<div class=\"codex\">\n<pre><code>#!\/bin\/bash\r\nPERIOD=7\r\nBACKUPDIR=\/home\/ec2-user\/backups\/sql\r\nTODAY=`date '+%Y%m%d'`\r\nEXPIRE=`date --date \"$PERIOD days ago\" +%Y%m%d`\r\n# \u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u30ed\u30b0\u30d5\u30a1\u30a4\u30eb\u540d\r\nBACKUPLOG=\/home\/ec2-user\/backups\/log\/backupMySQL$TODAY.log\r\nEXPIRELOG=\/home\/ec2-user\/backups\/log\/backupMySQL$EXPIRE.log\r\n\r\ndump() {\r\n        mysqldump -u{\u30e6\u30fc\u30b6ID} -p{\u30d1\u30b9\u30ef\u30fc\u30c9} -x $DB &gt; $BACKUPDIR\/mySQL$DB$TODAY.sql\r\n        gzip -f $BACKUPDIR\/mySQL$DB$TODAY.sql\r\n        s3cmd put -rr $BACKUPDIR\/mySQL$DB$TODAY.sql.gz s3:\/\/backup-XYZ\/sql\/mySQL$DB$TODAY.sql.gz\r\n\r\n        rm -f $BACKUPDIR\/mySQL$DB$EXPIRE.sql.gz\r\n        s3cmd del s3:\/\/backup-XYZ\/sql\/mySQL$DB$EXPIRE.sql.gz\r\n        echo \"`date` database $DB FINISHED\" &gt;&gt; $BACKUPLOG\r\n}\r\n\r\n# \u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u30ed\u30b0\u30d5\u30a1\u30a4\u30eb\u4f5c\u6210\r\nrm -f $EXPIRELOG\r\ntouch $BACKUPLOG\r\nchmod 600 $BACKUPLOG\r\n\r\necho \"`date` BACKUP START\" &gt;&gt; $BACKUPLOG\r\nDB={\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u540d\uff11}\r\ndump\r\nDB={\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u540d\uff12}\r\ndump\r\n\r\n\u2026\u3000\u5fc5\u8981\u306a\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u7e70\u308a\u8fd4\u3057\u3000\u2026\r\n\r\necho \"`date` BACKUP END\" &gt;&gt; $BACKUPLOG\r\n\r\nexit $?<\/code><\/pre>\n<\/div>\n<h2>PostgreSQL<\/h2>\n<p><span class=\"title\">dump_pgsql.sh<\/span><\/p>\n<div class=\"codex\">\n<pre><code>#!\/bin\/bash\r\nPERIOD=7\r\nBACKUPDIR=\/home\/ec2-user\/backups\/sql\r\nTODAY=`date '+%Y%m%d'`\r\nEXPIRE=`date --date \"$PERIOD days ago\" +%Y%m%d`\r\n# \u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u30ed\u30b0\u30d5\u30a1\u30a4\u30eb\u540d\r\nBACKUPLOG=\/home\/ec2-user\/backups\/log\/backupPgSQL$TODAY.log\r\nEXPIRELOG=\/home\/ec2-user\/backups\/log\/backupPgSQL$EXPIRE.log\r\n\r\ndump() {\r\n        pg_dump -U{\u3000\u30e6\u30fc\u30b6ID\u3000} $DB &gt; $BACKUPDIR\/pgSQL$DB$TODAY.sql\r\n        gzip -f $BACKUPDIR\/pgSQL$DB$TODAY.sql\r\n        s3cmd put -rr $BACKUPDIR\/pgSQL$DB$TODAY.sql.gz s3:\/\/backup-xyz\/sql\/pgSQL$DB$TODAY.sql.gz\r\n\r\n        rm -f $BACKUPDIR\/pgSQL$DB$EXPIR.sql.gz\r\n        s3cmd del s3:\/\/backup-xyz\/sql\/pgSQL$DB$EXPIRE.sql.gz\r\n        echo \"`date` database $DB FINISHED\" &gt;&gt; $BACKUPLOG\r\n}\r\n\r\n# \u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u30ed\u30b0\u30d5\u30a1\u30a4\u30eb\u4f5c\u6210\r\nrm -f $EXPIRELOG\r\ntouch $BACKUPLOG\r\nchmod 600 $BACKUPLOG\r\n\r\necho \"`date` database BACKUP START\" &gt;&gt; $BACKUPLOG\r\nDB={\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u540d\uff11}\r\ndump\r\nDB={\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u540d\uff12}\r\ndump\r\n\r\n\u2026\u3000\u5fc5\u8981\u306a\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u7e70\u308a\u8fd4\u3057\u3000\u2026\r\n\r\necho \"`date` database BACKUP FINISHED\" &gt;&gt; $BACKUPLOG\r\n\r\nexit $?<\/code><\/pre>\n<\/div>\n<h2>cron\u767b\u9332<\/h2>\n<p>crontab\u3078\u306e\u767b\u9332<br \/>\n<span class=\"title\">ec2-user\u3067\u30b3\u30de\u30f3\u30c9\u5b9f\u884c<\/span><\/p>\n<div class=\"codex\">\n<pre><code># crontab -e<\/code><\/pre>\n<\/div>\n<p><span class=\"title\">crontab\u767b\u9332\u5185\u5bb9<\/span><br \/>\n\u6df1\u591c2:00\u30683:00\u306b\u5b9f\u884c\u3059\u308b\u3088\u3046\u306b\u767b\u9332\u3057\u307e\u3059\u3002<\/p>\n<div class=\"codex\">\n<pre><code>00 2 * * * \/home\/ec2-user\/backups\/dump_pgsql.sh\r\n00 3 * * * \/home\/ec2-user\/backups\/dump_mysql.sh<\/code><\/pre>\n<\/div>\n<h1>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u56de\u5fa9\u624b\u9806<\/h1>\n<h2>MySQL<\/h2>\n<p>S3\u304b\u3089\u30d5\u30a1\u30a4\u30eb\u3092\u30c0\u30a6\u30a6\u30ed\u30fc\u30c9\u3057\u3001\u56de\u5fa9\u5148\u306b\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3057\u307e\u3059\u3002<br \/>\n\u6b21\u306b\u3001bzip2\u3067\u89e3\u51cd\u3057\u307e\u3059\u3002<\/p>\n<div class=\"codex\">\n<pre><code># gunzip -c mySQL{\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u540d}YYYYMMDD.sql.gz &gt;mySQL{\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u540d}YYYYMMDD.sql<\/code><\/pre>\n<\/div>\n<p>\u56de\u5fa9\u3059\u308b\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u4f5c\u6210\u3057\u305f\u5f8c\u3001mysql\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n<div class=\"codex\">\n<pre><code># mysql -u root -p\r\nEnter password:\r\nmysql&gt; CREATE DATABASE {\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u540d} default character set utf8;\r\nQuery OK, 1 row affected\r\nmysql&gt; exit\r\nBye<\/code><\/pre>\n<\/div>\n<p>\u305d\u306e\u3042\u3068\u3067\u3001<\/p>\n<div class=\"codex\">\n<pre><code># mysql -u{\u30e6\u30fc\u30b6ID} -p{\u30d1\u30b9\u30ef\u30fc\u30c9}  {\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u540d} &lt; mySQ{\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u540d}YYYYMMDD.sql<\/code><\/pre>\n<\/div>\n<h2>PostgreSQL<\/h2>\n<p>S3\u304b\u3089\u30d5\u30a1\u30a4\u30eb\u3092\u30c0\u30a6\u30a6\u30ed\u30fc\u30c9\u3057\u3001\u56de\u5fa9\u5148\u306b\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3057\u307e\u3059\u3002<br \/>\n\u56de\u5fa9\u3059\u308b\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<div class=\"codex\">\n<pre><code># createdb -E UTF8 {\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u540d} -U<\/code><code>{\u30e6\u30fc\u30b6ID}<\/code><\/pre>\n<\/div>\n<p>\u6b21\u306e\u30b3\u30de\u30f3\u30c9\u3067\u89e3\u51cd\u3057\u3001\u5fa9\u5143\u3057\u307e\u3059\u3002<\/p>\n<div class=\"codex\">\n<pre><code># gunzip -c\u3000pgSQL{\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u540d}YYYYMMDD.gz | psql -U{\u30e6\u30fc\u30b6ID}  {\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u540d}<\/code><\/pre>\n<\/div>\n<p>[\u53c2\u8003]<a href=\"http:\/\/itpro.nikkeibp.co.jp\/article\/COLUMN\/20060227\/230790\/\">ITpro<\/a><\/p>\n<h1>root\u3067\u306es3cmd\u5b9f\u884c<\/h1>\n<p>\u30d5\u30a1\u30a4\u30eb\u306e\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u306froot\u3067\u884c\u3046\u306e\u3067\u3001s3cmd\u5b9f\u884c\u306e\u305f\u3081\u3001\/root\/.s3cfg\u3078~ec2-user\/.s3cfg\u3092\u30b3\u30d4\u30fc\u3057\u307e\u3057\u305f\u3002<\/p>\n<h2>tar.bz2\u5f62\u5f0f\u306e\u5727\u7e2e\u3068\u5fa9\u5143<\/h2>\n<p>[\u53c2\u8003]<a href=\"http:\/\/itpro.nikkeibp.co.jp\/article\/COLUMN\/20060228\/231200\/\">ITpro<\/a><\/p>\n<div class=\"codex\">\n<pre><code># tar cjvf package.tar.bz2 package-dir\r\n# tar xjvf package.tar.bz2<\/code><\/pre>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Views: 117 \u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u74b0\u5883\u3092\u6574\u5099\u3057\u305f\u969b\u306e\u30e1\u30e2 \u53c2\u8003\uff1a post1 s3cmd\u3092\u4f7f\u3063\u3066EC2\u304b\u3089S3\u306bDB\u30d0\u30c3\u30af\u30a2\u30c3\u30d7 post2 AWS S3 s3cmd \u3067 WARNING: Upload failed \u304c [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":5,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[11],"tags":[],"_links":{"self":[{"href":"https:\/\/www.sambuichi.jp\/index.php?rest_route=\/wp\/v2\/posts\/468"}],"collection":[{"href":"https:\/\/www.sambuichi.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sambuichi.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sambuichi.jp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sambuichi.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=468"}],"version-history":[{"count":48,"href":"https:\/\/www.sambuichi.jp\/index.php?rest_route=\/wp\/v2\/posts\/468\/revisions"}],"predecessor-version":[{"id":712,"href":"https:\/\/www.sambuichi.jp\/index.php?rest_route=\/wp\/v2\/posts\/468\/revisions\/712"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.sambuichi.jp\/index.php?rest_route=\/wp\/v2\/media\/5"}],"wp:attachment":[{"href":"https:\/\/www.sambuichi.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=468"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sambuichi.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=468"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sambuichi.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=468"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}