wal-e

os: centos 7.4
db: postgresql 11.7

wal-e 是一個用於執行PostgreSQLWal文件和基本備份的連續歸檔的程序。

目前 wal-e 看上去已經不怎麼維護了。

版本

# cat /etc/centos-release
CentOS Linux release 7.4.1708 (Core) 
# 
# 
# yum list installed |grep -i postgresql
postgresql11.x86_64                11.7-1PGDG.rhel7                    @pgdg11  
postgresql11-contrib.x86_64        11.7-1PGDG.rhel7                    @pgdg11  
postgresql11-debuginfo.x86_64      11.5-1PGDG.rhel7                    @pgdg11  
postgresql11-devel.x86_64          11.7-1PGDG.rhel7                    @pgdg11  
postgresql11-docs.x86_64           11.7-1PGDG.rhel7                    @pgdg11  
postgresql11-libs.x86_64           11.7-1PGDG.rhel7                    @pgdg11  
postgresql11-llvmjit.x86_64        11.7-1PGDG.rhel7                    @pgdg11  
postgresql11-odbc.x86_64           12.01.0000-1PGDG.rhel7              @pgdg11  
postgresql11-plperl.x86_64         11.7-1PGDG.rhel7                    @pgdg11  
postgresql11-plpython.x86_64       11.7-1PGDG.rhel7                    @pgdg11  
postgresql11-plpython3.x86_64      11.7-1PGDG.rhel7                    @pgdg11  
postgresql11-pltcl.x86_64          11.7-1PGDG.rhel7                    @pgdg11  
postgresql11-server.x86_64         11.7-1PGDG.rhel7                    @pgdg11  
postgresql11-tcl.x86_64            2.4.0-2.rhel7.1                     @pgdg11  
postgresql11-test.x86_64           11.7-1PGDG.rhel7                    @pgdg11 

# su - postgres
Last login: Wed Jan 15 18:34:12 CST 2020 on pts/0
$
$
$ psql -c "select version();"
                                                 version                                                 
---------------------------------------------------------------------------------------------------------
 PostgreSQL 11.7 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39), 64-bit
(1 row)

依賴安裝

Dependencies

python (>= 3.4)
lzop
psql (>= 8.4)
pv

# yum install python3 python3-devel python3-lib lzop pv

下載安裝

# python3 -m pip install wal-e[aws,azure,google,swift]

# which wal-e
/usr/local/bin/wal-e

修改 postgresql.conf 參數

# cd /var/lib/pgsql/11/data/
# vi postgresql.conf

wal_level = logical
archive_mode = on
archive_command = '/usr/local/bin/wal-e --file-prefix=file://localhost/tmp wal-push %p '
archive_timeout = 60

# systemctl restart postgresql-11.service

# ls -l /tmp/
drwx------ 2 postgres postgres   4096 May  8 20:33 wal_005

# ls -l /tmp/wal_005

total 304
-rw------- 1 postgres postgres 76669 May  8 20:28 000000010000000100000099.lzo
-rw------- 1 postgres postgres 76669 May  8 20:28 00000001000000010000009A.lzo
-rw------- 1 postgres postgres 76604 May  8 20:29 00000001000000010000009B.lzo
-rw------- 1 postgres postgres 76604 May  8 20:29 00000001000000010000009C.lzo

參考:
https://github.com/wal-e/wal-e

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章