zoukankan      html  css  js  c++  java
  • recovery.conf 用于 stream replication

    recovery.conf 是 postgresql slave 数据库的重要文件,示例文件为.

    $ ls -l $PGHOME/share/recovery.conf.sample
    

    可以编辑 $PGDATA/recovery.conf

    异步stream

    recovery_target_timeline = 'latest'
    standby_mode = 'on'
    primary_conninfo = 'host=192.168.56.201 port=5432 user=replicator password=passw0rd'
    primary_slot_name = 'pgsql_node02'
    trigger_file = '/tmp/postgresql.trigger.5432'
    

    ##同步stream

    recovery_target_timeline = 'latest'
    standby_mode = 'on
    primary_conninfo = 'host=192.168.56.201 port=5432 user=replicator password=passw0rd application_name=node02'
    primary_slot_name = 'pgsql_node02'
    trigger_file = '/tmp/postgresql.trigger.5432'
    

    相比异步多了 application_name=node02
    备注一下:
    application_name 对应 postgresql.conf 的 synchronous_standby_names 的变量值

    同时 slot 不是必须的,但是建议使用,在 master 上需要首先创建 slot

    postgres=# select * from pg_create_physical_replication_slot('pgsql_node2');
    

    同步时,在master上必须设置如下参数:

    fsync = on
    synchronous_commit = on    #同步复制必须设置为on
    synchronous_standby_names = 'node2,node3' #同步复制必须设置
    或者 synchronous_standby_names = '*'
    full_page_writes = on
    wal_log_hints = on
    
  • 相关阅读:
    Rocky Linux8国内镜像源
    强制缓存和协商缓存的区别
    从源码来看VUE的执行流程
    plugin
    判断数据类型的方法
    获取函数参数
    BFC
    VUE的$nextTick
    HTTP
    JavaScript创建和触发自定义事件
  • 原文地址:https://www.cnblogs.com/ctypyb2002/p/9792900.html
Copyright © 2011-2022 走看看