当前位置: 首页 > 工具软件 > WAL-G > 使用案例 >

wal-g

乜胜泫
2023-12-01

os: centos 7.4
db: postgresql 11.7

wal-g 继承了 wal-e,同时又做了改进。

可以理解为 wal-g 是 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)

依赖安装

# yum install lzop pv go libsodium libsodium-devel libsodium-static

下载安装

# cd /opt
# wget https://github.com/wal-g/wal-g/releases/download/v0.2.15/wal-g.linux-amd64.tar.gz
# cp ./wal-g /usr/local/bin/

# cd ~
# which wal-g
/usr/local/bin/wal-g

修改 postgresql.conf 参数

# mkdir -p /tmp/pgwal;
chown -R postgres:postgres /tmp/pgwal;

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

wal_level = logical
archive_mode = on
archive_command = 'export WALG_FILE_PREFIX=/tmp/pgwal;/usr/local/bin/wal-g wal-push %p'
archive_timeout = 60

# systemctl restart postgresql-11.service

# tree /tmp/pgwal/
/tmp/pgwal/
└── wal_005
    ├── 0000000100000001000000C1.lz4
    └── 0000000100000001000000C2.lz4

1 directory, 2 files

为什么会再创建个 wal_005 的目录?

参考:
https://github.com/wal-g/wal-g
https://github.com/wal-g/wal-g/blob/master/PostgreSQL.md

 类似资料: