{"id":9774,"date":"2017-03-14T15:21:21","date_gmt":"2017-03-14T14:21:21","guid":{"rendered":"https:\/\/www.dbi-services.com\/blog\/postgres-barman-and-dmk\/"},"modified":"2017-03-14T15:21:21","modified_gmt":"2017-03-14T14:21:21","slug":"postgres-barman-and-dmk","status":"publish","type":"post","link":"https:\/\/www.dbi-services.com\/blog\/postgres-barman-and-dmk\/","title":{"rendered":"Postgres Barman and DMK"},"content":{"rendered":"<p>As PostgreSQL is more and more present in our client\u2019s infrastructure, I wanted to describe you the barman installation and configuration. Barman is the backup and recovery tool for PostgreSQL, I configured it using DMK out tool for infrastructure administrators on Oracle, MySQL, and PostgreSQL.<\/p>\n<p>I used two virtual severs running under RedHat Enterprise Libux 7.1, one for PostgreSQL database server (pg1) ands the second for barman (pg2).<\/p>\n<p>At first I install PostgreSQL 9.6 on both servers:<\/p>\n<pre class=\"brush: sql; gutter: false; first-line: 1\">[root@pg1 ~]# wget https:\/\/download.postgresql.org\/pub\/repos\/yum\/9.6\/redhat\/\nrhel-7-x86_64\/pgdg-redhat96-9.6-3.noarch.rpm\n--2017-02-06 15:08:05--\u00a0 https:\/\/download.postgresql.org\/pub\/repos\/yum\/9.6\/redhat\n\/rhel-7-x86_64\/pgdg-redhat96-9.6-3.noarch.rpm\nResolving download.postgresql.org (download.postgresql.org)... \n217.196.149.55, 174.143.35.246, 87.238.57.227, ...\nConnecting to download.postgresql.org (download.postgresql.org)|\n217.196.149.55|:443... connected.\nHTTP request sent, awaiting response... 200 OK\nLength: 4816 (4.7K) [application\/x-redhat-package-manager]\nSaving to: \u00e2pgdg-redhat96-9.6-3.noarch.rpm\n\u00a0\n100%[======================================&gt;] 4,816\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \n\u00a0\n2017-02-06 15:08:05 (2.71 MB\/s) - pgdg-redhat96-9.6-3.noarch.rpm saved \n\u00a0\n[root@pg1 ~]# sudo yum localinstall -y pgdg-redhat96-9.6-3.noarch.rpm\nExamining pgdg-redhat96-9.6-3.noarch.rpm: pgdg-redhat96-9.6-3.noarch\nMarking pgdg-redhat96-9.6-3.noarch.rpm to be installed\nResolving Dependencies\n--&gt; Running transaction check\n---&gt; Package pgdg-redhat96.noarch 0:9.6-3 will be installed\n--&gt; Finished Dependency Resolution\n\u00a0\nDependencies Resolved\n\u00a0\n================================================================================\n\u00a0Package\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Arch\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Version\u00a0\u00a0\u00a0\u00a0 Repository\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Size\n================================================================================\nInstalling:\n\u00a0pgdg-redhat96\u00a0\u00a0\u00a0\u00a0 noarch\u00a0\u00a0\u00a0\u00a0 9.6-3\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/pgdg-redhat96-9.6-3.noarch\u00a0\u00a0\u00a0\u00a0 2.7 k\n\u00a0\nTransaction Summary\n================================================================================\nInstall\u00a0 1 Package\n\u00a0\nTotal size: 2.7 k\nInstalled size: 2.7 k\nDownloading packages:\nRunning transaction check\nRunning transaction test\nTransaction test succeeded\nRunning transaction\n\u00a0 Installing : pgdg-redhat96-9.6-3.noarch\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1\/1\n\u00a0 Verifying\u00a0 : pgdg-redhat96-9.6-3.noarch\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1\/1\n\u00a0\nInstalled:\n\u00a0 pgdg-redhat96.noarch 0:9.6-3\n\u00a0\nComplete!\n\n<\/pre>\n<p>I install barman on the barman server (pg2):<\/p>\n<pre class=\"brush: sql; gutter: false; first-line: 1\">[root@pg2 ~]# sudo yum install barman\npgdg96\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 | 4.1 kB\u00a0\u00a0\u00a0\u00a0 00:00\n(1\/2): pgdg96\/7Server\/x86_64\/group_gz\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0 249 B\u00a0\u00a0 00:00\n(2\/2): pgdg96\/7Server\/x86_64\/primary_db\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0\u00a0| 129 kB\u00a0\u00a0 00:02\nResolving Dependencies\n--&gt; Running transaction check\n---&gt; Package barman.noarch 0:2.1-1.rhel7 will be installed\n--&gt; Processing Dependency: python-psycopg2 &gt;= 2.4.2 for package:\nbarman-2.1-1.rhel7.noarch\n--&gt; Processing Dependency: python-argh &gt;= 0.21.2 for package: \nbarman-2.1-1.rhel7.noarch\n--&gt; Processing Dependency: python-dateutil for package: \nbarman-2.1-1.rhel7.noarch\n--&gt; Processing Dependency: python-argcomplete for package: \nbarman-2.1-1.rhel7.noarch\n--&gt; Running transaction check\n---&gt; Package python-argcomplete.noarch 0:0.3.7-1.rhel7 will be installed\n---&gt; Package python-argh.noarch 0:0.23.0-1.rhel7 will be installed\n---&gt; Package python-dateutil.noarch 1:2.5.3-3.rhel7 will be installed\n--&gt; Processing Dependency: python-six for package: 1:\npython-dateutil-2.5.3-3.rhel7.noarch\n---&gt; Package python-psycopg2.x86_64 0:2.6.2-3.rhel7 will be installed\n--&gt; Processing Dependency: postgresql96-libs for package: \npython-psycopg2-2.6.2-3.rhel7.x86_64\n--&gt; Running transaction check\n---&gt; Package postgresql96-libs.x86_64 0:9.6.1-1PGDG.rhel7 will be installed\n---&gt; Package python-six.noarch 0:1.9.0-2.el7 will be installed\n--&gt; Finished Dependency Resolution\n\u00a0\nDependencies Resolved\n\u00a0\n================================================================================\n\u00a0Package\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Arch\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Version\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Repository\u00a0\u00a0\u00a0\u00a0\u00a0 Size\n================================================================================\nInstalling:\n\u00a0barman\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 noarch\u00a0\u00a0\u00a0\u00a0 2.1-1.rhel7\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 pgdg96\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 248 k\nInstalling for dependencies:\n\u00a0postgresql96-libs\u00a0\u00a0\u00a0\u00a0\u00a0 x86_64\u00a0\u00a0\u00a0\u00a0 9.6.1-1PGDG.rhel7\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 pgdg96\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 308 k\n\u00a0python-argcomplete\u00a0\u00a0\u00a0\u00a0 noarch\u00a0\u00a0\u00a0\u00a0 0.3.7-1.rhel7\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 pgdg96\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 23 k\n\u00a0python-argh\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 noarch\u00a0\u00a0\u00a0\u00a0 0.23.0-1.rhel7\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 pgdg96\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 33 k\n\u00a0python-dateutil\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 noarch\u00a0\u00a0\u00a0\u00a0 1:2.5.3-3.rhel7\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 pgdg96\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 241 k\n\u00a0python-psycopg2\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 x86_64\u00a0\u00a0\u00a0\u00a0 2.6.2-3.rhel7\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 pgdg96\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 131 k\n\u00a0python-six\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 noarch\u00a0\u00a0\u00a0\u00a0 1.9.0-2.el7\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ol7_latest\u00a0\u00a0\u00a0\u00a0\u00a0 28 k\n\u00a0\nTransaction Summary\n================================================================================\nInstall\u00a0 1 Package (+6 Dependent packages)\n\u00a0\nTotal download size: 1.0 M\nInstalled size: 3.6 M\nIs this ok [y\/d\/N]: y\nDownloading packages:\n(1\/7): barman-2.1-1.rhel7.noarch.rpm\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 | 248 kB\u00a0\u00a0 00:03\n(2\/7): python-argcomplete-0.3.7-1.rhel7.noarch.rpm\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0 23 kB\u00a0\u00a0 00:00\n(3\/7): python-argh-0.23.0-1.rhel7.noarch.rpm\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0 33 kB\u00a0\u00a0 00:00\n(4\/7): postgresql96-libs-9.6.1-1PGDG.rhel7.x86_64.rpm\u00a0\u00a0\u00a0\u00a0\u00a0 | 308 kB\u00a0\u00a0 00:04\n(5\/7): python-six-1.9.0-2.el7.noarch.rpm\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0 28 kB\u00a0\u00a0 00:00\n(6\/7): python-dateutil-2.5.3-3.rhel7.noarch.rpm\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 | 241 kB\u00a0\u00a0 00:01\n(7\/7): python-psycopg2-2.6.2-3.rhel7.x86_64.rpm\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 | 131 kB\u00a0\u00a0 00:01\n--------------------------------------------------------------------------------\nTotal\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 163 kB\/s | 1.0 MB\u00a0 00:06\nRunning transaction check\nRunning transaction test\nTransaction test succeeded\nRunning transaction\n\u00a0 Installing : python-argh-0.23.0-1.rhel7.noarch\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1\/7\n\u00a0 Installing : postgresql96-libs-9.6.1-1PGDG.rhel7.x86_64\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 2\/7\n\u00a0 Installing : python-psycopg2-2.6.2-3.rhel7.x86_64\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 3\/7\n\u00a0 Installing : python-argcomplete-0.3.7-1.rhel7.noarch\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 4\/7\n\u00a0 Installing : python-six-1.9.0-2.el7.noarch\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 5\/7\n\u00a0 Installing : 1:python-dateutil-2.5.3-3.rhel7.noarch\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 6\/7\n\u00a0 Installing : barman-2.1-1.rhel7.noarch\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 7\/7\n\u00a0 Verifying\u00a0 : python-psycopg2-2.6.2-3.rhel7.x86_64\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1\/7\n\u00a0 Verifying\u00a0 : python-six-1.9.0-2.el7.noarch\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 2\/7\n\u00a0 Verifying\u00a0 : python-argcomplete-0.3.7-1.rhel7.noarch\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 3\/7\n\u00a0 Verifying\u00a0 : postgresql96-libs-9.6.1-1PGDG.rhel7.x86_64\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 4\/7\n\u00a0 Verifying\u00a0 : python-argh-0.23.0-1.rhel7.noarch\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 5\/7\n\u00a0 Verifying\u00a0 : barman-2.1-1.rhel7.noarch\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 6\/7\n\u00a0 Verifying\u00a0 : 1:python-dateutil-2.5.3-3.rhel7.noarch\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 7\/7\n\u00a0\nInstalled:\n\u00a0 barman.noarch 0:2.1-1.rhel7\n\u00a0\nDependency Installed:\n\u00a0 postgresql96-libs.x86_64 0:9.6.1-1PGDG.rhel7\n\u00a0 python-argcomplete.noarch 0:0.3.7-1.rhel7\n\u00a0 python-argh.noarch 0:0.23.0-1.rhel7\n\u00a0 python-dateutil.noarch 1:2.5.3-3.rhel7\n\u00a0 python-psycopg2.x86_64 0:2.6.2-3.rhel7\n\u00a0 python-six.noarch 0:1.9.0-2.el7\nComplete!<\/pre>\n<p>Everything is installed on both servers\u00a0:<\/p>\n<p>&#8211; PostgreSQL 9.6<\/p>\n<p>&#8211; DMK last version<\/p>\n<p>&#8211; barman<\/p>\n<p>Now we configure as follows:<\/p>\n<p>The barman server is pg2 : 192.168.1.101<\/p>\n<p>The database server is pg1 : 192.168.1.100<\/p>\n<p>&nbsp;<\/p>\n<p>On the database server, we create a barman user:<\/p>\n<pre class=\"brush: sql; gutter: false; first-line: 1\">postgres@:5432) [postgres] &gt; create user barman superuser login encrypted password \n'barman';\nCREATE ROLE<\/pre>\n<p>And a barman_streaming user:<\/p>\n<pre class=\"brush: sql; gutter: false; first-line: 1\">postgres@: [postgres] &gt; create user barman_streaming replication encrypted password \n'barman';\nCREATE ROLE<\/pre>\n<p>We modify the following parameters max_replication_slots (which specifies the maximum number of replication slots the server can support), and max_wal_senders (specifies the maximum number of simultaneously running wal sender processes):<\/p>\n<pre class=\"brush: sql; gutter: false; first-line: 1\">postgres@:5432) [postgres] &gt; alter system set max_replication_slots=10;\nALTER SYSTEM<\/pre>\n<pre class=\"brush: sql; gutter: false; first-line: 1\">postgres@:5432) [postgres] &gt; alter system set max_wal_senders=10;<\/pre>\n<pre class=\"brush: sql; gutter: false; first-line: 1\">ALTER SYSTEM<\/pre>\n<p>As those previous parameters have been modified, we need to restart the database, we use pgrestart which is a DMK alias for pg_ctl -D ${PGDATA} restart -m fast<\/p>\n<pre class=\"brush: sql; gutter: false; first-line: 1\">postgres@pg1:\/home\/postgres\/ [PG1] pgrestart\nwaiting for server to shut down.... done\nserver stopped\nserver starting\npostgres@pg1:\/home\/postgres\/ [PG1] 2017-02-06 15:59:14.756 CET - 1 - 17008 -\u00a0 \n- @ LOG:\u00a0 redirecting log output to logging collector process\n2017-02-06 15:59:14.756 CET - 2 - 17008 -\u00a0 - \n@ HINT:\u00a0 Future log output will appear in directory \n\"\/u01\/app\/postgres\/admin\/PG1\/pg_log\".<\/pre>\n<p>We modify the pg_hba.conf on the barman server in order to allow connections from the barman server to the database server as follows:<\/p>\n<pre class=\"brush: sql; gutter: false; first-line: 1\">host\u00a0\u00a0\u00a0 all\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0\u00a0barman\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 192.168.1.101\/24\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 md5\nhost\u00a0\u00a0\u00a0 replication\u00a0\u00a0\u00a0 \u00a0barman_streaming 192.168.1.101\/24\u00a0\u00a0\u00a0\u00a0\u00a0 md5<\/pre>\n<p>We modify the .pgpass file on the barman server in order not to be asked for passwords:<\/p>\n<pre class=\"brush: sql; gutter: false; first-line: 1\">postgres@pg2:\/home\/postgres\/ [pg96] cat .pgpass\n*:*:*:postgres:postgres\n192.168.1.100:*:*:barman:barman\n192.168.1.100:*:*:barman_streaming:barman<\/pre>\n<p>Finally we test the connection from the barman server to the database server:<\/p>\n<pre class=\"brush: sql; gutter: false; first-line: 1\">postgres@pg2:\/home\/postgres\/ [pg96] psql -c 'select version()'\n -U barman -h 192.168.1.100 -p 5432 postgres\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 version\n\u00a0\n--------------------------------------------------------------------------------\n\n\u00a0PostgreSQL 9.6.1 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (\nRed Hat 4.8.5-11), 64-bit\n(1 row)<\/pre>\n<pre class=\"brush: sql; gutter: false; first-line: 1\">postgres@pg2:\/home\/postgres\/ [pg96] psql -U barman_streaming -h 192.168.1.100 \n-p 5432 -c \"IDENTIFY_SYSTEM\" replication=1\n\u00a0\u00a0\u00a0\u00a0\u00a0 systemid\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 | timeline |\u00a0 xlogpos\u00a0 | dbname\n---------------------+----------+-----------+--------\n\u00a06384063115439945376 |\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1 | 0\/F0006F0 |\n(1 row)<\/pre>\n<p>Now it\u2019s time to create a configuration file pg96.conf in $DMK_HOME\/etc\/barman.d in the barman server:<\/p>\n<pre class=\"brush: sql; gutter: false; first-line: 1\">[pg96]\ndescription =\u00a0 \"PostgreSQL 9.6 server\"\nconninfo = host=192.168.1.100 port=5432 user=barman dbname=postgres\nbackup_method = postgres\nstreaming_conninfo = host=192.168.1.100 port=5432 user=barman_streaming \ndbname=postgres\nstreaming_wals_directory = \/u99\/received_wal\nstreaming_archiver = on\nslot_name = barman<\/pre>\n<p>We create a barman.conf file in $DMK_HOME\/etc as follows, mainly defining the barman_user, the configuration file directory and the barman backup home, the barman lock directory and the log directory:<\/p>\n<pre class=\"brush: sql; gutter: false; first-line: 1\">postgres@pg2:\/u01\/app\/postgres\/local\/dmk\/etc\/ [pg96] cat barman.conf\n; Barman, Backup and Recovery Manager for PostgreSQL\n; http:\/\/www.pgbarman.org\/ - http:\/\/www.2ndQuadrant.com\/\n;\n; Main configuration file\n\u00a0\n[barman]\n; System user\nbarman_user = postgres\n\u00a0\n; Directory of configuration files. Place your sections in separate files \nwith .conf extension\n; For example place the 'main' server section in \/etc\/barman.d\/main.conf\nconfiguration_files_directory = \/u01\/app\/postgres\/local\/dmk\/etc\/barman.d\n\u00a0\n; Main directory\nbarman_home = \/u99\/backup\n\u00a0\n; Locks directory - default: %(barman_home)s\nbarman_lock_directory = \/u01\/app\/postgres\/local\/dmk\/etc\/\n\u00a0\n; Log location\nlog_file = \/u01\/app\/postgres\/local\/dmk\/log\/barman.log\n\u00a0\n; Log level (see https:\/\/docs.python.org\/3\/library\/logging.html#levels)\nlog_level = DEBUG\n\u00a0\n; Default compression level: possible values are None (default), \nbzip2, gzip, pigz, pygzip or pybzip2\ncompression = gzip\n\u00a0\n; Pre\/post backup hook scripts\n;pre_backup_script = env | grep ^BARMAN\n;pre_backup_retry_script = env | grep ^BARMAN\n;post_backup_retry_script = env | grep ^BARMAN\n;post_backup_script = env | grep ^BARMAN\n\u00a0\n; Pre\/post archive hook scripts\n;pre_archive_script = env | grep ^BARMAN\n;pre_archive_retry_script = env | grep ^BARMAN\n;post_archive_retry_script = env | grep ^BARMAN\n;post_archive_script = env | grep ^BARMAN\n\u00a0\n; Global retention policy (REDUNDANCY or RECOVERY WINDOW) - default empty\nretention_policy = RECOVERY WINDOW OF 4 WEEKS\n\u00a0\n; Global bandwidth limit in KBPS - default 0 (meaning no limit)\n;bandwidth_limit = 4000\n\u00a0\n; Immediate checkpoint for backup command - default false\n;immediate_checkpoint = false\n\u00a0\n; Enable network compression for data transfers - default false\n;network_compression = false\n\u00a0\n; Number of retries of data copy during base backup after an error - default 0\n;basebackup_retry_times = 0\n\u00a0\n; Number of seconds of wait after a failed copy, before retrying - default 30\n;basebackup_retry_sleep = 30\n\u00a0\n; Maximum execution time, in seconds, per server\n; for a barman check command - default 30\n;check_timeout = 30\n\u00a0\n; Time frame that must contain the latest backup date.\n; If the latest backup is older than the time frame, barman check\n; command will report an error to the user.\n; If empty, the latest backup is always considered valid.\n; Syntax for this option is: \"i (DAYS | WEEKS | MONTHS)\" where i is an\n; integer &gt; 0 which identifies the number of days | weeks | months of\n; validity of the latest backup for this check. Also known as 'smelly backup'.\n;last_backup_maximum_age =\n\u00a0\n; Minimum number of required backups (redundancy)\n;minimum_redundancy = 1<\/pre>\n<p>&nbsp;<\/p>\n<p>In order to enable streaming of transaction logs and to use replication slots, we run the following command on the barman server:<\/p>\n<pre class=\"brush: sql; gutter: false; first-line: 1\">postgres@pg2:\/u01\/app\/postgres\/local\/dmk\/etc\/ [pg96] barman receive-wal \n--create-slot pg96\nCreating physical replication slot 'barman' on server 'pg96'\nReplication slot 'barman' created<\/pre>\n<p>Then we can test:<\/p>\n<p>We can force a log switch on the database server:<\/p>\n<pre class=\"brush: sql; gutter: false; first-line: 1\">postgres@pg2:\/u01\/app\/postgres\/local\/dmk\/etc\/ [pg96] barman switch-xlog \n--force pg96\nThe xlog file 00000001000000000000000F has been closed on server 'pg96'<\/pre>\n<p>&nbsp;<\/p>\n<p>We start receive wal:<\/p>\n<pre class=\"brush: sql; gutter: false; first-line: 1\">postgres@pg2:\/u99\/received_wal\/ [pg96] barman -c \n\/u01\/app\/postgres\/local\/dmk\/etc\/barman.conf receive-wal pg96\nStarting receive-wal for server pg96\npg96: pg_receivexlog: starting log streaming at 0\/68000000 (timeline 3)\npg96: pg_receivexlog: finished segment at 0\/69000000 (timeline 3)\npg96: pg_receivexlog: finished segment at 0\/6A000000 (timeline 3)\npg96: pg_receivexlog: finished segment at 0\/6B000000 (timeline 3)\npg96: pg_receivexlog: finished segment at 0\/6C000000 (timeline 3)<\/pre>\n<p>&nbsp;<\/p>\n<p>We can check the barman configuration:<\/p>\n<pre class=\"brush: sql; gutter: false; first-line: 1\">postgres@pg2:\/u99\/restore_test\/ [pg96] barman check pg96\nServer pg96:\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 PostgreSQL: OK\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 superuser: OK\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 PostgreSQL streaming: OK\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 wal_level: OK\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 replication slot: OK\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 directories: OK\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 retention policy settings: OK\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 backup maximum age: OK (no last_backup_maximum_age provided)\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 compression settings: OK\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 failed backups: FAILED (there are 1 failed backups)\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 minimum redundancy requirements: OK (have 3 backups, \n                    expected at least 0)\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 pg_basebackup: OK\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 pg_basebackup compatible: OK\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 pg_basebackup supports tablespaces mapping: OK\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 pg_receivexlog: OK\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 pg_receivexlog compatible: OK\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 receive-wal running: OK\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 archiver errors: OK<\/pre>\n<p>We can run a barman archive-wal command:<\/p>\n<pre class=\"brush: sql; gutter: false; first-line: 1\">postgres@pg2:\/home\/postgres\/ [pg96] barman archive-wal pg96\nProcessing xlog segments from streaming for pg96\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 00000003.history\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 000000030000000000000067\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 000000030000000000000068<\/pre>\n<p>And finally you can run a backup with the command:<\/p>\n<pre class=\"brush: sql; gutter: false; first-line: 1\">postgres@pg2:\/home\/postgres\/ [pg96] barman backup pg96\nStarting backup using postgres method for server pg96 in \n\/u99\/backup\/pg96\/base\/20170214T103226\nBackup start at xlog location: 0\/69000060 (000000030000000000000069, 00000060)\nCopying files.\nCopy done.\nFinalising the backup.\nBackup size: 60.1 MiB\nBackup end at xlog location: 0\/6B000000 (00000003000000000000006A, 00000000)\nBackup completed\nProcessing xlog segments from streaming for pg96\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 000000030000000000000069<\/pre>\n<p>We can list the backups\u00a0:<\/p>\n<pre class=\"brush: sql; gutter: false; first-line: 1\">postgres@pg2:\/u02\/pgdata\/ [pg96] barman list-backup pg96\npg96 20170214T103226 - Tue Feb 14 09:32:27 2017 - Size: 60.2 MiB - WAL Size: 0 B \n(tablespaces: tab1:\/u02\/pgdata\/PG1\/mytab)\npg96 20170207T061338 - Tue Feb\u00a0 7 06:19:38 2017 - Size: 29.0 MiB - WAL Size: 0 B\npg96 20170207T060633 - Tue Feb\u00a0 7 06:12:33 2017 - Size: 29.0 MiB - WAL Size: 0 B<\/pre>\n<p>&nbsp;<\/p>\n<p>We have the possibility to test a restore for example on the barman server :<\/p>\n<pre class=\"brush: sql; gutter: false; first-line: 1\">postgres@pg2:\/u02\/pgdata\/ [pg96] barman recover pg96 20170214T103226 \n\/u99\/restore_test\/\nStarting local restore for server pg96 using backup 20170214T103226\nDestination directory: \/u99\/restore_test\/\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 24648, tab1, \/u02\/pgdata\/PG1\/mytab\nCopying the base backup.\nCopying required WAL segments.\nGenerating archive status files\nIdentify dangerous settings in destination directory.\n\u00a0\nIMPORTANT\nThese settings have been modified to prevent data losses\n\u00a0\npostgresql.conf line 71: archive_command = false\npostgresql.auto.conf line 4: archive_command = false<\/pre>\n<p>Your PostgreSQL server has been successfully prepared for recovery, the \/u99\/test_restore directory contains:<\/p>\n<p>postgres@pg2:\/u99\/restore_test\/ [pg96] ll<\/p>\n<pre class=\"brush: sql; gutter: false; first-line: 1\">total 64\n-rw-------\u00a0 1 postgres postgres\u00a0 208 Feb 14 10:32 backup_label\n-rw-------\u00a0 1 postgres postgres\u00a0 207 Feb 14 10:32 backup_label.old\ndrwx------ 10 postgres postgres \u00a0 98 Feb 14 10:32 base\ndrwx------\u00a0 2 postgres postgres 4096 Feb 14 10:32 global\ndrwx------\u00a0 2 postgres postgres\u00a0 \u00a0 6 Feb 14 10:32 mytab\ndrwx------\u00a0 2 postgres postgres \u00a0 17 Feb 14 10:32 pg_clog\ndrwx------\u00a0 2 postgres postgres\u00a0 \u00a0 6 Feb 14 10:32 pg_commit_ts\ndrwx------\u00a0 2 postgres postgres\u00a0 \u00a0 6 Feb 14 10:32 pg_dynshmem\n-rw-------\u00a0 1 postgres postgres 4416 Feb 14 10:32 pg_hba.conf\n-rw-------\u00a0 1 postgres postgres 4211 Feb 14 10:32 pg_hba.conf_conf\n-rw-------\u00a0 1 postgres postgres 1636 Feb 14 10:32 pg_ident.conf\ndrwx------\u00a0 4 postgres postgres \u00a0 65 Feb 14 10:32 pg_logical\ndrwx------\u00a0 4 postgres postgres \u00a0 34 Feb 14 10:32 pg_multixact\ndrwx------\u00a0 2 postgres postgres \u00a0 17 Feb 14 10:32 pg_notify\ndrwx------\u00a0 2 postgres postgres\u00a0 \u00a0 6 Feb 14 10:32 pg_replslot\ndrwx------\u00a0 2 postgres postgres\u00a0 \u00a0 6 Feb 14 10:32 pg_serial\ndrwx------\u00a0 2 postgres postgres\u00a0 \u00a0 6 Feb 14 10:32 pg_snapshots\ndrwx------\u00a0 2 postgres postgres\u00a0 \u00a0 6 Feb 14 10:32 pg_stat\ndrwx------\u00a0 2 postgres postgres\u00a0 \u00a0 6 Feb 14 10:32 pg_stat_tmp\ndrwx------\u00a0 2 postgres postgres \u00a0 17 Feb 14 10:32 pg_subtrans\ndrwx------\u00a0 2 postgres postgres \u00a0 18 Feb 14 10:32 pg_tblspc\ndrwx------\u00a0 2 postgres postgres\u00a0 \u00a0 6 Feb 14 10:32 pg_twophase\n-rw-------\u00a0 1 postgres postgres\u00a0 \u00a0 4 Feb 14 10:32 PG_VERSION\ndrwx------\u00a0 3 postgres postgres \u00a0 81 Feb 14 10:39 pg_xlog\n-rw-------\u00a0 1 postgres postgres\u00a0 391 Feb 14 10:39 postgresql.auto.conf\n-rw-------\u00a0 1 postgres postgres\u00a0 358 Feb 14 10:32 postgresql.auto.conf.origin\n-rw-------\u00a0 1 postgres postgres 7144 Feb 14 10:39 postgresql.conf\n-rw-------\u00a0 1 postgres postgres 7111 Feb 14 10:32 postgresql.conf.origin\n-rw-------\u00a0 1 postgres postgres \u00a0 56 Feb 14 10:32 recovery.done<\/pre>\n<p>If you need to \u00a0restore your backup on the pg1 original database server, you have to use the &#8211;remote-ssh-command as follows (you specify the hostname where you want restore, and the PGDATA directory)<\/p>\n<pre class=\"brush: sql; gutter: false; first-line: 1\">postgres@pg2:\/home\/postgres\/.ssh\/ [pg96] barman recover --remote-ssh-command \"ssh postgres@pg1\" pg96 20170214T103226 \/u02\/pgdata\/PG1\nStarting remote restore for server pg96 using backup 20170214T103226\nDestination directory: \/u02\/pgdata\/PG1\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 24648, tab1, \/u02\/pgdata\/PG1\/mytab\nCopying the base backup.\nCopying required WAL segments.\nGenerating archive status files\nIdentify dangerous settings in destination directory.\n\u00a0\nIMPORTANT\nThese settings have been modified to prevent data losses\n\u00a0\npostgresql.conf line 71: archive_command = false\npostgresql.auto.conf line 4: archive_command = false\n\u00a0\nYour PostgreSQL server has been successfully prepared for recovery!<\/pre>\n<p>You also have the possibility to realise a point in time recovery.<\/p>\n<p>In my PG1 database I create a table employes and insert some data\u00a0:<\/p>\n<pre class=\"brush: sql; gutter: false; first-line: 1\">postgres@[local]:5432) [blubb] &gt; create table employes (name varchar(10));\nCREATE TABLE\n(postgres@[local]:5432) [blubb] &gt; insert into employes values ('fiona');\nINSERT 0 1\n(postgres@[local]:5432) [blubb] &gt; insert into employes values ('cathy');\nINSERT 0 1\n(postgres@[local]:5432) [blubb] &gt; insert into employes values ('helene');\nINSERT 0 1\n(postgres@[local]:5432) [blubb] &gt; select * from employes;\n\u00a0 name \u00a0\n--------\n\u00a0fiona\n\u00a0cathy\n\u00a0helene<\/pre>\n<p>A few minutes later I insert some more records in the employes table:<\/p>\n<pre class=\"brush: sql; gutter: false; first-line: 1\">postgres@[local]:5432) [blubb] &gt; insert into employes values ('larry');\nINSERT 0 1\n(postgres@[local]:5432) [blubb] &gt; insert into employes values ('bill');\nINSERT 0 1\n(postgres@[local]:5432) [blubb] &gt; insert into employes values ('steve');\nINSERT 0 1\n(postgres@[local]:5432) [blubb] &gt; select * from employes;\n\u00a0 name \u00a0\n--------\n\u00a0fiona\n\u00a0cathy\n\u00a0helene\n\u00a0larry\n\u00a0bill\n\u00a0steve<\/pre>\n<p>The first data were create at 15:15, let\u2019s see if the pitr barman restore works correctly:<\/p>\n<p>I stop the PG1 database :<\/p>\n<pre class=\"brush: sql; gutter: false; first-line: 1\">postgres@pg1:\/u02\/pgdata\/ [PG1] pgstop\nwaiting for server to shut down....... done\nserver stopped<\/pre>\n<p>I delete the PGDATA directory:<\/p>\n<pre class=\"brush: sql; gutter: false; first-line: 1\">postgres@pg1:\/u02\/pgdata\/ [PG1] rm -rf PG1<\/pre>\n<p>And from the barman server I run the pitr recovery command using the &#8211;target-time argument:<\/p>\n<pre class=\"brush: sql; gutter: false; first-line: 1\">postgres@pg2:\/home\/postgres\/ [pg96] barman recover --remote-ssh-command \"ssh postgres@pg1\" pg96 \n--target-time \"2017-02-14 15:15:48\"\u00a0 20170214T141055 \/u02\/pgdata\/PG1\u00a0\nStarting remote restore for server pg96 using backup 20170214T141055\nDestination directory: \/u02\/pgdata\/PG1\nDoing PITR. Recovery target time: '2017-02-14 15:15:48'\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 24648, tab1, \/u02\/pgdata\/PG1\/mytab\nCopying the base backup.\nCopying required WAL segments.\nGenerating recovery.conf\nIdentify dangerous settings in destination directory.\n\u00a0\nIMPORTANT\nThese settings have been modified to prevent data losses\n\u00a0\npostgresql.conf line 72: archive_command = false\npostgresql.auto.conf line 4: archive_command = false\n\u00a0\nYour PostgreSQL server has been successfully prepared for recovery!<\/pre>\n<p>I restart my PG1 database the data are correctly restored, just before the Larry, Bill and Steve insertion into the employes tables<\/p>\n<pre class=\"brush: sql; gutter: false; first-line: 1\">postgres@[local]:5432) [blubb] &gt; select * from employes;\n\u00a0 name \u00a0\n--------\n\u00a0fiona\n\u00a0cathy\n\u00a0helene\n(3 rows)\n\n<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As PostgreSQL is more and more present in our client\u2019s infrastructure, I wanted to describe you the barman installation and configuration. Barman is the backup and recovery tool for PostgreSQL, I configured it using DMK out tool for infrastructure administrators on Oracle, MySQL, and PostgreSQL. I used two virtual severs running under RedHat Enterprise Libux&hellip;&nbsp;<\/p>\n","protected":false},"author":27,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"neve_meta_sidebar":"","neve_meta_container":"","neve_meta_enable_content_width":"","neve_meta_content_width":0,"neve_meta_title_alignment":"","neve_meta_author_avatar":"","neve_post_elements_order":"","neve_meta_disable_header":"","neve_meta_disable_footer":"","neve_meta_disable_title":"","neve_meta_reading_time":"","_themeisle_gutenberg_block_has_review":false,"footnotes":""},"categories":[4133],"tags":[329],"class_list":["post-9774","post","type-post","status-publish","format-standard","category-database","tag-barman"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v28.9 (Yoast SEO v28.9) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Postgres Barman and DMK - dbi services Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.dbi-services.com\/blog\/postgres-barman-and-dmk\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Postgres Barman and DMK\" \/>\n<meta property=\"og:description\" content=\"As PostgreSQL is more and more present in our client\u2019s infrastructure, I wanted to describe you the barman installation and configuration. Barman is the backup and recovery tool for PostgreSQL, I configured it using DMK out tool for infrastructure administrators on Oracle, MySQL, and PostgreSQL. I used two virtual severs running under RedHat Enterprise Libux&hellip;&nbsp;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dbi-services.com\/blog\/postgres-barman-and-dmk\/\" \/>\n<meta property=\"og:site_name\" content=\"dbi services Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/dbiservices\/\" \/>\n<meta property=\"article:published_time\" content=\"2017-03-14T14:21:21+00:00\" \/>\n<meta name=\"author\" content=\"Oracle Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@dbiservices\" \/>\n<meta name=\"twitter:site\" content=\"@dbiservices\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Oracle Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"13 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/postgres-barman-and-dmk\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/postgres-barman-and-dmk\\\/\"},\"author\":{\"name\":\"Oracle Team\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/person\\\/bf7c7eb0bec165183207237c9d0ee1d5\"},\"headline\":\"Postgres Barman and DMK\",\"datePublished\":\"2017-03-14T14:21:21+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/postgres-barman-and-dmk\\\/\"},\"wordCount\":548,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/#organization\"},\"keywords\":[\"Barman\"],\"articleSection\":[\"Database\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/postgres-barman-and-dmk\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/postgres-barman-and-dmk\\\/\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/postgres-barman-and-dmk\\\/\",\"name\":\"Postgres Barman and DMK - dbi services Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#website\"},\"datePublished\":\"2017-03-14T14:21:21+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/postgres-barman-and-dmk\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/postgres-barman-and-dmk\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/postgres-barman-and-dmk\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Postgres Barman and DMK\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/\",\"name\":\"dbi services Blog\",\"description\":\"#BeSharing\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/#organization\",\"name\":\"dbi services\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/dbi-services-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/dbi-services-logo.png\",\"width\":512,\"height\":512,\"caption\":\"dbi services\"},\"image\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/dbiservices\\\/\",\"https:\\\/\\\/x.com\\\/dbiservices\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/dbi-services\\\/\",\"https:\\\/\\\/www.youtube.com\\\/user\\\/dbiservices\"],\"description\":\"Swiss IT consulting and services company specialized in efficient data infrastructures and platforms: databases, application servers, cloud, DevOps, digitalization, analytics, data quality and monitoring. Headquartered in Del\u00e9mont with offices in Nyon, Basel, Bern and Zurich.\",\"email\":\"info@dbi-services.com\",\"telephone\":\"+41 32 422 96 00\",\"legalName\":\"dbi services SA\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/person\\\/bf7c7eb0bec165183207237c9d0ee1d5\",\"name\":\"Oracle Team\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/12\\\/oracle-square.png\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/12\\\/oracle-square.png\",\"contentUrl\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/12\\\/oracle-square.png\",\"caption\":\"Oracle Team\"},\"description\":\"Posts published under the Oracle Team account are collective contributions by the dbi services Oracle consultants. The practice covers the full Oracle Database lifecycle: architecture, migration and upgrade, high availability with RAC and Data Guard, backup and recovery, performance tuning, and engineered systems such as Oracle Database Appliance and Exadata. The team holds Oracle certifications up to Certified Master level and operates customer platforms under service level agreements.\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/author\\\/oracle-team\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Postgres Barman and DMK - dbi services Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.dbi-services.com\/blog\/postgres-barman-and-dmk\/","og_locale":"en_US","og_type":"article","og_title":"Postgres Barman and DMK","og_description":"As PostgreSQL is more and more present in our client\u2019s infrastructure, I wanted to describe you the barman installation and configuration. Barman is the backup and recovery tool for PostgreSQL, I configured it using DMK out tool for infrastructure administrators on Oracle, MySQL, and PostgreSQL. I used two virtual severs running under RedHat Enterprise Libux&hellip;&nbsp;","og_url":"https:\/\/www.dbi-services.com\/blog\/postgres-barman-and-dmk\/","og_site_name":"dbi services Blog","article_publisher":"https:\/\/www.facebook.com\/dbiservices\/","article_published_time":"2017-03-14T14:21:21+00:00","author":"Oracle Team","twitter_card":"summary_large_image","twitter_creator":"@dbiservices","twitter_site":"@dbiservices","twitter_misc":{"Written by":"Oracle Team","Est. reading time":"13 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.dbi-services.com\/blog\/postgres-barman-and-dmk\/#article","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/postgres-barman-and-dmk\/"},"author":{"name":"Oracle Team","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/bf7c7eb0bec165183207237c9d0ee1d5"},"headline":"Postgres Barman and DMK","datePublished":"2017-03-14T14:21:21+00:00","mainEntityOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/postgres-barman-and-dmk\/"},"wordCount":548,"commentCount":0,"publisher":{"@id":"https:\/\/www.dbi-services.com\/#organization"},"keywords":["Barman"],"articleSection":["Database"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.dbi-services.com\/blog\/postgres-barman-and-dmk\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.dbi-services.com\/blog\/postgres-barman-and-dmk\/","url":"https:\/\/www.dbi-services.com\/blog\/postgres-barman-and-dmk\/","name":"Postgres Barman and DMK - dbi services Blog","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/#website"},"datePublished":"2017-03-14T14:21:21+00:00","breadcrumb":{"@id":"https:\/\/www.dbi-services.com\/blog\/postgres-barman-and-dmk\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dbi-services.com\/blog\/postgres-barman-and-dmk\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.dbi-services.com\/blog\/postgres-barman-and-dmk\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.dbi-services.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Postgres Barman and DMK"}]},{"@type":"WebSite","@id":"https:\/\/www.dbi-services.com\/blog\/#website","url":"https:\/\/www.dbi-services.com\/blog\/","name":"dbi services Blog","description":"#BeSharing","publisher":{"@id":"https:\/\/www.dbi-services.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.dbi-services.com\/#organization","name":"dbi services","url":"https:\/\/www.dbi-services.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2026\/09\/dbi-services-logo.png","contentUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2026\/09\/dbi-services-logo.png","width":512,"height":512,"caption":"dbi services"},"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/dbiservices\/","https:\/\/x.com\/dbiservices","https:\/\/www.linkedin.com\/company\/dbi-services\/","https:\/\/www.youtube.com\/user\/dbiservices"],"description":"Swiss IT consulting and services company specialized in efficient data infrastructures and platforms: databases, application servers, cloud, DevOps, digitalization, analytics, data quality and monitoring. Headquartered in Del\u00e9mont with offices in Nyon, Basel, Bern and Zurich.","email":"info@dbi-services.com","telephone":"+41 32 422 96 00","legalName":"dbi services SA"},{"@type":"Person","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/bf7c7eb0bec165183207237c9d0ee1d5","name":"Oracle Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/12\/oracle-square.png","url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/12\/oracle-square.png","contentUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/12\/oracle-square.png","caption":"Oracle Team"},"description":"Posts published under the Oracle Team account are collective contributions by the dbi services Oracle consultants. The practice covers the full Oracle Database lifecycle: architecture, migration and upgrade, high availability with RAC and Data Guard, backup and recovery, performance tuning, and engineered systems such as Oracle Database Appliance and Exadata. The team holds Oracle certifications up to Certified Master level and operates customer platforms under service level agreements.","url":"https:\/\/www.dbi-services.com\/blog\/author\/oracle-team\/"}]}},"_links":{"self":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/9774","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/users\/27"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/comments?post=9774"}],"version-history":[{"count":0,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/9774\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media?parent=9774"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/categories?post=9774"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/tags?post=9774"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}