{"id":226481,"date":"2014-06-17T11:04:03","date_gmt":"2014-06-17T07:04:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=226481"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=226481","title":{"rendered":"<span class=\"post_title\">\u0412\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 Postgreql \u0438\u0437 WAL-\u0431\u044d\u043a\u0430\u043f\u0430 \u0441 \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u043e\u043c \u0447\u0430\u0441\u0442\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439<\/span>"},"content":{"rendered":"<div class=\"content html_format\">\n<h4>\u0412\u0432\u043e\u0434\u043d\u0430\u044f<\/h4>\n<p>  \u0412 \u0421\u0423\u0411\u0414 Postgres \u0435\u0441\u0442\u044c \u0442\u0430\u043a\u043e\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435 \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u2014 \u043f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c \u043a\u0430\u043a \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043d\u0430\u0447\u0430\u0442\u044c \u0447\u0442\u043e \u0442\u043e \u043c\u0435\u043d\u044f\u0442\u044c \u0432 \u0444\u0430\u0439\u043b\u0430\u0445 \u0441\u0430\u043c\u043e\u0439 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0421\u0423\u0411\u0414 \u043f\u0438\u0448\u0435\u0442 \u0443\u0436\u0435 \u043f\u0435\u0440\u0435\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0435 \u0432\u043e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0432 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0436\u0443\u0440\u043d\u0430\u043b \u2014 Write-Ahead Log, \u0430 \u043f\u043e\u0441\u043b\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0433\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u0434\u0435\u043b\u0430\u0435\u0442 \u0432 \u044d\u0442\u043e\u043c \u0436\u0443\u0440\u043d\u0430\u043b\u0435 \u043f\u043e\u043c\u0435\u0442\u043a\u0443. \u0421\u0434\u0435\u043b\u0430\u043d\u043e \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u0434\u043b\u044f \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u0441\u043b\u0435 \u0441\u0431\u043e\u0435\u0432, \u043d\u043e \u0432 \u0438\u0442\u043e\u0433\u0435 \u043f\u044b\u0442\u043b\u0438\u0432\u044b\u0439 \u0443\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0434\u043e\u0448\u0435\u043b \u0434\u043e \u0438\u0434\u0435\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u0436\u0443\u0440\u043d\u0430\u043b \u0434\u043b\u044f \u0440\u0435\u0437\u0435\u0440\u0432\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u0438. \u0412 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435 \u043b\u043e\u0433\u0438\u0447\u043d\u043e, \u0432\u0441\u0435 \u0445\u043e\u0434\u044b \u0432 \u043d\u0451\u043c \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u044b, \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0431\u044d\u043a\u0430\u043f\u0430, \u043d\u043e \u0438 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0431\u0430\u0437\u044b \u043d\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u043f\u0440\u0435\u0440\u0432\u0430\u0432 \u043f\u0440\u043e\u0438\u0433\u0440\u044b\u0432\u0430\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 WAL-\u043b\u043e\u0433\u0430 \u0432 \u043d\u0443\u0436\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442.<\/p>\n<p>  \u041e\u0434\u043d\u0430\u043a\u043e \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0442\u0430\u043a\u043e\u0439 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u2014 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c \u0432 \u043f\u043e\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u0438\u043a \u0432\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u0431\u044d\u043a\u0430\u043f \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b\u0438 \u0430\u0440\u0445\u0438\u0432\u0430\u0446\u0438\u044e WAL-\u043b\u043e\u0433\u043e\u0432, \u0432 \u0441\u0440\u0435\u0434\u0443 \u0432\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043b\u0438 \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0441 \u043e\u0448\u0438\u0431\u043e\u0447\u043d\u043e\u0439 \u043c\u0430\u0441\u043a\u043e\u0439, \u0430 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b\u0438 \u044d\u0442\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043f\u044f\u0442\u043d\u0438\u0446\u0443, \u043a\u043e\u0433\u0434\u0430 \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b \u0438\u0441\u0447\u0435\u0437\u043d\u043e\u0432\u0435\u043d\u0438\u0435 \u043a\u0430\u043a\u043e\u0439 \u0442\u043e \u043d\u0443\u0436\u043d\u043e\u0439 \u0435\u043c\u0443 \u0437\u0430\u043f\u0438\u0441\u0438. \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c\u0441\u044f \u0438\u0437 \u0431\u044d\u043a\u0430\u043f\u0430 \u0434\u043e \u0441\u0440\u0435\u0434\u044b, \u043f\u043e\u0442\u0435\u0440\u044f\u0432 \u0432\u0441\u044e \u0440\u0430\u0431\u043e\u0442\u0443 \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u043e\u0432 \u0437\u0430 \u0447\u0435\u0442\u0432\u0435\u0440\u0433 \u0438 \u043f\u044f\u0442\u043d\u0438\u0446\u0443.<\/p>\n<p>  \u0412\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0439 \u0432\u043e\u043f\u0440\u043e\u0441, \u0430 \u043d\u0435\u043b\u044c\u0437\u044f \u043b\u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u043e\u0438\u0433\u0440\u044b\u0432\u0430\u043d\u0438\u0435 WAL-\u043b\u043e\u0433\u043e\u0432 \u0441 \u043f\u043e\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u0438\u043a\u0430 \u043f\u043e \u043f\u044f\u0442\u043d\u0438\u0446\u0443, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0432 \u043d\u0430\u0448 \u00ab\u043e\u0448\u0438\u0431\u043e\u0447\u043d\u044b\u0439\u00bb \u0437\u0430\u043f\u0440\u043e\u0441?<\/p>\n<p>  \u0412 \u043e\u0431\u044b\u0447\u043d\u043e\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u044f \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u043b\u0441\u044f \u0431\u044b \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u043c \u043d\u0430 \u0444\u043e\u0440\u0443\u043c, \u043d\u043e \u0443 \u043c\u0435\u043d\u044f \u0431\u044b\u043b\u043e 2 \u0434\u0438\u0441\u0442\u0440\u0438\u0431\u0443\u0442\u0438\u0432\u0430 FreeBSD, 10 \u0442\u0430\u0440\u0431\u043e\u043b\u043b\u043e\u0432 \u0441 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0430\u043c\u0438 PostgresSQL \u0440\u0430\u0437\u043d\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u0439, 10\u0413\u0431 \u043c\u0435\u0441\u0442\u0430 \u043d\u0430 \u0432\u0438\u043d\u0442\u0435, gcc, \u0434\u0432\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0435\u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0445 \u043d\u0435\u0434\u0435\u043b\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0442\u0435\u043a\u0438\u043b\u0430, \u0440\u043e\u043c, \u044f\u0449\u0438\u043a \u043f\u0438\u0432\u0430 \u0438 \u043e\u0431\u0440\u044b\u0432\u043e\u0447\u043d\u044b\u0435 \u0432\u043e\u0441\u043f\u043e\u043c\u0438\u043d\u0430\u043d\u0438\u044f \u043e \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0435 \u044f\u0437\u044b\u043a\u0430 C. \u041d\u0435 \u0442\u043e \u0447\u0442\u043e\u0431\u044b \u044d\u0442\u043e \u0431\u044b\u043b \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u0437\u0430\u043f\u0430\u0441 \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f, \u043d\u043e \u0440\u0430\u0437 \u0443\u0436 \u0437\u0430\u0433\u043b\u044f\u043d\u0443\u043b \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u043a\u043e\u0434\u044b, \u0442\u043e \u0441\u043b\u043e\u0436\u043d\u043e \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c\u0441\u044f\u2026<\/p>\n<p>  <a name=\"habracut\"><\/a><\/p>\n<p>  \u0418\u0442\u0430\u043a, \u0434\u043b\u044f \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432 \u0432\u0437\u044f\u0442\u044b FreeBSD 10 \u0438 PostgreSQL 9.2.8 \u0438\u0437 \u0435\u0451 \u043f\u043e\u0440\u0442\u043e\u0432. \u041a\u043b\u0438\u0435\u043d\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e pkg, \u0432 \u043d\u0435\u043c \u043d\u0438\u0447\u0435\u0433\u043e \u043c\u0435\u043d\u044f\u0442\u044c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e. \u0417\u0430\u0440\u0430\u043d\u0435\u0435 \u0438\u0437\u0432\u0438\u043d\u044f\u044e\u0441\u044c \u0437\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0435 \u043a\u0430\u043f\u0438\u0442\u0430\u043d\u0441\u0442\u0432\u043e, \u043d\u043e \u0442\u0435\u043a\u0441\u0442 \u043f\u0438\u0441\u0430\u043b\u0441\u044f \u043a\u0430\u043a \u0434\u043b\u044f \u043d\u043e\u0432\u0438\u0447\u043a\u043e\u0432, \u0442\u0430\u043a \u0438 \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0431\u044b\u0441\u0442\u0440\u043e \u0432\u0441\u0451 \u043e\u0441\u0432\u0435\u0436\u0438\u0442\u044c \u0432 \u0433\u043e\u043b\u043e\u0432\u0435 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u0441\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0440\u0430\u0441\u043f\u0438\u0441\u0430\u043d\u044b \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e.<\/p>\n<h4>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0438 \u0431\u0430\u0437\u043e\u0432\u0430\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430<\/h4>\n<pre><code class=\"bash\">root@leninzhiv&gt; cd \/usr\/ports\/databases\/postgresql92-server root@leninzhiv&gt; make fetch root@leninzhiv&gt; make extract <\/code><\/pre>\n<p>  \u0421\u043a\u0430\u0447\u0430\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0441 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0430\u043c\u0438 \u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u043f\u0430\u043f\u043a\u0443 work \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u043f\u043e\u0440\u0442\u0430. \u042f \u0447\u0435\u0441\u0442\u043d\u043e \u0433\u043e\u0432\u043e\u0440\u044f \u0442\u0430\u043a \u0438 \u043d\u0435 \u043f\u043e\u043d\u044f\u043b \u043a\u0430\u043a \u043f\u0435\u0440\u0435\u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 \u043f\u043e\u0441\u043b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439, \u043a\u0430\u043a\u043e\u0433\u043e \u0442\u043e make rebuild \u0432\u0440\u043e\u0434\u0435 \u043d\u0435\u0442\u0443, make clean \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043d\u043e\u0441\u0438\u0442 \u044d\u0442\u0443 \u043f\u0430\u043f\u043a\u0443 \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u043c\u0438. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043b \u043f\u0430\u043f\u043a\u0443 work \u0432 \u0441\u0432\u043e\u044e \u0434\u043e\u043c\u0430\u0448\u043d\u044e\u044e \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e, \u0432\u043d\u043e\u0441\u0438\u043b \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0442\u0430\u043c, \u0437\u0430\u0442\u0435\u043c \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043b \u0432 \u043f\u0430\u043f\u043a\u0443 \u043f\u043e\u0440\u0442\u0430 \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u043b make install.<\/p>\n<p>  \u041f\u043e\u043a\u0430 \u0447\u0442\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043c\u0435\u043d\u044f\u0435\u043c, \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0442\u0430\u0432\u0438\u043c \u043f\u043e\u0441\u0442\u0433\u0440\u0435\u0441:  <\/p>\n<pre><code class=\"bash\">root@leninzhiv&gt; make install <\/code><\/pre>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0430\u043f\u043a\u0438 \u0434\u043b\u044f \u0430\u0440\u0445\u0438\u0432\u043e\u0432:  <\/p>\n<pre><code class=\"bash\">root@leninzhiv&gt; mkdir -p \/usr\/db_archive\/wal root@leninzhiv&gt; mkdir -p \/usr\/db_archive\/data root@leninzhiv&gt; chown -R pgsql:wheel \/usr\/pg_archive <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u0442\u0433\u0440\u0435\u0441 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0447\u0442\u043e\u0431\u044b \u0443 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0431\u044b\u043b \u0434\u043e\u0441\u0442\u0443\u043f \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u044e\u0437\u0435\u0440\u0430 \u043f\u043e\u044d\u043e\u043c\u0443 \u043c\u0435\u043d\u044f\u0435\u043c \u043f\u0440\u0430\u0432\u0430:  <\/p>\n<pre><code class=\"bash\">root@leninzhiv&gt; chmod 0700 \/usr\/pg_archive\/data <\/code><\/pre>\n<p>  \u0414\u0435\u043b\u0430\u0435\u043c \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043d\u0443\u044e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443. \u0417\u0434\u0435\u0441\u044c \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043f\u043e\u0434 \u043f\u043e\u0441\u0442\u0433\u0440\u0435\u0441\u043e\u0432\u0443\u044e \u0443\u0447\u0435\u0442\u043a\u0443 pgsql \u0447\u0442\u043e\u0431\u044b \u0431\u044b\u043b\u043e \u043c\u0435\u043d\u044c\u0448\u0435 \u0432\u043e\u0437\u043d\u0438 \u0441 \u043f\u0440\u0430\u0432\u0430\u043c\u0438 \u043d\u0430 \u0444\u0430\u0439\u043b\u044b.<\/p>\n<pre><code class=\"bash\">root@leninzhiv&gt; su - pgsql pgsql@leninzhiv&gt; initdb -D \/usr\/local\/pgsql\/data <\/code><\/pre>\n<p>  \u0420\u0430\u0441\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u043c \u0438 \u043f\u0440\u0430\u0432\u0438\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0430\u0440\u0445\u0438\u0432\u0430\u0446\u0438\u0438 WAL-\u043b\u043e\u0433\u043e\u0432 \u0432 \/usr\/local\/pgsql\/data\/postgresql.conf:<br \/>  archive_mode=on<br \/>  wal_level = archive<br \/>  archive_command = &#8216;test! -f \/usr\/db_archive\/wal\/%f &#038;&#038; cp %p \/usr\/db_archive\/wal\/%f&#8217;<br \/>  (\u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u0430\u043c \u0440\u044f\u0434\u043e\u043c \u0432 \u043a\u0430\u043c\u043c\u0435\u043d\u0442\u0430\u0445)<br \/>  max_wal_senders = 1<\/p>\n<p>  \u0412 \/usr\/local\/pgsql\/data\/pg_hba.conf \u0440\u0430\u0441\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443<br \/>  local replication pgsql trust<\/p>\n<p>  \u0421\u0442\u0430\u0440\u0442\u0443\u0435\u043c \u0441\u0435\u0440\u0432\u0435\u0440  <\/p>\n<pre><code class=\"bash\">pgsql@leninzhiv&gt; \/usr\/local\/etc\/rc.d\/postgresql start <\/code><\/pre>\n<p>  \u0414\u0435\u043b\u0430\u0435\u043c \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u0431\u044d\u043a\u0430\u043f  <\/p>\n<pre><code class=\"bash\">pgsql@leninzhiv&gt; pg_basebackup -D \/usr\/db_archive\/data\/ <\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0432 \u043f\u0430\u043f\u043a\u0435 \/usr\/db_archive\/data\/ \u0434\u043e\u043b\u0436\u043d\u0430 \u043b\u0435\u0436\u0430\u0442\u044c \u043a\u043e\u043f\u0438\u044f \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445, \u0432 \/usr\/db_archive\/wal\/ \u0434\u043e\u043b\u0436\u043d\u044b \u043b\u0435\u0436\u0430\u0442\u044c WAL \u0444\u0430\u0439\u043b\u044b \u0432\u0438\u0434\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e 000000010000000000000003<\/p>\n<p>  \u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0432 \u043f\u0430\u043f\u043a\u0443 \u0441 \u0431\u044d\u043a\u0430\u043f\u043e\u043c \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043a\u043e\u043d\u0444\u0438\u0433 \u0434\u043b\u044f \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f  <\/p>\n<pre><code class=\"bash\">cp \/usr\/local\/share\/postgresql\/recovery.conf.sample \/usr\/db_archive\/data\/recovery.conf <\/code><\/pre>\n<p>  \u0438 \u0432 \u043d\u0451\u043c \u0440\u0430\u0441\u043a\u043e\u043c\u043c\u0435\u043d\u0438\u0442\u0440\u0443\u0435\u043c \u0438 \u043f\u0440\u0430\u0432\u0438\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f (\u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u043e\u0436\u0435 \u0440\u044f\u0434\u043e\u043c \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0445).<br \/>  restore_command = &#8216;cp \/usr\/db_archive\/data\/%f %p&#8217;<\/p>\n<p>  \u0412\u043d\u043e\u0441\u0438\u043c \u0437\u0430\u043f\u0438\u0441\u0438:  <\/p>\n<pre><code class=\"bash\">pgsql@leninzhiv&gt; psql -U pgsql -d postgres <\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"sql\">postgres=# CREATE TABLE z (z_id serial, z_text character(50)); postgres=# INSERT INTO z (z_text) VALUES ('Karlin'); postgres=# INSERT INTO z (z_text) VALUES ('Petrov'); postgres=# INSERT INTO z (z_text) VALUES ('Ivanov'); postgres=# INSERT INTO z (z_text) VALUES ('Kaplan'); postgres=# INSERT INTO z (z_text) VALUES ('Karas'); postgres=# INSERT INTO z (z_text) VALUES ('Bukova'); postgres=# INSERT INTO z (z_text) VALUES ('Sidorova'); postgres=# INSERT INTO z (z_text) VALUES ('Karman'); postgres=# INSERT INTO z (z_text) VALUES ('Nikolaev'); <\/code><\/pre>\n<p>  \u0423\u0434\u0430\u043b\u044f\u0435\u043c \u0437\u0430\u043f\u0438\u0441\u0438:  <\/p>\n<pre><code class=\"sql\">postgres=# DELETE FROM z WHERE z_text ILIKE 'Ka%'; <\/code><\/pre>\n<p>  \u0418\u0437\u043c\u0435\u043d\u044f\u0435\u043c \u0437\u0430\u043f\u0438\u0441\u0438, \u0432\u043d\u043e\u0441\u0438\u043c \u043d\u043e\u0432\u044b\u0435, \u0434\u0438\u0441\u043a\u043e\u0442\u0435\u043a\u0430  <\/p>\n<pre><code class=\"sql\">postgres=# UPDATE z SET z_text='Petrova' WHERE z_text='Sidorova'; postgres=# INSERT INTO z (z_text) VALUES ('Kruglov'); postgres=# UPDATE z SET z_text='Alexeeva' WHERE z_text='Bukova'; postgres=# INSERT INTO z (z_text) VALUES ('Kvadrat'); <\/code><\/pre>\n<p>  \u041e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0435\u043c \u0447\u0442\u043e \u0443\u0434\u0430\u043b\u044f\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0438 \u043f\u043e \u043c\u0430\u0441\u043a\u0435 \u0431\u044b\u043b\u043e \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u0435\u0439 \u0438\u0434\u0435\u0435\u0439 \u0438 \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u041a\u0430\u0440\u043b\u0438\u043d\u044b\u043c \u043c\u044b \u0443\u0434\u0430\u043b\u0438\u043b\u0438 \u041a\u0430\u043f\u043b\u0430\u043d\u0430, \u041a\u0430\u0440\u0430\u0441\u044f \u0438 \u041a\u0430\u0440\u043c\u0430\u043d\u0430.<\/p>\n<p>  \u041e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0441\u0435\u0440\u0432\u0435\u0440  <\/p>\n<pre><code class=\"bash\">pgsql@leninzhiv&gt; \/usr\/local\/etc\/rc.d\/postgresql stop pgsql@leninzhiv&gt; exit root@leninzhiv&gt; <\/code><\/pre>\n<p>  \u0438 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u0434\u0443\u043c\u0430\u0442\u044c \u0447\u0442\u043e \u0436\u0435 \u0434\u0435\u043b\u0430\u0442\u044c.<\/p>\n<h4>\u0418\u0434\u0451\u043c \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438<\/h4>\n<p>  \u041a\u0430\u043a \u0432\u044b \u043f\u043e\u043c\u043d\u0438\u0442\u0435, \u043f\u043e\u0441\u043b\u0435 make extract \u044f \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043b \u043f\u0430\u043f\u043a\u0443 work \u0438\u0437 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u043f\u043e\u0440\u0442\u0430 \u0432 \u0441\u0432\u043e\u044e \u0434\u043e\u043c\u0430\u0448\u043d\u044e\u044e \u043f\u0430\u043f\u043a\u0443, \u0438 \u0434\u0435\u043b\u0430\u043b \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u043d\u0435\u0439. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0442\u0443\u0434\u0430. \u0415\u0441\u043b\u0438 \u043a\u0442\u043e \u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u0430\u043a \u0434\u0435\u043b\u0430\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0430\u0445 \u0432 \u0441\u0430\u043c\u043e\u0439 \u043f\u0430\u043f\u043a\u0435 \u043f\u043e\u0440\u0442\u0430 \u0447\u0442\u043e\u0431\u044b \u0432\u0441\u0451 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u0435\u0440\u0435\u0441\u043e\u0431\u0438\u0440\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u0441\u043b\u0435 \u0432\u043d\u0435\u0441\u0451\u043d\u043d\u044b\u0445 \u0432 \u043a\u043e\u0434 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0431\u0443\u0434\u0443 \u043a\u0440\u0430\u0439\u043d\u0435 \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u0435\u043d.<\/p>\n<p>  \u0412\u043d\u0430\u0447\u0430\u043b\u0435 \u044f \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043b \u0441\u0435\u0431\u0435 \u0446\u0435\u043b\u044c \u043d\u0430\u0439\u0442\u0438 \u0442\u043e \u043c\u0435\u0441\u0442\u043e \u0433\u0434\u0435 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 \u0437\u0430\u043f\u0438\u0441\u0438 WAL-\u043b\u043e\u0433\u043e\u0432. <\/p>\n<p>  \u0424\u0430\u0439\u043b \u0441 \u043a\u043e\u0434\u043e\u043c \u043e\u0442\u043d\u043e\u0441\u044f\u0449\u0438\u043c\u0441\u044f \u043a WAL \u044f \u043d\u0430\u0448\u0435\u043b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u043e\u0438\u0441\u043a\u0430 \u0441\u0442\u0440\u043e\u043a\u0438 \u00abWAL\u00bb \u0432 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u043c \u0444\u0430\u0439\u043b\u043e\u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 work\/postgresql-9.2.8\/src \u0438 \u0437\u0434\u0440\u0430\u0432\u043e\u0433\u043e \u0441\u043c\u044b\u0441\u043b\u0430, \u044d\u0442\u043e \u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u0444\u0430\u0439\u043b xlog.c<\/p>\n<p>  \u042f \u043d\u0435 \u0443\u043c\u0435\u044e \u0432 \u0442\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u043a\u0443 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c \u043d\u0430 C, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u043e\u0441\u0442\u043e \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0437\u0430\u043f\u0438\u0441\u044c \u0435\u0451 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0432 \u0444\u0430\u0439\u043b, \u0441\u043e\u0431\u0440\u0430\u043b \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b.<\/p>\n<p>  \u0412 \u0444\u0430\u0439\u043b\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0442\u0430\u043a\u043e\u0439 \u0432\u043e\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:  <\/p>\n<pre><code>bool check_wal_buffers(int *newval, void **extra, GucSource source)  void assign_xlog_sync_method(int new_sync_method, void *extra)  Size XLOGShmemSize(void)  static int XLOGChooseNumBuffers(void)  bool check_wal_buffers(int *newval, void **extra, GucSource source)  void XLOGShmemInit(void)  Size XLOGShmemSize(void)  static void ReadControlFile(void)  void StartupXLOG(void)  static void ReadControlFile(void)  static char * str_time(pg_time_t tnow)  static void ValidateXLOGDirectoryStructure(void)  static void readRecoveryCommandFile(void)  static List * readTimeLineHistory(TimeLineID targetTLI)  static bool read_backup_label(XLogRecPtr *checkPointLoc, bool *backupEndRequired,       bool *backupFromStandby)  static XLogRecord * ReadCheckpointRecord(XLogRecPtr RecPtr, int whichChkpt)  static XLogRecord * ReadRecord(XLogRecPtr *RecPtr, int emode, bool fetching_ckpt)  static bool XLogPageRead(XLogRecPtr *RecPtr, int emode, bool fetching_ckpt,     bool randAccess)  static int XLogFileReadAnyTLI(uint32 log, uint32 seg, int emode, int sources)  ... static XLogRecord * ReadRecord(XLogRecPtr *RecPtr, int emode, bool fetching_ckpt)  static bool XLogPageRead(XLogRecPtr *RecPtr, int emode, bool fetching_ckpt,     bool randAccess)  static bool RecordIsValid(XLogRecord *record, XLogRecPtr recptr, int emode)  static bool recoveryStopsHere(XLogRecord *record, bool *includeThis)  static void CheckRecoveryConsistency(void)  static XLogRecord * ReadRecord(XLogRecPtr *RecPtr, int emode, bool fetching_ckpt)  static bool XLogPageRead(XLogRecPtr *RecPtr, int emode, bool fetching_ckpt,     bool randAccess)  ... <\/code><\/pre>\n<p>  \u0412 \u043e\u0431\u0449\u0435\u043c, \u0443 \u043c\u0435\u043d\u044f \u0441\u043b\u043e\u0436\u0438\u043b\u043e\u0441\u044c \u0432\u043f\u0435\u0447\u0430\u0442\u043b\u0435\u043d\u0438\u0435 \u0447\u0442\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432 \u0446\u0438\u043a\u043b\u0435 ReadRecord -&gt; XLogPageRead -&gt; RecordIsValid -&gt; RecoveryStopsHere -&gt; CheckRecoveryConsistency.<\/p>\n<p>  \u0411\u043e\u043b\u0435\u0435 \u0431\u043b\u0438\u0437\u043a\u043e\u0435 \u0437\u043d\u0430\u043a\u043e\u043c\u0442\u0441\u0432\u043e \u0441 \u0444\u0443\u043d\u043a\u0438\u0446\u0435\u0439 ReadRecord \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u043e \u0447\u0442\u043e \u043e\u043d\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u0434\u0432\u0443\u0445 \u043c\u0435\u0441\u0442\u0430\u0445 \u2014 \u043a\u0430\u043a return record \u0438 \u043a\u0430\u043a return (XLogRecord *) buffer, \u0432\u044b\u0448\u0435\u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u043c \u043d\u0435\u0445\u0438\u0442\u0440\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u0443\u0442\u043e\u0447\u043d\u044f\u0435\u043c \u0447\u0442\u043e \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0441 WAL-\u043b\u043e\u0433\u043e\u0432 \u0432\u043e\u0437\u0432\u0440\u0430\u0442 \u0438\u0434\u0451\u0442 \u0447\u0435\u0440\u0435\u0437 return (XLogRecord *) buffer. \u041f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e! \u041f\u0438\u0448\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432 \u0444\u0430\u0439\u043b. <\/p>\n<p>  \u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0442\u0438\u043f\u0430 XLogRecord \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 \u0444\u0430\u0439\u043b\u0435 xlog.h \u0438 \u043e\u043d\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043b\u0430\u043a\u043e\u043d\u0438\u0447\u043d\u0430:  <\/p>\n<pre><code class=\"cpp\">typedef struct XLogRecord { \tpg_crc32\txl_crc;\t\t\t\/* CRC for this record *\/ \tXLogRecPtr\txl_prev;\t\t\/* ptr to previous record in log *\/ \tTransactionId xl_xid;\t\t\/* xact id *\/ \tuint32\t\txl_tot_len;\t\t\/* total len of entire record *\/ \tuint32\t\txl_len;\t\t\t\/* total len of rmgr data *\/ \tuint8\t\txl_info;\t\t\/* flag bits, see below *\/ \tRmgrId\t\txl_rmid;\t\t\/* resource manager for this record *\/ \t\/* ACTUAL LOG DATA FOLLOWS AT END OF STRUCT *\/ } XLogRecord; <\/code><\/pre>\n<p>  \u041e\u0442\u043b\u0438\u0447\u043d\u043e, \u0435\u0441\u043b\u0438 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0434\u043b\u0438\u043d\u0430, \u0442\u043e \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0435\u0451 \u0434\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u0444\u0430\u0439\u043b, \u043f\u0435\u0440\u0435\u0434 return (XLogRecord *) buffer \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c:<\/p>\n<pre><code class=\"cpp\">FILE *pf2 = fopen(&quot;\/usr\/local\/pgsql\/data\/log3.txt&quot;, &quot;a&quot;); char *buf_poi = buffer; for (uint32 i=0; i &lt; record-&gt;xl_tot_len; i++) {fputc(*buf_poi, pf2); buf_poi++;} fprintf(pf2, &quot;\\n crc32: %u \\n xl_xid=%i \\n&quot;, record-&gt;xl_crc, record-&gt;xl_xid);  fclose(pf2); <\/code><\/pre>\n<p>  \u0421\u043d\u043e\u0441\u0438\u043c \u0441\u0442\u0430\u0440\u044b\u0439 \u041f\u043e\u0441\u0442\u0433\u0440\u0435\u0441, \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u043b\u0438\u0432\u0430\u0435\u043c \u043d\u043e\u0432\u044b\u0439:<\/p>\n<pre><code class=\"bash\">root@leninzhiv&gt; cd \/usr\/ports\/databases\/postgresql92-server root@leninzhiv&gt; make deinstall <\/code><\/pre>\n<p>  \u041d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u044e \u0447\u0442\u043e \u043c\u044b \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e work \u0432 \u0434\u043e\u043c\u0430\u0448\u043d\u044e\u044e \u043f\u0430\u043f\u043a\u0443 \u0438 \u0432\u0441\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u0434\u0430 \u0432\u043d\u043e\u0441\u0438\u043b\u0438 \u0442\u0430\u043c. \u0422\u0435\u043f\u0435\u0440\u044c \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0435\u0451 \u043d\u0430 \u043c\u0435\u0441\u0442\u043e \u043f\u0430\u043f\u043a\u0438 work \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u043f\u043e\u0440\u0442\u0430.  <\/p>\n<pre><code class=\"bash\">root@leninzhiv&gt; rm -R \/usr\/ports\/databases\/postgresql92-server\/work root@leninzhiv&gt; cp -R ~\/work \/usr\/ports\/databases\/postgresql92-server\/work root@leninzhiv&gt; make install <\/code><\/pre>\n<p>  \u0423\u0434\u0430\u043b\u044f\u0435\u043c \u0444\u0430\u0439\u043b\u044b \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u043d\u0430 \u0438\u0445 \u043c\u0435\u0441\u0442\u043e \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u0431\u044d\u043a\u0430\u043f. WAL-\u0444\u0430\u0439\u043b\u044b \u0441\u0430\u043c\u0438 \u043f\u043e\u0434\u0442\u044f\u043d\u0443\u0442\u0441\u044f.  <\/p>\n<pre><code class=\"bash\">root@leninzhiv&gt; su - pgsql pgsql@leninzhiv&gt; \/usr\/local\/etc\/rc.d\/postgresql stop pgsql@leninzhiv&gt; rm -R \/usr\/local\/pgsql\/data pgsql@leninzhiv&gt; cp -R \/usr\/db_archive\/data \/usr\/local\/pgsql\/data   pgsql@leninzhiv&gt; \/usr\/local\/etc\/rc.d\/postgresql start  pgsql@leninzhiv&gt; psql -U pgsql -d postgres <\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"sql\">postgres=# select * from z; postgres=# \\q <\/code><\/pre>\n<pre><code class=\"bash\">pgsql@leninzhiv&gt; \/usr\/local\/etc\/rc.d\/postgresql stop <\/code><\/pre>\n<p>  \u0421\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u0430 log3.txt, \u0432\u043d\u0430\u0447\u0430\u043b\u0435 \u0438\u0434\u0435\u043c \u043c\u043d\u043e\u0433\u043e \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439, \u0432\u0438\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u043b\u0443\u0436\u0435\u0431\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 \u0438 \u0434\u0430\u043d\u043d\u044b\u0445, \u0431\u043b\u0438\u0436\u0435 \u043a \u043a\u043e\u043d\u0446\u0443 \u0432\u0438\u0434\u0438\u043c:<\/p>\n<pre><code>\u0413#{\u042b####\u0420T##\u043a###r###R#### ##########0###@######\t#e########\t###gNikolaev                                           crc32: 3682278083  l_xid=1002  W# \u041c#####U##\u043a###,### ###`#######\u0422\u203a\u0429\u040c%\u045b###### crc32: 3423214679  xl_xid=1002  r&quot;\u0425 ####xU##\u043b###5######## ##########0###@########\u042f## crc32: 2698322546  xl_xid=1003  #\u0429%2####\u0401U##\u043b###5######## ##########0###@########\u042f## crc32: 841341184  xl_xid=1003  \u044c#W\u0437####\u0430U##\u043b###5######## ##########0###@########\u042f## crc32: 3881244668  xl_xid=1003  Z7#\u0440#####V##\u043b###5######## ##########0###@########\u042f## crc32: 4028315482  xl_xid=1003  \u00b5\u0404\u0408\u0452####PV##\u043b###,### ###`########\u0404\u0429\u040c%\u045b###### crc32: 2426645173  xl_xid=1003  \u0423\u045a-B####\u20acV##\u043c###y###Y###@ ##########0###@########I##### ####\u0402#(######gPetrova                                            crc32: 1110285523  xl_xid=1004 <\/code><\/pre>\n<p>  \u0412\u0438\u0434\u0438\u043c \u0447\u0442\u043e \u043c\u0435\u0436\u0434\u0443 \u0437\u043d\u0430\u043a\u043e\u043c\u044b\u043c\u0438 \u0444\u0430\u043c\u0438\u043b\u0438\u044f\u043c\u0438 \u041d\u0438\u043a\u043e\u043b\u0430\u0435\u0432 \u0438 \u041f\u0435\u0442\u0440\u043e\u0432\u0430 \u0435\u0441\u0442\u044c 4 \u043f\u043e\u0445\u043e\u0436\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0438 \u043e\u0434\u043d\u0430 \u043d\u0435\u043f\u043e\u0445\u043e\u0436\u0430\u044f, \u043f\u043e\u0434 \u043e\u0434\u043d\u0438\u043c \u043d\u043e\u043c\u0435\u0440\u043e\u043c \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438. \u0412\u0438\u0434\u0438\u043c\u043e, \u044d\u0442\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f, \u0437\u043d\u0430\u0447\u0438\u0442 \u0432 WAL-\u043b\u043e\u0433 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0443\u0436\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0442\u0438\u043f\u0430 \u00ab\u0441\u0442\u0435\u0440\u0435\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 50 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 64822\u00bb. \u0412 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435, \u043a\u0430\u043a \u0438 \u043e\u0436\u0438\u0434\u0430\u043b\u043e\u0441\u044c. \u0414\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0438 xl_xid=1003 \u0432\u043c\u0435\u0441\u0442\u043e \u0437\u0430\u043f\u0438\u0441\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 NULL. <\/p>\n<p>  \u041e\u043f\u044f\u0442\u044c \u0443\u0434\u0430\u043b\u044f\u0435\u043c \u0441\u0442\u0430\u0440\u044b\u0439 \u041f\u043e\u0441\u0442\u0433\u0440\u0435\u0441, \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043d\u043e\u0432\u044b\u0439, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435\u2026 <\/p>\n<p>  \u0423\u0434\u0430\u043b\u0435\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u043d\u0430 \u043c\u0435\u0441\u0442\u0435! \u041f\u0440\u0430\u0432\u0434\u0430 \u0432\u0441\u0435 \u0447\u0442\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0442\u0438 \u043f\u043e\u0441\u043b\u0435 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u043d\u0435 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e \ud83d\ude41 \u0427\u0442\u043e \u0436, \u0441 \u043d\u0430\u0441\u043a\u043e\u043a\u0430 \u0432\u0437\u044f\u0442\u044c \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c. \u0412 \u043e\u0431\u0449\u0435\u043c \u0442\u043e \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0432\u0435\u0434\u044c \u043f\u0435\u0440\u0435\u0434 \u043f\u0440\u043e\u0438\u0433\u0440\u044b\u0432\u0430\u043d\u0438\u0435\u043c \u0437\u0430\u043f\u0438\u0441\u0438 \u043f\u0440\u043e\u0445\u043e\u0434\u044f\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0446\u0435\u043b\u043e\u0441\u0442\u043d\u043e\u0441\u0442\u0438 \u0438 \u0432\u0441\u0435\u0433\u043e \u0442\u0430\u043a\u043e\u0433\u043e.<\/p>\n<p>  \u0417\u043d\u0430\u0447\u0438\u0442 \u0446\u0435\u043b\u044c \u043d\u043e\u043c\u0435\u0440 2 \u2014 \u043d\u0430\u0439\u0442\u0438 \u0433\u0434\u0435 \u0438\u0434\u0435\u0442 \u00ab\u043f\u0440\u043e\u0438\u0433\u0440\u044b\u0432\u0430\u043d\u0438\u0435\u00bb \u0437\u0430\u043f\u0438\u0441\u0438. \u0411\u044b\u0441\u0442\u0440\u044b\u0439 \u043f\u043e\u0438\u0441\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f readRecord \u0432 \u0442\u043e\u043c \u0436\u0435 \u0444\u0430\u0439\u043b\u0435 \u043f\u0440\u0438\u0432\u0435\u043b \u043c\u0435\u043d\u044f \u043a \u0444\u0443\u043d\u043a\u0446\u0438\u0438 void StartupXLOG(void)\u2026 \u0418 \u0432\u043e\u0442 \u0442\u0443\u0442 \u044f \u043e\u0442\u0447\u0435\u0442\u043b\u0438\u0432\u043e \u043f\u043e\u043d\u044f\u043b \u0447\u0442\u043e \u0434\u043e \u0441\u0435\u0433\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u0448\u0435\u043b \u043d\u0435 \u0442\u0435\u043c \u043f\u0443\u0442\u0435\u043c, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043f\u043e\u0447\u0442\u0438 \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 \u0432\u0442\u043e\u0440\u043e\u0433\u043e-\u0442\u0440\u0435\u0442\u044c\u0435\u0433\u043e \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u0432 \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432\u044b\u0437\u043e\u0432\u0430 readRecord (\u043e\u043d\u0438 \u0442\u0430\u043c \u0440\u044f\u0434\u043e\u043c) \u0441\u0440\u0430\u0437\u0443 \u0438\u0434\u0451\u0442 \u0432\u043e \u043f\u0435\u0440\u0432\u044b\u0445 \u0448\u0438\u043a\u0430\u0440\u043d\u044b\u0439 \u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043a\u0443\u0441\u043e\u043a, \u0430 \u0432\u043e \u0432\u0442\u043e\u0440\u044b\u0445, \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f \u00abNow apply the WAL record itself\u00bb \u2014 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u043f\u0440\u043e\u0438\u0433\u0440\u044b\u0448\u0430 \u0437\u0430\u043f\u0438\u0441\u0438 RmgrTable[record-&gt;xl_rmid].rm_redo(EndRecPtr, record);<\/p>\n<p>  \u0418\u0437\u043c\u0435\u043d\u0438\u043c \u044d\u0442\u043e\u0442 \u043a\u0443\u0441\u043e\u043a \u043a\u043e\u0434\u0430 \u043d\u0430   <\/p>\n<pre><code class=\"cpp\">if (record-&gt;xl_xid==1003) {} else RmgrTable[record-&gt;xl_rmid].rm_redo(EndRecPtr, record); <\/code><\/pre>\n<p>  \u041e\u043f\u044f\u0442\u044c \u043f\u0435\u0440\u0435\u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c\u2026 \u041f\u043e\u0431\u0435\u0434\u0430! \u0423\u0434\u0430\u043b\u0435\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u043d\u0430 \u043c\u0435\u0441\u0442\u0435 \u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f, \u0441\u0434\u0435\u043b\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u0441\u043b\u0435 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0442\u043e\u0436\u0435 \u043d\u0430 \u043c\u0435\u0441\u0442\u0435!<\/p>\n<h4>\u041e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u043c\u0441\u044f \u043d\u0430 \u043c\u0435\u0441\u0442\u043d\u043e\u0441\u0442\u0438<\/h4>\n<p>  \u0427\u0442\u043e \u0436, \u044d\u0442\u043e, \u043d\u0435\u0441\u043e\u043c\u043d\u0435\u043d\u043d\u043e, \u0445\u043e\u0440\u043e\u0448\u043e, \u043d\u043e \u0437\u0430\u0434\u0430\u0447\u0443 \u043c\u044b \u0440\u0435\u0448\u0438\u043b\u0438 \u043d\u0430 \u043a\u0440\u0430\u0439\u043d\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u043e\u043c \u043d\u0430\u0431\u043e\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445, \u0430 \u0432\u043e\u0442 \u043a\u0430\u043a \u043d\u0430\u0439\u0442\u0438 \u043d\u0443\u0436\u043d\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u043b\u043e\u0433\u0430\u0445 \u0440\u0430\u0431\u043e\u0447\u0435\u0439 \u0431\u0430\u0437\u044b?<\/p>\n<p>  \u0412\u0435\u0440\u043d\u0435\u043c\u0441\u044f \u043a \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u043e\u043c\u0443 \u0448\u0438\u043a\u0430\u0440\u043d\u043e\u043c\u0443 \u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u043c\u0443 \u043a\u0443\u0441\u043a\u0443 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 StartupXLOG:<\/p>\n<pre><code class=\"cpp\">#ifdef WAL_DEBUG \t\t\t\tif (XLOG_DEBUG || \t\t\t\t (rmid == RM_XACT_ID && trace_recovery_messages &lt;= DEBUG2) || \t\t\t\t\t(rmid != RM_XACT_ID && trace_recovery_messages &lt;= DEBUG3)) \t\t\t\t{ \t\t\t\t\tStringInfoData buf;  \t\t\t\t\tinitStringInfo(&buf); \t\t\t\t\tappendStringInfo(&buf, &quot;REDO @ %X\/%X; LSN %X\/%X: &quot;, \t\t\t\t\t\t\t\t\t ReadRecPtr.xlogid, ReadRecPtr.xrecoff, \t\t\t\t\t\t\t\t\t EndRecPtr.xlogid, EndRecPtr.xrecoff); \t\t\t\t\txlog_outrec(&buf, record); \t\t\t\t\tappendStringInfo(&buf, &quot; - &quot;); \t\t\t\t\tRmgrTable[record-&gt;xl_rmid].rm_desc(&buf, \t\t\t\t\t\t\t\t\t\t\t\t\t   record-&gt;xl_info, \t\t\t\t\t\t\t\t\t\t\t\t\t XLogRecGetData(record)); \t\t\t\t\telog(LOG, &quot;%s&quot;, buf.data); \t\t\t\t\tpfree(buf.data); \t\t\t\t} #endif <\/code><\/pre>\n<p>  \u041c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0432\u044b\u0432\u043e\u0434 \u0432 \u043b\u043e\u0433\u0438, \u0440\u0430\u0441\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0432 #define WAL_DEBUG \u0432 pg_config_manual.h \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0432 wal_debug=on \u0432 \u0444\u0430\u0439\u043b postgresql.conf, \u043d\u043e \u044f, \u043f\u043e \u043f\u0440\u0438\u0432\u044b\u0447\u043a\u0435, \u043d\u0430\u043f\u0440\u0430\u0432\u0438\u043b \u0432\u044b\u0432\u043e\u0434 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0444\u0430\u0439\u043b. \u042d\u0442\u043e\u0442 \u043a\u0443\u0441\u043e\u043a, \u043a\u0430\u043a \u044f \u043f\u043e\u043d\u044f\u043b, \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 rm_desc (\u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 RmgrTable \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u0439?), \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043e\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a:<\/p>\n<pre><code>REDO @ 0\/3015500; LSN 0\/3015578: prev 0\/30154D0; xid 1002; len 82: Heap - insert: rel 1663\/12318\/16386; tid 0\/9  REDO @ 0\/3015578; LSN 0\/30155A8: prev 0\/3015500; xid 1002; len 12: Transaction - commit: 2014-06-06 08:38:27.537874+00   REDO @ 0\/30155A8; LSN 0\/30155E0: prev 0\/3015578; xid 1003; len 21: Heap - delete: rel 1663\/12318\/16386; tid 0\/1  REDO @ 0\/30155E0; LSN 0\/3015618: prev 0\/30155A8; xid 1003; len 21: Heap - delete: rel 1663\/12318\/16386; tid 0\/4  REDO @ 0\/3015618; LSN 0\/3015650: prev 0\/30155E0; xid 1003; len 21: Heap - delete: rel 1663\/12318\/16386; tid 0\/5  REDO @ 0\/3015650; LSN 0\/3015688: prev 0\/3015618; xid 1003; len 21: Heap - delete: rel 1663\/12318\/16386; tid 0\/8  REDO @ 0\/3015688; LSN 0\/30156B8: prev 0\/3015650; xid 1003; len 12: Transaction - commit: 2014-06-06 08:38:27.54153+00   REDO @ 0\/30156B8; LSN 0\/3015738: prev 0\/3015688; xid 1004; len 89: Heap - hot_update: rel 1663\/12318\/16386; tid 0\/7; new 0\/10  <\/code><\/pre>\n<p>  \u042d\u0442\u043e \u0443\u0436\u0435 \u0437\u043d\u0430\u043a\u043e\u043c\u044b\u0439 \u043d\u0430\u043c \u043a\u0443\u0441\u043e\u043a \u0441 \u043d\u043e\u043c\u0435\u0440\u043e\u043c \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 1003, \u0438 \u043f\u043e \u043d\u0435\u043c\u0443 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0447\u0442\u043e \u0434\u0430, \u044d\u0442\u043e \u0447\u0435\u0442\u044b\u0440\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043d\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0438 \u043e\u0434\u043d\u043e \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438. \u0412 \u043a\u043e\u043c\u0430\u043d\u0434\u0430\u0445 \u043d\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043c\u044b \u0432\u0438\u0434\u0438\u043c rel \u2014 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 \u00aboid \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 \u0438\u043c\u0435\u043d\/oid \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445\/oid \u0442\u0430\u0431\u043b\u0438\u0446\u044b\u00bb. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0446\u0438\u0444\u0435\u0440\u043a\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u043c\u0438<\/p>\n<p>  SELECT oid, spcname FROM pg_catalog.pg_tablespace;<br \/>  SELECT oid, datname FROM pg_catalog.pg_database;<br \/>  \u0438, \u0432\u043d\u0435\u0437\u0430\u043f\u043d\u043e,<br \/>  SELECT oid, relname FROM pg_catalog.pg_class;<\/p>\n<p>  \u0412\u0442\u043e\u0440\u043e\u0439 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440 \u2014 \u0432 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u0435\u0441\u0442\u044c \u043e\u0442\u043c\u0435\u0442\u043a\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u041d\u0443, \u0442\u0443\u0442 \u043d\u0438\u0447\u0435\u0433\u043e \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0442\u044c \u043d\u0435 \u043d\u0430\u0434\u043e, \u0435\u0441\u043b\u0438 \u043c\u044b \u0437\u043d\u0430\u0435\u043c \u043a\u043e\u0433\u0434\u0430 \u044d\u0442\u043e\u0442 \u0441\u0430\u043c\u044b\u0439 crime \u0431\u044b\u043b commited, \u0442\u043e \u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0432\u0443\u044e\u0449\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u043d\u0430\u0439\u0434\u0435\u043c.<\/p>\n<p>  \u041d\u0443 \u0438, \u043a\u0430\u043a \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431, \u043c\u043e\u0436\u043d\u043e \u0432\u0435\u0440\u043d\u0443\u0442\u044c\u0441\u044f \u043a \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0443 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0432 \u043a\u0440\u0430\u043a\u043e\u0437\u044f\u0431\u0440\u0430\u0445, \u0438 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u043e \u043e\u0431\u0440\u044b\u0432\u043a\u0430\u043c \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u044b\u043b\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u044b \u043a\u0430\u043a \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043a\u043e\u043c\u0430\u043d\u0434\u0430\u043c INSERT \u0438 UPDATE, \u0435\u0441\u043b\u0438 \u043c\u044b \u043f\u043e\u043c\u043d\u0438\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0441 \u043a\u0430\u043a\u0438\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u0434\u0435\u043b\u0430\u043b\u0438\u0441\u044c \u043d\u0435\u0437\u0430\u0434\u043e\u043b\u0433\u043e \u0434\u043e \u0438\u043b\u0438 \u043f\u043e\u0441\u043b\u0435 \u0438\u0441\u043a\u043e\u043c\u043e\u0433\u043e \u00ab\u043e\u0448\u0438\u0431\u043e\u0447\u043d\u043e\u0433\u043e\u00bb \u0437\u0430\u043f\u0440\u043e\u0441\u0430. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 UPDATE, \u043f\u0440\u0430\u0432\u0434\u0430, \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435, \u0441\u0442\u0440\u043e\u043a\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438\u0441\u044c \u043a\u0430\u043a \u043d\u043e\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0435\u0441\u043b\u0438 \u0441\u0442\u0440\u043e\u043a\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0430\u0441\u044c \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u0437\u0430\u043f\u0438\u0441\u0435\u0439, \u0442\u043e \u0432 WAL-\u043b\u043e\u0433\u0430\u0445 \u043e\u043d\u0430 \u043d\u0435 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f.<\/p>\n<p>  \u041d\u0443 \u0438 \u043d\u0430\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u043a \u043c\u043e\u0433\u0443 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c \u0447\u0442\u043e \u0432 \u043a\u043e\u043d\u0442\u0440\u0438\u0431\u0430\u0445 PostgreSQL 9.3 \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u0443\u0442\u0438\u043b\u0438\u0442\u0430 pg_xlogdump, \u043a\u043e\u0442\u043e\u0440\u0430\u044f, \u0432\u0440\u043e\u0434\u0435 \u0431\u044b, \u043a\u0430\u043a \u0440\u0430\u0437 \u043d\u0430\u0446\u0435\u043b\u0435\u043d\u0430 \u043d\u0430 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e WAL-\u043b\u043e\u0433\u043e\u0432 \u0432 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u043e\u0447\u0438\u0442\u0430\u0435\u043c\u043e\u043c \u0432\u0438\u0434\u0435. \u0415\u0441\u043b\u0438 \u0432\u044b \u0437\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u043d\u044b \u0432 \u043a\u0430\u043a\u0438\u0445 \u0442\u043e \u0444\u0438\u0447\u0430\u0445 \u0442\u043e \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b \u043f\u0438\u0441\u0430\u0442\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c.<\/p>\n<p>  \u0412\u043f\u043e\u043b\u043d\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0447\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u043d\u0430 \u0430\u0440\u0445\u0438\u0432\u0430\u0445 \u0440\u0430\u0431\u043e\u0447\u0435\u0439 \u0411\u0414 \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u043a\u0430\u043a\u0438\u0435 \u0442\u043e \u043f\u043e\u0434\u0432\u043e\u0434\u043d\u044b\u0435 \u043a\u0430\u043c\u043d\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043a\u0430\u043a \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 UPDATE-\u044b, \u0435\u0441\u043b\u0438 \u043c\u044b \u00ab\u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u00bb \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0447\u0430\u0441\u0442\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u043d\u0430 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0447\u0430\u0441\u0442\u043e\u0435 \u0432\u0430\u043a\u0443\u0443\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435? \u042f \u043d\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u043b. \u041d\u043e \u0432 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043b\u0443\u0447\u0448\u0435 \u0438\u043c\u0435\u0442\u044c \u0445\u043e\u0442\u044c \u043a\u0430\u043a\u0443\u044e \u0442\u043e \u043d\u0430\u0434\u0435\u0436\u0434\u0443 \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0443, \u0447\u0435\u043c \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0438\u043a\u0430\u043a\u043e\u0439.      \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\/226481\/\"> http:\/\/habrahabr.ru\/post\/226481\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">\n<h4>\u0412\u0432\u043e\u0434\u043d\u0430\u044f<\/h4>\n<p>  \u0412 \u0421\u0423\u0411\u0414 Postgres \u0435\u0441\u0442\u044c \u0442\u0430\u043a\u043e\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435 \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u2014 \u043f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c \u043a\u0430\u043a \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043d\u0430\u0447\u0430\u0442\u044c \u0447\u0442\u043e \u0442\u043e \u043c\u0435\u043d\u044f\u0442\u044c \u0432 \u0444\u0430\u0439\u043b\u0430\u0445 \u0441\u0430\u043c\u043e\u0439 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0421\u0423\u0411\u0414 \u043f\u0438\u0448\u0435\u0442 \u0443\u0436\u0435 \u043f\u0435\u0440\u0435\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0435 \u0432\u043e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0432 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0436\u0443\u0440\u043d\u0430\u043b \u2014 Write-Ahead Log, \u0430 \u043f\u043e\u0441\u043b\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0433\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u0434\u0435\u043b\u0430\u0435\u0442 \u0432 \u044d\u0442\u043e\u043c \u0436\u0443\u0440\u043d\u0430\u043b\u0435 \u043f\u043e\u043c\u0435\u0442\u043a\u0443. \u0421\u0434\u0435\u043b\u0430\u043d\u043e \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u0434\u043b\u044f \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u0441\u043b\u0435 \u0441\u0431\u043e\u0435\u0432, \u043d\u043e \u0432 \u0438\u0442\u043e\u0433\u0435 \u043f\u044b\u0442\u043b\u0438\u0432\u044b\u0439 \u0443\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0434\u043e\u0448\u0435\u043b \u0434\u043e \u0438\u0434\u0435\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u0436\u0443\u0440\u043d\u0430\u043b \u0434\u043b\u044f \u0440\u0435\u0437\u0435\u0440\u0432\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u0438. \u0412 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435 \u043b\u043e\u0433\u0438\u0447\u043d\u043e, \u0432\u0441\u0435 \u0445\u043e\u0434\u044b \u0432 \u043d\u0451\u043c \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u044b, \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0431\u044d\u043a\u0430\u043f\u0430, \u043d\u043e \u0438 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0431\u0430\u0437\u044b \u043d\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u043f\u0440\u0435\u0440\u0432\u0430\u0432 \u043f\u0440\u043e\u0438\u0433\u0440\u044b\u0432\u0430\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 WAL-\u043b\u043e\u0433\u0430 \u0432 \u043d\u0443\u0436\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442.<\/p>\n<p>  \u041e\u0434\u043d\u0430\u043a\u043e \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0442\u0430\u043a\u043e\u0439 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u2014 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c \u0432 \u043f\u043e\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u0438\u043a \u0432\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u0431\u044d\u043a\u0430\u043f \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b\u0438 \u0430\u0440\u0445\u0438\u0432\u0430\u0446\u0438\u044e WAL-\u043b\u043e\u0433\u043e\u0432, \u0432 \u0441\u0440\u0435\u0434\u0443 \u0432\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043b\u0438 \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0441 \u043e\u0448\u0438\u0431\u043e\u0447\u043d\u043e\u0439 \u043c\u0430\u0441\u043a\u043e\u0439, \u0430 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b\u0438 \u044d\u0442\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043f\u044f\u0442\u043d\u0438\u0446\u0443, \u043a\u043e\u0433\u0434\u0430 \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b \u0438\u0441\u0447\u0435\u0437\u043d\u043e\u0432\u0435\u043d\u0438\u0435 \u043a\u0430\u043a\u043e\u0439 \u0442\u043e \u043d\u0443\u0436\u043d\u043e\u0439 \u0435\u043c\u0443 \u0437\u0430\u043f\u0438\u0441\u0438. \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c\u0441\u044f \u0438\u0437 \u0431\u044d\u043a\u0430\u043f\u0430 \u0434\u043e \u0441\u0440\u0435\u0434\u044b, \u043f\u043e\u0442\u0435\u0440\u044f\u0432 \u0432\u0441\u044e \u0440\u0430\u0431\u043e\u0442\u0443 \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u043e\u0432 \u0437\u0430 \u0447\u0435\u0442\u0432\u0435\u0440\u0433 \u0438 \u043f\u044f\u0442\u043d\u0438\u0446\u0443.<\/p>\n<p>  \u0412\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0439 \u0432\u043e\u043f\u0440\u043e\u0441, \u0430 \u043d\u0435\u043b\u044c\u0437\u044f \u043b\u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u043e\u0438\u0433\u0440\u044b\u0432\u0430\u043d\u0438\u0435 WAL-\u043b\u043e\u0433\u043e\u0432 \u0441 \u043f\u043e\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u0438\u043a\u0430 \u043f\u043e \u043f\u044f\u0442\u043d\u0438\u0446\u0443, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0432 \u043d\u0430\u0448 \u00ab\u043e\u0448\u0438\u0431\u043e\u0447\u043d\u044b\u0439\u00bb \u0437\u0430\u043f\u0440\u043e\u0441?<\/p>\n<p>  \u0412 \u043e\u0431\u044b\u0447\u043d\u043e\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u044f \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u043b\u0441\u044f \u0431\u044b \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u043c \u043d\u0430 \u0444\u043e\u0440\u0443\u043c, \u043d\u043e \u0443 \u043c\u0435\u043d\u044f \u0431\u044b\u043b\u043e 2 \u0434\u0438\u0441\u0442\u0440\u0438\u0431\u0443\u0442\u0438\u0432\u0430 FreeBSD, 10 \u0442\u0430\u0440\u0431\u043e\u043b\u043b\u043e\u0432 \u0441 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0430\u043c\u0438 PostgresSQL \u0440\u0430\u0437\u043d\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u0439, 10\u0413\u0431 \u043c\u0435\u0441\u0442\u0430 \u043d\u0430 \u0432\u0438\u043d\u0442\u0435, gcc, \u0434\u0432\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0435\u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0445 \u043d\u0435\u0434\u0435\u043b\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0442\u0435\u043a\u0438\u043b\u0430, \u0440\u043e\u043c, \u044f\u0449\u0438\u043a \u043f\u0438\u0432\u0430 \u0438 \u043e\u0431\u0440\u044b\u0432\u043e\u0447\u043d\u044b\u0435 \u0432\u043e\u0441\u043f\u043e\u043c\u0438\u043d\u0430\u043d\u0438\u044f \u043e \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0435 \u044f\u0437\u044b\u043a\u0430 C. \u041d\u0435 \u0442\u043e \u0447\u0442\u043e\u0431\u044b \u044d\u0442\u043e \u0431\u044b\u043b \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u0437\u0430\u043f\u0430\u0441 \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f, \u043d\u043e \u0440\u0430\u0437 \u0443\u0436 \u0437\u0430\u0433\u043b\u044f\u043d\u0443\u043b \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u043a\u043e\u0434\u044b, \u0442\u043e \u0441\u043b\u043e\u0436\u043d\u043e \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c\u0441\u044f\u2026<\/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-226481","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/226481","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=226481"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/226481\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=226481"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=226481"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=226481"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}