磨砺技术珠矶,践行数据之道,追求卓越价值

回到上一级页面: PostgreSQL基础知识与基本操作索引页     回到顶级页面:PostgreSQL索引页

通过实验,可以发现,PostgreSQL中使用WAL log来存储到其他地方,来辅助完成PITR。

但是,WAL是16MB一个,

缺省情况下,如果一个WAL文件没有写满,它就不会被archive_command 调用来拷贝走。

如果长时间没有太多作业,可能有点WAL log会一直位于pg_xlog目录下作为online redo log存在。

那么从崩溃中或者出错中恢复时,也需要提供这些pg_xlog目录下的文件。

有的人建议每间隔几分钟就拷贝pg_xlog目录下的文件。
我认为是不妥当的,这是因为这对于PostgreSQL而言是举手之劳,但是它没有这样作。

而且,如果自己去拷贝online redo log,也可能产生数据不一致的问题。还是不要这样作的好。

PostgreSQL 建议的方法是:archive_timeout,通过更加频繁的强制log_switch来保证对事务的保存。

http://www.postgresql.org/docs/9.1/static/continuous-archiving.html

The archive command is only invoked on completed WAL segments. Hence, if your server generates only little WAL traffic (or has slack periods where it does so), there could be a long delay between the completion of a transaction and its safe recording in archive storage. To put a limit on how old unarchived data can be, you can set archive_timeout to force the server to switch to a new WAL segment file at least that often. Note that archived files that are archived early due to a forced switch are still the same length as completely full files. It is therefore unwise to set a very short archive_timeout — it will bloat your archive storage. archive_timeout settings of a minute or so are usually reasonable.

Also, you can force a segment switch manually with pg_switch_xlog if you want to ensure that a just-finished transaction is archived as soon as possible. Other utility functions related to WAL management are listed in Table 9-56.
archive_timeout (integer)
The archive_command is only invoked for completed WAL segments. Hence, if your server generates little WAL traffic (or has slack periods where it does so), there could be a long delay between the completion of a transaction and its safe recording in archive storage. To limit how old unarchived data can be, you can set archive_timeout to force the server to switch to a new WAL segment file periodically. When this parameter is greater than zero, the server will switch to a new segment file whenever this many seconds have elapsed since the last segment file switch, and there has been any database activity, including a single checkpoint. (Increasing checkpoint_timeout will reduce unnecessary checkpoints on an idle system.) Note that archived files that are closed early due to a forced switch are still the same length as completely full files. Therefore, it is unwise to use a very short archive_timeout — it will bloat your archive storage. archive_timeout settings of a minute or so are usually reasonable. You should consider using streaming replication, instead of archiving, if you want data to be copied off the master server more quickly than that. This parameter can only be set in the postgresql.conf file or on the server command line.

回到上一级页面: PostgreSQL基础知识与基本操作索引页     回到顶级页面:PostgreSQL索引页

磨砺技术珠矶,践行数据之道,追求卓越价值

