postgresql的备份可以借助于脚本和contron来完成
备份脚本该脚本主要用于一天进行一次备份,备份保留一个星期。如果是其它的备份策略请对应的调整相关的参数
#!/bin/bash## 设置备份的地址backuppath=/var/lib/pgsql/9.4/backups# 获取当前时间cur_time=$(date '+%Y-%m-%d')sevendays_time=$(date -d -7days '+%Y-%m-%d')rm -f $backuppath/{dbname}$sevendays_time.bakpg_dump --port 5432 --username "postgres" --no-password --format custom --blobs --verbose --file "$backuppath/{dbname}$cur_time.bak" "{dbname}"还原脚本
backuppath=/var/lib/pgsql/9.5/backupsread -p "please enter restore date:" cur_datepg_restore --host "127.0.0.1" --port "5432" --username "postgres" --no-password --dbname "{dbname}" --verbose --clean "$backuppath/{dbname}$cur_date.bak"总结
以上是内存溢出为你收集整理的postgresql的备份与还原全部内容,希望文章能够帮你解决postgresql的备份与还原所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)