Patroni 不会更改 postgresql.conf 中的 wal_level

问题描述

我将 patroini yaml 文件中的 wal_level 从副本修改为逻辑并运行以下命令。但是,postgresql.conf 中的值没有改变。我错过了什么?

有没有办法改变 DCS 参数?我什至尝试使用alter database,所以我会有一个自动文件,但这也无济于事。

非常感谢您的帮助

patronictl -c postgres.yml show-config 
patronictl -c postgres.yml edit-config 
// I also did reload here to be of safe side and then restarted cluster
patronictl -c postgres.yml restart postgres-cluster 




scope: postgres-cluster
name: aaa-pg2
namespace: /db/

restapi:
  listen: "0.0.0.0:8008"
  connect_address: "...:8008"

etcd:
  hosts: "..."
bootstrap:
  dcs:
    ttl: 30
    loop_wait: 10
    retry_timeout: 10
    maximum_lag_on_failover: 1048576
    postgresql:
      use_pg_rewind: true
      use_slots: true
      parameters:
      hot_standby: "on"
      wal_keep_segments: 8
      max_wal_senders: 5
      max_replication_slots: 5
      checkpoint_timeout: 30
      wal_level: logical

  initdb:
    - encoding: UTF8
    - data-checksums
  pg_hba:
    - "host replication replicator 127.0.0.1/32 trust"
    - "host replication replicator .../0 trust"
    - "host replication replicator .../0 trust"
    - "host all all 0.0.0.0/0 trust"
  users:
    admin:
      options:
        - createrole
        - createdb
      password: admin
log:
  dir: /opt/app/patroni/log
  level: INFO
postgresql:
  listen: "0.0.0.0:5432"
  connect_address: "...:5432"

  data_dir: /postgres_db/data
  config_dir: /postgres_db/data
  bin_dir: /usr/pgsql/bin

  authentication:
    replication:
    username: postgres
      password: aaa

    superuser:
      username: postgres
      password: bbb

  parameters:
    unix_socket_directories: "."
   # pgpass: ~/pgpass

tags:
  clonefrom: false
  nofailover: false
  noloadbalance: false
  nosync: false

Postgres 由 Patroni 使用以下参数运行:

ps -ef | grep postgres

/usr/pgsql/bin/postgres -D /postgres_db/data --config-file=/postgres_db/data/postgresql.conf --listen_addresses=0.0.0.0 --port=5432 --cluster_name=postgres-cluster --wal_level=replica --hot_standby=on --max_connections=100 --max_wal_senders=10 --max_prepared_transactions=0 --max_locks_per_transaction=64 --track_commit_timestamp=off --max_replication_slots=10 --max_worker_processes=8 --wal_log_hints=on

解决方法

当我运行patronictl -c postgres.yml edit-config 时,参数部分没有缩进。一旦我运行了带有 -p 选项的命令 parentictl -c postgres.yml edit-config ,它就会将它放在正确的缩进中,现在它可以工作了。