{"id":218821,"date":"2014-04-09T17:28:05","date_gmt":"2014-04-09T13:28:05","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=218821"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=218821","title":{"rendered":"<span class=\"post_title\">\u0412\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 MySQL \u0438\u0437\u00a0\u0441\u043d\u0438\u043c\u043a\u0430\u00a0EBS<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t\u042d\u0442\u043e \u043a\u043e\u0440\u043e\u0442\u043a\u043e\u0435 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u043a\u043e\u043c\u0443-\u0442\u043e, \u043a\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 AWS (\u0438, \u0432 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, MySQL \u043d\u0430 \u0438\u043d\u0441\u0442\u0430\u043d\u0441\u0435&nbsp;EC2), \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 MySQL \u0438\u0437 \u0441\u043d\u0438\u043c\u043a\u0430&nbsp;EBS (\u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043b\u044e\u0431\u043e\u0439 \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440, \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435, \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442 \u0437\u0430\u0431\u043b\u0430\u0433\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u2014 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/github.com\/alestic\/ec2-consistent-snapshot\">ec2\u2011consistent\u2011snapshot<\/a>, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440)<\/p>\n<p>  \u041f\u0440\u0435\u0436\u0434\u0435 \u0432\u0441\u0435\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u043a\u0440\u044b\u0442\u044c <a href=\"https:\/\/console.aws.amazon.com\/ec2\/v2\/home\">EC2 Management Console<\/a>, \u0438 \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 ELASTIC BLOCK STORE&nbsp;\u2192&nbsp;Snapshots \u043d\u0430\u0439\u0442\u0438 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u0441\u043d\u0438\u043c\u043e\u043a (\u043e\u0431\u044b\u0447\u043d\u043e \u044d\u0442\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0441\u043d\u0438\u043c\u043e\u043a \u0440\u0430\u0437\u0434\u0435\u043b\u0430).<\/p>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u043d\u0443\u0436\u043d\u043e \u0449\u0451\u043b\u043a\u043d\u0443\u0442\u044c \u043d\u0430 \u0441\u043d\u0438\u043c\u043a\u0435 \u043f\u0440\u0430\u0432\u043e\u0439 \u043a\u043d\u043e\u043f\u043a\u043e\u0439 \u043c\u044b\u0448\u043a\u0438 \u0438 \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u00abCreate Volume\u00bb. \u0412 Availability Zone \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0442\u043e\u0442 \u0436\u0435 \u0440\u0435\u0433\u0438\u043e\u043d, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0438\u043d\u0441\u0442\u0430\u043d\u0441&nbsp;EC2.<\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u0432 \u0440\u0430\u0437\u0434\u0435\u043b ELASTIC BLOCK STORE&nbsp;\u2192&nbsp;Volumes \u0438, \u043e\u043f\u044f\u0442\u044c \u0436\u0435, \u0449\u0451\u043b\u043a\u043d\u0443\u0442\u044c \u043f\u0440\u0430\u0432\u043e\u0439 \u043a\u043d\u043e\u043f\u043a\u043e\u0439 \u043c\u044b\u0448\u043a\u0438 \u043d\u0430 \u043f\u043e\u044f\u0432\u0438\u0432\u0448\u0438\u0439\u0441\u044f \u0440\u0430\u0437\u0434\u0435\u043b. \u0412 \u043c\u0435\u043d\u044e \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043f\u0443\u043d\u043a\u0442 \u00abAttach Volume\u00bb, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0432 \u043f\u043e\u044f\u0432\u0438\u0432\u0448\u0435\u043c\u0441\u044f \u043c\u043e\u0434\u0430\u043b\u044c\u043d\u043e\u043c \u043e\u043a\u043d\u0435 \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0438\u043d\u0441\u0442\u0430\u043d\u0441&nbsp;EC2 \u0438 \u043d\u0430\u0436\u0430\u0442\u044c \u00abYes, Attach\u00bb.<\/p>\n<p>  \u0412\u0441\u0451&nbsp;&mdash;&nbsp;\u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u043f\u043e\u044f\u0432\u0438\u0442\u044c\u0441\u044f \u043d\u043e\u0432\u043e\u0435 \u0431\u043b\u043e\u0447\u043d\u043e\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e. \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c <code>dmesg&nbsp;|&nbsp;tail<\/code> \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043a\u0430\u043a\u043e\u0439 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0431\u044b\u043b \u043f\u0440\u0438\u0441\u0432\u043e\u0435\u043d \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0451\u043d\u043d\u043e\u0433\u043e \u0431\u043b\u043e\u0447\u043d\u043e\u0433\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430. \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u044d\u0442\u043e xvdg. \u0422\u043e\u0433\u0434\u0430 \u0424\u0421 \u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u0442\u044c\u0441\u044f, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0430 \/dev\/xvdg1 (\u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0442\u0435\u043d\u0438\u0439 \u0442\u043e\u0433\u043e, \u043a\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u043b \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0440\u0430\u0437\u0434\u0435\u043b\u043e\u0432).<br \/>  <a name=\"habracut\"><\/a><br \/>  \u0421\u043e\u0437\u0434\u0430\u0451\u043c \u043d\u043e\u0432\u044b\u0439 \u043a\u0430\u0442\u0430\u043b\u043e\u0433, \u0438 \u043c\u043e\u043d\u0442\u0438\u0440\u0443\u0435\u043c \u0440\u0430\u0437\u0434\u0435\u043b \u0432 \u044d\u0442\u043e\u0442 \u043a\u0430\u0442\u0430\u043b\u043e\u0433:<\/p>\n<pre><code class=\"bash\">mkdir \/mnt\/backup mount \/dev\/xvdg1 \/mnt\/backup <\/code><\/pre>\n<p>  \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0431\u044d\u043a\u0430\u043f\u0430, \u0432\u043a\u043b\u044e\u0447\u0438\u043c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 MySQL, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0439 \u0441 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0435\u0439 \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<pre><code class=\"bash\">sudo -u mysql \/usr\/libexec\/mysqld --basedir=\/usr --datadir=\/mnt\/backup\/mysql --plugin-dir=\/usr\/lib64\/mysql\/plugin --log-error=\/var\/log\/mysqld_backup.log --pid-file=\/var\/run\/mysqld\/mysqld_backup.pid --socket=\/var\/lib\/mysql\/mysql_backup.sock --port=5523 <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u043a \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043d\u043e\u043c\u0443 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0443 MySQL:<\/p>\n<pre><code class=\"bash\">mysql -h 127.0.0.1 -P 5523 <\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u0443\u0434\u0430\u043b\u043e\u0441\u044c, \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>  \u0414\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439: \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440-\u0441\u0442\u0430\u0436\u0451\u0440 \u043c\u0435\u043d\u044f\u043b \u0432 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u043d\u043e \u043e\u0442\u0432\u043b\u0451\u043a\u0441\u044f \u043d\u0430 \u0440\u0430\u0437\u043c\u044b\u0448\u043b\u0435\u043d\u0438\u044f \u043e \u0432\u0435\u0447\u043d\u043e\u043c, \u0438 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u0437\u0430\u0431\u044b\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0432 SQL\u2011\u0437\u0430\u043f\u0440\u043e\u0441\u0435 WHERE. \u041d\u0443, \u043d\u0438\u0447\u0435\u0433\u043e \u0441\u0442\u0440\u0430\u0448\u043d\u043e\u0433\u043e \u2014 \u0441 \u043a\u0435\u043c \u043d\u0435 \u0431\u044b\u0432\u0430\u0435\u0442.<\/p>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u044f&nbsp;sex \u0432 website.profile. \u041f\u0440\u0438\u0447\u0451\u043c \u0434\u0430\u0436\u0435 \u043d\u0435 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439, \u0430 \u0433\u0434\u0435-\u0442\u043e \u0434\u043b\u044f \u0442\u0440\u0435\u0442\u0438 (\u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440 \u0431\u044b\u043b, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0437\u0430\u0434\u0443\u043c\u0447\u0438\u0432\u044b\u0439, \u043d\u043e \u043d\u0435 \u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043a\u043e, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043d\u0430\u0436\u0430\u0442\u044c Ctrl&nbsp;+&nbsp;C, \u043f\u043e\u043d\u044f\u0432, \u0447\u0442\u043e \u0437\u0430\u043f\u0440\u043e\u0441 \u044f\u0432\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0434\u043e\u0437\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u043e\u043b\u0433\u043e). \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 \u0448\u0435\u043b\u043b\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0430\u0439\u043b, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u043d\u0443\u0436\u043d\u044b\u0435 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b:<\/p>\n<pre><code class=\"bash\">select id from profile where sex=&quot;test&quot; into outfile '\/tmp\/profile_id_list'; <\/code><\/pre>\n<p>  \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u043d \u0444\u0430\u0439\u043b \/tmp\/profile_id_list, \u0433\u0434\u0435 \u0431\u0443\u0434\u0443\u0442 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b \u0442\u0435\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439, \u043f\u043e\u043b\u0435 sex \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0443\u0436\u043d\u043e \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0438\u0437 \u0431\u044d\u043a\u0430\u043f\u0430.<\/p>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u043f\u0438\u0448\u0435\u043c restore.py:<\/p>\n<pre><code class=\"python\">import MySQLdb  db = MySQLdb.connect(host=&quot;127.0.0.1&quot;,                      port=5523,                      user=&quot;user&quot;,                      passwd=&quot;password&quot;,                      db=&quot;website&quot;)  c = db.cursor()  f = open(&quot;\/tmp\/profile_id_list&quot;)  for profile_id in f.readlines():     c.execute(         &quot;select sex from profile where id=%s&quot;,         (profile_id,)     )     print &quot;update profile set sex=\\&quot;%s\\&quot; where id=%s;&quot; % (         c.fetchone()[0],         profile_id[:-1]     ) <\/code><\/pre>\n<p>  \u0418 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c SQL\u2011\u0444\u0430\u0439\u043b \u0434\u043b\u044f \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f sex:<\/p>\n<pre><code class=\"bash\">python restore.py &gt; restore.sql <\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u0444\u0430\u0439\u043b \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0440\u043e\u043a \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e wc&nbsp;-l&nbsp;restore.sql), \u0438, \u0437\u0430\u0442\u0435\u043c, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c SQL\u2011\u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0438\u0437 \u0444\u0430\u0439\u043b\u0430:<\/p>\n<pre><code class=\"bash\">mysql website &lt; restore.sql <\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u0432\u0441\u0451 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u043e\u0441\u044c.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c \/tmp\/profile_id_list \u0438 \u043f\u0440\u043e\u0447\u0438\u0435 \u0444\u0430\u0439\u043b\u044b, \u0438, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0432\u044b\u043a\u043b\u044e\u0447\u0438\u0442\u044c MySQL\u2011\u0441\u0435\u0440\u0432\u0435\u0440:<\/p>\n<pre><code class=\"bash\">mysqladmin -u root -p -h 127.0.0.1 -P 5523 shutdown <\/code><\/pre>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0442\u043c\u043e\u043d\u0442\u0438\u0440\u0443\u0435\u043c \u0440\u0430\u0437\u0434\u0435\u043b \u0438 \u0443\u0434\u0430\u043b\u0438\u043c \u043a\u0430\u0442\u0430\u043b\u043e\u0433, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u043d \u043c\u043e\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043b\u0441\u044f:<\/p>\n<pre><code class=\"bash\">umount \/mnt\/backup rm -r \/mnt\/backup <\/code><\/pre>\n<p>  \u0410 \u0432 AWS Management Console, \u0441\u043e\u043e\u0442\u0432\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0437\u0430\u0445\u043e\u0434\u0438\u043c \u0432 \u0440\u0430\u0437\u0434\u0435\u043b ELASTIC BLOCK STORE&nbsp;\u2192&nbsp;Volumes \u0438 \u043e\u0442\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0435 \u0431\u043b\u043e\u0447\u043d\u043e\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e (Detach Volume). \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c (Delete Volume).<\/p>\n<p>  \u0415\u0449\u0451 \u043c\u043e\u0436\u043d\u043e \u0441\u043d\u043e\u0432\u0430 \u0437\u0430\u0439\u0442\u0438 \u0432 \u0440\u0430\u0437\u0434\u0435\u043b \u0441\u043e \u0441\u043d\u0438\u043c\u043a\u0430\u043c\u0438 (ELASTIC BLOCK STORE&nbsp;\u2192&nbsp;Snapshots) \u0438 \u043a\u0430\u043a-\u043d\u0438\u0431\u0443\u0434\u044c \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c \u0442\u0435 \u0441\u043d\u0438\u043c\u043a\u0438, \u0433\u0434\u0435 (\u0441\u0443\u0434\u044f \u043f\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u043d\u0438\u043c\u043a\u0430) \u0435\u0441\u0442\u044c \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u0442\u0440\u0430\u0437\u0438\u0442\u044c \u044d\u0442\u043e \u0432 \u0438\u043c\u0435\u043d\u0438 \u0441\u043d\u0438\u043c\u043a\u0430). \u0410\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u0430&nbsp;&mdash;&nbsp;\u0432\u043e\u043e\u0431\u0449\u0435 \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0441\u043d\u0438\u043c\u043e\u043a. \u041d\u043e \u044d\u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0445\u0443\u0436\u0435 \u0441 \u0442\u043e\u0439 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f, \u0447\u0442\u043e \u0438\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u043e\u0442 \u0441\u043d\u0438\u043c\u043e\u043a \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u043a\u043e\u043c\u0443-\u0442\u043e \u0435\u0449\u0451 (\u0434\u043b\u044f \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u0434\u0440\u0443\u0433\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u043c\u0435\u043d\u043d\u043e \u0432 \u044d\u0442\u043e\u043c \u0441\u043d\u0438\u043c\u043a\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043a\u0430\u043a \u0440\u0430\u0437 \u0432 \u043f\u043e\u043b\u043d\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435). \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043b\u0443\u0447\u0448\u0435 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0442\u044c, \u0447\u0442\u043e \u043b\u044e\u0431\u043e\u0439 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 (\u0430 \u0442\u0435\u043c \u0431\u043e\u043b\u0435\u0435 \u0441\u0430\u043c\u044b\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439) \u0441\u043d\u0438\u043c\u043e\u043a \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0446\u0435\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u0438 \u043d\u0430 \u0432\u0441\u044f\u043a\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u043d\u0435 \u0443\u0434\u0430\u043b\u044f\u0442\u044c \u0438\u0445 \u043a\u0430\u043a\u043e\u0435-\u0442\u043e \u0432\u0440\u0435\u043c\u044f (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0435\u0434\u0435\u043b\u044e).<\/p>\n<p>  \u0418 \u043d\u0430\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u043a \u0441\u043e\u0432\u0435\u0442. \u0423 MySQL \u0435\u0441\u0442\u044c \u0440\u0435\u0436\u0438\u043c, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u0435\u043b\u044c\u0437\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 DELETE \u0438\u043b\u0438 UPDATE, \u0435\u0441\u043b\u0438 \u0432 \u043d\u0451\u043c \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u0435 WHERE, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u043e \u0437\u0430\u0434\u0430\u0451\u0442\u0441\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442. \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u0435\u0441\u043b\u0438 \u0432\u044b \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u0437\u0430\u0431\u044b\u043b\u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c WHERE, \u0442\u043e \u0432\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u043e\u0448\u0438\u0431\u043a\u0443:  <\/p>\n<blockquote><p>ERROR 1175 (HY000): You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column  <\/p><\/blockquote>\n<p>\u0414\u043b\u044f \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0442\u0430\u043a\u043e\u0433\u043e \u0440\u0435\u0436\u0438\u043c\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043a \u043e\u043f\u0446\u0438\u044f\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u044b mysql, \u043f\u043e \u0432\u043a\u0443\u0441\u0443: <code>\u2011\u2011i\u2011am\u2011a\u2011dummy<\/code> \u0438\u043b\u0438 <code>\u2011\u2011safe\u2011updates<\/code>.<\/p>\n<p>  \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e\u0433\u043e \u044d\u0444\u0444\u0435\u043a\u0442\u0430 \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u0432 \u0444\u0430\u0439\u043b ~\/.my.cnf \u0441\u0442\u0440\u043e\u043a\u0443 <code>safe\u2011updates<\/code> (\u0447\u0442\u043e \u0443\u0434\u043e\u0431\u043d\u043e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u0432\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 mysql \u0432\u043e\u043e\u0431\u0449\u0435 \u0431\u0435\u0437 \u0432\u0441\u044f\u043a\u0438\u0445 \u043e\u043f\u0446\u0438\u0439, \u0438 \u0432\u0441\u0451 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0431\u0435\u0440\u0451\u0442\u0441\u044f \u0438\u0437 ~\/.my.cnf).<\/p>\n<p>  \u041a\u0441\u0442\u0430\u0442\u0438, \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u044d\u0442\u043e\u0442 \u0440\u0435\u0436\u0438\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0435\u0449\u0451 \u043f\u0430\u0440\u0443 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439 (\u043a\u043e\u0442\u043e\u0440\u044b\u0435, \u0432\u043f\u0440\u043e\u0447\u0435\u043c, \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c, \u043d\u043e \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u044d\u0442\u043e \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0440\u0435\u0434\u043a\u043e): \u0434\u043b\u044f select_limit \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 1000, \u0430 \u0434\u043b\u044f max_join_size&nbsp;&mdash;&nbsp;1000000.      \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/218821\/\"> http:\/\/habrahabr.ru\/post\/218821\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t\u042d\u0442\u043e \u043a\u043e\u0440\u043e\u0442\u043a\u043e\u0435 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u043a\u043e\u043c\u0443-\u0442\u043e, \u043a\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 AWS (\u0438, \u0432 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, MySQL \u043d\u0430 \u0438\u043d\u0441\u0442\u0430\u043d\u0441\u0435&nbsp;EC2), \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 MySQL \u0438\u0437 \u0441\u043d\u0438\u043c\u043a\u0430&nbsp;EBS (\u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043b\u044e\u0431\u043e\u0439 \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440, \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435, \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442 \u0437\u0430\u0431\u043b\u0430\u0433\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u2014 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/github.com\/alestic\/ec2-consistent-snapshot\">ec2\u2011consistent\u2011snapshot<\/a>, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440)<\/p>\n<p>  \u041f\u0440\u0435\u0436\u0434\u0435 \u0432\u0441\u0435\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u043a\u0440\u044b\u0442\u044c <a href=\"https:\/\/console.aws.amazon.com\/ec2\/v2\/home\">EC2 Management Console<\/a>, \u0438 \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 ELASTIC BLOCK STORE&nbsp;\u2192&nbsp;Snapshots \u043d\u0430\u0439\u0442\u0438 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u0441\u043d\u0438\u043c\u043e\u043a (\u043e\u0431\u044b\u0447\u043d\u043e \u044d\u0442\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0441\u043d\u0438\u043c\u043e\u043a \u0440\u0430\u0437\u0434\u0435\u043b\u0430).<\/p>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u043d\u0443\u0436\u043d\u043e \u0449\u0451\u043b\u043a\u043d\u0443\u0442\u044c \u043d\u0430 \u0441\u043d\u0438\u043c\u043a\u0435 \u043f\u0440\u0430\u0432\u043e\u0439 \u043a\u043d\u043e\u043f\u043a\u043e\u0439 \u043c\u044b\u0448\u043a\u0438 \u0438 \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u00abCreate Volume\u00bb. \u0412 Availability Zone \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0442\u043e\u0442 \u0436\u0435 \u0440\u0435\u0433\u0438\u043e\u043d, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0438\u043d\u0441\u0442\u0430\u043d\u0441&nbsp;EC2.<\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u0432 \u0440\u0430\u0437\u0434\u0435\u043b ELASTIC BLOCK STORE&nbsp;\u2192&nbsp;Volumes \u0438, \u043e\u043f\u044f\u0442\u044c \u0436\u0435, \u0449\u0451\u043b\u043a\u043d\u0443\u0442\u044c \u043f\u0440\u0430\u0432\u043e\u0439 \u043a\u043d\u043e\u043f\u043a\u043e\u0439 \u043c\u044b\u0448\u043a\u0438 \u043d\u0430 \u043f\u043e\u044f\u0432\u0438\u0432\u0448\u0438\u0439\u0441\u044f \u0440\u0430\u0437\u0434\u0435\u043b. \u0412 \u043c\u0435\u043d\u044e \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043f\u0443\u043d\u043a\u0442 \u00abAttach Volume\u00bb, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0432 \u043f\u043e\u044f\u0432\u0438\u0432\u0448\u0435\u043c\u0441\u044f \u043c\u043e\u0434\u0430\u043b\u044c\u043d\u043e\u043c \u043e\u043a\u043d\u0435 \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0438\u043d\u0441\u0442\u0430\u043d\u0441&nbsp;EC2 \u0438 \u043d\u0430\u0436\u0430\u0442\u044c \u00abYes, Attach\u00bb.<\/p>\n<p>  \u0412\u0441\u0451&nbsp;&mdash;&nbsp;\u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u043f\u043e\u044f\u0432\u0438\u0442\u044c\u0441\u044f \u043d\u043e\u0432\u043e\u0435 \u0431\u043b\u043e\u0447\u043d\u043e\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e. \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c <code>dmesg&nbsp;|&nbsp;tail<\/code> \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043a\u0430\u043a\u043e\u0439 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0431\u044b\u043b \u043f\u0440\u0438\u0441\u0432\u043e\u0435\u043d \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0451\u043d\u043d\u043e\u0433\u043e \u0431\u043b\u043e\u0447\u043d\u043e\u0433\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430. \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u044d\u0442\u043e xvdg. \u0422\u043e\u0433\u0434\u0430 \u0424\u0421 \u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u0442\u044c\u0441\u044f, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0430 \/dev\/xvdg1 (\u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0442\u0435\u043d\u0438\u0439 \u0442\u043e\u0433\u043e, \u043a\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u043b \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0440\u0430\u0437\u0434\u0435\u043b\u043e\u0432).  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-218821","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/218821","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=218821"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/218821\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=218821"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=218821"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=218821"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}