<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"Trebuchet MS";
        panose-1:2 11 6 3 2 2 2 2 2 4;}
@font-face
        {font-family:Georgia;
        panose-1:2 4 5 2 5 4 5 2 3 3;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Trebuchet MS",sans-serif;
        color:windowtext;
        font-weight:normal;
        font-style:normal;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">Hello!<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">I’m trying to backup my postgress DB using the Spacewalk install documentation at
<a href="https://github.com/spacewalkproject/spacewalk/wiki/SpacewalkBackup">https://github.com/spacewalkproject/spacewalk/wiki/SpacewalkBackup</a>, and it fails with the errors below. If I try it without spacewalk running,  it gives an error and creates an
 empty backup file. If I try it with spacewalk running, it creates a 3.9 GB backup file, but I can’t restore it. Spacewalk is the only thing using this database. How do you all do your database backups?
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">Errors when spacewalk not running(creates empty backup file):<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">[root@spacewalk ~]# spacewalk-service stop<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">Shutting down spacewalk services...<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">Redirecting to /bin/systemctl stop taskomatic.service<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">Stopping cobblerd (via systemctl):                         [  OK  ]<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">Redirecting to /bin/systemctl stop rhn-search.service<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">Redirecting to /bin/systemctl stop osa-dispatcher.service<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">Redirecting to /bin/systemctl stop httpd.service<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">Redirecting to /bin/systemctl stop tomcat.service<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">Redirecting to /bin/systemctl stop jabberd.service<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">Redirecting to /bin/systemctl stop postgresql.service<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">Done.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">[root@spacewalk ~]# su - postgres -c  'pg_dumpall > /var/lib/pgsql/backups/full_postgres_backup-`date +%Y%m%d`.sql'<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">pg_dumpall: could not connect to database "template1": could not connect to server: No such file or directory<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">        Is the server running locally and accepting<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">[root@spacewalk ~]# ls -al /var/lib/pgsql/backups<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">total 0<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">drwx------ 2 postgres postgres  47 Feb 26 12:32 .<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">drwx------ 6 postgres postgres 122 Nov  1 14:55 ..<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">-rw-r--r-- 1 postgres postgres   0 Feb 26 12:32 full_postgres_backup-20180226.sql<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">Errors when spacewalk running
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">[root@spacewalk ~]# spacewalk-service start<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">Starting spacewalk services...<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">Redirecting to /bin/systemctl start<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">Redirecting to /bin/systemctl start postgresql.service<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">Redirecting to /bin/systemctl start jabberd.service<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">Redirecting to /bin/systemctl start tomcat.service<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">Waiting for tomcat to be ready ...<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">Redirecting to /bin/systemctl start httpd.service<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">Redirecting to /bin/systemctl start osa-dispatcher.service<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">Redirecting to /bin/systemctl start rhn-search.service<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">Starting cobblerd (via systemctl):                         [  OK  ]<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">Redirecting to /bin/systemctl start taskomatic.service<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">Done.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">[root@spacewalk ~]# su - postgres -c  'pg_dumpall > /var/lib/pgsql/backups/full_postgres_backup-`date +%Y%m%d`.sql'<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">pg_dump: [archiver (db)] connection to database "template1" failed: FATAL:  no pg_hba.conf entry for host "[local]", user "postgres", database "template1", SSL off<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">pg_dumpall: pg_dump failed on database "template1", exiting<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">[root@spacewalk backups]# ls -al<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">total 3910032<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">drwx------ 2 postgres postgres         47 Feb 26 12:32 .<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">drwx------ 6 postgres postgres        122 Nov  1 14:55 ..<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">-rw-r--r-- 1 postgres postgres 4003869597 Feb 26 12:40 full_postgres_backup-20180226.sql<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">But you can’t restore per the github.com directions:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">[root@spacewalk backups]# su - postgres<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">Last login: Mon Feb 26 12:38:18 EST 2018 on pts/0<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">-bash-4.2$ SPACEWALK_DB_NAME=spacewalkdb<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">-bash-4.2$ ls /var/lib/pgsql/backups<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">full_postgres_backup-20180226.sql<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">-bash-4.2$ SPACEWALK_DB_BACKUPFILE=/var/lib/pgsql/backups/full_postgres_backup-20180226.sql<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">-bash-4.2$ full_postgres_backup-20180226.sql^C<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">-bash-4.2$ id<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">uid=26(postgres) gid=26(postgres) groups=26(postgres)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">-bash-4.2$ dropdb $SPACEWALK_DB_NAME<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">dropdb: could not connect to database template1: could not connect to server: No such file or directory<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">        Is the server running locally and accepting<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">Thanks!<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">Nicole<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:9.0pt;margin-right:0in;margin-bottom:13.5pt;margin-left:0in">
<b><span style="font-family:"Trebuchet MS",sans-serif;color:#D44500">Nicole Beck</span></b><span style="font-family:"Trebuchet MS",sans-serif;color:#333333"><br>
Information Technology Analyst<br>
Information Technolgy Services – Core Infrustructure Services - Unix<o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:9.0pt;margin-right:0in;margin-bottom:13.5pt;margin-left:0in">
<span style="font-family:"Trebuchet MS",sans-serif;color:#333333">315.506.9744<br>
<a href="mailto:nskyrca@syr.edu"><span style="color:#0563C1">nskyrca@syr.edu</span></a><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:9.0pt;margin-right:0in;margin-bottom:9.0pt;margin-left:0in">
<span style="font-family:"Trebuchet MS",sans-serif;color:#333333">215 Machinery Hall, Syracuse, NY 13244<br>
syracuse.edu<o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:9.0pt;margin-right:0in;margin-bottom:9.0pt;margin-left:0in">
<span style="font-size:14.0pt;font-family:"Georgia",serif;color:#D44500">Syracuse University<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>