From: wbudic Date: Wed, 18 Aug 2021 07:59:02 +0000 (+1000) Subject: Added how to backup/restore. X-Git-Url: https://lifelog.hopto.org/gitweb/?a=commitdiff_plain;h=d376fcfa326c40b4a130004e7f745994fe609706;p=LifeLog.git Added how to backup/restore. --- diff --git a/Installation_PostgreSQL.txt b/Installation_PostgreSQL.txt index 6b68a7c..a5d574f 100644 --- a/Installation_PostgreSQL.txt +++ b/Installation_PostgreSQL.txt @@ -75,6 +75,20 @@ sudo -u postgres psql -c "SHOW data_directory;" | grep -G / ## Quick tar all sudo tar czvf ~/postgresql.db.backup.tar $(sudo -u postgres psql -c "SHOW data_directory;" | grep -G /) +# Backup/Restore +# You must setup an ~/.pgpass, and change the following cat string to your systems setup. + +cat "hostname:port:database:username:password" >> ~/.pgpass; chmod 600 ~/.pgpass; + +# Backup with: +pg_dump --file "~/dev/LifeLog/dbLifeLog/bck-pg-$DB_NAME.sql" $DB_NAME + +# Now you can run your backup utility. To include your ~/dev/ directory. +# Or use and setup mine @see -> https://github.com/wbudic/B_L_R_via_sshfs +# p.s. If this saved you one day, let me know. :) + +# Restore with: +psql $DB_NAME < "~/dev/LifeLog/dbLifeLog/bck-pg-$DB_NAME.sql"