posgresql backup/restore1. Backup DATE=`date +%Y%m%d-%H%M` BACK_DATA=xxapp-data-${DATE}.out # Set the name of the backup file here. Adding the date is to prevent duplication. docker exec pg-db pg_dumpall -U postgres > ${BACK_DATA} # pg-db is the docker name of the database 2. Recovery docker cp ${BACK_DATA} pg-db:/tmp docker exec pg-db psql -U postgres -f /tmp/${BACK_DATA} postgres mysql backup/restore1. Backup DATE=`date +%Y%m%d-%H%M` BACK_DATA=xxapp-data-${DATE}.sql # mysql-db is the docker name of the database, xxxpwd is the root user password, app-db is the name of the data to be backed up docker exec mysql-db mysqldump -uroot -pxxxpwd --databases app-db > ${BACK_DATA} 2. Restore the following ${BACK_DATA} to replace it with the actual generated file name docker cp ${BACK_DATA} mysql-db:/tmp docker exec -it mysql-db mysql -uroot -pxxxpwd mysql> source /tmp/${BACK_DATA}.sql mysql> \q Bye Replenish postgresql backs up all databases, mysql backs up a specific database. Summarize The above is the database backup (postgresql, mysql) in the docker environment introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website! You may also be interested in:
|
<<: MySQL index usage instructions (single-column index and multi-column index)
>>: Detailed explanation of type protection in TypeScript
1. Install components yum install epel-rpm-macros...
Preface In the early stages of some projects, dev...
Preface There are many open source monitoring too...
Background requirements: As the business grows la...
Table of contents Preface Laying the foundation p...
Add rules to the el-form form: Define rules in da...
mysql query with multiple conditions Environment:...
Table of contents Preface 1. typeof 2. instanceof...
In Linux system, newly install docker and enter t...
After purchasing an Alibaba Cloud server, you nee...
Table of contents 1. Introduction 2. Simple defin...
Table of contents 1. We must ensure that the vue/...
First: action is an attribute of form. HTML5 has d...
This is the style recommendation given by the W3C ...
This article records the creation of a USB boot d...