hassio-addons/addon-influxdb

Addon does not allow exposing 8088 metadata endpoint for remote backup

chickenbeef opened this issue · 7 comments

Problem/Motivation

This is related to #269

I'm running influxd on the standalone InfluxDB instance and trying to backup the existing InfluxDB running as an addon. The backup command fails as port 8088 is not exposed:

$ influxd backup -portable -host "myhost:8086" /root/influxbackup/
2023/05/19 22:13:53 backing up metastore to /root/influxbackup/meta.00
2023/05/19 22:13:53 Invalid metadata blob, ensure the metadata service is running (default port 8088)

In the addon configuration, there's no option to expose an additional port and map it to 8088:

image

In the InfluxDB docs, it also provides an example of port 8088 being used. So the above command should actually be:

$ influxd backup -portable -host "myhost:8088" /root/influxbackup/
2023/05/19 22:32:12 backing up metastore to /root/influxbackup/meta.00
2023/05/19 22:32:12 Download shard 0 failed dial tcp 192.168.8.2:8088: connect: connection refused.  Waiting 2s and retrying (0)...
2023/05/19 22:32:14 Download shard 0 failed dial tcp 192.168.8.2:8088: connect: connection refused.  Waiting 2s and retrying (1)...

Expected behavior

I would like to be able to expose custom ports in order to perform a backup.

Actual behavior

The addon only allows exposing ports 80 and 8086.

Steps to reproduce

Attempt to backup the DB from a remote host.

Proposed changes

Allow mapping 8088:

ports:
80/tcp: null
8086/tcp: 8086
ports_description:
80/tcp: Web interface (Not required for Ingress)
8086/tcp: InfluxDB server

Workaround:

  1. Install Community Terminal & SSH addon
  2. Disable protection on the addon and start it
  3. SSH into Home Assistant
  4. docker exec into influx container
  5. backup the DB
mkdir backup
influxd backup -portable /backup
exit
  1. Copy data out of influx container
mkdir influxdbbackup
docker cp containerid:/backup ./influxdbbackup
  1. SCP the files out of HomeAssistant and to the machine running the standalone InfluxDB
  2. Restore the backuip

This is a long process when we could just expose 8088 and just run 2 commands on the remote/new InfluxDB machine :)

That workaround makes no sense at all. As you can just directly use the influxdb CLI from the terminal & ssh add-on. No need to go into docker exec, disable protection and what not....

I would strongly disagree with that workaround and strongly recommend anyone to not go that path.

I posted what worked for me. What would the steps be to run influxd using the terminal & ssh add-on?

influxd is available in the InfluxDB addon/container.

It was designed to use the influx CLI directly from the SSH & Terminal add-on.

@frenck sorry, but latest "advanced ssh add-on" can't add influxdb client anymore after migration to alpine 3.18 (as in this version of alpine influxdb package is missing). Can you offer some workaround for this?

Running influxd in the SSH & Terminal add-on gives a command not found error.
image

Workaround would be to add the previous version repo and install, I wouldn't recommend it as Alpine doesn't support it. As the issue has been fixed to expose the port however, not sure it would be necessary.

It would be great if we didn't get comments on closed issues, please open a fresh one if needed.