pgBackRest 之一 setup

pgbackrest 用於 postgresql 的備份還原,從 github 來看一直在維護。

os: centos 7.4
db: postgresql 11.7

版本

# 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 make gcc openssl openssl-devel libxml2 libxml2-devel lz4 lz4-devel
 
# cd /tmp
# wget https://github.com/pgbackrest/pgbackrest/archive/release/2.26.tar.gz
# tar -zxvf 2.26.tar.gz
# cd pgbackrest-release-2.26/src
# export PATH=/usr/pgsql-11/bin:$PATH
# ./configure
# make
# make install
install -d /usr/local/bin
install -m 755 pgbackrest /usr/local/bin

# pgbackrest
pgBackRest 2.26 - General help

Usage:
    pgbackrest [options] [command]

Commands:
    archive-get     Get a WAL segment from the archive.
    archive-push    Push a WAL segment to the archive.
    backup          Backup a database cluster.
    check           Check the configuration.
    expire          Expire backups that exceed retention.
    help            Get help.
    info            Retrieve information about backups.
    restore         Restore a database cluster.
    stanza-create   Create the required stanza data.
    stanza-delete   Delete a stanza.
    stanza-upgrade  Upgrade a stanza.
    start           Allow pgBackRest processes to run.
    stop            Stop pgBackRest processes from running.
    version         Get version.

Use 'pgbackrest help [command]' for more information.

# mkdir -p -m 770 /var/log/pgbackrest;
chown postgres:postgres /var/log/pgbackrest;
mkdir -p /etc/pgbackrest;
mkdir -p /etc/pgbackrest/conf.d;
touch /etc/pgbackrest/pgbackrest.conf;
chmod 640 /etc/pgbackrest/pgbackrest.conf;
chown postgres:postgres /etc/pgbackrest/pgbackrest.conf;

參考:
https://github.com/pgbackrest/pgbackrest

https://pgbackrest.org/
https://pgbackrest.org/configuration.html
https://pgbackrest.org/command.html
https://pgbackrest.org/user-guide-index.html

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