From e95fa6bd67a83456d3f5451d9158d83b556900b2 Mon Sep 17 00:00:00 2001 From: chlordk Date: Wed, 27 Jul 2022 08:14:01 +0200 Subject: [PATCH] Instructions for using remove_cluster.yml --- README.md | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 5a9d66d90..82b5d1c58 100644 --- a/README.md +++ b/README.md @@ -414,16 +414,20 @@ I can recommend the following backup and restore tools: Do not forget to validate your backups (for example [pgbackrest auto](https://github.com/vitabaks/pgbackrest_auto)). ## How to start from scratch -Should you need to start from very beginning, use the following to clean up: -- on all nodes, stop Patroni and remove PGDATA: - ```shell - sudo systemctl stop patroni - sudo rm -rf /var/lib/postgresql/ # be careful with this if there are other PG clusters - ``` -- then delete etcd entry (can be run on any node): - ```shell - etcdctl rm --dir --recursive /service/postgres-cluster # adjust if you changed the cluster's name - ``` +Should you need to start from very beginning, use the playbook `remove_cluster.yml`. + +To prevent the script to be used by accident in a production environment, edit `remove_cluster.yml` and remove the *safety pin*. Change these variables accordingly: + +- remove_postgres: true +- remove_etcd: true + +Run the script and all the data are gone. + +`ansible-playbook remove_cluster.yml` + +A new installation can now be made from scratch. + +:heavy_exclamation_mark: Be careful not to copy this script without the *safety pin* to the production environment. ---