• CentOS 7.8 patroni修改postgresql配置参数


    使用edit-config

    bash-4.2$ patronictl -c /etc/patroni/patroni.yml edit-config
    loop_wait: 10
    master_start_timeout: 300
    maximum_lag_on_failover: 1048576
    postgresql:
      parameters:
        hot_standby: 'on'
        listen_addresses: 0.0.0.0
        max_connections: 500  //默认值为100,这里加到500
        max_replication_slots: 10
        max_wal_senders: 10
        port: 5432
        wal_keep_segments: 100
        wal_level: logical
        wal_log_hints: 'on'
      use_pg_rewind: true
      use_slots: true
    retry_timeout: 10
    synchronous_mode: false
    ttl: 30

    保存

    --- 
    +++ 
    @@ -3,6 +3,7 @@
     maximum_lag_on_failover: 1048576
     postgresql:
       parameters:
    +    max_connections: 500
         hot_standby: 'on'
         listen_addresses: 0.0.0.0
         max_replication_slots: 10
    
    Apply these changes? [y/N]: y
    Configuration changed

      也可以直接修改

    bash-4.2$ patronictl edit-config -p "max_connections=6000"
    bash-4.2$ patronictl edit-config -p "ssl=on" bash-4.2$ patronictl edit-config -p "ssl_cert_file=ssl/server.crt" bash-4.2$ patronictl edit-config -p "ssl_key_file=ssl/server.key" bash-4.2$ patronictl edit-config -p "log_min_duration_statement=5000" --- +++ @@ -5,6 +5,7 @@ parameters: hot_standby: 'on' listen_addresses: 0.0.0.0 + log_min_duration_statement: 5000 max_connections: 500 max_replication_slots: 10 max_wal_senders: 10 Apply these changes? [y/N]: y Configuration changed

    查看集群

    bash-4.2$ patronictl -c /etc/patroni/patroni.yml list
    +--------+---------------------+---------+---------+----+-----------+-----------------+
    | Member | Host                | Role    | State   | TL | Lag in MB | Pending restart |
    + Cluster: pgsql (7042477957214539800) --+---------+----+-----------+-----------------+
    | pg1    | 192.168.1.50:5432 | Replica | running |  2 |         0 | *               |
    | pg2    | 192.168.1.51:5432 | Leader  | running |  2 |           | *               |
    | pg3    | 192.168.1.52:5432 | Replica | running |  2 |         0 | *               |
    +--------+---------------------+---------+---------+----+-----------+-----------------+
    
    Pending restart 列里有*号的都需要重启才生效

    重启完再次查看

    bash-4.2$ patronictl -c /etc/patroni/patroni.yml list
    +--------+---------------------+---------+---------+----+-----------+
    | Member | Host                | Role    | State   | TL | Lag in MB |
    + Cluster: pgsql (7042477957214539800) --+---------+----+-----------+
    | pg1    | 192.168.1.50:5432 | Replica | running |  2 |         0 |
    | pg2    | 192.168.1.51:5432 | Leader  | running |  2 |           |
    | pg3    | 192.168.1.52:5432 | Replica | running |  2 |         0 |
    +--------+---------------------+---------+---------+----+-----------+

     切换主

    bash-4.2$ patronictl switchover pgsql
    Master [pg2]:     //当前的master
    Candidate ['pg1', 'pg3'] []: pg1 //可选的master的节点
    When should the switchover take place (e.g. 2021-12-22T08:43 )  [now]: 
    Current cluster topology
  • 相关阅读:
    【CSS】flex 布局 justifycontent:spacebetween;解决最后一排数量不够自动向两端排列问题
    【Vue】NavBar 顶部弹窗点击弹窗击空白区域关闭弹窗实现
    【patchpackage】基本使用,给修改的 node_modules 下源码“打补丁”
    【FSResizer】faststone下图片神器
    【pandas】按照数据列中元素出现的先后顺序进行分组排列(最后一种个人原创)
    【PC】微信多开bat
    【正则表达式应用】不规则多维数组展平一维
    【首发】【Navicat premium 16】激活完整记录
    【原创】彻底解决GitHub访问慢的问题(只需三招)
    【Edge浏览器】8大隐藏功能,开启更好用
  • 原文地址:https://www.cnblogs.com/linyouyi/p/15714010.html
Copyright © 2020-2023  润新知