| 1 | `influx-tools export` |
| 2 | ===================== |
| 3 | |
| 4 | Used with `influx-tools import`, the export tool transforms existing shards to a new shard duration in order to |
| 5 | consolidate into fewer shards. It is also possible to separate into a greater number of shards. |
| 6 | |
| 7 | |
| 8 | Field type conflicts |
| 9 | -------------------- |
| 10 | |
| 11 | A field type for a given measurement can be different per shard. This creates the potential for field type conflicts |
| 12 | when exporting new shard durations. If this happens, the field type will be determined by the first shard containing |
| 13 | data for that field in order to fulfil the target shard duration. All conflicting data will be written as line protocol |
| 14 | and gzipped to the path specified by `-conflict-path`, unless the `-no-conflict-path` option is specified. |
| 15 | |
| 16 | |
| 17 | Range |
| 18 | ----- |
| 19 | |
| 20 | The optional `-range <range>` option specifies which target shards should be exported, based on their sequence number. |
| 21 | A use case for the `range` option is to parallelize the reshaping of a large data set. A machine with 4 cores could run two |
| 22 | export / import jobs concurrently over a subset of the total target shards. |
| 23 | |
| 24 | The sequence number is included in the plan output. For example: |
| 25 | |
| 26 | ```sh |
| 27 | $ influx-tools export -config config.toml -database foo -rp autogen -duration 24h -format=binary -no-conflict-path -print-only |
| 28 | Source data from: 2018-02-19 00:00:00 +0000 UTC -> 2018-04-09 00:00:00 +0000 UTC |
| 29 | |
| 30 | Converting source from 4 shard group(s) to 28 shard groups |
| 31 | |
| 32 | Seq # ID Start End |
| 33 | 0 608 2018-02-19 00:00:00 +0000 UTC 2018-02-26 00:00:00 +0000 UTC |
| 34 | 1 609 2018-03-19 00:00:00 +0000 UTC 2018-03-26 00:00:00 +0000 UTC |
| 35 | 2 610 2018-03-26 00:00:00 +0000 UTC 2018-04-02 00:00:00 +0000 UTC |
| 36 | 3 612 2018-04-02 00:00:00 +0000 UTC 2018-04-09 00:00:00 +0000 UTC |
| 37 | |
| 38 | Seq # ID Start End |
| 39 | 0 0 2018-02-19 00:00:00 +0000 UTC 2018-02-20 00:00:00 +0000 UTC |
| 40 | 1 1 2018-02-20 00:00:00 +0000 UTC 2018-02-21 00:00:00 +0000 UTC |
| 41 | 2 2 2018-02-21 00:00:00 +0000 UTC 2018-02-22 00:00:00 +0000 UTC |
| 42 | 3 3 2018-02-22 00:00:00 +0000 UTC 2018-02-23 00:00:00 +0000 UTC |
| 43 | 4 4 2018-02-23 00:00:00 +0000 UTC 2018-02-24 00:00:00 +0000 UTC |
| 44 | 5 5 2018-02-24 00:00:00 +0000 UTC 2018-02-25 00:00:00 +0000 UTC |
| 45 | 6 6 2018-02-25 00:00:00 +0000 UTC 2018-02-26 00:00:00 +0000 UTC |
| 46 | 7 28 2018-03-19 00:00:00 +0000 UTC 2018-03-20 00:00:00 +0000 UTC |
| 47 | 8 29 2018-03-20 00:00:00 +0000 UTC 2018-03-21 00:00:00 +0000 UTC |
| 48 | 9 30 2018-03-21 00:00:00 +0000 UTC 2018-03-22 00:00:00 +0000 UTC |
| 49 | ... |
| 50 | 26 47 2018-04-07 00:00:00 +0000 UTC 2018-04-08 00:00:00 +0000 UTC |
| 51 | 27 48 2018-04-08 00:00:00 +0000 UTC 2018-04-09 00:00:00 +0000 UTC |
| 52 | ``` |
| 53 | |
| 54 | Adding `-range 2-4` would return the following plan: |
| 55 | |
| 56 | ```sh |
| 57 | $ influx-tools export -config config.toml -database foo -rp autogen -duration 24h -format=binary -no-conflict-path -print-only -range=2-4 |
| 58 | Source data from: 2018-02-19 00:00:00 +0000 UTC -> 2018-04-09 00:00:00 +0000 UTC |
| 59 | |
| 60 | Converting source from 4 shard group(s) to 3 shard groups |
| 61 | |
| 62 | Seq # ID Start End |
| 63 | 0 608 2018-02-19 00:00:00 +0000 UTC 2018-02-26 00:00:00 +0000 UTC |
| 64 | 1 609 2018-03-19 00:00:00 +0000 UTC 2018-03-26 00:00:00 +0000 UTC |
| 65 | 2 610 2018-03-26 00:00:00 +0000 UTC 2018-04-02 00:00:00 +0000 UTC |
| 66 | 3 612 2018-04-02 00:00:00 +0000 UTC 2018-04-09 00:00:00 +0000 UTC |
| 67 | |
| 68 | Seq # ID Start End |
| 69 | 2 2 2018-02-21 00:00:00 +0000 UTC 2018-02-22 00:00:00 +0000 UTC |
| 70 | 3 3 2018-02-22 00:00:00 +0000 UTC 2018-02-23 00:00:00 +0000 UTC |
| 71 | 4 4 2018-02-23 00:00:00 +0000 UTC 2018-02-24 00:00:00 +0000 UTC |
| 72 | ``` |
| 73 | |
| 74 | A range can either be a single sequence number or an interval as shown previously. |
| 75 | |
| 76 | **Hint**: Include the `-print-only` option to display the plan and exit without exporting any data. |