• Barman 安装


    Barman需要用到psql客户端,所以需要在Barman服务器安装psql数据库
    
    1 linux操作系统环境准备:
    
    python版本:2.6或2.7
    yum -y install epel-release.noarch
    yum -y install python-argcomplete.noarch
    yum -y install python-argh.noarch
    yum -y install python-psycopg2.x86_64 python-psycopg2-doc.x86_64
    yum -y install python-dateutil.noarch python-dateutil15.noarch
    yum -y install rsync.x86_64
    
    
    2 创建barman系统用户
    groupadd barman
    useradd -g barman barman
    passwd barman
    
    3 安装Barman
    # tar -zxvf barman-1.4.0.tar.gz
    # chown -R barman:barman barman-1.4.0
    
    [barman@localhost barman-1.4.0]$ ./setup.py build
    [root@localhost barman-1.4.0]# ./setup.py install
    [root@localhost barman-1.4.0]# su - barman
    [barman@localhost ~]$ cd /software/barman-1.4.0
    [barman@localhost barman-1.4.0]$ ./setup.py install --user
    
    将Barman配置文件Barman.conf拷贝到~/.barman.conf
    [barman@localhost ~]$ cp /software/barman-1.4.0/doc/barman.conf ~/.barman.conf
    [barman@localhost ~]$ ls -al
    -rw-r--r--  1 barman barman 2863 Feb 12 15:57 .barman.conf
    
    4 配置.barman.conf文件:
    [main-test]
    description =  "test"
    ssh_command = ssh barman@barmanIP
    conninfo = host=IP user=postgres
    incoming_wals_directory: /barman_backup/main-test/incoming
    minimum_redundancy = 1
    retention_policy = REDUNDANCY 2
    
    
    5 Barman服务器与数据库服务器之间做互信
    [barman@localhost ~]$ ssh-keygen -t rsa
    [barman@localhost ~]$ ssh-copy-id -i .ssh/id_rsa.pub barman@IP
    [barman@localhost ~]$ ssh barman@IP
    
    [barman@erp ~]$ ssh-keygen -t rsa
    [barman@erp ~]$ ssh-copy-id -i .ssh/id_rsa.pub barman@barmanIP
    [barman@erp ~]$ ssh barman@barmanIP
    
    
    6 基于时间点的恢复: --基于时间的恢复将数据库恢复到read only状态
    [barman@slony ~]$ barman recover --target-time "2015-02-27 15:25:00" --remote-ssh-command "ssh postgres@IP" main-test 20150227T141803 /home/postgres/pgdata
    
    **********************************************************************************
    Barman备份standby数据库:
    
    在standby库操作:
    安装pgespresso-master.zip       --https://github.com/2ndquadrant-it/pgespresso
    [postgres@segdb1 pgespresso-master]$ make 
    [postgres@segdb1 pgespresso-master]$make install
    
    [postgres@segdb1 ~]$ psql 
    postgres=# CREATE EXTENSION pgespresso;
    
    在Barman服务器:
    vi .barman.conf
    添加
    backup_options = concurrent_backup
    
    注:
    必须将主服务器的归档日志归档到:/home/barman/barman/main-test-standby/incoming目录下
    archive_command = 'rsync -a %p barman@barmanIP:/barman_backup/main-test/incoming/%f'
  • 相关阅读:
    2020年面向对象程序设计寒假作业1_实践题
    2020年面向对象程序设计寒假作业1_问答题
    实验5:开源控制器实践——POX
    实验4:开源控制器实践——OpenDaylight
    实验3:OpenFlow协议分析实践
    实验2:Open vSwitch虚拟交换机实践
    第一次个人编程作业
    实验1:SDN拓扑实践
    第一次博客作业
    面向对象程序设计寒假作业3
  • 原文地址:https://www.cnblogs.com/telwanggs/p/11543254.html
Copyright © 2020-2023  润新知