AWX/Database Backup: Difference between revisions

From Omnia
< AWX
Jump to navigation Jump to search
No edit summary
No edit summary
Line 12: Line 12:
  AWX Restore Readme
  AWX Restore Readme
  https://github.com/ansible/awx-operator/blob/devel/roles/restore/README.md
  https://github.com/ansible/awx-operator/blob/devel/roles/restore/README.md
---
<pre>
k -n awx get all
pod/awx-awx-postgres-15-0
k -n awx exec -it awx-awx-postgres-15-0 -- /bin/bash
pg_dump -U postgres awx17 > /var/lib/pgsql/12/backups/awx17.bak_02032023
bash-5.1$ pg_dump -U postgres awx > dumb.db
bash-5.1$ pg_dump -U postgres awx --format=c > dumb2.db
https://groups.google.com/g/awx-project/c/y0k1hQfI77E
/opt/app-root/src
# k -n awx cp awx_psql_dump.sql awx-awx-postgres-15-0:/opt/app-root/src/
k -n awx cp awx_psql_dump.sql awx-awx-postgres-15-0:/opt/app-root/src/ -c postgres
dropdb -U awx awx
createdb -U awx awx
pg_restore -U awx -d awx < psql_dump.sql
createdb -U awx awx
pg_restore -U awx -d awx < awx_psql_dump.sql
</pre>

Revision as of 19:39, 14 January 2025

AWX V19 - Backup and Restore
https://groups.google.com/g/awx-project/c/y0k1hQfI77E
1. Export Docker DB like: pg_dump --username awx awx --format=c" > ./psql_dump.sql
2. Drop AWX-Operator DB: minikube kubectl -- exec -it awx-postgres-0 -- dropdb -U awx awx ( failed here since  the db was  currently  being  used)

3. Create new DB: minikube kubectl -- exec -it awx-postgres-0 -- createdb -U awx awx
4. Restore DB: minikube kubectl -- exec -it awx-postgres-0 -- pg_restore -U awx -d awx < psql_dump.sql
AWX Backup Readme
https://github.com/ansible/awx-operator/blob/devel/roles/backup/README.md
AWX Restore Readme
https://github.com/ansible/awx-operator/blob/devel/roles/restore/README.md

---

k -n awx get all


pod/awx-awx-postgres-15-0

k -n awx exec -it awx-awx-postgres-15-0 -- /bin/bash


pg_dump -U postgres awx17 > /var/lib/pgsql/12/backups/awx17.bak_02032023


bash-5.1$ pg_dump -U postgres awx > dumb.db
bash-5.1$ pg_dump -U postgres awx --format=c > dumb2.db

https://groups.google.com/g/awx-project/c/y0k1hQfI77E

/opt/app-root/src

# k -n awx cp awx_psql_dump.sql awx-awx-postgres-15-0:/opt/app-root/src/
k -n awx cp awx_psql_dump.sql awx-awx-postgres-15-0:/opt/app-root/src/ -c postgres

dropdb -U awx awx
createdb -U awx awx
pg_restore -U awx -d awx < psql_dump.sql

createdb -U awx awx
pg_restore -U awx -d awx < awx_psql_dump.sql