postgresql归档备份
2015-06-26 16:11
435 查看
主库配置
修改pg_hba.conf
修改postgresql.conf
执行
继续编辑postgresql.conf
重新执行
归档后如何恢复呢?
备库配置
编辑recovery.conf
修改端口后启动。
tip:归档的好处,相当于时刻进行了增量备份。意味着
修改pg_hba.conf
local replication postgres trust host replication postgres 127.0.0.1/32 trust host replication postgres ::1/128 trust
修改postgresql.conf
wal_level = hot_standby --WAL记录级别 --or wal_level = archive max_wal_senders = 1 --允许几个链接读取WAL记录
执行
pg_basebackup -D basegd/ -R --备份至目录basegb -R生成recovery.conf文件显示为
NOTICE: WAL archiving is not enabled; you must ensure that all required WAL segments are copied through other means to complete the backup
继续编辑postgresql.conf
archive_mode = on archive_command = 'cp %p /home/postgre/archivedir/%f' --WAL归档目录 archive_timeout = 60 --强制60秒生成了一个归档文件
重新执行
pg_basebackup -D basegd/ -R这次没有一些异常提示。
归档后如何恢复呢?
备库配置
编辑recovery.conf
restore_command='cp /home/postgres/archivedir/%f %p' --从WAL归档目录接受文件 archive_cleanup_command='pg_archivecleanup /home/postgres/archivedir %r' --归档后可清理的不需要的WAL文件 recovery_end_command='touch /home/postgres/gd.tim' --完成后执行的shell命令
修改端口后启动。
tip:归档的好处,相当于时刻进行了增量备份。意味着
archive_timeout =60秒备份了主库一次。
相关文章推荐
- sql 转义
- Office Tips 2 - 如何备份oracle sql developer的connection
- Can't open and lock privilege tables: Table 'mysql.host' doesn't exist
- AWS中RDS修改mysql的编码
- 选出列名为一定长度的sql语句写法
- Excel 中使用SQL 语句查询数据(八)-----用Group by 进行分组统计
- oracle调用JAVA类的方法
- MongoDB初步
- Oracle触发器详解
- Oracle触发器详解
- Yii使用Mongodb
- [Mysql]备份同库中一张表的历史记录 insert into ..select
- [Mysql]备份同库中一张表的历史记录 insert into ..select
- mongoDB简介及安装
- 发现一个不错的网址,学习mysql配置。
- [转]oracle 10g数据泵之impdp-同时导入多个文件
- django数据库中的时间格式与页面渲染出来的时间格式不一致的处理
- SQL Server 01 修改对象名称
- mysql group by......
- DB2数据库用SQL求时间差