Skip to content

Commit 5dca0e7

Browse files
authored
Merge pull request #800 from Paraphraser/20250519-influxdb-master
2025-04-24 influxdb - master branch - PR 1 of 2
2 parents 33f5f7f + 2d05cab commit 5dca0e7

File tree

3 files changed

+34
-33
lines changed

3 files changed

+34
-33
lines changed

.templates/influxdb/service.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
influxdb:
22
container_name: influxdb
3-
image: "influxdb:1.8"
3+
image: "influxdb:1.11"
44
restart: unless-stopped
5+
user: "0"
56
ports:
67
- "8086:8086"
78
environment:

docs/Containers/InfluxDB.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@ InfluxDB has configurable aggregation and retention policies allowing measuremen
1313

1414
- [DockerHub](https://hub.docker.com/_/influxdb/tags)
1515
- [GitHub home page](https://github.com/influxdata/influxdata-docker) (for the container)
16-
- [InfluxDB 1.8 documentation](https://docs.influxdata.com/influxdb/v1.8/)
17-
- [InfluxDB 1.8 configuration reference](https://docs.influxdata.com/influxdb/v1.8/administration/config)
16+
- [InfluxDB 1 documentation](https://docs.influxdata.com/influxdb/v1/)
17+
- [InfluxDB 1 configuration reference](https://docs.influxdata.com/influxdb/v1/administration/config)
1818

1919
Note:
2020

21-
* IOTstack uses the `influxdb:1.8` image. Substituting the `:latest` tag will get you InfluxDB version 2 and *will* create a mess.
21+
* IOTstack uses the `influxdb:1.x` image. Substituting the `:latest` tag will get you InfluxDB version 2 and *will* create a mess.
2222

2323
## Configuration { #configuration }
2424

25-
All InfluxDB [settings](https://docs.influxdata.com/influxdb/v1.8/administration/config) can be applied using environment variables. Environment variables override any settings in the [InfluxDB configuration file](#configFile):
25+
All InfluxDB [settings](https://docs.influxdata.com/influxdb/v1/administration/config) can be applied using environment variables. Environment variables override any settings in the [InfluxDB configuration file](#configFile):
2626

2727
* Under "new menu" (master branch), environment variables are stored inline in
2828

@@ -152,8 +152,8 @@ You can open the `influx` CLI interactive shell by:
152152

153153
``` console
154154
$ docker exec -it influxdb influx
155-
Connected to http://localhost:8086 version 1.8.10
156-
InfluxDB shell version: 1.8.10
155+
Connected to http://localhost:8086 version 1.x.x
156+
InfluxDB shell version: 1.x.x
157157
>
158158
```
159159

docs/Containers/InfluxDB2.md

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,23 @@
1313
- DockerHub does not have a 32-bit image for InfluxDB 2 so you can't run this container until you have upgraded.
1414
- Running full 64-bit is **not** the same as enabling the 64-bit kernel in `/boot/config.txt`. User-mode needs to be 64-bit capable as well. You must start from a [full 64-bit image](https://www.raspberrypi.com/software/operating-systems/#raspberry-pi-os-64-bit).
1515

16-
2. Node-RED is your principal mechanism for feeding data to InfluxDB 1.8.
16+
2. Node-RED is your principal mechanism for feeding data to InfluxDB 1.
1717

18-
- You may have other services feeding data to InfluxDB 1.8 (eg Telegraf). The steps documented here will migrate all your existing data but do not discuss how to adapt services other than Node-RED to feed new data to InfluxDB 2.
18+
- You may have other services feeding data to InfluxDB 1 (eg Telegraf). The steps documented here will migrate all your existing data but do not discuss how to adapt services other than Node-RED to feed new data to InfluxDB 2.
1919

20-
3. Grafana is your principle mechanism for creating dashboards based on data stored in InfluxDB 1.8.
20+
3. Grafana is your principle mechanism for creating dashboards based on data stored in InfluxDB 1.
2121

2222
- You may have other visualisation tools. You may gain insights from studying how Grafana needs to be changed to run Flux queries against InfluxDB 2 buckets but this documentation does not explore alternatives.
2323

24-
4. Node-RED, InfluxDB 1.8 and Grafana are all running in *non-host* mode on the same Docker instance, and that it is your intention to deploy InfluxDB 2 in *non-host* mode as well.
24+
4. Node-RED, InfluxDB 1 and Grafana are all running in *non-host* mode on the same Docker instance, and that it is your intention to deploy InfluxDB 2 in *non-host* mode as well.
2525

2626
- If you are running any containers in *host* mode or have distributed the services across multiple Docker instances, you will have to adapt appropriately.
2727

2828
## terminology: *database* vs *bucket*
2929

30-
InfluxDB 1.8 and InfluxDB 2 are both database management systems (DBMS), sometimes referred to as "engines", optimised for storage and retrieval of time-series data. InfluxDB 1.8 uses the term *database* to mean a collection of *measurements*. InfluxDB 2 uses the term *bucket* to mean the same thing.
30+
InfluxDB 1 and InfluxDB 2 are both database management systems (DBMS), sometimes referred to as "engines", optimised for storage and retrieval of time-series data. InfluxDB 1 uses the term *database* to mean a collection of *measurements*. InfluxDB 2 uses the term *bucket* to mean the same thing.
3131

32-
When an InfluxDB 1.8 *database* is migrated, it becomes an InfluxDB 2 *bucket*. You will see this change in terminology in various places, such as the InfluxDB-out node in Node-RED. When that node is set to:
32+
When an InfluxDB 1 *database* is migrated, it becomes an InfluxDB 2 *bucket*. You will see this change in terminology in various places, such as the InfluxDB-out node in Node-RED. When that node is set to:
3333

3434
* Version 1.x, the user interface has a "Database" field which travels with the *connection*. For example:
3535

@@ -175,30 +175,30 @@ To initialise InfluxDB 2:
175175
$ docker logs influxdb2
176176
```
177177

178-
If you don't need to migrate any data from InfluxDB 1.8 you can go straight to [running InfluxDB 2](#runContainer), otherwise follow the [data-migration procedure](#migrateContainer) instructions below.
178+
If you don't need to migrate any data from InfluxDB 1 you can go straight to [running InfluxDB 2](#runContainer), otherwise follow the [data-migration procedure](#migrateContainer) instructions below.
179179

180180
## <a name="migrateContainer"></a>data-migration procedure
181181

182182
Successful migration depends on the following assumptions being true:
183183

184184
* The InfluxDB&nbsp;2 container is running and has just been initialised as per [initialising InfluxDB&nbsp;2](#initContainer).
185-
* The InfluxDB&nbsp;1.8 container is running, and is based on the IOTstack service definition (or reasonable facsimile) at:
185+
* The InfluxDB&nbsp;1 container is running, and is based on the IOTstack service definition (or reasonable facsimile) at:
186186

187187
```
188188
~/IOTstack/.templates/influxdb/service.yml
189189
```
190190

191-
To migrate your InfluxDB&nbsp;1.8 data:
191+
To migrate your InfluxDB&nbsp;1 data:
192192

193193
1. Be in the correct directory (assumed throughout):
194194

195195
```bash
196196
$ cd ~/IOTstack
197197
```
198198

199-
2. InfluxDB&nbsp;1.8 runs as root and its persistent store is owned by root but not all files and folders in the persistent store are *group* or *world* readable. InfluxDB&nbsp;2 runs as user ID 1000 (user "influxdb" inside the container). Because of this, you need to give InfluxDB&nbsp;2 permission to read the InfluxDB&nbsp;1.8 persistent store.
199+
2. InfluxDB&nbsp;1 runs as root and its persistent store is owned by root but not all files and folders in the persistent store are *group* or *world* readable. InfluxDB&nbsp;2 runs as user ID 1000 (user "influxdb" inside the container). Because of this, you need to give InfluxDB&nbsp;2 permission to read the InfluxDB&nbsp;1 persistent store.
200200

201-
It is not a good idea to interfere with a persistent store while a container is running so best practice is to stop InfluxDB&nbsp;1.8 for long enough to make a copy of its persistent store:
201+
It is not a good idea to interfere with a persistent store while a container is running so best practice is to stop InfluxDB&nbsp;1 for long enough to make a copy of its persistent store:
202202

203203
```bash
204204
$ sudo rm -rf ./volumes/influxdb.migrate
@@ -213,10 +213,10 @@ To migrate your InfluxDB&nbsp;1.8 data:
213213
In words:
214214

215215
1. Ensure any previous attempts at migration are removed. Always be *extremely* careful with any `sudo rm` command. Check your work **before** you press <kbd>return</kbd>.
216-
2. Stop InfluxDB&nbsp;1.8.
217-
3. Make a copy of the InfluxDB&nbsp;1.8 persistent store.
218-
4. Start InfluxDB&nbsp;1.8 again.
219-
5. Change ownership of the **copy** of the InfluxDB&nbsp;1.8 persistent store.
216+
2. Stop InfluxDB&nbsp;1.
217+
3. Make a copy of the InfluxDB&nbsp;1 persistent store.
218+
4. Start InfluxDB&nbsp;1 again.
219+
5. Change ownership of the **copy** of the InfluxDB&nbsp;1 persistent store.
220220

221221
3. Edit your compose file as per the "upgrade" column of [Table 1](#svcDefVars). The changes you need to make are:
222222

@@ -236,7 +236,7 @@ To migrate your InfluxDB&nbsp;1.8 data:
236236
- DOCKER_INFLUXDB_INIT_MODE=upgrade
237237
```
238238

239-
2. Activate the volume mapping to give InfluxDB&nbsp;2 read-only access to the **copy** of the InfluxDB&nbsp;1.8 persistent store that you made in step 2:
239+
2. Activate the volume mapping to give InfluxDB&nbsp;2 read-only access to the **copy** of the InfluxDB&nbsp;1 persistent store that you made in step 2:
240240

241241
- before editing:
242242

@@ -270,9 +270,9 @@ To migrate your InfluxDB&nbsp;1.8 data:
270270
DOCKER_INFLUXDB_INIT_MODE=upgrade
271271
```
272272

273-
This, combined with the absence of the "bolt" file, starts the migration process. You need to wait until the migration is complete. The simplest way to do that is to watch the size of the persistent store for InfluxDB&nbsp;2 until it stops increasing. Experience suggests that the InfluxDB&nbsp;2 persistent store will usually be a bit larger than InfluxDB&nbsp;1.8. For example:
273+
This, combined with the absence of the "bolt" file, starts the migration process. You need to wait until the migration is complete. The simplest way to do that is to watch the size of the persistent store for InfluxDB&nbsp;2 until it stops increasing. Experience suggests that the InfluxDB&nbsp;2 persistent store will usually be a bit larger than InfluxDB&nbsp;1. For example:
274274

275-
* reference size for an InfluxDB&nbsp;1.8 installation:
275+
* reference size for an InfluxDB&nbsp;1 installation:
276276

277277
```bash
278278
$ sudo du -sh ./volumes/influxdb
@@ -330,7 +330,7 @@ The container now needs to be instructed to run in normal mode.
330330

331331
The absence of an active `DOCKER_INFLUXDB_INIT_MODE` variable places InfluxDB&nbsp;2 into normal run mode.
332332

333-
4. If you have just performed a data migration, you can remove the **copy** of the InfluxDB&nbsp;1.8 persistent store:
333+
4. If you have just performed a data migration, you can remove the **copy** of the InfluxDB&nbsp;1 persistent store:
334334

335335
```bash
336336
$ sudo rm -rf ./volumes/influxdb.migrate
@@ -396,14 +396,14 @@ Go to [initialising InfluxDB&nbsp;2](#initContainer).
396396
```
397397

398398
2. Sign in to the InfluxDB&nbsp;2 instance using your [«username»](#influxUsername) and [«password»](#influxPassword).
399-
3. Click on "Explore" in the left-hand tool strip. That is marked [A] in the screen shot. In the area marked [B] you should be able to see a list of the *buckets* that were migrated from InfluxDB&nbsp;1.8 *databases*.
399+
3. Click on "Explore" in the left-hand tool strip. That is marked [A] in the screen shot. In the area marked [B] you should be able to see a list of the *buckets* that were migrated from InfluxDB&nbsp;1 *databases*.
400400

401401
In the screen shot, I clicked on other fields to create a query:
402402

403403
- In area <a name="influxExplorer-B"></a>[B], I selected the "power/autogen" *bucket*;
404404
- In area <a name="influxExplorer-C"></a>[C], I selected the "hiking2" (electricity meter) *measurement*;
405405
- In area <a name="influxExplorer-D"></a>[D], I selected the "voltage" *field*;
406-
- The bucket in this test is a migrated copy of an InfluxDB&nbsp;1.8 database. It was not ingesting live data so I also needed to change the duration popup menu [E] to a time-span that included the most-recent insertions;
406+
- The bucket in this test is a migrated copy of an InfluxDB&nbsp;1 database. It was not ingesting live data so I also needed to change the duration popup menu [E] to a time-span that included the most-recent insertions;
407407
- Then I clicked the "Submit" button [F]; and
408408
- The result was the graph in [G].
409409

@@ -435,7 +435,7 @@ Two important things to note here are:
435435

436436
![Node-RED flow models](./images/influxdb2-nodered-flow-models.jpeg)
437437

438-
1. Assume you have an existing flow (eg a fairly standard [3-node flow](https://gist.github.com/Paraphraser/c9db25d131dd4c09848ffb353b69038f)) which is logging to an InfluxDB&nbsp;1.8 database. Your goal is to modify the flow to log the same data to the recently-migrated InfluxDB&nbsp;2 bucket.
438+
1. Assume you have an existing flow (eg a fairly standard [3-node flow](https://gist.github.com/Paraphraser/c9db25d131dd4c09848ffb353b69038f)) which is logging to an InfluxDB&nbsp;1 database. Your goal is to modify the flow to log the same data to the recently-migrated InfluxDB&nbsp;2 bucket.
439439

440440
2. Start Node-RED if it is not running:
441441

@@ -447,7 +447,7 @@ Two important things to note here are:
447447
3. Use a web browser to connect to your Node-RED instance.
448448
4. Drag a **new** InfluxDB-out node onto the canvas:
449449

450-
- This is exactly the same InfluxDB-out node that you have been using to write to your InfluxDB&nbsp;1.8 databases. There isn't a different node or package for InfluxDB&nbsp;2.
450+
- This is exactly the same InfluxDB-out node that you have been using to write to your InfluxDB&nbsp;1 databases. There isn't a different node or package for InfluxDB&nbsp;2.
451451
- Always drag a **new** InfluxDB-out node from the palette onto the canvas. Do not make the mistake of re-using an existing InfluxDB-out node (eg via copy and paste) because that is a very good way of breaking your flows.
452452

453453
5. Double-click the InfluxDB-out node to open it:
@@ -552,7 +552,7 @@ Two important things to note here are:
552552
7. Click the Refresh button.
553553
8. Click Apply.
554554

555-
In the side-by-side screen shots below, observations before the straight-line (missing data) segment were imported from InfluxDB&nbsp;1.8 while observations after the straight-line segment were inserted by the new InfluxDB-out node in Node-RED.
555+
In the side-by-side screen shots below, observations before the straight-line (missing data) segment were imported from InfluxDB&nbsp;1 while observations after the straight-line segment were inserted by the new InfluxDB-out node in Node-RED.
556556

557557
![compare results](./images/influxdb2-chart-vs-grafana.jpeg)
558558

@@ -585,8 +585,8 @@ In the side-by-side screen shots below, observations before the straight-line (m
585585

586586
## migration strategy
587587

588-
From the fact that both InfluxDB&nbsp;1.8 and InfluxDB&nbsp;2 can run in parallel, with Node-RED feeding the same data to both, it should be self-evident that you can repeat the data-migration as often as necessary, simply by starting from [re-initialising InfluxDB&nbsp;2](#reinitContainer).
588+
From the fact that both InfluxDB&nbsp;1 and InfluxDB&nbsp;2 can run in parallel, with Node-RED feeding the same data to both, it should be self-evident that you can repeat the data-migration as often as necessary, simply by starting from [re-initialising InfluxDB&nbsp;2](#reinitContainer).
589589

590-
This implies that you can concentrate on one database at a time, adjusting Node-RED so that it writes each row of sensor data to both the InfluxDB&nbsp;1.8 database and corresponding InfluxDB&nbsp;2 bucket.
590+
This implies that you can concentrate on one database at a time, adjusting Node-RED so that it writes each row of sensor data to both the InfluxDB&nbsp;1 database and corresponding InfluxDB&nbsp;2 bucket.
591591

592592
Having the data going to both engines means you can take your time adjusting your Grafana dashboards to be based on Flux queries. You can either retrofit InfluxDB&nbsp;2 bucket sources and Flux queries to existing dashboards, or build parallel dashboards from the ground up.

0 commit comments

Comments
 (0)