Class: Container::Backup::Influxdb
- Defined in:
- lib/container/steps/databases.rb
Instance Method Summary collapse
Methods inherited from Step
#backup_path, #container, #image, #initialize, #params, #perform
Constructor Details
This class inherits a constructor from Container::Backup::Step
Instance Method Details
#backup ⇒ Object
www.influxdata.com/blog/new-features-in-open-source-backup-and-restore/
- "backup={volumes: [influxdb_data],databases: [influxdb: {user: ${INFLUXDB_ADMIN_USER},password: ${INFLUXDB_ADMIN_PASSWORD}}]}"
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/container/steps/databases.rb', line 91 def backup # influxd backup -portable [options] <path-to-backup> # # Backup Options # # -host <host:port> – The host to connect to and perform a snapshot of. Defaults to 127.0.0.1:8088. # -database <name> – The database to backup. Optional. If not given, all databases are backed up. # -retention <name> – The retention policy to backup. Optional. # -shard <id> – The shard id to backup. Optional. If specified, -retention is required. # -since <2015-12-24T08:12:13Z> – Do a file-level backup since the given time. The time needs to be in the RFC3339 format. Optional. # -start <2015-12-24T08:12:23Z> – All points earlier than this timestamp will be excluded from the export. Not compatible with -since. # -end <2015-12-24T08:12:23Z> – All points later than this time stamp will be excluded from the export. Not compatible with -since. # -portable – Generate backup files in the format used for InfluxDB Enterprise. sh "docker exec #{container} sh -c 'influxd backup -protable /#{backup_path}'" end |
#restore ⇒ Object
108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/container/steps/databases.rb', line 108 def restore # influxd restore -portable [options] <path-to-backup> # Regardless of whether you have existing backup automation that supports the legacy format, or you are a new user, you may wish to test the new online feature for legacy to gain the advantages described above. It is activated by using either the -portable or -online flags. The flags indicate that the input is in either the new portable backup format (which is the same format that Enterprise InfluxDB uses), or the legacy backup format, respectively. It has the following options: # -host <host:port> – The host to connect to and perform a snapshot of. Defaults to 127.0.0.1:8088. # -db <name> – Identifies the database from the backup that will be restored. # -newdb <name> – The name of the database into which the archived data will be imported on the target system. If not given, then the value of -db is used. The new database name must be unique to the target system. # -rp <name> – Identifies the retention policy from the backup that will be restored. Requires that -db is set. # -newrp <name> – The name of the retention policy that will be created on the target system. Requires that -rp is set. If not given, the value of -rp is used. # -shard <id> – Optional. If given, -db and -rp are required. Will restore the single shard’s data. sh "docker exec #{container} sh -c 'influxd restore -protable /#{backup_path}'" end |