Journals that only publish online. How reliable are they? There are lots of journals that only publish online. However they are indexed by scopus and ISI so they are unlikely to be predatory journals. Are they safe? What are the chances that some hacker erases the journal’s database and all the records of publications are lost? 

Surely it’s better to have printed copies of volumes and stuff. At least that way there is always proof that one’s article has been published.
Any reputable online-only journal will have a plan for data retention that goes beyond what's visible to the user. There will be backups somewhere.

Print journals may have the advantage of having a physical repository copy existing, but even those are not necessarily of "archival quality" (that is, printed on acid-free paper and using techniques that promote their long-term preservation).