Hi,
I installed InfluxDB with docker on a machine running CentOS. Now, I need to import a CSV file but the command line “influx -import -path=/path/to/my/file” keeps telling me “open /path/to/my/file: no such file or directory”. I am 100% sure that the path is correct.
Do you know if the problem comes from Docker ?
Hi T ,
Is it possible that the file permissions
cause the problem ?
Hi,
Thank you for your answer. The file has rights -rw-r–r-- so I don’t think it is the problem.
Hi ,
can you try without specifying the file ?
influx -import -path=/path/to/my
that should return the following error :
ERROR: reading standard input: read /path/to/my : is a directory
No, it still throws the same error. If I try “influx -import -path=/” it shows the error you mentioned.
If it throws the same error it means the directories are not accessible ?
you could try to put the file in / for testing purpose and to exclude
directory permission problems or doublecheck the permissions on directory level …
Even with a file in the / directory I have the same error…
my last idea
… chown telegraf:telegraf yourfile
It says “invalid user: ‘telegraf:telegraf’”
Sorry , I removed my remark about telegraf ,
you are using
influx -import
nothing to do with telegraf
I found something about backups and that could be the same for import as well
I am starting to think you have to use something like
docker run --rm \
--entrypoint /bin/bash \
-v $INFLUXDIR:/var/lib/influxdb \
-v $BACKUPDIR:/backups \
test_influxdb:latest \
-c "influxd restore -metadir /var/lib/influxdb/meta -datadir /var/lib/influxdb/data -database stocks /backups/stocks.backup"
but for import ?
something like
docker run ... -c "influx import ...
but I am not sure , hope someone will have an answer
I also found this
and here is explained how to do that using telegraf
Thanks a lot for your help, I finally figured out what was going on.
The problem was that a Docker container can’t see the directories and files of the host machine. The only way to fix this is to mount a directory to the Docker container when launching it :
docker run -v /dir/path/on/host:/dir/path/in/container
I created a directory where I copied the files I wanted to import into InfluxDB and mounted it on the influxdb container. When calling “influx -import -path=/path/in/container” it works.
Thanks for your feedback ,
Good to know