{"id":727,"date":"2020-04-21T18:49:33","date_gmt":"2020-04-21T16:49:33","guid":{"rendered":"https:\/\/www.anginf.de\/?p=727"},"modified":"2023-02-07T16:56:42","modified_gmt":"2023-02-07T15:56:42","slug":"influxdb-backup-and-restore-on-ubuntu-18-04","status":"publish","type":"post","link":"https:\/\/www.anginf.de\/?p=727","title":{"rendered":"influxdb: backup and restore on Ubuntu 18.04"},"content":{"rendered":"\n<p>I ran into some trouble trying to backup and restore a InfluxDB to a new server. Here are the steps to <em>correctly<\/em> backup a database and restore it on the remote host.<\/p>\n\n\n\n<p>On the source host, backup the InfluxDB you want while the influxdb is running:<\/p>\n\n\n\n<pre class=\"wp-block-code has-dark-gray-color has-text-color\"><code lang=\"bash\" class=\"language-bash\"># This will create a directory \"backup\" for DATABASE_NAME:\ninfluxd backup -database DATABASE_NAME backup<\/code><\/pre>\n\n\n\n<p>Transfer the directory to the target machine and import the data (using default directories from influx):<\/p>\n\n\n\n<pre class=\"wp-block-code has-dark-gray-color has-text-color\"><code lang=\"bash\" class=\"language-bash\">sudo service influxdb stop # Restore works ONLY on stopped InfluxDB\nsudo influxd restore -metadir \/var\/lib\/influxdb\/meta BACKUP_DIRECTORY\nsudo influxd restore -database DATABASE_NAME -datadir \/var\/lib\/influxdb\/data BACKUP_DIRECTORY\nsudo chown -R influxdb:influxdb \/var\/lib\/influxdb\nsudo service influxdb start<\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I ran into some trouble trying to backup and restore a InfluxDB to a new server. Here are the steps to correctly backup a database and restore it on the remote host. On the source host, backup the InfluxDB you want while the influxdb is running: Transfer the directory to the target machine and import &hellip; <a href=\"https:\/\/www.anginf.de\/?p=727\" class=\"more-link\"><span class=\"screen-reader-text\">influxdb: backup and restore on Ubuntu 18.04<\/span> weiterlesen <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-727","post","type-post","status-publish","format-standard","hentry","category-allgemein"],"_links":{"self":[{"href":"https:\/\/www.anginf.de\/index.php?rest_route=\/wp\/v2\/posts\/727","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.anginf.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.anginf.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.anginf.de\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.anginf.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=727"}],"version-history":[{"count":2,"href":"https:\/\/www.anginf.de\/index.php?rest_route=\/wp\/v2\/posts\/727\/revisions"}],"predecessor-version":[{"id":777,"href":"https:\/\/www.anginf.de\/index.php?rest_route=\/wp\/v2\/posts\/727\/revisions\/777"}],"wp:attachment":[{"href":"https:\/\/www.anginf.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=727"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.anginf.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=727"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.anginf.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=727"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}