{"id":4603,"date":"2015-05-18T09:32:36","date_gmt":"2015-05-18T07:32:36","guid":{"rendered":"https:\/\/www.dbi-services.com\/blog\/getting-started-with-postgres-plus-advanced-server-2-setting-up-a-backup-and-recovery-server\/"},"modified":"2015-05-18T09:32:36","modified_gmt":"2015-05-18T07:32:36","slug":"getting-started-with-postgres-plus-advanced-server-2-setting-up-a-backup-and-recovery-server","status":"publish","type":"post","link":"https:\/\/www.dbi-services.com\/blog\/getting-started-with-postgres-plus-advanced-server-2-setting-up-a-backup-and-recovery-server\/","title":{"rendered":"getting started with postgres plus advanced server (2) &#8211; setting up a backup and recovery server"},"content":{"rendered":"<p>The <a href=\"http:\/\/dbi-services.com\/blog\/getting-started-with-postgres-plus-advanced-server-1-setting-up-ppas\/\" target=\"_blank\" rel=\"noopener\">first post<\/a> in this series explained how to get ppas installed on a linux system. Now that the database cluster is up and running we should take care immediately about backup and recovery. For this I&#8217;ll use another system where I&#8217;ll install and configure <a href=\"http:\/\/www.enterprisedb.com\/edb-backup-and-recovery-tool\" target=\"_blank\" rel=\"noopener\">bart<\/a>. So, the system overview for now is:<\/p>\n<table>\n<tbody>\n<tr>\n<td><strong>server<\/strong><\/td>\n<td><strong>ip address<\/strong><\/td>\n<td><strong>purpose<\/strong><\/td>\n<\/tr>\n<tr>\n<td>ppas<\/td>\n<td>192.168.56.243<\/td>\n<td>ppas database cluster<\/td>\n<\/tr>\n<tr>\n<td>ppasbart<\/td>\n<td>192.168.56.245<\/td>\n<td>backup and recovery server<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>As bart requires the postgres binaries I&#8217;ll just repeat the ppas installation on the bart server. Check the <a href=\"http:\/\/dbi-services.com\/blog\/getting-started-with-postgres-plus-advanced-server-1-setting-up-ppas\/\" target=\"_blank\" rel=\"noopener\">first post<\/a>on how to do that.<br \/>\ntip: there is a &#8220;&#8211;extract-only&#8221; switch which only extracts the binaries without bringing up a database cluster.<br \/>\nAfter that just install the bart rpm:<\/p>\n<pre>yum localinstall edb-bart-1.0.2-1.rhel6.x86_64.rpm<\/pre>\n<p>All the files will be installed under:<\/p>\n<pre class=\"brush: actionscript3; gutter: true; first-line: 1\">ls -la \/usr\/edb-bart-1.0\/\ntotal 20\ndrwxr-xr-x.  4 root root    44 Apr 23 13:41 .\ndrwxr-xr-x. 14 root root  4096 Apr 23 13:41 ..\ndrwxr-xr-x.  2 root root    17 Apr 23 13:41 bin\ndrwxr-xr-x.  2 root root    21 Apr 23 13:41 etc\n-rw-r--r--.  1 root root 15225 Jan 27 15:24 license.txt\n<\/pre>\n<p>Having a dedicated user for bart is a good idea:<\/p>\n<pre class=\"brush: actionscript3; gutter: true; first-line: 1\"># groupadd bart\n# useradd -g bart bart\n# passwd bart\nChanging password for user bart.\nNew password: \nRetype new password: \n$passwd: all authentication tokens updated successfully.\n<\/pre>\n<p>As backups need some space a top level directory for all the bart backups needs to be created:<\/p>\n<pre class=\"brush: actionscript3; gutter: true; first-line: 1\"># mkdir \/opt\/backup\nchown bart:bart \/opt\/backup\nchmod 700 \/opt\/backup\nmkdir -p \/opt\/backup\/ppas94\/archived_wals\n<\/pre>\n<p>Now everything is in place to start the bart configuration. A minimal configuration file would look like this:<\/p>\n<pre class=\"brush: actionscript3; gutter: true; first-line: 1\">cat \/usr\/edb-bart-1.0\/etc\/bart.cfg\n[BART]\nbart-host = bart@192.168.56.245\nbackup_path = \/opt\/backup\npg_basebackup_path = \/opt\/PostgresPlus\/9.4AS\/bin\/pg_basebackup\nlogfile = \/var\/tmp\/bart.log\nxlog-method = fetch\n\n[PPAS94]\nhost = 192.168.56.243\nport = 5444\nuser = enterprisedb\ndescription = \"PPAS 94 server\"\n<\/pre>\n<p>The BART section is the global section while the next sections are specific to the database clusters to backup and restore. As bart requires passwordless ssh authentication between the bart host and the database host to be backup up lets setup this. On the bart bart host ( ppasbart ):<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">su - bart\nssh-keygen -t rsa<\/pre>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">On the host where database runs ( ppas ):<\/pre>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">su -\ncd \/opt\/PostgresPlus\/9.4AS\nmkdir .ssh\nchown enterprisedb:enterprisedb .ssh\/\nchmod 700 .ssh\/\nsu - enterprisedb\nssh-keygen -t rsa<\/pre>\n<p>As the public keys are now available we&#8217;ll need to make them available on each host. On the ppas host:<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">cat .ssh\/id_rsa.pub &gt; .ssh\/authorized_keys\nchmod 600 .ssh\/authorized_keys<\/pre>\n<p>Add the public key from the barthost to the authorized keys file above. Example: get the public key from the bart host:<\/p>\n<pre class=\"brush: actionscript3; gutter: true; first-line: 1\">[bart@ppasbart ~]$ id\nuid=1001(bart) gid=1001(bart) groups=1001(bart) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023\n[bart@ppasbart ~]$ cat .ssh\/id_rsa.pub \nssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCn+DN\/\/ia+BocR6kTfHkPoXfx3\/HRU5KM1Bqy1nDeGnUn98CSl3kbRkUkiyumDfj4XOIoxOxnVJw6Invyi2VjzeQ12XMMILBFRBAoePDpy4kOQWY+SaS215G72DKzNYY8nGPUwjaQdFpFt3eQhwLP4D5uqomPIi9Dmv7Gp8ZHU0DBgJfrDaqrg8oF3GrzF50ZRjZTAkF3pDxJnrzIEEme+QQFKVxBnSU2ClS5XHdjMBWg+oSx3XSEBHZefP9NgX22ru52lTWmvTscUQbIbDo8SaWucIZC7uhvljteN4AuAdMv+OUblOm9ZUtO2Y8vX8hNMJvqRBlYh9RGl+m6wUZLN document.write(['bart','ppasbart.loca'].join('@'))l\n<\/pre>\n<p>Copy\/paste this key into the authorized_keys file for the enterprisedb user on the database host, so that the file looks similar to this:<\/p>\n<pre class=\"brush: actionscript3; gutter: true; first-line: 1\">cat .ssh\/id_rsa.pub \nssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCn+DN\/\/ia+BocR6kTfHkPoXfx3\/HRU5KM1Bqy1nDeGnUn98CSl3kbRkUkiyumDfj4XOIoxOxnVJw6Invyi2VjzeQ12XMMILBFRBAoePDpy4kOQWY+SaS215G72DKzNYY8nGPUwjaQdFpFt3eQhwLP4D5uqomPIi9Dmv7Gp8ZHU0DBgJfrDaqrg8oF3GrzF50ZRjZTAkF3pDxJnrzIEEme+QQFKVxBnSU2ClS5XHdjMBWg+oSx3XSEBHZefP9NgX22ru52lTWmvTscUQbIbDo8SaWucIZC7uhvljteN4AuAdMv+OUblOm9ZUtO2Y8vX8hNMJvqRBlYh9RGl+m6wUZLN l\n[bart@ppasbart ~]$ cat .ssh\/authorized_keys\nssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAQZWeegLpqVB20c3cIN0Bc7pN6OjFM5pBsunDbO6SQ0+UYxZGScwjnX9FSOlmYzqrlz62jxV2dOJBHgaJj\/mbFs5XbmvFw6Z4Zj224aBOXAfej4nHqVnn1Tpuum4HIrbsau3rI+jLCNP+MKnumwM7JiG06dsoG4PeUOghCLyFrItq2\/uCIDHWoeQCqqnLD\/lLG5y1YXQCSR4VkiQm62tU0aTUBQdZWnvtgskKkHWyVRERfLOmlz2puvmmc5YxmQ5XBVMN5dIcIZntTfx3JC3imjrUl10L3hkiPkV0eAt3KtC1M0n9DDao3SfHFfKfEfp5p69vvpZM2uGFbcpkQrtN l\nssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCn+DN\/\/ia+BocR6kTfHkPoXfx3\/HRU5KM1Bqy1nDeGnUn98CSl3kbRkUkiyumDfj4XOIoxOxnVJw6Invyi2VjzeQ12XMMILBFRBAoePDpy4kOQWY+SaS215G72DKzNYY8nGPUwjaQdFpFt3eQhwLP4D5uqomPIi9Dmv7Gp8ZHU0DBgJfrDaqrg8oF3GrzF50ZRjZTAkF3pDxJnrzIEEme+QQFKVxBnSU2ClS5XHdjMBWg+oSx3XSEBHZefP9NgX22ru52lTWmvTscUQbIbDo8SaWucIZC7uhvljteN4AuAdMv+OUblOm9ZUtO2Y8vX8hNMJvqRBlYh9RGl+m6wUZLN\n<\/pre>\n<p>Make the file the same on the bart host and test if you can connect without passwords:<\/p>\n<pre class=\"brush: actionscript3; gutter: true; first-line: 1\">[bart@ppasbart ~]$ hostname\nppasbart.local\n[bart@ppasbart ~]$ ssh bart@ppasbart\nLast login: Thu Apr 23 14:24:39 2015 from ppas\n[bart@ppasbart ~]$ logout\nConnection to ppasbart closed.\n[bart@ppasbart ~]$ ssh enterprisedb@ppas\nLast login: Thu Apr 23 14:24:47 2015 from ppas\n-bash-4.2$ logout\nConnection to ppas closed.\n<\/pre>\n<p>Do the same test on the ppas host:<\/p>\n<pre class=\"brush: actionscript3; gutter: true; first-line: 1\">bash-4.2$ hostname\nppas.local\n-bash-4.2$ ssh bart@ppasbart\nLast login: Thu Apr 23 14:22:07 2015 from ppasbart\n[bart@ppasbart ~]$ logout\nConnection to ppasbart closed.\n-bash-4.2$ ssh enterprisedb@ppas\nLast login: Thu Apr 23 14:22:18 2015 from ppasbart\n-bash-4.2$ logout\nConnection to ppas closed.\n-bash-4.2$<\/pre>\n<p>Once this works we need to setup a replication user in the database being backed up. So create the user in the database which runs on the ppas host (I&#8217;ll do that with enterprise user instead of the postgres user as we&#8217;ll need to adjust pg_hba.conf file right after creating the user):<\/p>\n<pre class=\"brush: actionscript3; gutter: true; first-line: 1\">[root@ppas 9.4AS]# su - enterprisedb\nLast login: Thu Apr 23 14:25:50 CEST 2015 from ppasbart on pts\/1\n-bash-4.2$ . pgplus_env.sh\n-bash-4.2$ psql -U enterprisedb\npsql.bin (9.4.1.3)\nType \"help\" for help.\n\nedb=# CREATE ROLE bart WITH LOGIN REPLICATION PASSWORD 'bart';       \nCREATE ROLE\nedb=# exit\n-bash-4.2$ echo \"host    all     bart         192.168.56.245\/32          md5\" &gt;&gt; data\/pg_hba.conf\n<\/pre>\n<p>Make sure that the IP matches your bart host. Then adjust the bart.cfg file on the bart host to match your configuration:<\/p>\n<pre class=\"brush: actionscript3; gutter: true; first-line: 1\">cat \/usr\/edb-bart-1.0\/etc\/bart.cfg\n[BART]\nbart-host = bart@192.168.56.245\nbackup_path = \/opt\/backup\npg_basebackup_path = \/opt\/PostgresPlus\/9.4AS\/bin\/pg_basebackup\nlogfile = \/var\/tmp\/bart.log\nxlog-method = fetch\n\n[PPAS94]\nhost = 192.168.56.243\nport = 5444\nuser = bart\nremote-host = enterprisedb@192.168.56.243\ndescription = \"PPAS 94 remote server\"\n<\/pre>\n<p>Another requirement is that the bart database user must be able to connect to the database without prompting for a password. Thus we create the .pgpass file on the bart host which is used for reading the password:<\/p>\n<pre class=\"brush: actionscript3; gutter: true; first-line: 1\">[bart@ppasbart ~]$ cat .pgpass \n192.168.56.243:5444:*:bart:bart\n[bart@ppasbart ~]$ chmod 600 .pgpass\n<\/pre>\n<p>As a last step we need to enable wal archiving on the database that should be backed up. The following parameters need to be set in the postgresql.conf file:<\/p>\n<pre class=\"brush: actionscript3; gutter: true; first-line: 1\">wal_level = archive  # or higher\narchive_mode = on\narchive_command = 'scp %p bart@192.168.56.245:\/opt\/backup\/ppas94\/archived_wals\/%f'\nmax_wal_senders = 1  # or higher\n<\/pre>\n<p>Once done restart the database cluster:<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">su -\nservice ppas-9.4 restart<\/pre>\n<p>Lets see if bart can see anything on the bart server:<\/p>\n<pre class=\"brush: actionscript3; gutter: true; first-line: 1\">[bart@ppasbart ~]$ \/usr\/edb-bart-1.0\/bin\/bart -c \/usr\/edb-bart-1.0\/etc\/bart.cfg SHOW-SERVERS -s PPAS94 \nServer name         : ppas94\nHost name           : 192.168.56.243\nUser name           : bart\nPort                : 5444\nRemote host         : enterprisedb@192.168.56.243\nArchive path        : \/opt\/backup\/ppas94\/archived_wals\nWARNING: xlog-method is empty, defaulting to global policy\nXlog Method         : fetch\nTablespace path(s)  : \nDescription         : \"PPAS 94 remote server\"\n<\/pre>\n<p>Looks fine. So lets do a backup:<\/p>\n<pre class=\"brush: actionscript3; gutter: true; first-line: 1\">[bart@ppasbart ~]$ \/usr\/edb-bart-1.0\/bin\/bart -c \/usr\/edb-bart-1.0\/etc\/bart.cfg BACKUP -s PPAS94\n\nINFO:  creating backup for server 'ppas94'\nINFO:  backup identifier: '1429795268774'\nWARNING: xlog-method is empty, defaulting to global policy\n56357\/56357 kB (100%), 1\/1 tablespace\n\nINFO:  backup checksum: 6e614f981902c99326a7625a9c262d98\nINFO:  backup completed successfully\n<\/pre>\n<p>Cool. Lets see what is in the backup catalog:<\/p>\n<pre class=\"brush: actionscript3; gutter: true; first-line: 1\">[root@ppasbart tmp]# ls -la \/opt\/backup\/\ntotal 0\ndrwx------. 3 bart bart 19 Apr 23 15:02 .\ndrwxr-xr-x. 4 root root 38 Apr 23 13:49 ..\ndrwx------. 4 bart bart 46 Apr 23 15:21 ppas94\n[root@ppasbart tmp]# ls -la \/opt\/backup\/ppas94\/\ntotal 4\ndrwx------. 4 bart bart   46 Apr 23 15:21 .\ndrwx------. 3 bart bart   19 Apr 23 15:02 ..\ndrwx------. 2 bart bart   36 Apr 23 15:21 1429795268774\ndrwx------. 2 bart bart 4096 Apr 23 15:21 archived_wals\n[root@ppasbart tmp]# ls -la \/opt\/backup\/ppas94\/1429795268774\/\ntotal 56364\ndrwx------. 2 bart bart       36 Apr 23 15:21 .\ndrwx------. 4 bart bart       46 Apr 23 15:21 ..\n-rw-rw-r--. 1 bart bart       33 Apr 23 15:21 base.md5\n-rw-rw-r--. 1 bart bart 57710592 Apr 23 15:21 base.tar\n[root@ppasbart tmp]# ls -la \/opt\/backup\/ppas94\/archived_wals\/\ntotal 81928\ndrwx------. 2 bart bart     4096 Apr 23 15:21 .\ndrwx------. 4 bart bart       46 Apr 23 15:21 ..\n-rw-------. 1 bart bart 16777216 Apr 23 15:10 000000010000000000000002\n-rw-------. 1 bart bart 16777216 Apr 23 15:13 000000010000000000000003\n-rw-------. 1 bart bart 16777216 Apr 23 15:20 000000010000000000000004\n-rw-------. 1 bart bart 16777216 Apr 23 15:21 000000010000000000000005\n-rw-------. 1 bart bart 16777216 Apr 23 15:21 000000010000000000000006\n-rw-------. 1 bart bart      304 Apr 23 15:21 000000010000000000000006.00000028.backup\n<\/pre>\n<p>Use the SHOW-BACKUPS switch to get on overview of the backups available:<\/p>\n<pre class=\"brush: actionscript3; gutter: true; first-line: 1\">[bart@ppasbart ~]$ \/usr\/edb-bart-1.0\/bin\/bart -c \/usr\/edb-bart-1.0\/etc\/bart.cfg SHOW-BACKUPS \n Server Name   Backup ID       Backup Time           Backup Size  \n                                                                  \n ppas94        1429795268774   2015-04-23 15:21:23   55.0371 MB   \n ppas94        1429795515326   2015-04-23 15:25:18   5.72567 MB   \n ppas94        1429795614916   2015-04-23 15:26:58   5.72567 MB   \n                                                                  \n<\/pre>\n<p>A backup without a restore proves nothing so lets try to restore one of the backups to the ppas server to a different directory:<\/p>\n<pre class=\"brush: actionscript3; gutter: true; first-line: 1\">[root@ppas 9.4AS]# mkdir \/opt\/PostgresPlus\/9.4AS\/data2\n[root@ppas 9.4AS]# chown enterprisedb:enterprisedb \/opt\/PostgresPlus\/9.4AS\/data2\n<\/pre>\n<p>On the ppasbart host do the restore:<\/p>\n<pre class=\"brush: actionscript3; gutter: true; first-line: 1\">[bart@ppasbart ~]$ \/usr\/edb-bart-1.0\/bin\/bart -c \/usr\/edb-bart-1.0\/etc\/bart.cfg RESTORE -s PPAS94 -i 1429795614916 -r enterprisedb@ppas -p \/opt\/PostgresPlus\/9.4AS\/data2\nINFO:  restoring backup '1429795614916' of server 'ppas94'\nINFO:  restoring backup to enterprisedb@ppas:\/opt\/PostgresPlus\/9.4AS\/data2\nINFO:  base backup restored\nINFO:  archiving is disabled\nINFO:  backup restored successfully at enterprisedb@ppas:\/opt\/PostgresPlus\/9.4AS\/data2\n<\/pre>\n<p>Looks good. Lets see what is in the data2 directory on the ppas host:<\/p>\n<pre class=\"brush: actionscript3; gutter: true; first-line: 1\">[root@ppas 9.4AS]# ls \/opt\/PostgresPlus\/9.4AS\/data2\nbackup_label  dbms_pipe  pg_clog      pg_hba.conf    pg_log      pg_multixact  pg_replslot  pg_snapshots  pg_stat_tmp  pg_tblspc    PG_VERSION  postgresql.auto.conf\nbase          global     pg_dynshmem  pg_ident.conf  pg_logical  pg_notify     pg_serial    pg_stat       pg_subtrans  pg_twophase  pg_xlog     postgresql.conf\n[root@ppas 9.4AS]# ls \/opt\/PostgresPlus\/9.4AS\/data2\/pg_xlog\n000000010000000000000008  archive_status\n<\/pre>\n<p>Looks good, too. As this is all on the same server we need to change the port before bringing up the database:<\/p>\n<pre class=\"brush: actionscript3; gutter: true; first-line: 1\">-bash-4.2$ grep port postgresql.conf  | head  -1\nport = 5445\t\t\t\t# (change requires restart)\n-bash-4.2$ pg_ctl start -D data2\/\nserver starting\n-bash-4.2$ 2015-04-23 16:01:30 CEST FATAL:  data directory \"\/opt\/PostgresPlus\/9.4AS\/data2\" has group or world access\n2015-04-23 16:01:30 CEST DETAIL:  Permissions should be u=rwx (0700).\n<\/pre>\n<p>Ok, fine. Change it:<\/p>\n<pre class=\"brush: actionscript3; gutter: true; first-line: 1\">-bash-4.2$ chmod 700 \/opt\/PostgresPlus\/9.4AS\/data2\n-bash-4.2$ pg_ctl start -D data2\/\nserver starting\n-bash-4.2$ 2015-04-23 16:02:00 CEST LOG:  redirecting log output to logging collector process\n2015-04-23 16:02:00 CEST HINT:  Future log output will appear in directory \"pg_log\".\n<\/pre>\n<p>Seems ok, lets connect:<\/p>\n<pre class=\"brush: actionscript3; gutter: true; first-line: 1\">-bash-4.2$ psql -p 5445 -U bart\nPassword for user bart: \npsql.bin (9.4.1.3)\nType \"help\" for help.\n\nedb=&gt; l\n                                           List of databases\n   Name    |    Owner     | Encoding |   Collate   |    Ctype    | ICU |       Access privileges       \n-----------+--------------+----------+-------------+-------------+-----+-------------------------------\n edb       | enterprisedb | UTF8     | en_US.UTF-8 | en_US.UTF-8 |     | \n postgres  | enterprisedb | UTF8     | en_US.UTF-8 | en_US.UTF-8 |     | \n template0 | enterprisedb | UTF8     | en_US.UTF-8 | en_US.UTF-8 |     | =c\/enterprisedb              +\n           |              |          |             |             |     | enterprisedb=CTc\/enterprisedb\n template1 | enterprisedb | UTF8     | en_US.UTF-8 | en_US.UTF-8 |     | =c\/enterprisedb              +\n           |              |          |             |             |     | enterprisedb=CTc\/enterprisedb\n(4 rows)\n<\/pre>\n<p>Cool. Works. But: archiving is disabled and you&#8217;ll need to enable it again. This is the default behavior of bart as it adds &#8220;archive_mode=off&#8221; to the end of the postgressql.conf. But take care that you adjust the archive_command parameter as all archived wals will be scp&#8217;ed to the same directory on the ppasbart server as the original database did. Can we do a point in time recovery? Let&#8217;s try (I&#8217;ll destroy the restored database cluster and will use the same data2 directory ):<\/p>\n<pre class=\"brush: actionscript3; gutter: true; first-line: 1\">-bash-4.2$ pg_ctl -D data2 stop -m fast\nwaiting for server to shut down.... done\nserver stopped\n-bash-4.2$ rm -rf data2\/*\n-bash-4.2$ \n<\/pre>\n<p>Lets try the restore to a specific point in time:<\/p>\n<pre class=\"brush: actionscript3; gutter: true; first-line: 1\">[bart@ppasbart ~]$ \/usr\/edb-bart-1.0\/bin\/bart -c \/usr\/edb-bart-1.0\/etc\/bart.cfg RESTORE -s PPAS94 -i 1429795614916 -r enterprisedb@ppas -p \/opt\/PostgresPlus\/9.4AS\/data2 -g '2015-04-03 15:23:00'\nINFO:  restoring backup '1429795614916' of server 'ppas94'\nINFO:  restoring backup to enterprisedb@ppas:\/opt\/PostgresPlus\/9.4AS\/data2\nINFO:  base backup restored\nINFO:  creating recovery.conf file\nINFO:  archiving is disabled\nINFO:  backup restored successfully at enterprisedb@ppas:\/opt\/PostgresPlus\/9.4AS\/data2\n<\/pre>\n<p>Seems ok, but what is the difference? When specifying a point in time a recovery.conf file will be created for the restored database cluster:<\/p>\n<pre class=\"brush: actionscript3; gutter: true; first-line: 1\">-bash-4.2$ cat data2\/recovery.conf\nrestore_command = 'scp -o BatchMode=yes -o PasswordAuthentication=no bart@192.168.56.245:\/opt\/backup\/ppas94\/archived_wals\/%f %p'\nrecovery_target_time = '2015-04-03 15:23:00'\n<\/pre>\n<p>Lets start the database (after changing the port again in postgresql.conf):<\/p>\n<pre class=\"brush: actionscript3; gutter: true; first-line: 1\">-bash-4.2$ pg_ctl -D data2 start\nserver starting\n-bash-4.2$ 2015-04-23 16:16:12 CEST LOG:  redirecting log output to logging collector process\n2015-04-23 16:16:12 CEST HINT:  Future log output will appear in directory \"pg_log\".\n<\/pre>\n<p>Are we able to connect?<\/p>\n<pre class=\"brush: actionscript3; gutter: true; first-line: 1\">-bash-4.2$ psql -U bart -p 5445 \nPassword for user bart: \npsql.bin (9.4.1.3)\nType \"help\" for help.\n\nedb=&gt;<\/pre>\n<p>Works, too. So now we have a central backup server for our postgresql infrastructure from which backups and restores can be executed. Combine this with a backup software (like netbackup, etc) which picks up the backups from the bartserver and you should be fine. in the next post we&#8217;ll setup a hot standby database server.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The first post in this series explained how to get ppas installed on a linux system. Now that the database cluster is up and running we should take care immediately about backup and recovery. For this I&#8217;ll use another system where I&#8217;ll install and configure bart. So, the system overview for now is: server ip [&hellip;]<\/p>\n","protected":false},"author":29,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[198],"tags":[77],"type_dbi":[],"class_list":["post-4603","post","type-post","status-publish","format-standard","hentry","category-database-management","tag-postgresql"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.2 (Yoast SEO v27.5) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>getting started with postgres plus advanced server (2) - setting up a backup and recovery server - dbi 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\/getting-started-with-postgres-plus-advanced-server-2-setting-up-a-backup-and-recovery-server\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"getting started with postgres plus advanced server (2) - setting up a backup and recovery server\" \/>\n<meta property=\"og:description\" content=\"The first post in this series explained how to get ppas installed on a linux system. Now that the database cluster is up and running we should take care immediately about backup and recovery. For this I&#8217;ll use another system where I&#8217;ll install and configure bart. So, the system overview for now is: server ip [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dbi-services.com\/blog\/getting-started-with-postgres-plus-advanced-server-2-setting-up-a-backup-and-recovery-server\/\" \/>\n<meta property=\"og:site_name\" content=\"dbi Blog\" \/>\n<meta property=\"article:published_time\" content=\"2015-05-18T07:32:36+00:00\" \/>\n<meta name=\"author\" content=\"Daniel Westermann\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@westermanndanie\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Daniel Westermann\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"11 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\\\/getting-started-with-postgres-plus-advanced-server-2-setting-up-a-backup-and-recovery-server\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/getting-started-with-postgres-plus-advanced-server-2-setting-up-a-backup-and-recovery-server\\\/\"},\"author\":{\"name\":\"Daniel Westermann\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/person\\\/8d08e9bd996a89bd75c0286cbabf3c66\"},\"headline\":\"getting started with postgres plus advanced server (2) &#8211; setting up a backup and recovery server\",\"datePublished\":\"2015-05-18T07:32:36+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/getting-started-with-postgres-plus-advanced-server-2-setting-up-a-backup-and-recovery-server\\\/\"},\"wordCount\":791,\"commentCount\":0,\"keywords\":[\"PostgreSQL\"],\"articleSection\":[\"Database management\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/getting-started-with-postgres-plus-advanced-server-2-setting-up-a-backup-and-recovery-server\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/getting-started-with-postgres-plus-advanced-server-2-setting-up-a-backup-and-recovery-server\\\/\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/getting-started-with-postgres-plus-advanced-server-2-setting-up-a-backup-and-recovery-server\\\/\",\"name\":\"getting started with postgres plus advanced server (2) - setting up a backup and recovery server - dbi Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#website\"},\"datePublished\":\"2015-05-18T07:32:36+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/person\\\/8d08e9bd996a89bd75c0286cbabf3c66\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/getting-started-with-postgres-plus-advanced-server-2-setting-up-a-backup-and-recovery-server\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/getting-started-with-postgres-plus-advanced-server-2-setting-up-a-backup-and-recovery-server\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/getting-started-with-postgres-plus-advanced-server-2-setting-up-a-backup-and-recovery-server\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"getting started with postgres plus advanced server (2) &#8211; setting up a backup and recovery server\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/\",\"name\":\"dbi Blog\",\"description\":\"\",\"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\":\"Person\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/person\\\/8d08e9bd996a89bd75c0286cbabf3c66\",\"name\":\"Daniel Westermann\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/31350ceeecb1dd8986339a29bf040d4cd3cd087d410deccd8f55234466d6c317?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/31350ceeecb1dd8986339a29bf040d4cd3cd087d410deccd8f55234466d6c317?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/31350ceeecb1dd8986339a29bf040d4cd3cd087d410deccd8f55234466d6c317?s=96&d=mm&r=g\",\"caption\":\"Daniel Westermann\"},\"description\":\"Daniel Westermann is Principal Consultant and Technology Leader Open Infrastructure at dbi services. He has more than 15 years of experience in management, engineering and optimization of databases and infrastructures, especially on Oracle and PostgreSQL. Since the beginning of his career, he has specialized in Oracle Technologies and is Oracle Certified Professional 12c and Oracle Certified Expert RAC\\\/GridInfra. Over time, Daniel has become increasingly interested in open source technologies, becoming \u201cTechnology Leader Open Infrastructure\u201d and PostgreSQL expert. \u00a0Based on community or EnterpriseDB tools, he develops and installs complex high available solutions with PostgreSQL. He is also a certified PostgreSQL Plus 9.0 Professional and a Postgres Advanced Server 9.4 Professional. He is a regular speaker at PostgreSQL conferences in Switzerland and Europe. Today Daniel is also supporting our customers on AWS services such as AWS RDS, database migrations into the cloud, EC2 and automated infrastructure management with AWS SSM (System Manager). He is a certified AWS Solutions Architect Professional. Prior to dbi services, Daniel was Management System Engineer at LC SYSTEMS-Engineering AG in Basel. Before that, he worked as Oracle Developper &amp;\u00a0Project Manager at Delta Energy Solutions AG in Basel (today Powel AG). Daniel holds a diploma in Business Informatics (DHBW, Germany). His branch-related experience mainly covers the pharma industry, the financial sector, energy, lottery and telecommunications.\",\"sameAs\":[\"https:\\\/\\\/x.com\\\/westermanndanie\"],\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/author\\\/daniel-westermann\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"getting started with postgres plus advanced server (2) - setting up a backup and recovery server - dbi 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\/getting-started-with-postgres-plus-advanced-server-2-setting-up-a-backup-and-recovery-server\/","og_locale":"en_US","og_type":"article","og_title":"getting started with postgres plus advanced server (2) - setting up a backup and recovery server","og_description":"The first post in this series explained how to get ppas installed on a linux system. Now that the database cluster is up and running we should take care immediately about backup and recovery. For this I&#8217;ll use another system where I&#8217;ll install and configure bart. So, the system overview for now is: server ip [&hellip;]","og_url":"https:\/\/www.dbi-services.com\/blog\/getting-started-with-postgres-plus-advanced-server-2-setting-up-a-backup-and-recovery-server\/","og_site_name":"dbi Blog","article_published_time":"2015-05-18T07:32:36+00:00","author":"Daniel Westermann","twitter_card":"summary_large_image","twitter_creator":"@westermanndanie","twitter_misc":{"Written by":"Daniel Westermann","Est. reading time":"11 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.dbi-services.com\/blog\/getting-started-with-postgres-plus-advanced-server-2-setting-up-a-backup-and-recovery-server\/#article","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/getting-started-with-postgres-plus-advanced-server-2-setting-up-a-backup-and-recovery-server\/"},"author":{"name":"Daniel Westermann","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/8d08e9bd996a89bd75c0286cbabf3c66"},"headline":"getting started with postgres plus advanced server (2) &#8211; setting up a backup and recovery server","datePublished":"2015-05-18T07:32:36+00:00","mainEntityOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/getting-started-with-postgres-plus-advanced-server-2-setting-up-a-backup-and-recovery-server\/"},"wordCount":791,"commentCount":0,"keywords":["PostgreSQL"],"articleSection":["Database management"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.dbi-services.com\/blog\/getting-started-with-postgres-plus-advanced-server-2-setting-up-a-backup-and-recovery-server\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.dbi-services.com\/blog\/getting-started-with-postgres-plus-advanced-server-2-setting-up-a-backup-and-recovery-server\/","url":"https:\/\/www.dbi-services.com\/blog\/getting-started-with-postgres-plus-advanced-server-2-setting-up-a-backup-and-recovery-server\/","name":"getting started with postgres plus advanced server (2) - setting up a backup and recovery server - dbi Blog","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/#website"},"datePublished":"2015-05-18T07:32:36+00:00","author":{"@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/8d08e9bd996a89bd75c0286cbabf3c66"},"breadcrumb":{"@id":"https:\/\/www.dbi-services.com\/blog\/getting-started-with-postgres-plus-advanced-server-2-setting-up-a-backup-and-recovery-server\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dbi-services.com\/blog\/getting-started-with-postgres-plus-advanced-server-2-setting-up-a-backup-and-recovery-server\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.dbi-services.com\/blog\/getting-started-with-postgres-plus-advanced-server-2-setting-up-a-backup-and-recovery-server\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/www.dbi-services.com\/blog\/"},{"@type":"ListItem","position":2,"name":"getting started with postgres plus advanced server (2) &#8211; setting up a backup and recovery server"}]},{"@type":"WebSite","@id":"https:\/\/www.dbi-services.com\/blog\/#website","url":"https:\/\/www.dbi-services.com\/blog\/","name":"dbi Blog","description":"","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":"Person","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/8d08e9bd996a89bd75c0286cbabf3c66","name":"Daniel Westermann","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/31350ceeecb1dd8986339a29bf040d4cd3cd087d410deccd8f55234466d6c317?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/31350ceeecb1dd8986339a29bf040d4cd3cd087d410deccd8f55234466d6c317?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/31350ceeecb1dd8986339a29bf040d4cd3cd087d410deccd8f55234466d6c317?s=96&d=mm&r=g","caption":"Daniel Westermann"},"description":"Daniel Westermann is Principal Consultant and Technology Leader Open Infrastructure at dbi services. He has more than 15 years of experience in management, engineering and optimization of databases and infrastructures, especially on Oracle and PostgreSQL. Since the beginning of his career, he has specialized in Oracle Technologies and is Oracle Certified Professional 12c and Oracle Certified Expert RAC\/GridInfra. Over time, Daniel has become increasingly interested in open source technologies, becoming \u201cTechnology Leader Open Infrastructure\u201d and PostgreSQL expert. \u00a0Based on community or EnterpriseDB tools, he develops and installs complex high available solutions with PostgreSQL. He is also a certified PostgreSQL Plus 9.0 Professional and a Postgres Advanced Server 9.4 Professional. He is a regular speaker at PostgreSQL conferences in Switzerland and Europe. Today Daniel is also supporting our customers on AWS services such as AWS RDS, database migrations into the cloud, EC2 and automated infrastructure management with AWS SSM (System Manager). He is a certified AWS Solutions Architect Professional. Prior to dbi services, Daniel was Management System Engineer at LC SYSTEMS-Engineering AG in Basel. Before that, he worked as Oracle Developper &amp;\u00a0Project Manager at Delta Energy Solutions AG in Basel (today Powel AG). Daniel holds a diploma in Business Informatics (DHBW, Germany). His branch-related experience mainly covers the pharma industry, the financial sector, energy, lottery and telecommunications.","sameAs":["https:\/\/x.com\/westermanndanie"],"url":"https:\/\/www.dbi-services.com\/blog\/author\/daniel-westermann\/"}]}},"_links":{"self":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/4603","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\/29"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/comments?post=4603"}],"version-history":[{"count":0,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/4603\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media?parent=4603"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/categories?post=4603"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/tags?post=4603"},{"taxonomy":"type","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/type_dbi?post=4603"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}