Last active
October 21, 2019 20:10
-
-
Save blohinn/e301fb4d13c75d7db59de747c0fc358f to your computer and use it in GitHub Desktop.
Revisions
-
blohinn revised this gist
Oct 21, 2019 . 1 changed file with 21 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,3 +7,24 @@ docker exec -t tatcamps.prod.postgres pg_dump -U tatcamp --column-inserts tatcam docker exec -t ulmts.postgres psql -U ulmts ulmts -t -c "drop schema public cascade; create schema public;" cat your_dump.sql | docker exec -i tatcamps.dev.postgres psql -U tatcamp -d tatcamp ############################ # # Работает внутри контейнера (без приставки docker exec -t <container_uid>) # # docker exec -t <container_uid> pg_dump -U smartnet -d smartnet -F c > dump_`date +%d-%m-%Y"_"%H-%M`.gz docker exec -t <container_uid> pg_restore -U smartnet -d smartnet <dumpfile>.gz # # Через gzip (запуск за пределами контейнера) # # docker exec -t <container_uid> pg_dump -U smartnet -d smartnet | gzip > dump_`date +%d-%m-%Y"_"%H-%M`.gz gunzip <dumpfile>.gz cat <dumpfile> | docker exec -i <container_uid> psql -U smartnet -d smartnet # Или сразу, без распаковки gzcat <dumpfile>.gz | docker exec -i <container_uid> psql -U smartnet -d smartnet -
blohinn revised this gist
Sep 16, 2019 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,4 +4,6 @@ docker exec -t tatcamps.prod.postgres pg_dump -U tatcamp --column-inserts tatcamp > dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql docker exec -t ulmts.postgres psql -U ulmts ulmts -t -c "drop schema public cascade; create schema public;" cat your_dump.sql | docker exec -i tatcamps.dev.postgres psql -U tatcamp -d tatcamp -
blohinn created this gist
Apr 25, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,7 @@ Бэкап данных (+ создание таблиц) Подразумевается, что бд tatcamps.dev.postgres существует, но таблицы в ней удалены для создания бэкапов docker exec -t tatcamps.prod.postgres pg_dump -U tatcamp --column-inserts tatcamp > dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql cat your_dump.sql | docker exec -i tatcamps.dev.postgres psql -U tatcamp -d tatcamp