How can I setup some kind of buffering database with mariadb
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.