Skip to content

Instantly share code, notes, and snippets.

@lxxstc
Last active December 18, 2015 01:58
Show Gist options
  • Save lxxstc/5707181 to your computer and use it in GitHub Desktop.
Save lxxstc/5707181 to your computer and use it in GitHub Desktop.

概念

Write Ahead Log

  • Why? Write Ahead Log 减少磁盘IO 做PITR
  • Location: $PGDATA/pg_xlog
  • Size: 16MB determinated at compile time
  • rotation

check_point

checkpoint_segments = 3 # default
checkpoint_timeout = 5 # minute default
checkpoint_completion_target = 

PITR & Logging Ship (warming standby)

  • 参数 master postgresql.conf
archive_mode = on # ArchPG
archive_command = '/usr/bin/omnipitr-archive -l /var/log/qfare_omnipitr/omnipitr-^Y^m^d.log -s /var/run/qfare_omnipitr
-dr gzip=rsync://l-interdb3.f.cn1.qunar.com/slave_PITR/ -dr gzip=rsync://l-interdb7.f.cn1.qunar.com/slave_PITR/ -dr gzip=rsync://l-interdb4.f.cn1.qunar.com/slave_PITR/ -db /var/run/qfare_omnipitr/dstbackup --pid-file /var/run/qfare_omnipitr/omnipitr.pid -v "%p"'
archive_timeout
  • 如果一个从挂了,会是什么状况

Streaming (Hot Standby)

wal_keep_segments =   # This sets only the minimum number of segments retained in pg_xlog,  the system might need to retain more segments for WAL archival or to recover from a checkpoint

Time Line

  • 什么是Time Line
  • 通过 pg_controldata 查看 time line

配置文件

postgresql.conf

recovery.conf

方案

Streaming vs Logging ship

  • Why This?

结构

工具

Omnipitr

集群配置工具 LXX的

关键参数

  • full_page

监控

  • Streaming Process & Reciving Process
  • RealTime Data Write

流程

  • 打包

可能遇到的问题

streaming链接未建立

omnipitr出错

无法链接从库

其他

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment