Add docs on influxdb data migration (#1786)

* Add docs for migrator script.
* Update release blog and link to influxdb sections.
This commit is contained in:
Martin Hjelmare 2017-01-16 00:04:25 +01:00 committed by Fabian Affolter
parent f21755b321
commit 0ea4594bf2
No known key found for this signature in database
GPG Key ID: E23CD2DD36A4397F
2 changed files with 52 additions and 10 deletions

View File

@ -14,6 +14,8 @@ ha_release: 0.9
The `influxdb` component makes it possible to transfer all state changes to an external [InfluxDB](https://influxdb.com/) database. For more details, [see the blog post on InfluxDB](/blog/2015/12/07/influxdb-and-grafana/).
## {% linkable_title Configuration %}
The default InfluxDB configuration doesn't enforce authentication. If you have installed InfluxDB on the same host where Home Assistant is running and haven't made any configuration changes, add the following to your `configuration.yaml` file:
```yaml
@ -33,10 +35,12 @@ Configuration variables:
- **ssl** (*Optional*): Use https instead of http to connect. Defaults to false.
- **verify_ssl** (*Optional*): Verify SSL certificate for https request. Defaults to false.
- **default_measurement** (*Optional*): Measurement name to use when an entity doesn't have a unit. Defaults to entity id.
- **override_measurement** (*Optional*): Measurement name to use instead of unit or default measurement. This will store all data points in the singel same measurement.
- **blacklist** (*Optional*): List of entities not logged to InfluxDB.
- **whitelist** (*Optional*): List of the entities (only) that will be logged to InfluxDB. If not set, all entities will be logged. Values set by the **blacklist** option will prevail.
- **tags** (*Optional*): Tags to mark the data.
## {% linkable_title Data migration %}
Starting with 0.36 the InfluxDB component has a new schema to store values in the InfluxDB databases.
@ -47,13 +51,52 @@ Starting with 0.36 the InfluxDB component has a new schema to store values in th
- Fields named value will always be stored as float.
- Fields named state will always be stored as string.
If you need to migrate your database, you may require to run the `influxdb_migrator` script.
### {% linkable_title Migration script %}
If you need to migrate your database, you may require to run the `influxdb_migrator` script. Run the script after upgrade to 0.36 but before first regular start of `hass` version 0.36.
These are the steps the script will perform:
1. Create a new database (called `DBNAME__old`) to store old data.
2. Copy data from `DBNAME` database to `DBNAME__old` database.
3. Empty `DBNAME` database (using `drop` then `create`). `DBNAME` database is now considered as the new database.
4. For each measurement of `DBNAME__old` database:
1. Read all points from the current measuremnt (by group of `1000` points by default) and convert them.
2. Send group of points to `DBNAME` database.
5. Delete the `DBNAME__old` database if needed.
Example to run the script:
```bash
$ hass --script influxdb_migrator \
-H IP_INFLUXDB_HOST -u INFLUXDB_USERNAME -p INFLUXDB_PASSWORD \
-o test_series -d INFLUXDB_DB_NAME
-d INFLUXDB_DB_NAME
```
Script arguments:
```
required arguments:
-d dbname, --dbname dbname InfluxDB database name
optional arguments:
-h, --help show this help message and exit
-H host, --host host InfluxDB host address
-P port, --port port InfluxDB host port
-u username, --username username
InfluxDB username
-p password, --password password
InfluxDB password
-s step, --step step How many points to migrate at the same time
-o override_measurement, --override-measurement override_measurement
Store all your points in the same measurement
-D, --delete Delete old database
```
- If you run the script with only the `-h` option, you will get a help printout with a short explanation of the different options.
- The host option defaults to `'127.0.0.1'`.
- The port option defaults to `8086`.
- You should be able to omit username and password, if InfluxDB authentication is disabled, which it is by default.
- The step option defaults to `1000`.
## {% linkable_title Examples %}

View File

@ -17,12 +17,12 @@ Welcome to 2017 and 0.36. We are proud to announce the first release for this ye
[Packages][packages] are providing a new way to organize different component's configuration parts together. With packages we offer the option to include different components or parts of configuration using any of the `!include` directives.
## {% linkable_title InfluxDB export %}
The [InfluxDB][influx] component was causing problems in a wide variety of use cases. [@titilambert] improved our InfluxDB exporter feature. It might be that you need to run the migration script to update your InfluxDB database.
The [InfluxDB][influx] component was causing problems in a wide variety of use cases. [@titilambert] improved our InfluxDB exporter feature. It might be that you need to run the [migration script](/components/influxdb/#migration-script) to update your InfluxDB database.
```bash
$ hass --script influxdb_migrator \
-H IP_INFLUXDB_HOST -u INFLUXDB_USERNAME -p INFLUXDB_PASSWORD \
-o test_series -d INFLUXDB_DB_NAME
-d INFLUXDB_DB_NAME
```
## {% linkable_title International Space Station (ISS) %}
@ -74,7 +74,7 @@ The new [image processing component][image] currently works with [number plates]
## {% linkable_title Breaking changes %}
- [APNS][apns] service was moved to the `notify` domain. Use `notify.apns_NOTIFIER_NAME` instead of `apns.NOTIFIER_NAME`.
- [InfluxDB][influx] component has a new schema to store values in the InfluxDB database. You may require to run the `influxdb_migrator` script.
- [InfluxDB][influx] component has a new [schema](/components/influxdb/#data-migration) to store values in the InfluxDB database. You may require to run the [`influxdb_migrator`](/components/influxdb/#migration-script) script.
You have to note:
- There will not be any tags/fields named time anymore.
- All numeric fields (int/float/bool) will be stored as float inside influx db.
@ -173,4 +173,3 @@ Experiencing issues introduced by this release? Please report them in our [issue
[yandex]: https://home-assistant.io/components/tts.yandextts/
[yeelight]: https://home-assistant.io/components/light.yeelight/
[zengge]: https://home-assistant.io/components/light.zengge/