In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Editor to share with you this time is to explain in detail how to achieve psql database backup and recovery in docker, the article is rich in content, interested partners can learn about it, I hope you can get something after reading this article.
1. Backup of Postgres database in Docker
Command:
Docker exec it db_13 pg_dumpall-c-U mrp > mrp217
Explanation:
Docker exec it [mirror database name in docker] pg_dumpall-c-U [user name] > [database name at import]
2. Postgres database backup
Command:
Pg_dump-host xxxxx-port 5434-username odoo > odoo217 mrp
Explanation:
Pg_dump-host [address]-port [port]-username [user name of database] > [exported file] [database name]
3. Restore locally, restore to docker directly from the command line
Psql-U odoo (user name)-h localhost-p 6543 (port mapped by docker)-d odoo (database name)-f / media/liang/_dde_data/mrp217
4. Before restoring to a database in docker, delete the old database, build a new one, and then restore (regular database updates)
Docker exec-it db13 bash # enter daocker
Psql-U odoo (user name)-d postgres # enters the psql database
Once inside, perform the database operation:
Drop databse odoo; # Delete database
Create database odoo; # create a new database
Just quit dockers and then restore the database.
4.1 another kind of recovery, mine does not apply here
Pg_dump-h localhost-p 5432-U odoo-F c-b-v-f "/ usr/20200214.backup" mrp docker, function: backup from docker database to docker
Outside docker cp db_mrp_sync:/usr/20200214.backup. / docker, function: import from docker to server outside docker
Scp xxxxxx:/home/xxx/20200214.backup D:\ connects remotely and leads to a local location
Pg_restore-d / path/to/your/file/mrp.sql-c-U
5. Will be imported locally from the test server
Scp xxxx:/home/xxx/mrp217 D:\ connect to a remote location, when the shell tool is not installed in the local location
Scp ip: the path to the backup file in the test server, the local path to import
After reading this article on how to achieve psql database backup and recovery in docker, if you think the article is well written, you can share it with more people.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.