<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:'Trebuchet MS',Trebuchet,sans-serif;" dir="ltr">
<p>Thanks everyone. There are a lot of different ways to do it!<br>
</p>
<br>
<div>The man page for pg_dumpall says "pg_dumpall also dumps global objects that are common to all databases. (pg_dump does not save these objects.) This currently includes information about database users and groups, tablespaces, and properties such as access
 permissions that apply to databases as a whole."  Is that something we have to worry about if we just use the "pg_dump rhnschema" method to backup? Spacewalk is the only database I have.<br>
</div>
<br>
<br>
Nicole<br>
<br>
<div style="color: rgb(0, 0, 0);">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" color="#000000" face="Calibri, sans-serif"><b>From:</b> spacewalk-list-bounces@redhat.com <spacewalk-list-bounces@redhat.com> on behalf of Brian Long <briandlong@gmail.com><br>
<b>Sent:</b> Tuesday, February 27, 2018 10:49 AM<br>
<b>To:</b> spacewalk-list@redhat.com<br>
<b>Subject:</b> Re: [Spacewalk-list] postgres DB backup question</font>
<div> </div>
</div>
<div>
<div dir="ltr">I use the "db-control" program to handle an online (DB running) backup.
<div>db-control online-backup /local/backups/satellite-pgsql.$DATE 1>/dev/null<br>
</div>
<div><br>
</div>
<div>/Brian/</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Mon, Feb 26, 2018 at 1:23 PM, Nicole Beck <span dir="ltr">
<<a href="mailto:nskyrca@syr.edu" target="_blank">nskyrca@syr.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div lang="EN-US">
<div class="m_3770126169640865472WordSection1">
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">Hello!<u></u><u></u></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" target="_blank">
https://github.com/<wbr>spacewalkproject/spacewalk/<wbr>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?
<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">Errors when spacewalk not running(creates empty backup file):<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">[root@spacewalk ~]# spacewalk-service stop<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">Shutting down spacewalk services...<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">Redirecting to /bin/systemctl stop taskomatic.service<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">Stopping cobblerd (via systemctl):                   <wbr>      [  OK  ]<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">Redirecting to /bin/systemctl stop rhn-search.service<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">Redirecting to /bin/systemctl stop osa-dispatcher.service<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">Redirecting to /bin/systemctl stop httpd.service<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">Redirecting to /bin/systemctl stop tomcat.service<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">Redirecting to /bin/systemctl stop jabberd.service<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">Redirecting to /bin/systemctl stop postgresql.service<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">Done.<u></u><u></u></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_<wbr>postgres_backup-`date +%Y%m%d`.sql'<u></u><u></u></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<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">        Is the server running locally and accepting<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.<wbr>5432"?<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">[root@spacewalk ~]# ls -al /var/lib/pgsql/backups<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">total 0<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">drwx------ 2 postgres postgres  47 Feb 26 12:32 .<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">drwx------ 6 postgres postgres 122 Nov  1 14:55 ..<u></u><u></u></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.<wbr>sql<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">Errors when spacewalk running
<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">[root@spacewalk ~]# spacewalk-service start<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">Starting spacewalk services...<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">Redirecting to /bin/systemctl start<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">Redirecting to /bin/systemctl start postgresql.service<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">Redirecting to /bin/systemctl start jabberd.service<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">Redirecting to /bin/systemctl start tomcat.service<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">Waiting for tomcat to be ready ...<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">Redirecting to /bin/systemctl start httpd.service<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">Redirecting to /bin/systemctl start osa-dispatcher.service<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">Redirecting to /bin/systemctl start rhn-search.service<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">Starting cobblerd (via systemctl):                         [  OK  ]<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">Redirecting to /bin/systemctl start taskomatic.service<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">Done.<u></u><u></u></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_<wbr>postgres_backup-`date +%Y%m%d`.sql'<u></u><u></u></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<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">pg_dumpall: pg_dump failed on database "template1", exiting<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">[root@spacewalk backups]# ls -al<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">total 3910032<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">drwx------ 2 postgres postgres         47 Feb 26 12:32 .<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">drwx------ 6 postgres postgres        122 Nov  1 14:55 ..<u></u><u></u></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.<wbr>sql<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">But you can’t restore per the
<a href="http://github.com" target="_blank">github.com</a> directions:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">[root@spacewalk backups]# su - postgres<u></u><u></u></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<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">-bash-4.2$ SPACEWALK_DB_NAME=spacewalkdb<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">-bash-4.2$ ls /var/lib/pgsql/backups<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">full_postgres_backup-20180226.<wbr>sql<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">-bash-4.2$ SPACEWALK_DB_BACKUPFILE=/var/<wbr>lib/pgsql/backups/full_<wbr>postgres_backup-20180226.sql<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">-bash-4.2$ full_postgres_backup-20180226.<wbr>sql^C<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">-bash-4.2$ id<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">uid=26(postgres) gid=26(postgres) groups=26(postgres)<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">-bash-4.2$ dropdb $SPACEWALK_DB_NAME<u></u><u></u></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<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">        Is the server running locally and accepting<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.<wbr>5432"?<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">Thanks!<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif">Nicole<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif"><u></u> <u></u></span></p>
<p class="MsoNormal" style="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<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-right:0in; margin-bottom:13.5pt; margin-left:0in">
<span style="font-family:"Trebuchet MS",sans-serif; color:#333333"><a href="tel:(315)%20506-9744" value="+13155069744" target="_blank">315.506.9744</a><br>
<a href="mailto:nskyrca@syr.edu" target="_blank"><span style="color:#0563c1">nskyrca@syr.edu</span></a><u></u><u></u></span></p>
<p class="MsoNormal" style="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>
<a href="http://syracuse.edu" target="_blank">syracuse.edu</a><u></u><u></u></span></p>
<p class="MsoNormal" style="margin-right:0in; margin-bottom:9.0pt; margin-left:0in">
<span style="font-size:14.0pt; font-family:"Georgia",serif; color:#d44500">Syracuse University<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Trebuchet MS",sans-serif"><u></u> <u></u></span></p>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>
<br>
______________________________<wbr>_________________<br>
Spacewalk-list mailing list<br>
<a href="mailto:Spacewalk-list@redhat.com">Spacewalk-list@redhat.com</a><br>
<a href="https://www.redhat.com/mailman/listinfo/spacewalk-list" rel="noreferrer" target="_blank">https://www.redhat.com/<wbr>mailman/listinfo/spacewalk-<wbr>list</a><br>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
</body>
</html>