Keep 2 Raspberry up to Date

Hi there. I dont know if here is the right Place to ask.
My Plan is having 2 identical raspies with a homematic board and OH2; Influx; Homegear; Grafana and keep them synced in case one dies.
Perfekt would be a Delay of 1 day or so if I mess up something. So I could go back.
Basically I am looking for a mirror or Replikation Solution that brings over everything. And if the First one breaks I just set the Second active.

Looking forward to your ideas.

one idea would be: (there are many tutorials on rsync). Here is another one:

you may have to stop some services just before rsync fires on a cron schedule (e.g. InfluxDB) to allow the files to close properly. Copying open database (and other actively open) files is not really recommended.

Hi. Thanks a lot for your response
Yes I was thinking about rsync. Stoping the services once a night would be no problem. I’m just struggling what exactly to copy without breaking any keys and making sure the owners stay valid.

what do you mean by "keys"? (something like /root/.ssh/authorized_keys or something else?)

rsync should have no problem copying over permission and ownership settings (assuming the linux user already exists in the remote host). There are flags in the rsync command line to take care of this kind of stuff:

Yes. And as much as i know also homegear stores some keys

if these keys are stored in files: then rsync should have no problem copying them over.

Now… if these some of these keys depend on some hardware parameters that will change (e.g. the MAC Address of the Ethernet NIC)… you may have to re-validate/re-generate them when you bring live the standby system (rare case).