Recommended way to reset/clean evenstore

Hello

In our application we have the requirement to clean all data. What would be the recommended way to do that?

We create a lot of streams so iterating over all streams and deleting them? Not sue about that. We also need to reset projections and recreate persistent subscriptions.

After a clean operation, there will be streams recreated again with the same.

Would just deleting the data folder from every node in the cluster be an option?

Maarten

You could delete the data directory.

  • By clearing out the data directory you will also loose any user accounts, projections, etc. You could set those up on startup, just worth mentioning.

Ok, so the solution could be as follow:

  • Deploy a custom Windows service on each server which hosts an ES node

  • That Windows service is connected to a service bus like RabbitMQ and can act on certain messages.

In this case it would be stopping the ES service on the server, clearing the data folder, bringing the ES service back up. Afterwards performing some operations like adding a user, adding projections and recreating subscription groups.

This would be a valid approach?

Maarten

My guess is you could just quickly script all the stuff like adding projections/users etc without actually writing a windows service etc. Also you likely want to use different folder names per deploy, this will allow the possibility of a rollback to a previous version.