{"id":312197,"date":"2020-10-28T21:00:27","date_gmt":"2020-10-28T21:00:27","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=312197"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=312197","title":{"rendered":"\u042d\u0442\u044e\u0434 \u043f\u043e PITR \u0448\u0442\u0430\u0442\u043d\u044b\u043c\u0438 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 PostgreSQL"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\u0412 \u043a\u043e\u0440\u043e\u0442\u043a\u043e\u0439 \u0437\u0430\u043c\u0435\u0442\u043a\u0435 \u043e\u043f\u0438\u0441\u0430\u043d c\u0446\u0435\u043d\u0430\u0440\u0438\u0439 <b>P<\/b>oint <b>I<\/b>n <b>T<\/b>ime <b>R<\/b>ecovery \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0441\u0440\u0435\u0434\u0441\u0442\u0432 \u0438\u0437 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u043f\u043e\u0441\u0442\u0430\u0432\u043a\u0438 PostgreSQL \u0432\u0435\u0440\u0441\u0438\u0438 11.<br \/>  \u0414\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u043e\u0439 \u043a\u043e\u043f\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0448\u0442\u0430\u0442\u043d\u0430\u044f \u0443\u0442\u0438\u043b\u0438\u0442\u0430 \u2014 <a href=\"https:\/\/postgrespro.ru\/docs\/postgresql\/11\/app-pgbasebackup\" rel=\"nofollow\">pg_basebackeup<\/a>.<br \/>  \u0414\u043b\u044f \u043f\u043e\u0442\u043e\u043a\u043e\u0432\u043e\u0439 \u0430\u0440\u0445\u0438\u0432\u0430\u0446\u0438\u0438 \u0444\u0430\u0439\u043b\u043e\u0432 WAL \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0448\u0442\u0430\u0442\u043d\u0430\u044f \u0443\u0442\u0438\u043b\u0438\u0442\u0430 \u2014 <a href=\"https:\/\/postgrespro.ru\/docs\/postgresql\/11\/app-pgreceivewal\" rel=\"nofollow\">pg_receivewal<\/a><\/p>\n<p>  \u041e\u0431\u0449\u0438\u0439 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u043d \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 <a href=\"https:\/\/postgrespro.ru\/docs\/postgresql\/11\/continuous-archiving\" rel=\"nofollow\">\u041d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u043e\u0435 \u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 (Point-in-Time Recovery, PITR)<\/a>, \u043e\u0434\u043d\u0430\u043a\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043e\u0431\u0449\u0438\u043c\u0438 \u0444\u0440\u0430\u0437\u0430\u043c\u0438. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435, \u0445\u043e\u0442\u044f \u0438 \u0432\u043f\u043e\u043b\u043d\u0435 \u043f\u0440\u0435\u043e\u0434\u043e\u043b\u0438\u043c\u044b\u0435 \u0448\u0435\u0440\u043e\u0445\u043e\u0432\u0430\u0442\u043e\u0441\u0442\u0438.<\/p>\n<p>  \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u043b \u043f\u043e \u043f\u043e\u0438\u0441\u043a\u0443 \u043d\u0430 \u0425\u0430\u0431\u0440\u0435, \u0432\u0440\u043e\u0434\u0435 \u043d\u0435 \u043d\u0430\u0448\u0435\u043b \u0441\u0442\u0430\u0442\u0435\u0439 \u043e PITR \u0448\u0442\u0430\u0442\u043d\u044b\u043c\u0438 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438. \u0422\u0430\u043a, \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043a\u043e\u043c\u0443 \u0442\u043e \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f, \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u0430-\u0440\u044b\u0431\u044b.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u2014 \u0441\u0430\u043c\u0430\u044f \u043f\u0440\u043e\u0441\u0442\u0430\u044f, \u043e\u0434\u0438\u043d \u0441\u0435\u0440\u0432\u0435\u0440 RedHat Linux, \u043e\u0434\u0438\u043d \u0441\u0435\u0440\u0432\u0438\u0441 PostgreSQL(<b>pgdata<\/b>=\/postgres\/pgdata, <b>waldir<\/b>=\/postgres\/waldir), <b>pg_receivewal<\/b> \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u0438\u043c\u0435\u043d\u0438 <b>postgres<\/b>, \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043d\u0435 \u0443\u0442\u043e\u0447\u043d\u044f\u0435\u0442\u0441\u044f \u0438 \u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e \u043d\u0430 \u043b\u0438\u0447\u043d\u043ee \u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u0435.<\/p>\n<h2>\u041f\u043e\u0440\u044f\u0434\u043e\u043a \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u043f\u043e \u043f\u0443\u043d\u043a\u0442\u0430\u043c<\/h2>\n<p>  <\/p>\n<h3>1. \u0421\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0430\u043f\u043a\u0438 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442\u044b <\/h3>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0430\u043f\u043a\u0438.<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"bash\">mkdir -p \/postgres\/wal_arc chown postgres:postgres \/postgres\/wal_arc  mkdir -p \/postgres\/backup chown postgres:postgres \/postgres\/backups  mkdir -p \/postgres\/scripts chown postgres:postgres \/postgres\/scripts<\/code><\/pre>\n<\/div><\/div>\n<p>  C\u043a\u0440\u0438\u043f\u0442\u044b \u0432 \u043f\u0430\u043f\u043a\u0435 <b>\/postgres\/scripts<\/b>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">pg_receivewal.sh<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"bash\">#!\/bin\/bash # pg_receivewal.sh # \/postgres\/scripts\/ pg_receivewal --no-loop --synchronous --slot=slot_receivewal --directory=\/postgres\/wal_arc --verbose --host=localhost &gt; \/postgres\/scripts\/pg_receivewal.log 2&gt;&amp;1<\/code><\/pre>\n<\/div><\/div>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">rename.sh<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"bash\">#!\/bin\/bash # rename.sh # \/postgres\/scripts\/ for f in \/postgres\/wal_arc\/*.partial; do   mv -- &quot;$f&quot; &quot;${f%.partial}&quot; done exit 0<\/code><\/pre>\n<\/div><\/div>\n<p>  <\/p>\n<h3>2. \u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u043e\u0435 \u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 WAL-\u0444\u0430\u0439\u043b\u043e\u0432<\/h3>\n<p>\u041d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0444\u0430\u0439\u043b .pgpass, \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 <b>pg_receivewal <\/b>\u0431\u0435\u0437 \u043f\u0430\u0440\u043e\u043b\u044f:  <\/p>\n<pre><code class=\"bash\">vi ~\/.pgpass     localhost:5432:*:postgres:postgres chmod 0600 ~\/.pgpass<\/code><\/pre>\n<p>  \u041d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441 \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 <b>pg_receivewal<\/b>.\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c <b>root<\/b>.  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">pg_receivewal.service<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"bash\">########################################################## # \/etc\/systemd\/system\/ # pg_receivewal.service [Unit] Description=Receiving for WAL stream [Service] Type=simple WorkingDirectory=\/postgres\/scripts User=postgres Group=postgres ExecStart=\/postgres\/scripts\/pg_receivewal.sh [Install] WantedBy=multi-user.target<\/code><\/pre>\n<\/div><\/div>\n<p>  \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0441\u0435\u0440\u0432\u0438\u0441.\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c <b>root<\/b>  <\/p>\n<pre><code class=\"bash\">systemctl daemon-reload systemctl start pg_receivewal.service<\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c.\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c <b>root<\/b>.  <\/p>\n<pre><code class=\"bash\">systemctl status pg_receivewal.service<\/code><\/pre>\n<p>  \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0433\u043e \u0441\u0442\u0430\u0440\u0442\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043e\u0442\u0432\u0435\u0442   <\/p>\n<pre><code class=\"bash\">\u25cf pg_receivewal.service - Receiving for WAL stream    Loaded: loaded (\/etc\/systemd\/system\/pg_receivewal.service; disabled; vendor preset: disabled)    Active: active (running) since...<\/code><\/pre>\n<p>  <\/p>\n<h3>3. \u0417\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 <\/h3>\n<p>\u041b\u044e\u0431\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c, \u043d\u0430 \u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u0435 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044f.<\/p>\n<h3>4. \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u043e\u0439 \u043a\u043e\u043f\u0438\u0438. <\/h3>\n<p>\u0412\u0441\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e \u0438 \u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u043e:  <\/p>\n<pre><code class=\"bash\">pg_basebackup  -D \/postgres\/backups\/ --format=tar -Xs --progress --verbose<\/code><\/pre>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043e\u0442\u0432\u0435\u0442 \u043e \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438:  <\/p>\n<pre><code class=\"bash\">pg_basebackup: initiating base backup, waiting for checkpoint to complete pg_basebackup: checkpoint completed \u2026 pg_basebackup: base backup completed<\/code><\/pre>\n<p>  <\/p>\n<h3>5. \u0418\u043c\u0438\u0442\u0438\u0440\u0443\u0435\u043c \u043a\u0430\u0442\u0430\u0441\u0442\u0440\u043e\u0444\u0443 \u0411\u0414<\/h3>\n<p>\u041e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u0435\u0440\u0432\u0435\u0440 PostgreSQL \u043b\u044e\u0431\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c.<br \/>  \u0423\u0434\u0430\u043b\u0438\u0442\u044c \u043f\u0430\u043f\u043a\u0438 \u0444\u0430\u0439\u043b\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 WAL:<\/p>\n<pre><code class=\"bash\">rm -rf \/postgres\/pgdata rm -rf \/postgres\/waldir<\/code><\/pre>\n<p>  <\/p>\n<h3>6. \u0412\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0411\u0414<\/h3>\n<p>\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0430\u043f\u043a\u0438 \u0444\u0430\u0439\u043b\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 WAL:<\/p>\n<pre><code class=\"bash\">mkdir \/postgres\/pgdata chown postgres:postgres \/postgres\/pgdata chmod 750 \/postgres\/pgdata   mkdir \/postgres\/waldir chown postgres:postgres \/postgres\/waldir chmod 750 \/postgres\/waldir<\/code><\/pre>\n<p>  \u0412\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0444\u0430\u0439\u043b\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u043e\u0439 \u043a\u043e\u043f\u0438\u0438:<\/p>\n<pre><code class=\"bash\">cd \/postgres\/backups  cp base.tar \/postgres\/pgdata  cd \/postgres\/pgdata  tar -xvf base.tar  rm base.tar   rm -r pg_wal  ln -s \/postgres\/waldir pg_wal<\/code><\/pre>\n<p>  \u0412 \u043f\u0430\u043f\u043a\u0435 <b>\/postgres\/wal_arc<\/b> \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u043d\u0435\u043f\u043e\u043b\u043d\u044b\u0439 \u0444\u0430\u0439\u043b WAL(\u0441 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435\u043c partial), \u043d\u0443\u0436\u043d\u043e \u0435\u0433\u043e \u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u0442\u044c, \u043d\u0430 \u0441\u043b\u0443\u0447\u0430\u0439 \u0435\u0441\u043b\u0438 \u0442\u043e\u0447\u043a\u0430 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043e\u043a\u0430\u0436\u0435\u0442\u0441\u044f \u0432 \u043d\u0435\u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435 WAL. \u041f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u0442\u044c \u0444\u0430\u0439\u043b \u2014 \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u0438\u043b\u0438 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u043c <b>rename.sh<\/b>:<\/p>\n<pre><code class=\"bash\">\/postgres\/scripts\/rename.sh<\/code><\/pre>\n<p>  \u0414\u043b\u044f \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u0430 \u0437\u0430\u0434\u0430\u043d\u043d\u0443\u044e \u0442\u043e\u0447\u043a\u0443 \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u0444\u0430\u0439\u043b <b>recovery.conf<\/b>:<\/p>\n<pre><code class=\"bash\">restore_command = 'cp \/postgres\/wal_arc\/%f  %p' recovery_target_time = '*****' recovery_target_action=promote<\/code><\/pre>\n<p>  <b>recovery_target_time<\/b> \u0437\u0430\u0434\u0430\u0435\u0442\u0441\u044f \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u0430\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0442\u043e\u0447\u043a\u0430 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 <b>timestamp<\/b>.<\/p>\n<p>  \u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441 PostgreSQL \u043b\u044e\u0431\u044b\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c.<\/p>\n<p>  \u0424\u0430\u0439\u043b <b>recovery.conf <\/b>\u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d \u0432 <b>recovery.done<\/b> ?<\/p>\n<pre><code class=\"bash\">cd \/postgres\/pgdata ls -la recovery.done<\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u0444\u0430\u0439\u043b \u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d-\u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0448\u043b\u043e \u0443\u0441\u043f\u0435\u0448\u043d\u043e.<\/p>\n<p>  \u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u043b\u043e\u0433 \u0444\u0430\u0439\u043b \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0441\u0442\u0440\u043e\u043a\u0438:<\/p>\n<pre><code class=\"bash\">starting point-in-time recovery to ... database system is ready to accept connections <\/code><\/pre>\n<p>  \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0433\u043e \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043f\u043e\u0442\u043e\u043a\u043e\u0432\u0443\u044e \u0430\u0440\u0445\u0438\u0432\u0430\u0446\u0438\u044e \u0444\u0430\u0439\u043b\u043e\u0432 WAL:<\/p>\n<pre><code class=\"bash\">pg_receivewal --create-slot --slot=slot_receivewal --verbose<\/code><\/pre>\n<p>\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c <b>root<\/b><\/p>\n<pre><code class=\"bash\">systemctl start pg_receivewal.service<\/code><\/pre>\n<h2>\u0418\u0442\u043e\u0433:<\/h2>\n<p>  \u0412 \u0441\u0430\u043c\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u043c \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0438, \u0411\u0430\u0437\u0430 \u0414\u0430\u043d\u043d\u044b\u0445 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0430 \u043d\u0430 \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u0443\u044e \u0442\u043e\u0447\u043a\u0443 \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438.<\/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=\"https:\/\/habr.com\/ru\/post\/525308\/\"> https:\/\/habr.com\/ru\/post\/525308\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\u0412 \u043a\u043e\u0440\u043e\u0442\u043a\u043e\u0439 \u0437\u0430\u043c\u0435\u0442\u043a\u0435 \u043e\u043f\u0438\u0441\u0430\u043d c\u0446\u0435\u043d\u0430\u0440\u0438\u0439 <b>P<\/b>oint <b>I<\/b>n <b>T<\/b>ime <b>R<\/b>ecovery \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0441\u0440\u0435\u0434\u0441\u0442\u0432 \u0438\u0437 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u043f\u043e\u0441\u0442\u0430\u0432\u043a\u0438 PostgreSQL \u0432\u0435\u0440\u0441\u0438\u0438 11.<br \/>  \u0414\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u043e\u0439 \u043a\u043e\u043f\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0448\u0442\u0430\u0442\u043d\u0430\u044f \u0443\u0442\u0438\u043b\u0438\u0442\u0430 \u2014 <a href=\"https:\/\/postgrespro.ru\/docs\/postgresql\/11\/app-pgbasebackup\" rel=\"nofollow\">pg_basebackeup<\/a>.<br \/>  \u0414\u043b\u044f \u043f\u043e\u0442\u043e\u043a\u043e\u0432\u043e\u0439 \u0430\u0440\u0445\u0438\u0432\u0430\u0446\u0438\u0438 \u0444\u0430\u0439\u043b\u043e\u0432 WAL \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0448\u0442\u0430\u0442\u043d\u0430\u044f \u0443\u0442\u0438\u043b\u0438\u0442\u0430 \u2014 <a href=\"https:\/\/postgrespro.ru\/docs\/postgresql\/11\/app-pgreceivewal\" rel=\"nofollow\">pg_receivewal<\/a><\/p>\n<p>  \u041e\u0431\u0449\u0438\u0439 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u043d \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 <a href=\"https:\/\/postgrespro.ru\/docs\/postgresql\/11\/continuous-archiving\" rel=\"nofollow\">\u041d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u043e\u0435 \u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 (Point-in-Time Recovery, PITR)<\/a>, \u043e\u0434\u043d\u0430\u043a\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043e\u0431\u0449\u0438\u043c\u0438 \u0444\u0440\u0430\u0437\u0430\u043c\u0438. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435, \u0445\u043e\u0442\u044f \u0438 \u0432\u043f\u043e\u043b\u043d\u0435 \u043f\u0440\u0435\u043e\u0434\u043e\u043b\u0438\u043c\u044b\u0435 \u0448\u0435\u0440\u043e\u0445\u043e\u0432\u0430\u0442\u043e\u0441\u0442\u0438.<\/p>\n<p>  \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u043b \u043f\u043e \u043f\u043e\u0438\u0441\u043a\u0443 \u043d\u0430 \u0425\u0430\u0431\u0440\u0435, \u0432\u0440\u043e\u0434\u0435 \u043d\u0435 \u043d\u0430\u0448\u0435\u043b \u0441\u0442\u0430\u0442\u0435\u0439 \u043e PITR \u0448\u0442\u0430\u0442\u043d\u044b\u043c\u0438 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438. \u0422\u0430\u043a, \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043a\u043e\u043c\u0443 \u0442\u043e \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f, \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u0430-\u0440\u044b\u0431\u044b.  <\/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-312197","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/312197","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=312197"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/312197\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=312197"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=312197"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=312197"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}