{"id":140,"date":"2020-03-07T15:58:09","date_gmt":"2020-03-07T14:58:09","guid":{"rendered":"https:\/\/nissel.it\/?p=140"},"modified":"2020-04-19T08:50:08","modified_gmt":"2020-04-19T06:50:08","slug":"datensicherung-mit-rsnapshot","status":"publish","type":"post","link":"https:\/\/nissel.it\/index.php\/2020\/03\/07\/datensicherung-mit-rsnapshot\/","title":{"rendered":"Datensicherung mit rsnapshot"},"content":{"rendered":"\n<p>Installation von rsnapshot<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt install rsnapshot<\/code><\/pre>\n\n\n\n<p>Rsnaphot \u00fcber die Datei \/etc\/rsnapshot.conf konfigurieren. In diesem Beispiel 7 Tage, 4 Wochen ein Monat<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#########################################\n#     BACKUP LEVELS \/ INTERVALS         #\n# Must be unique and in ascending order #\n# e.g. alpha, beta, gamma, etc.         #\n#########################################\n\nretain  daily   7\nretain  weekly  4\nretain  monthly 1<\/code><\/pre>\n\n\n\n<!--more-->\n\n\n\n<p>Das Backup Verzeichnis angeben.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>snapshot_root   \/var\/backups\/homepages\/<\/code><\/pre>\n\n\n\n<p>Unerw\u00fcnschte Daten ausklammern<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>exclude \/var\/www\/vhosts\/*\/httpdocs\/moodledata\nexclude \/var\/www\/vhosts\/system\/*\/statistics\nexclude \/var\/www\/vhosts\/system\/*\/logs<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>Die Daten die gesichert werden sollen angeben.<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>backup          \/home\/          localhost\/\nbackup          \/etc\/           localhost\/\nbackup          \/usr\/local\/     localhost\/\nbackup          \/var\/www\/       localhost\/\nbackup          \/root\/          localhost\/\nbackup          \/opt\/lms\/       localhost\/\nbackup  \/opt\/psa\/admin\/conf\/    localhost\/ #\/opt\/psa\/ bei ausreichend Platz ca. 800MB<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Mysql Datenbanken sichen<\/h2>\n\n\n\n<p>Vor den ausf\u00fchren der Backups kann ein script ausgef\u00fchrt werden welches z.B. alle Datenbanken sichert.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cmd_preexec     \/usr\/bin\/lms_backupMySQL.sh<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/bin\/bash\n\ncd \/var\/www\/vhosts\/databaseDumps\/\nmysql -N -e 'show databases' | while read dbname; do \n        mysqldump --single-transaction -C -Q -e --create-options \"$dbname\" > \"$dbname\".sql; \n        &#91;&#91; $? -eq 0 ]] &amp;&amp; gzip -f \"$dbname\".sql; \ndone<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Testen der Konfiguration<\/h2>\n\n\n\n<p>Mit dem Befehl rsnapshot und dem ersten &#8222;retain&#8220; kann ein Backup getestet werden.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>rsnapshot daily\n----------------------------------------------------------------------------\nrsnapshot encountered an error! The program was invoked with these options:\n\/usr\/bin\/rsnapshot daily \n----------------------------------------------------------------------------\nERROR: \/etc\/rsnapshot.conf on line 73:\nERROR: cmd_preexec \/usr\/bin\/lms_backupMySQL.sh - missing tabs to separate \\\n         words - change spaces to tabs. \nERROR: \/etc\/rsnapshot.conf on line 167:\nERROR: exclude \/var\/www\/vhosts\/*\/httpdocs\/moodledata - missing tabs to \\\n         separate words - change spaces to tabs. \n<\/code><\/pre>\n\n\n\n<p>An vielen stellen der Konfiguration muss ein Tab anstelle von Leerzeichen eingef\u00fcgt werden. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Backup automatisch starten<\/h2>\n\n\n\n<p>rsnapshot hat bereits eine Datei \/etc\/cron.d\/rsnapshot erstellt die angepasst werden muss. Oder man erstellt scripte in \/etc\/cron.daly weekly &#8230;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>25 5    * * *   root    \/usr\/bin\/rsnapshot daily\n47 5    * * 7   root    \/usr\/bin\/rsnapshot weekly \n52 5    1 * *   root    \/usr\/bin\/rsnapshot monthly<\/code><\/pre>\n\n\n\n<p>Linux: Ubuntu 18.04.4<br>Plesk: Obsidian 18.0.25<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Installation von rsnapshot Rsnaphot \u00fcber die Datei \/etc\/rsnapshot.conf konfigurieren. In diesem Beispiel 7 Tage, 4 Wochen ein Monat<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[8],"class_list":["post-140","post","type-post","status-publish","format-standard","hentry","category-webserver","tag-backup"],"_links":{"self":[{"href":"https:\/\/nissel.it\/index.php\/wp-json\/wp\/v2\/posts\/140","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nissel.it\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nissel.it\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nissel.it\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nissel.it\/index.php\/wp-json\/wp\/v2\/comments?post=140"}],"version-history":[{"count":7,"href":"https:\/\/nissel.it\/index.php\/wp-json\/wp\/v2\/posts\/140\/revisions"}],"predecessor-version":[{"id":232,"href":"https:\/\/nissel.it\/index.php\/wp-json\/wp\/v2\/posts\/140\/revisions\/232"}],"wp:attachment":[{"href":"https:\/\/nissel.it\/index.php\/wp-json\/wp\/v2\/media?parent=140"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nissel.it\/index.php\/wp-json\/wp\/v2\/categories?post=140"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nissel.it\/index.php\/wp-json\/wp\/v2\/tags?post=140"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}