中文字幕日韩精品一区二区免费_精品一区二区三区国产精品无卡在_国精品无码专区一区二区三区_国产αv三级中文在线

pg10wal歸檔同步配置

一.rsync server(172.16.3.226) 

創(chuàng)新互聯(lián)建站是一家集網(wǎng)站建設,嵐皋企業(yè)網(wǎng)站建設,嵐皋品牌網(wǎng)站建設,網(wǎng)站定制,嵐皋網(wǎng)站建設報價,網(wǎng)絡營銷,網(wǎng)絡優(yōu)化,嵐皋網(wǎng)站推廣為一體的創(chuàng)新建站企業(yè),幫助傳統(tǒng)企業(yè)提升企業(yè)形象加強企業(yè)競爭力??沙浞譂M足這一群體相比中小企業(yè)更為豐富、高端、多元的互聯(lián)網(wǎng)需求。同時我們時刻保持專業(yè)、時尚、前沿,時刻以成就客戶成長自我,堅持不斷學習、思考、沉淀、凈化自己,讓我們?yōu)楦嗟钠髽I(yè)打造出實用型網(wǎng)站。

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.建立數(shù)據(jù)庫歸檔目錄

# 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

三、數(shù)據(jù)庫歸檔配置

#------------------------------------------------------------------------------

# 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)

網(wǎng)站名稱:pg10wal歸檔同步配置
轉(zhuǎn)載來源:http://www.rwnh.cn/article14/jscsde.html

成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供定制開發(fā)、自適應網(wǎng)站、標簽優(yōu)化、靜態(tài)網(wǎng)站、微信公眾號、網(wǎng)站改版

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

商城網(wǎng)站建設
苍溪县| 肥东县| 岐山县| 宁强县| 江达县| 桓台县| 永宁县| 堆龙德庆县| 肥城市| 洛南县| 临夏市| 太康县| 县级市| 瓦房店市| 西丰县| 台中市| 土默特左旗| 札达县| 高尔夫| 河曲县| 襄城县| 安丘市| 麦盖提县| 登封市| 太白县| 恭城| 兴隆县| 云和县| 内乡县| 永福县| 阿拉善右旗| 河西区| 佛学| 宣汉县| 杂多县| 峨山| 雷州市| 内乡县| 上虞市| 什邡市| 郑州市|