我安装了一个patroni主节点,需要创建一个pgbackrest副本,主节点状态正在运行,但从节点停止然后它消失,因为它看起来像属于另一个数据库标识符, 当我尝试手动运行恢复命令pgbackrest --stanza=main --log-level-console=info --delta Restore从节点状态更改为运行
这里是主postgresql.yml文件:
> scope: {{ obasicat }} namespace: /pg_cluster/ name: {{ master }}
>
> restapi:
> listen: {{ master_ip }}:8008
> connect_address: {{ master_ip }}:8008
>
> etcd:
> host: {{ etcd_ip }}:2379
>
> bootstrap: dcs:
> ttl: 30
> loop_wait: 10
> retry_timeout: 10
> maximum_lag_on_failover: {{ lag }}
> postgresql:
> use_pg_rewind: false
> use_slots: true
>
> method: pgbackrest pgbackrest:
> command: /home/osadmin/custom_bootstrap.sh
> keep_existing_recovery_conf: False
> no_params: False
> recovery_conf:
> recovery_target: immediate
> recovery_target_action: pause
> restore_command: pgbackrest --stanza={{ obasicat }} archive-get %f %p
>
> pg_hba:
> - host all postgres 0.0.0.0/0 trust
> - host replication replicate {{ master_ip }}/0 md5
> - host replication replicate {{ slave_ip }}/0 md5
> - host all all 0.0.0.0/0 md5
>
> users:
> admin:
> password: admin
> options:
> - createrole
> - createdb
>
> postgresql: listen: "*:5432" connect_address: {{ master_ip }}:5432
> data_dir: /{{opgbase}}/{{opgname}}/data/ bin_dir:
> /opt/pgsql/na/11.7/bin/ authentication:
> replication:
> username: replicate
> password: replicate
> superuser:
> username: postgres
> password: postgres
>
> create_replica_methods:
> - pgbackrest pgbackrest:
> command: pgbackrest --stanza={{ obasicat }} --delta restore --config=/etc/pgbackrest.conf --pg1-path=/pgqdata/pgserver01/data/ --log-level-console=info
> keep_data: True
> no_params: True
>
> tags:
> nofailover: false
> noloadbalance: false
> clonefrom: false
> nosync: false
>
> log:
> level: DEBUG
> dir: /tmp/
这是从属 postgresql.yml 文件:
> scope: {{ obasicat }} namespace: /pg_cluster/ name: {{ slave }}
>
> restapi:
> listen: {{ slave_ip }}:8008
> connect_address: {{ slave_ip }}:8008
>
> etcd:
> host: {{ etcd_ip }}:2379
>
> bootstrap: dcs:
> ttl: 30
> loop_wait: 10
> retry_timeout: 10
> maximum_lag_on_failover: {{ lag }}
> postgresql:
> use_pg_rewind: false
> use_slots: true
>
> method: pgbackrest pgbackrest:
> command: /home/osadmin/custom_bootstrap.sh
> keep_existing_recovery_conf: False
> no_params: False
> recovery_conf:
> recovery_target: immediate
> recovery_target_action: pause
> restore_command: pgbackrest --stanza={{ obasicat }} archive-get %f %p
>
> pg_hba:
> - host all postgres 0.0.0.0/0 trust
> - host replication replicate {{ master_ip }}/0 md5
> - host replication replicate {{ slave_ip }}/0 md5
> - host all all 0.0.0.0/0 md5
>
> users:
> admin:
> password: admin
> options:
> - createrole
> - createdb
>
> postgresql: listen: "*:5432" connect_address: {{ slave_ip }}:5432
> data_dir: /{{opgbase}}/{{opgname}}/data/ bin_dir:
> /opt/pgsql/na/11.7/bin/ authentication:
> replication:
> username: replicate
> password: replicate
> superuser:
> username: postgres
> password: postgres
>
> create_replica_methods:
> - pgbackrest pgbackrest:
> command: pgbackrest --stanza={{ obasicat }} --delta restore --config=/etc/pgbackrest_slave.conf --pg1-path=/pgqdata/pgserver01/data/ --log-level-console=info
> keep_data: True
> no_params: True
>
> tags:
> nofailover: false
> noloadbalance: false
> clonefrom: false
> nosync: false
>
> log:
> level: DEBUG
> dir: /tmp/
请帮忙?! 谢谢
尝试在 etcd/zookeper/consul 中更新密钥
7127773868874685913!= 7194568630546240772
/opt/etcd/etcdctl --endpoints=localhost:2379 get /service/stampede/initialize
获取此密钥7127773868874685913
/opt/etcd/etcdctl --endpoints=localhost:2379 put /service/stampede/initialize 7194568630546240772
更新到新密钥7194568630546240772
1.列出etcd中的键: etcdctl --endpoints=http://host:2379 get / --prefix --keys-only
2.删除旧的集群键: etcdctl --endpoints=http://host:2379 del /db/your_cluster_path --prefix
3.systemctl重启patroni
4.journalctl -u 赞助人