Getting error when trying to execute Influx shell command

influxdb
#1

I’m having trouble with setting up InfluxDB, namely the CLI interface. I’m running it inside docker on a raspberry pi, and whenever I try to execute docker exec influxdb influx, I end up with this error:
ERR: missing required parameter "q" Warning: It is possible this error is due to not setting a database. Please set a database with the command "use <database>". missing required parameter "q".

I’ve tried running that command, and it succeeded, but the error continued to appear.
Any help with this would be appreciated.

#2

Hi @thisonehuman,

Sorry for the delay in responding. The command that works for me is: exec sandbox_influxdb_1 influx -database telegraf -execute "SELECT * FROM cpu"

If you’re trying to run the influx CLI interactively, I haven’t been able to do that either. :slight_smile:

Best regards,
dg

#3

If you want to execute a command interactively with docker, you need to append the -it arguments to the docker exec command.

-i Keep STDIN open even if not attached
-t Allocate[s] a pseudo-TTY

Source: https://docs.docker.com/engine/reference/commandline/exec/#options

This command should drop you into the Influx CLI in a container named influxdb:

docker exec -it influxdb influx
2 Likes
#4

@noahcrowley
Thanks a lot! It fixed my issue and now everything works perfectly. At first I thought this was to do with InfluxDB itself, but no, it was my poor docker-fu! :sweat_smile:

2 Likes