pg 10 wal 归档同步配置
一.rsync server(172.16.3.226)
CentOS 7.2 X64
# yum install -y rsync
# mkdir -p -m 0700 /db/wal_archive
# chown -R postgres.postgres /db/wal_archive
可能存在的问题:
修改目录/db/wal_archive权限后仍报错如下:
rsync: mkstemp "/.000000010000000000000001.2Z6cX4" (in archive) failed: Permission denied (13)
解决办法:请查询 /etc/selinux/config的SELINUX配置项:
SELINUX=disabled
2.rsync server(172.16.3.226)
1).修改配置
# vi /etc/rsyncd.conf
[root@localhost wal_archive]# vi /etc/rsyncd.conf
# /etc/rsyncd: configuration file for rsync daemon mode
# See rsyncd.conf man page for more options.
# configuration example:
# uid = nobody
# gid = nobody
# use chroot = yes
# max connections = 4
# pid file = /var/run/rsyncd.pid
# exclude = lost+found/
# transfer logging = yes
# timeout = 900
# ignore nonreadable = yes
# dont compress = *.gz *.tgz *.zip *.z *.Z *.rpm *.deb *.bz2
# [ftp]
# path = /home/ftp
# comment = ftp export area
############# new add ##############
[archive]
# destination directory for copy
path = /db/wal_archive
# hosts you allow to access
hosts allow = 172.16.3.225
hosts deny = *
list = true
uid = postgres
gid = postgres
read only = false
[postgres@localhost wal_archive]#
2.启动服务
# systemctl start rsyncd
# systemctl enable rsyncd
二、传输文件
rync client(172.16.3.225)
1.安装软件
# yum install -y rsync
2.建立数据库归档目录
# mkdir -p -m 0700 /db/wal_archive
# chown -R postgres.postgres /db/wal_archive
3.同步脚本配置
1小时以外的wal同步
sync_archives.sh
#!bin/sh
export PATH=/bin:$PATH
find /db/wal_archive -name '0000*' -type f -mmin 60 | xargs -I{} rsync -avz {} 172.16.3.226::archive
归档删除脚本
两天以外的wal删除
del_archives.sh
#!bin/sh
export PATH=/bin:$PATH
find /db/wal_archive -name '0000*' -type f -mtime +2 - delete
# crontab -e
* * * * * /opt/cron/sync_archives.sh
0 1 * * * /opt/cron/del_archives.sh
三、数据库归档配置
#------------------------------------------------------------------------------
# WRITE AHEAD LOG
#------------------------------------------------------------------------------
# - Settings -
#wal_level = replica # minimal, replica, or logical
# (change requires restart)
#fsync = on # flush data to disk for crash safety
# (turning this off can cause
# unrecoverable data corruption)
#synchronous_commit = on # synchronization level;
# off, local, remote_write, remote_apply, or on
#wal_sync_method = fsync # the default is the first option
# supported by the operating system:
# open_datasync
# fdatasync (default on Linux)
# fsync
# fsync_writethrough
# open_sync
#full_page_writes = on # recover from partial page writes
#wal_compression = off # enable compression of full-page writes
#wal_log_hints = off # also do full page writes of non-critical updates
# (change requires restart)
#wal_buffers = -1 # min 32kB, -1 sets based on shared_buffers
# (change requires restart)
#wal_writer_delay = 200ms # 1-10000 milliseconds
#wal_writer_flush_after = 1MB # measured in pages, 0 disables
#commit_delay = 0 # range 0-100000, in microseconds
#commit_siblings = 5 # range 1-1000
# - Checkpoints -
#checkpoint_timeout = 5min # range 30s-1d
#max_wal_size = 1GB
#min_wal_size = 80MB
checkpoint_completion_target = 0.9 # checkpoint target duration, 0.0 - 1.0
#checkpoint_flush_after = 256kB # measured in pages, 0 disables
#checkpoint_warning = 30s # 0 disables
# - Archiving -
archive_mode = on # enables archiving; off, on, or always
# (change requires restart)
archive_command = 'cp -an %p > /db/wal_archive/%f' # command to use to archive a logfile segment
# placeholders: %p = path of file to archive
# %f = file name only
# e.g. 'test ! -f /mnt/server/archivedir/%f && cp %p /mnt/server/archivedir/%f'
archive_timeout = 86400 # force a logfile segment switch after this
# number of seconds; 0 disables
#------------------------------------------------------------------------------
# REPLICATION
#------------------------------------------------------------------------------
# - Sending Server(s) -
# Set these on the master and on any standby that will send replication data.
max_wal_senders = 20 # max number of walsender processes
# (change requires restart)
wal_keep_segments = 1000 # in logfile segments, 16MB each; 0 disables
#wal_sender_timeout = 60s # in milliseconds; 0 disables
#max_replication_slots = 10 # max number of replication slots
# (change requires restart)
#track_commit_timestamp = off # collect timestamp of transaction commit
# (change requires restart)
pg 10 wal 归档同步配置相关推荐
- 数据库周刊28│开发者最喜爱的数据库是什么?阿里云脱口秀聊程序员转型;MySQL update误操作;PG流复制踩坑;PG异机归档;MySQL架构选型;Oracle技能表……
文章来源:墨天轮社区 https://www.modb.pro/db/26343 摘要:墨天轮数据库周刊第28期发布啦,每周1次推送本周数据库相关热门资讯.精选文章.干货文档.本周分享 开发者最喜爱的 ...
- MySQL主从(MySQL proxy Lua读写分离设置,一主多从同步配置,分库分表方案)
Mysql Proxy Lua读写分离设置 一.读写分离说明 读写分离(Read/Write Splitting),基本的原理是让主数据库处理事务性增.改.删操作(INSERT.UPDATE.DELE ...
- Linux同步自己的配置,Linux学习心得之——Rsync同步配置
Linux学习心得之--Rsync同步配置 1 使用软件 类unix系统下的数据镜像备份工具:rsync. 2 安装说明 2.1 获取rsync 下载最新版本的rsync-3.0.8.tar.gz 2 ...
- 源码安装mysql主从_mysql源码安装和主从同步配置
mysql源码安装和主从同步配置 mysql介绍: MySQL 是一种关联数据库管理系统,关联数据库将数据保存在不同的表中,而不是将所有数据放在一个大仓库内,这样就增加了速度并提高了灵活性.MySQL ...
- mysql主从同步配置超详细_MySQL主从同步配置
一. 理论部分 MySQL主从同步 主从同步使得数据可以从一个数据库服务器复制到其他的服务器上.在复制数据时,一个服务器充当主服务器(master),其余的服务器充当从服务器(slave). 因为复制 ...
- linux启动lsyncd服务,Ubuntu下lsyncd实现远端实时同步配置
例子:双nginx实现自动同步配置 nginxA:10.5.8.19 nginxB:10.5.8.20 1,实现8.19免密登陆8.20 19操作 #ssh-keygen -t rsa #ssh-co ...
- oracle 11gogg,【OGG】Oracle GoldenGate 11g (二) GoldenGate 11g 单向同步配置 上
Oracle GoldenGate 11g (二) GoldenGate 11g 单向同步配置 上 Item Source System Target System Platform RHEL6.4 ...
- mysql多源复制 知乎_MySQL多主一从(多源复制)同步配置
>多主一从,也称为多源复制,数据流向.这是小编的服务器部署的一次小尝试,实际工作中还没遇到过 形式 主库1 -> 从库s 主库2 -> 从库s 主库n -> 从库s 应用场景 ...
- mysql5.7.17主从_mysql5.7.17主从同步配置
一.mysql同步原理 1.mysql主库在事务提交时将数据变更作为时间记录到二进制日志(binary log)中: 2.slave IO线程将master的binary log events读写到它 ...
最新文章
- SurfaceView 间取得焦点
- HwBinder原理总结-Android10.0 HwBinder通信原理(十一)
- 如何写出优雅的API
- 《BI那点儿事》Microsoft 线性回归算法
- OpenCV与图像处理学习三——线段、矩形、圆、椭圆、多边形的绘制以及文字的添加
- std中稳定排序算法_源代码库已开放 | 哈工大硕士生用 Python 实现了 11 种经典数据降维算法...
- java+路径拦截实现_SpringBoot实现拦截器
- android实现日志列表,【Android开发】listview+popupwindow实践:日志列表
- 详解python可迭代对象、迭代器和生成器
- python mount回调函数_python requests模块中返回时间elapsed解析
- Android源码设计模式解析与实战(四)
- Matlab中插值函数使用
- ACL2021奇葩标题大赏
- Base58编码的长度是如何计算的?
- Javascript之基本包装类型
- ELK-使用nxlog+filebeat采集不同类型的日志输出到logstash
- 使用Aforge 开发的摄像头,有拍照,录像,设置帧率,分辨率等,以及对视频以及相机等的控制
- select2.js插件支持拼音搜索(最新版-4.0.6)
- 数据库管理员详细介绍
- 实现button按钮的内容为图片