1. 程式人生 > 其它 >CentOS 7.8 patroni修改postgresql配置引數

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 -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 |
+--------+---------------------+---------+---------+----+-----------+