Context: A system tracks some sort of transactions (e.g. money flow) for it's whole user base. At the end of the month each entity capable of receiving transactions has to be sent exactly one bill containing all the transaction's of the current month. This system is instanced, meaning that there are multiple instances (servers) of the system running.
How to handle this sort of scenario? I must not allow duplicate monthly transaction evaluations. Given the nature of the system a master-slave architecture is ruled out as master-election or master-slave in general is not scaling to a large amount of instances.
I would like to spread the load of the monthly transaction aggregation across all running instances. The transactions are stored in a database in the form (user_id, transaction_target_id, transaction_amount). Failed monthly transaction aggregations should be retried by another instance
In short: I need exactly-once guarantees for a distributed system without a master-slave concept