How can I setup some kind of buffering database with mariadb I have a primary database on a linux box run mariadb, but it uses &gt;100 watts of power which reduces the UPS runtime.  Also I need to periodically reboot the server for updates and maintenance.
I want to have an intermediate database on the raspberry Pi 4 also mariadb.
So if the main server is off, it logs it locally(raspberry pi) on disk so if the power is lost the data is not.
I would prefer to have it attempt to transfer the data as soon as it comes in, but 15 minutes intervals is ok. After successful transfer the records should be deleted from the Pi. It needs to verify the records transferred correctly and not hope for the best. If the primary database fails, oh well I guess I will try again in 15 minutes and hope for the best. It will keep trying every 15 minutes until it succeeds. Even if it takes a week.
So I can setup a local mariadb easy enough, but how can I have it automatically transfer the data to the primary database and delete the records from itself.
Also the table has an auto incrementing field that needs to be ignored on the raspberry Pi as the primary server has it own auto incrementing field and that is the master.
I thought of some kind of data replication, but I don't want 2 copies of the data.
Primary - Primary  (aka multi-Master) replication.
When either is down, the other continues to log changes to the &quot;binlog&quot;, which will be promptly sent to the other machine when it comes back up.
Read the manual for details.  It is essentially setting up Replication to go both ways.  There are several steps.  A common mistake is forgetting to turn on log_slave_updates.