{"id":245847,"date":"2014-12-15T18:55:02","date_gmt":"2014-12-15T14:55:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=245847"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=245847","title":{"rendered":"<span class=\"post_title\">Replication slots \u0432 PostgreSQL<\/span>"},"content":{"rendered":"<div class=\"content html_format\"> \t\t\t\u0414\u043e \u0434\u0435\u0432\u044f\u0442\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0432 PostgreSQL \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u00ab\u0442\u0435\u043f\u043b\u043e\u0433\u043e\u00bb \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f WAL archiving. \u0412 \u0432\u0435\u0440\u0441\u0438\u0438 9.0 \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u043f\u043e\u0442\u043e\u043a\u043e\u0432\u0430\u044f \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u044f \u0441 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u044e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u00ab\u0433\u043e\u0440\u044f\u0447\u0435\u0433\u043e\u00bb read-only \u0441\u0435\u0440\u0432\u0435\u0440\u0430. \u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 PostgreSQL 9.4 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u043d\u043e\u0432\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u043e\u0442\u043e\u043a\u043e\u0432\u043e\u0439 \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c replication slots.<a name=\"habracut\"><\/a> \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0447\u0442\u043e \u043e\u043d \u0441\u043e\u0431\u043e\u0439 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0438 \u0447\u0435\u043c \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432. <br \/>  \u041d\u0430 \u0441\u0435\u0433\u043e\u0434\u043d\u044f\u0448\u043d\u0438\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043f\u0435\u0440\u0432\u044b\u0439 \u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442 \u0432 \u0440\u0435\u043b\u0438\u0437\u044b. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u0441\u0442\u0435\u043d\u0434\u0430 \u0432\u044b\u0431\u0440\u0430\u043d\u044b 2 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u043a\u0438 \u043f\u043e\u0434 Ubuntu 14.04. \u041f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u0431\u043e\u0440\u043a\u0438 \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432 \u0434\u043b\u044f \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e \u0438 \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432. \u0421\u0442\u0430\u0432\u0438\u043c \u0438\u0437 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u043e\u0432, \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0432 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043f\u0430\u043a\u0435\u0442\u044b: <\/p>\n<pre><code class=\"bash\">sudo apt-get update && sudo apt-get -y install make g++ checkinstall libreadline6-dev zlib1g-dev  <\/code><\/pre>\n<p>  \u0421\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u0438 \u0440\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u044b\u0432\u0430\u0435\u043c \u0430\u0440\u0445\u0438\u0432 \u0438\u0437 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f:<\/p>\n<pre><code class=\"bash\">wget https:\/\/ftp.postgresql.org\/pub\/source\/v9.4rc1\/postgresql-9.4rc1.tar.gz  tar xzf postgresql-9.4rc1.tar.gz  <\/code><\/pre>\n<p>  \u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043f\u0430\u043a\u0435\u0442:<\/p>\n<pre><code class=\"bash\">cd postgresql-9.4rc1\/  .\/configure  make  sudo checkinstall  <\/code><\/pre>\n<p>  \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0431\u0438\u043d\u0430\u0440\u043d\u0438\u043a\u0438 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0421\u0423\u0411\u0414 \u0441\u0442\u0430\u0432\u044f\u0442\u0441\u044f \u0432 \/usr\/local\/pgsql\/.<br \/>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f postgres \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0443:<\/p>\n<pre><code class=\"bash\">sudo useradd -M postgres  <\/code><\/pre>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u0434\u043b\u044f \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430:<\/p>\n<pre><code class=\"bash\">sudo mkdir -p \/data\/db  sudo chown postgres:postgres \/data\/db  sudo chmod 0700 \/data\/db  <\/code><\/pre>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u0435. \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043a\u043b\u0430\u0441\u0442\u0435\u0440:<\/p>\n<pre><code class=\"bash\">sudo -u postgres \/usr\/local\/pgsql\/bin\/initdb -D \/data\/db <\/code><\/pre>\n<p>  \u041a\u0440\u043e\u043c\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430, initdb \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0438. \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e pg_log, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0443\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u043b\u043e\u0433\u0438:<\/p>\n<pre><code class=\"bash\">sudo -u postgres mkdir \/data\/db\/pg_log  sudo -u postgres chmod 0700 \/data\/db\/pg_log  <\/code><\/pre>\n<p>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 pg_hba.conf \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0438 \u0447\u0442\u043e\u0431\u044b \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 \u043c\u043e\u0433 \u0437\u0430\u0431\u0438\u0440\u0430\u0442\u044c WAL-\u043b\u043e\u0433\u0438 \u0441 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e:<\/p>\n<pre><code class=\"bash\">host    all\t                    all\t                  192.168.1.0\/24              md5  host    replication         replica           192.168.1.108\/32          md5  <\/code><\/pre>\n<p>  \u0412 \u043a\u043e\u043d\u0444\u0438\u0433\u0435 postgresql.conf \u043f\u0440\u0430\u0432\u0438\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b: <br \/>  listen_addresses = &#8216;*&#8217; \u2014 \u0441\u043b\u0443\u0448\u0430\u0442\u044c \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u043d\u0430 \u0432\u0441\u0435\u0445 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430\u0445 <br \/>  wal_level = hot_standby \u2014 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 WAL-\u043b\u043e\u0433\u043e\u0432 \u0434\u043b\u044f \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u0438 <br \/>  max_wal_senders = 2 \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u0438 <br \/>  logging_collector = on \u2014 \u043b\u043e\u0433\u0438 \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u043c \u0432 pg_log<\/p>\n<p>  \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043d\u0430\u0448 \u043a\u043b\u0430\u0441\u0442\u0435\u0440:<\/p>\n<pre><code class=\"bash\">sudo -u postgres \/usr\/local\/pgsql\/bin\/pg_ctl -D \/data\/db start <\/code><\/pre>\n<p>  \u0421\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432:<\/p>\n<pre><code class=\"cs\">ps aux | grep postgres  postgres 21295  0.0  0.0  23700   604 ?        Ss   13:39   0:00 postgres: logger process                  postgres 21297  0.0 13.6 170880 138408 ?  Ss   13:39   0:01 postgres: checkpointer process            postgres 21298  0.0  5.0 170784 51076 ?     Ss   13:39   0:00 postgres: writer process                  postgres 21299  0.0  0.5 170648  5148?       Ss   13:39   0:00 postgres: wal writer process              postgres 21300  0.0  0.1 171052  1836 ?      Ss   13:39   0:00 postgres: autovacuum launcher process     postgres 21301  0.2  0.1  25924  1060 ?        Ss   13:39   0:17 postgres: stats collector process <\/code><\/pre>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f replica \u0441 \u043f\u0440\u0430\u0432\u0430\u043c\u0438 \u043d\u0430 \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u044e:<\/p>\n<pre><code class=\"bash\">\/usr\/local\/pgsql\/bin\/psql -U postgres -c &quot;create user replica with replication encrypted password '123'&quot;  <\/code><\/pre>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0442\u0435\u0441\u0442\u043e\u0432\u0443\u044e \u0431\u0430\u0437\u0443 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438:<\/p>\n<pre><code class=\"bash\">\/usr\/local\/pgsql\/bin\/createdb -U postgres testdb  \/usr\/local\/pgsql\/bin\/psql -U postgres -d testdb -c &quot;create table testtable (id serial, data text)&quot;  \/usr\/local\/pgsql\/bin\/psql -U postgres -d testdb -c &quot;insert into testtable select nextval('testtable_id_seq'::regclass), md5(generate_series(1,1000000)::text)&quot; <\/code><\/pre>\n<p>  \u041d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440. <br \/>  \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u0434\u043b\u044f \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430:<\/p>\n<pre><code class=\"bash\">sudo mkdir -p \/data\/db  sudo chmod 0700 \/data\/db  sudo chown postgres:postgres \/data\/db <\/code><\/pre>\n<p>  \u041f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0443\u0442\u0438\u043b\u0438\u0442\u044b pg_basebackup \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u0443\u044e \u043a\u043e\u043f\u0438\u044e \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430:<\/p>\n<pre><code class=\"bash\">sudo -u postgres \/usr\/local\/pgsql\/bin\/pg_basebackup -h 192.168.1.103 -U replica -D \/data\/db -X s  <\/code><\/pre>\n<p>  pg_basebackup \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u0442 \u0432\u0441\u0451 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 hot_standby \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 on \u0432 postgresql.conf <br \/>  \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0430\u0439\u043b recovery.conf \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0443\u043a\u0430\u0436\u0435\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c\u0443 \u0441\u0435\u0440\u0432\u0435\u0440\u0443:<\/p>\n<pre><code class=\"bash\">standby_mode='on'  primary_conninfo='host=192.168.1.103 port=5432 user=replica password=123'  <\/code><\/pre>\n<p>  \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043a\u043b\u0430\u0441\u0442\u0435\u0440 \u043d\u0430 \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u043e\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u0435:<\/p>\n<pre><code class=\"bash\">sudo -u postgres \/usr\/local\/pgsql\/bin\/pg_ctl -D \/data\/db start <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c\u0441\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441 wal_sender, \u0430 \u043d\u0430 \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u043e\u043c wal_receiver:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u043a\u0440\u044b\u0442\u044b\u0439 \u0442\u0435\u043a\u0441\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"bash\">postgres 21295  0.0  0.0  23700   604 ?        Ss   13:39   0:00 postgres: logger process                  postgres 21297  0.0  0.2 170756  2312 ?      Ss   13:39   0:00 postgres: checkpointer process            postgres 21298  0.0  0.2 170784  2252 ?      Ss   13:39   0:00 postgres: writer process                  postgres 21299  0.0  0.5 170648  5148 ?      Ss   13:39   0:00 postgres: wal writer process              postgres 21300  0.0  0.1 171052  1804 ?      Ss   13:39   0:00 postgres: autovacuum launcher process     postgres 21301  0.0  0.1  25924  1060 ?       Ss   13:39   0:00 postgres: stats collector process           postgres 21323  0.0  0.2 171048  2108 ?      Ss   13:46   0:00 postgres: wal sender process replica 192.168.1.108(56673) streaming 0\/4E000210   postgres 15150  0.0  0.0  23700   612 ?       Ss   13:46   0:00 postgres: logger process                  postgres 15151  0.0  0.1 170788  1496 ?     Ss   13:46   0:00 postgres: startup process   recovering 00000001000000000000004E  postgres 15152  0.0  0.0 170680   944 ?       Ss   13:46   0:00 postgres: checkpointer process            postgres 15153  0.0  0.1 170680  1204 ?      Ss   13:46   0:00 postgres: writer process                  postgres 15154  0.0  0.0  25792   648 ?        Ss   13:46   0:00 postgres: stats collector process         postgres 15155  0.6  0.1 174956  1660 ?      Ss   13:46   0:00 postgres: wal receiver process   streaming 0\/4E000138 <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 pg_stat_replication \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u0435 <\/p>\n<pre><code class=\"sql\">testdb=# select * from pg_stat_replication;  -[ RECORD 1 ]----+------------------------------  pid              | 21987  usesysid         | 16384  usename          | replica  application_name | walreceiver  client_addr      | 192.168.1.108  client_hostname  |  client_port      | 56674  backend_start    | 2014-11-25 18:30:09.206434+03  backend_xmin     |  state            | streaming  sent_location    | 0\/5A2D8E60  write_location   | 0\/5A2D8E60  flush_location   | 0\/5A2D8E60  replay_location  | 0\/5A2D8E60  sync_priority    | 0  sync_state       | async  <\/code><\/pre>\n<p>  \u0412\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0438 \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b. \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u043c \u0435\u0449\u0435 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u0438. <\/p>\n<pre><code class=\"sql\">testdb=# insert into testtable select nextval('testtable_id_seq'::regclass), md5(generate_series(1,1000000)::text);  INSERT 0 1000000  testdb=# select * from pg_stat_replication;  -[ RECORD 1 ]----+------------------------------  pid              | 21987  usesysid         | 16384  usename          | replica  application_name | walreceiver  client_addr      | 192.168.1.108  client_hostname  |  client_port      | 56674  backend_start    | 2014-11-25 18:30:09.206434+03  backend_xmin     |  state            | streaming  sent_location    | 0\/63800000  write_location   | 0\/63680000  flush_location   | 0\/63680000  replay_location  | 0\/6136E160  sync_priority    | 0  sync_state       | async <\/code><\/pre>\n<p>  \u0417\u0434\u0435\u0441\u044c \u043c\u044b \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u043c, \u0447\u0442\u043e \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 \u0437\u0430\u0431\u0440\u0430\u043b \u0441 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e \u0432\u0441\u0435 WAL-\u043b\u043e\u0433\u0438, \u043d\u043e \u0435\u0449\u0435 \u043d\u0435 \u0443\u0441\u043f\u0435\u043b \u0438\u0445 \u0432\u0441\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u043d \u043e\u0442\u0441\u0442\u0430\u0435\u0442 \u043e\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u0432 postgres \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 WAL-\u043b\u043e\u0433\u043e\u0432, \u044d\u0442\u043e \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0432 16\u041c\u0431, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 pg_xlog. \u0418\u0445 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043c\u043e\u0436\u043d\u043e \u043c\u0435\u043d\u044f\u0442\u044c \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 checkpoint_segments \u0438 wal_keep_segments. \u041a\u043e\u0433\u0434\u0430 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435 \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0435\u0442 \u043e\u0431\u0449\u0438\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 WAL-\u043b\u043e\u0433\u043e\u0432, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441 checkpointer, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442 WAL-\u043b\u043e\u0433\u0438 \u0432 \u0434\u0430\u0442\u0430-\u0444\u0430\u0439\u043b\u044b. \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e WAL-\u043b\u043e\u0433\u0438 \u043f\u0435\u0440\u0435\u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u0437\u0430\u043d\u043e\u0432\u043e. \u0412 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 postgres \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 \u043d\u0435 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0435\u0441\u043b\u0438 \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u044b\u0439 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u00ab\u043e\u0442\u0441\u0442\u0430\u043b\u00bb \u043e\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e, \u0442\u043e \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c WAL-\u043b\u043e\u0433\u0438 \u043f\u0435\u0440\u0435\u0441\u043e\u0437\u0434\u0430\u0434\u0443\u0442\u0441\u044f \u0434\u043e \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0438\u0445 \u0437\u0430\u0431\u0435\u0440\u0435\u0442 \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u044b\u0439. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0441\u043c\u043e\u0434\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u0443 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e.<br \/>  \u0412\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0437\u0430\u043f\u0440\u0435\u0442\u0438\u043c \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u043e\u043c\u0443 \u0441\u0435\u0440\u0432\u0435\u0440\u0443 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u043f\u043e\u0440\u0442 5432:<\/p>\n<pre><code class=\"bash\">sudo iptables -A OUTPUT -m tcp -p tcp \u2014dport 5432 -j DROP <\/code><\/pre>\n<p>  \u0421\u0433\u0435\u043d\u0435\u0440\u0438\u043c \u0435\u0449\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u0435:<\/p>\n<pre><code class=\"sql\">testdb=# insert into testtable select nextval('testtable_id_seq'::regclass), md5(generate_series(1,1000000)::text);  INSERT 0 1000000 <\/code><\/pre>\n<p>  \u0421\u0431\u0440\u043e\u0441\u0438\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u043e iptables \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043b\u043e\u0433\u0438 \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u043c \u0442\u0430\u043a\u0443\u044e \u043d\u0435\u043f\u0440\u0438\u044f\u0442\u043d\u0443\u044e \u043a\u0430\u0440\u0442\u0438\u043d\u0443.<\/p>\n<pre><code class=\"bash\">LOG:  started streaming WAL from primary at 0\/78000000 on timeline 1  FATAL:  could not receive data from WAL stream: ERROR:  requested WAL segment 000000010000000000000078 has already been removed <\/code><\/pre>\n<p>  \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 \u0443\u0434\u0430\u043b\u0438\u043b WAL-\u043b\u043e\u0433\u0438 \u0434\u043e \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0438\u0445 \u0443\u0441\u043f\u0435\u043b \u0437\u0430\u0431\u0440\u0430\u0442\u044c \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u044b\u0439. \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0437\u0430\u043d\u043e\u0432\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u0443\u044e \u043a\u043e\u043f\u0438\u044e \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430. \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 \u043d\u0435 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u043e\u0433\u043e. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u0441\u0435\u0442\u044c\u044e \u0438\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u044b\u0439 \u043a\u0430\u043d\u0430\u043b \u043c\u0435\u0436\u0434\u0443 \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u043c\u0438, \u0442\u043e \u043f\u0440\u0438 \u0438\u043d\u0442\u0435\u043d\u0441\u0438\u0432\u043d\u043e\u0439 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435 \u0438\/\u0438\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u0435, \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0440\u0438\u0441\u043a \u043f\u043e\u043b\u043e\u043c\u043a\u0438 \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u0438. \u0427\u0430\u0441\u0442\u0438\u0447\u043d\u044b\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 <a href=\"http:\/\/www.postgresql.org\/docs\/9.4\/static\/runtime-config-replication.html#RUNTIME-CONFIG-REPLICATION-SENDER\">wal_keep_segments<\/a>, \u0438 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 <a href=\"http:\/\/www.postgresql.org\/docs\/9.4\/static\/continuous-archiving.html#BACKUP-ARCHIVING-WAL\">WAL archiving<\/a>. \u041d\u043e \u0432 \u0432\u0435\u0440\u0441\u0438\u0438 9.4 \u043f\u043e\u044f\u0432\u044f\u0442\u0441\u044f replication slots. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442:<br \/>  \u041d\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0441\u043b\u043e\u0442:<\/p>\n<pre><code class=\"sql\">testdb=# SELECT pg_create_physical_replication_slot('standby_slot');  -[ RECORD 1 ]-----------------------+----------------  pg_create_physical_replication_slot | (standby_slot,)  <\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"sql\">testdb=# select * from pg_replication_slots;  -[ RECORD 1 ]+-------------  slot_name    | standby_slot  plugin       |  slot_type    | physical  datoid       |  database     |  active       | f  xmin         |  catalog_xmin |  restart_lsn  |  <\/code><\/pre>\n<p>  \u041d\u0430 \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u043e\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043a \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u043c\u0443 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u043c\u0443 \u0444\u0430\u0439\u043b\u0430 recovery.conf \u0441\u0442\u0440\u043e\u043a\u0443<br \/>  primary_slot_name = &#8216;standby_slot&#8217;<\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0441\u043d\u043e\u0432\u0430 \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u043c \u0435\u0433\u043e \u043e\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e \u0438 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u043c \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u044e\u0442 \u043e\u0431\u044a\u0435\u043c WAL-\u043b\u043e\u0433\u043e\u0432:<\/p>\n<pre><code class=\"sql\">testdb=# insert into testtable select nextval('testtable_id_seq'::regclass), md5(generate_series(1,10000000)::text);  <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b WAL-\u043b\u043e\u0433\u043e\u0432 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435, \u0430 \u043f\u043e\u0442\u043e\u043c \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0436\u0443\u0440\u043d\u0430\u043b\u044c\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 pg_xlog:<\/p>\n<pre><code class=\"sql\">testdb=# show checkpoint_segments;  -[ RECORD 1 ]-------+--  checkpoint_segments | 3  <\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"sql\">testdb=# show wal_keep_segments;  -[ RECORD 1 ]-----+--  wal_keep_segments | 0  <\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"sql\">testdb=#\\! ls \/data\/db\/pg_xlog | wc -l  50 <\/code><\/pre>\n<p>  \u0414\u043b\u044f \u0440\u0430\u0441\u0447\u0435\u0442\u0430 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 WAL-\u0444\u0430\u0439\u043b\u043e\u0432 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 <a href=\"http:\/\/www.postgresql.org\/docs\/9.4\/static\/wal-configuration.html\">\u0444\u043e\u0440\u043c\u0443\u043b\u0443<\/a>: (2 + checkpoint_completion_target) * checkpoint_segments + 1.<br \/>  \u041e\u0434\u043d\u0430\u043a\u043e \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e WAL-\u043b\u043e\u0433\u043e\u0432 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u044b\u0448\u0435. \u0420\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0441\u043b\u043e\u0442\u044b \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435 \u0441\u043a\u0430\u0447\u0435\u043d\u043d\u044b\u0445 WAL-\u043b\u043e\u0433\u043e\u0432 \u043a\u0430\u0436\u0434\u044b\u043c \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u044b\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c. \u0422\u0435\u043f\u0435\u0440\u044c WAL-\u043b\u043e\u0433\u0438 \u0431\u0443\u0434\u0443\u0442 \u043a\u043e\u043f\u0438\u0442\u044c\u0441\u044f \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 \u043d\u0435 \u0437\u0430\u0431\u0435\u0440\u0435\u0442 \u0438\u0445 \u0438\u043b\u0438 \u043f\u043e\u043a\u0430 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0443\u0434\u0430\u043b\u0435\u043d \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0441\u043b\u043e\u0442. \u041f\u043e \u043c\u0435\u0440\u0435 \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u044f WAL-\u043b\u043e\u0433\u043e\u0432, \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044f pg_xlog \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0431\u0443\u0434\u0435\u0442 \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0442\u044c\u0441\u044f. \u0421\u0431\u0440\u043e\u0441\u0438\u0432 \u043f\u0440\u0430\u0432\u0438\u043b\u043e iptables \u043d\u0430 \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u043e\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u0435, \u0432 \u043b\u043e\u0433\u0430\u0445 \u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u044f \u0432\u043e\u0437\u043e\u0431\u043d\u043e\u0432\u0438\u043b\u0430\u0441\u044c.<\/p>\n<pre><code class=\"sql\">testdb=#\\! tail -f \/data\/db\/pg_log\/postgresql-2014-11-27_191036.log  Is the server running on host &quot;192.168.1.103&quot; and accepting TCP\/IP connections on port 5432? \t  LOG:  started streaming WAL from primary at 0\/A0000000 on timeline 1 <\/code><\/pre>\n<p>  Replication slots \u044d\u0442\u043e \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442, \u043f\u043e\u0432\u044b\u0448\u0430\u044e\u0449\u0438\u0439 \u043d\u0430\u0434\u0435\u0436\u043d\u043e\u0441\u0442\u044c \u0438 \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u043e \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u0432 PostgreSQL.<\/p>\n<p>  \u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 replication slots \u043d\u0430 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u0430\u0439\u0442\u0435 PostgreSQL: <a href=\"http:\/\/www.postgresql.org\/docs\/9.4\/static\/warm-standby.html#STREAMING-REPLICATION-SLOTS\">www.postgresql.org\/docs\/9.4\/static\/warm-standby.html#STREAMING-REPLICATION-SLOTS<\/a> \t\t\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\/245847\/\"> http:\/\/habrahabr.ru\/post\/245847\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\"> \t\t\t\u0414\u043e \u0434\u0435\u0432\u044f\u0442\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0432 PostgreSQL \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u00ab\u0442\u0435\u043f\u043b\u043e\u0433\u043e\u00bb \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f WAL archiving. \u0412 \u0432\u0435\u0440\u0441\u0438\u0438 9.0 \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u043f\u043e\u0442\u043e\u043a\u043e\u0432\u0430\u044f \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u044f \u0441 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u044e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u00ab\u0433\u043e\u0440\u044f\u0447\u0435\u0433\u043e\u00bb read-only \u0441\u0435\u0440\u0432\u0435\u0440\u0430. \u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 PostgreSQL 9.4 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u043d\u043e\u0432\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u043e\u0442\u043e\u043a\u043e\u0432\u043e\u0439 \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c replication slots.<\/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-245847","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/245847","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=245847"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/245847\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=245847"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=245847"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=245847"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}