PostgreSQL的PITR中,对 unfilled wal log 如何处理为好的更多相关文章

  1. PostgreSQL 预写日志机制(WAL)

    关于持久性 持久性是指,事务提交后,对系统的影响必须是永久的,即使系统意外宕机,也必须确保事务提交时的修改已真正永久写入到永久存储中. 最简单的实现方法,当然是在事务提交后立即刷新事务修改后的数据到磁 ...

  2. PostgreSQL的 PITR实战---运用 recovery_target_time

    磨砺技术珠矶,践行数据之道,追求卓越价值 回到上一级页面: PostgreSQL基础知识与基本操作索引页     回到顶级页面:PostgreSQL索引页 看了很多的例子,没有发现具体讲 recove ...

  3. PostgreSQL 8.1 中文文档(转)

    PostgreSQL 8.1 中文文档(转) http://www.php100.com/manual/PostgreSQL8/ 或者点击下面链接 PostgreSQL 8.1 中文文档

  4. PostgreSQL 8.1 中文文档

    PostgreSQL 8.1 中文文档 http://www.php100.com/manual/PostgreSQL8/

  5. Expo大作战(六)--expo开发模式,expo中exp命令行工具,expo中如何查看日志log,expo中的调试方式

    简要:本系列文章讲会对expo进行全面的介绍,本人从2017年6月份接触expo以来,对expo的研究断断续续,一路走来将近10个月,废话不多说,接下来你看到内容,将全部来与官网 我猜去全部机翻+个人 ...

  6. loadrunner脚本中写入脚本输出log到外部文件,分析参数取值方式

    loadrunner脚本中写入脚本输出log到外部文件,分析参数取值方式 分类: 心得 loadrunner 我的测试 2012-04-01 12:52 2340人阅读 评论(0) 收藏 举报 脚本l ...

  7. 【翻译自mos文章】在Oracle GoldenGate中循环使用ggserr.log的方法

    在OGG中循环使用ggserr.log的方法: 參考原文: OGG How Do I Recycle The "ggserr.log" File? (Doc ID 967932.1 ...

  8. ROS中的日志(log)消息

    学会使用日志(log)系统,做ROS大型项目的主治医生 通过显示进程的运行状态是好的习惯,但需要确定这样做不会影响到软件的运行效率和输出的清晰度.ROS 日志 (log) 系统的功能就是让进程生成一些 ...

  9. JavaScript中的内存泄漏以及如何处理

    随着现在的编程语言功能越来越成熟.复杂,内存管理也容易被大家忽略.本文将会讨论JavaScript中的内存泄漏以及如何处理,方便大家在使用JavaScript编码时,更好的应对内存泄漏带来的问题. 概 ...

随机推荐

  1. Oracle EBS PO 接收事务处理查不到对应的数据

    1. 有一种情况是采购订单的借记账户不对 不匹配OU 2. 有可能是因为接口表卡住了 PENDING状态的把对应的数据删除掉即可  3. 接收时发生异常那个,丢失了接收头,rcv_shipment_h ...

  2. Hive的介绍及安装

    简介 Hive 是基于 Hadoop 的一个数据仓库工具,可以将结构化的数据文件 映射为一张数据库表,并提供类 SQL 查询功能. 本质是将 SQL 转换为 MapReduce 程序. Hive组件 ...

  3. Redis学习---Redis操作之Python连接

    PyCharm下的Redis连接 连接方式: 1. 操作模式 redis-py提供两个类Redis和StrictRedis用于实现Redis的命令,StrictRedis用于实现大部分官方的命令,并使 ...

  4. 一、JavaScript概述 二、JavaScript的语法 三、JavaScript的内置对象

    一.JavaScript的概述###<1>JavaScript的概念 又称ECMAScript,和java没有任何关系 嵌入在HTML元素中的 被浏览器解释运行的 一种脚本语言. ###& ...

  5. TFS使用笔记——合并不同分支的代码

    问题描述:我们需要把2.37中改动的代码合并到2.38当中. 查看“Pending Changes”,单击“Change”列排序,查看merge的items,然后选中merge的items,最后“Ch ...

  6. 论文 ClickP4: Towards Modular Programming of P4 小结

    当前P4存在的问题(ClickP4为解决的问题) 1.随着P4程序的规模和复杂性的增加,从零开始开发单片P4程序容易出错,需要相当多的时间和精力去解决,所以网络政策的多样性和动态性使得运营商为了满足要 ...

  7. Maven实战(九)Maven仓库简介

    目录 一.作用 Maven仓库分为本地仓库和远程仓库,集中存放项目引用的jar包,无需将jar包放在程序中,结合Maven项目的pom.xml,使得项目管理jar包更容易,有以下几个优点: 对于项目来 ...

  8. [DAViCHi/SeeYa/T-ARA][원더우먼][Wonder Woman]

    歌词来源:http://music.163.com/#/song?id=5371229 作曲 : 赵英秀 [作曲 : 赵英秀] [作曲 : 赵英秀] 作词 : K-Smith [作词 : KSmith ...

  9. python3+OpenGL环境配置

    注:示例系统环境:Windows10 64位 + Anaconda3: 1.首先登录https://www.opengl.org/resources/libraries/glut/,下载下图箭头所指的 ...

  10. Python+django+uWSGI+Nginx

    Python3.5+Django+uWSGI 安装Django pip3.5 install django 安装 uWSGI pip install uwsgi 新建 django_wsgi.py # ...