-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Anselme Goetschmann
committed
May 18, 2018
1 parent
3075355
commit e92919f
Showing
2 changed files
with
106 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
!Build/ | ||
.last_cover_stats | ||
/META.yml | ||
/META.json | ||
/MYMETA.* | ||
*.o | ||
*.pm.tdy | ||
*.bs | ||
|
||
# Devel::Cover | ||
cover_db/ | ||
|
||
# Devel::NYTProf | ||
nytprof.out | ||
|
||
# Dizt::Zilla | ||
/.build/ | ||
|
||
# Module::Build | ||
_build/ | ||
Build | ||
Build.bat | ||
|
||
# Module::Install | ||
inc/ | ||
|
||
# ExtUtils::MakeMaker | ||
/blib/ | ||
/_eumm/ | ||
/*.gz | ||
/Makefile | ||
/Makefile.old | ||
/MANIFEST.bak | ||
/pm_to_blib | ||
/*.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,73 @@ | ||
# InfluxDB Schema Updater | ||
|
||
The influxdb-schema updater is a small DevOps tool to manage the schema of a [InfluxDB](https://github.com/influxdata/influxdb) with a set of configuration files. | ||
The InfluxDB schema updater is a small DevOps tool to manage the schema of an [InfluxDB](https://github.com/influxdata/influxdb) instance with a set of configuration files. | ||
|
||
# SYNOPSIS | ||
|
||
`influxdb-schema-updater [--help] [--dryrun] [--diff] [--force] [--config <schema_location>] [--url <url>]` | ||
|
||
# OPTIONS | ||
|
||
- **--help** | ||
|
||
Print a help message and exit. | ||
|
||
- **--dryrun** | ||
|
||
Print the changes which would be applied in normal mode. | ||
|
||
- **--diff** | ||
|
||
Print the InfluxQL queries instead of executing them. | ||
|
||
- **--force** | ||
|
||
Apply the changes which were prevented in normal mode. | ||
|
||
- **--config** | ||
|
||
The directory where the schema files are located. Default is /etc/influxdb/schema/. | ||
|
||
- **--url** | ||
|
||
The url where the InfluxDB HTTP API is reachable. Default is localhost:8086. | ||
|
||
# DESCRIPTION | ||
|
||
This tool compares the databases, retention policies (RPs) and continuous queries (CQs) found in the `<schema_location>` directory to the ones in the InfluxDB instance reachable at `<url>`. If there is a difference, InfluxDB will be updated. Some changes like deleting a database are skipped when the `--force` flag is not set. | ||
|
||
The exit code is 0 if and only if every required update has been executed successfully. | ||
|
||
The `<schema_location>` directory should have the following structure: | ||
|
||
``` | ||
db/ | ||
<db_file1> | ||
<db_file2> | ||
... | ||
cq/ | ||
<cq_file1> | ||
<cq_file2> | ||
... | ||
``` | ||
|
||
The files in `db/` contain `CREATE` queries for databases followed by their their RPs, for example: | ||
|
||
``` | ||
CREATE DATABASE test WITH DURATION 100d REPLICATION 1 SHARD DURATION 2w NAME rp1; | ||
CREATE RETENTION POLICY rp2 ON test DURATION 260w REPLICATION 1 SHARD DURATION 12w; | ||
CREATE DATABASE test2; | ||
CREATE RETENTION POLICY rp1 ON test2 DURATION 100d REPLICATION 1 SHARD DURATION 2w; | ||
CREATE RETENTION POLICY rp2 ON test2 DURATION 260w REPLICATION 1 SHARD DURATION 12w; | ||
CREATE RETENTION POLICY rp3 ON test2 DURATION INF REPLICATION 1 SHARD DURATION 260w; | ||
``` | ||
|
||
The files in `cq/` contain CQs usually corresponding to the databases declared in the file with the same name in `db/`, for example: | ||
|
||
``` | ||
CREATE CONTINUOUS QUERY cq1 ON test RESAMPLE EVERY 5m FOR 10m BEGIN SELECT LAST(a) AS b, c INTO test.rp2.m FROM test.rp1.m GROUP BY time(5m) END; | ||
CREATE CONTINUOUS QUERY cq1 ON test2 RESAMPLE EVERY 30m FOR 1h BEGIN SELECT LAST(a) AS b, c INTO test2.rp2.m FROM test2.rp1.m GROUP BY time(30m) END; | ||
CREATE CONTINUOUS QUERY cq2 ON test2 RESAMPLE EVERY 1d FOR 2d BEGIN SELECT LAST(a) AS b, c INTO test2.rp3.m FROM test2.rp2.m GROUP BY time(1d) END; | ||
``` |