首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >未能在3个节点赞助者postgres-11集群中进行故障转移

未能在3个节点赞助者postgres-11集群中进行故障转移
EN

Stack Overflow用户
提问于 2020-04-30 01:22:03
回答 1查看 740关注 0票数 0

我有一个三节点patroni postgres-11集群running.The赞助人集群设置如下:

代码语言:javascript
复制
consul:
  url: <consul URL>

bootstrap:
  initdb:
    encoding: UTF8
  dcs:
    ttl: 30
    loop_wait: 10
    retry_timeout: 10
    maximum_lag_on_failover: 1048576
    postgresql:
      use_pg_rewind: true
      use_slots: true
      remove_data_directory_on_diverged_timelines: false
      remove_data_directory_on_rewind_failure: true
      parameters:
        archive_command: /bin/true
        archive_mode: 'on'
        archive_timeout: 1800s
        checkpoint_completion_target: 0.9
        default_statistics_target: 100
        effective_cache_size: 24GB
        effective_io_concurrency: 200
        hot_standby: 'on'
        log_directory: /var/log/postgresql
        log_filename: postgresql-%a.log
        logging_collector: 'on'
        maintenance_work_mem: 2GB
        max_connections: 2000
        max_parallel_maintenance_workers: 4
        max_parallel_workers: 8
        max_parallel_workers_per_gather: 4
        max_replication_slots: 10
        max_wal_senders: 10
        max_wal_size: 8GB
        max_worker_processes: 8
        min_wal_size: 2GB
        random_page_cost: 1.1
        shared_buffers: 8GB
        ssl: 'on'
        ssl_cert_file: /etc/ssl/certs/ssl-cert-snakeoil.pem
        ssl_key_file: /etc/ssl/private/ssl-cert-snakeoil.key
        track_commit_timestamp: 'on'
        wal_buffers: 16MB
        wal_keep_segments: 64
        wal_level: logical
        wal_log_hints: 'on'
        work_mem: 5242kB

postgresql:
  listen: 0.0.0.0:5432
  connect_address: <IP Address of the node>:5432
  data_dir: /var/lib/postgresql/11/<db name>
  pgpass: /tmp/pgpass0
  authentication:
    superuser:
      username: postgres
      password: postgres
    replication:
      username: replicator
      password: replicator
    rewind:
      username: rewind_user
      password: rewind_password
  pg_hba:
    - local all all peer
    - host all all 127.0.0.1/32 md5
    - hostssl all postgres 0.0.0.0/0 md5
    - host all postgres 0.0.0.0/0 reject
    - host all all 0.0.0.0/0 md5
    - hostssl all postgres ::0/0 md5
    - host all postgres ::0/0 reject
    - host all all ::0/0 md5
    - local replication all peer
    - host replication all 127.0.0.1/32 md5
    - hostssl replication replicator 0.0.0.0/0 md5
    - hostssl replication replicator ::0/0 md5
    - host replication replicator 0.0.0.0/0 md5
    - host replication replicator 127.0.0.1/32 trust
    - local postgres   postgres   peer
    - host all all 0.0.0.0/0 md5
  create_replica_methods:
    - basebackup
  basebackup:
    max-rate: '250M'

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

restapi:
  connect_address: <IP Address of the node>:8008
  listen: 0.0.0.0:8008

当我关闭主服务器时,我希望synchronous standby将成为主要的。但是,在两个备用节点上,我看到了以下错误:

代码语言:javascript
复制
INFO: following a different leader because i am not the healthiest node

不确定为什么同步备用没有成为主备用。我在Ubuntu 18.04上使用Ubuntu 18.04

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-04-30 02:23:06

我解决了问题。由于某种原因,我节点名称中的大写字母被转换为小写字母,所以赞助人找不到备用节点。如下所示:

代码语言:javascript
复制
{"leader":"Pa-db1","sync_standby":"pa-db2"}

节点的正确名称是Pa-db2,同样,第二个备用节点名是Pa-db3。我将所有节点的名称更改为小写字母,即pa-db1, pa-db2, pa-db3和故障转移工作!

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61514372

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档