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

Instructions for using remove_cluster.yml #189

Merged
merged 1 commit into from
Jul 27, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

---

Expand Down