Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to start patroni after pgbackrest restore #656

Open
kumarashish071092 opened this issue May 8, 2024 · 8 comments
Open

Unable to start patroni after pgbackrest restore #656

kumarashish071092 opened this issue May 8, 2024 · 8 comments

Comments

@kumarashish071092
Copy link

I have restored my entire cluster from a other pgbackrest host and after making the necessary changes , I was able to start the database using the below command :

/usr/lib/postgresql/14/bin/pg_ctl -D /mnt/Postgres/postgresql/14/trin-prod/data start

But this is not getting run by patroni service and the playbook execution is not getting completed .

how can I link the patroni and new postgres cluster and does it have to do anything with etcd as well?

@vitabaks
Copy link
Owner

vitabaks commented May 8, 2024

@kumarashish071092 Please attach the ansible and patroni logs.

@kumarashish071092
Copy link
Author

kumarashish071092 commented May 9, 2024 via email

@vitabaks
Copy link
Owner

vitabaks commented May 9, 2024

Ok, good!

I will prepare a website with detailed documentation soon.

@vitabaks
Copy link
Owner

vitabaks commented May 9, 2024

You may have an old version of automation because for pgbackrest we have not used the bootstrap method to provide delta restore functionality for a long time.

See details here https://github.com/vitabaks/postgresql_cluster#restore-and-cloning

@kumarashish071092
Copy link
Author

kumarashish071092 commented May 9, 2024 via email

@vitabaks
Copy link
Owner

vitabaks commented May 9, 2024

Is there any other way to restore pgbackrest with patroni

And why are you not satisfied with the current method? It is fully automated.

Point-In-Time-Recovery

https://github.com/vitabaks/postgresql_cluster#restore-and-cloning

You can run automatic restore of your existing patroni cluster
for PITR, specify the required parameters in the main.yml variable file and run the playbook with the tag:

ansible-playbook deploy_pgcluster.yml --tags point_in_time_recovery

What does automation do? (recovery steps with pgBackRest):

1. Stop patroni service on the Replica servers (if running);
2. Stop patroni service on the Master server;
3. Remove patroni cluster "xxxxxxx" from DCS (if exist);
4. Run "/usr/bin/pgbackrest --stanza=xxxxxxx --delta restore" on Master;
5. Run "/usr/bin/pgbackrest --stanza=xxxxxxx --delta restore" on Replica (if patroni_create_replica_methods: "pgbackrest");
6. Waiting for restore from backup (timeout 24 hours);
7. Start PostgreSQL for Recovery (master and replicas);
8. Waiting for PostgreSQL Recovery to complete (WAL apply);
9. Stop PostgreSQL instance (if running);
10. Disable PostgreSQL archive_command (if enabled);
11. Start patroni service on the Master server;
12. Check PostgreSQL is started and accepting connections on Master;
13. Make sure the postgresql users (superuser and replication) are present, and password does not differ from the specified in vars/main.yml;
14. Update postgresql authentication parameter in patroni.yml (if superuser or replication users is changed);
15. Reload patroni service (if patroni.yml is updated);
16. Start patroni service on Replica servers;
17. Check that the patroni is healthy on the replica server (timeout 10 hours);
18. Check postgresql cluster health (finish).

@vitabaks
Copy link
Owner

vitabaks commented May 9, 2024

@SDV109 Please confirm that you are already using the automated Point-In-Time-Recovery method. Do you have any difficulties with this?

@SDV109
Copy link
Contributor

SDV109 commented May 13, 2024

@vitabaks, Yes, I confirm that with the latest repository releases, there are no problems with the recovery method at a certain point in time.

@kumarashish071092, Hi, look at my comment on the PITR problem earlier, maybe it will help you: #588 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants