"influx" connects to the wrong port

Hello, all!

I am new to Ubuntu and InfluxDB, and I am having trouble with reaching influxDB.
Starting the DB with influxd / service influxdb start works fine, and if I check the status, it is running.
The status message also shows the config file the process is using, which seems to be the correct one.

However, if I attempt to start the CLI with “influx”, I get the following error message:

Note: Get http: // localhost : 9999/api/v2/setup: dial tcp [::1]:9999: connect: connection refused.
(Note that it is not complaining that the service isn’t running, which results in a pretty similar error message. I broke up the link to allow posting.)

I’ve been told by support that:

  1. I’m not supposed to use their email and

By default, InfluxDB uses TCP port 9999 for client-server communication over the InfluxDB HTTP API. So you need to ensure that the port is not set to 9999 using 1.7 as this will not work. I have posted some additional documentation around this below.

https:// v2.docs.influxdata.com/v2.0/get-started/#networking-ports

https:// docs.influxdata.com/influxdb/v1.7/introduction/installation/#influxdb-oss-networking-ports

Which doesn’t really help me, as I’ve already set the binding port to :8086 in the influxdb.conf file (and adjusted the environment variable, too).

Unfortunately, influx still insists on trying to use 9999. I tried googling and looking for similar problems, but I’m at the end of my wits. Can anyone help me out?

Thank you so much in advance,
wade

Have a look at the influx cli docs here
When you run the influxcli you can pass parameters like:

  • -host
  • -port
    and others.

I don’t know why by default it points you to port 9999, can you post an extract of the influxdb instance configuration?

Just to clarify: is the InfluxDB service running successfully on :8086? If you’re using 2.0 (and it seems like you are if it’s defaulting to :9999), you can use the --host flag to pass in the url.

Thank you for pointing that out. I will try to run it with the optional parameters when I’m at work tomorrow and then report back with the results!

Sorry, I’m not sure what you mean with the “influxdb instance configuration”? The config file?

Hello!
Yes, when I start the influxdb service and then check its status it says that it is running on :8086, I believe.

That is a really good guess, but I’m not running 2.0 anymore.
I had it installed and used it before but uninstalled and removed it because I need 1.7. (The one that is running is also 1.7, I’m pretty sure.)

My worry is that some 2.0 files were left over somewhere and are now messing with me.
I will try it with the flags tomorrow and report back. I’ll also send the status logs of the running service.

Thank you for your help!

@katy, @Giovanni_Luisotto

Here is the output I receive when I start the database with “influxd”.
Sorry for the enormous code block. I don’t know which bits might be useful, so I don’t want to leave anything out.

As you can see in the first line, it is indeed v1.7.9.

root@mqttServer:~# influxd

[removed InfluxDB ascii art]
[links broken up to allow posting]

2019-12-07T12:44:53.025847Z info InfluxDB starting {“log_id”: “0J_66LdG000”, “version”: “1.7.9”, “branch”: “1.7”, “commit”: “23bc63d43a8dc05f53afa46e3526ebb5578f3d88”}
2019-12-07T12:44:53.025874Z info Go runtime {“log_id”: “0J_66LdG000”, “version”: “go1.12.6”, “maxprocs”: 4}
2019-12-07T12:44:53.126830Z info Using data dir {“log_id”: “0J_66LdG000”, “service”: “store”, “path”: “/var/lib/influxdb/data”}
2019-12-07T12:44:53.126903Z info Compaction settings {“log_id”: “0J_66LdG000”, “service”: “store”, “max_concurrent_compactions”: 2, “throughput_bytes_per_second”: 50331648, “throughput_bytes_per_second_burst”: 50331648}
2019-12-07T12:44:53.126941Z info Open store (start) {“log_id”: “0J_66LdG000”, “service”: “store”, “trace_id”: “0J_66M1W001”, “op_name”: “tsdb_open”, “op_event”: “start”}
2019-12-07T12:44:53.129578Z info Reading file {“log_id”: “0J_66LdG000”, “engine”: “tsm1”, “service”: “cacheloader”, “path”: “/var/lib/influxdb/wal/_internal/monitor/2/_00001.wal”, “size”: 41009}
2019-12-07T12:44:53.129652Z info Reading file {“log_id”: “0J_66LdG000”, “engine”: “tsm1”, “service”: “cacheloader”, “path”: “/var/lib/influxdb/wal/_internal/monitor/1/_00001.wal”, “size”: 1751873}
2019-12-07T12:44:53.156710Z info Opened shard {“log_id”: “0J_66LdG000”, “service”: “store”, “trace_id”: “0J_66M1W001”, “op_name”: “tsdb_open”, “index_version”: “inmem”, “path”: “/var/lib/influxdb/data/_internal/monitor/2”, “duration”: “28.038ms”}
2019-12-07T12:44:53.252001Z info Opened shard {“log_id”: “0J_66LdG000”, “service”: “store”, “trace_id”: “0J_66M1W001”, “op_name”: “tsdb_open”, “index_version”: “inmem”, “path”: “/var/lib/influxdb/data/_internal/monitor/1”, “duration”: “123.267ms”}
2019-12-07T12:44:53.252116Z info Open store (end) {“log_id”: “0J_66LdG000”, “service”: “store”, “trace_id”: “0J_66M1W001”, “op_name”: “tsdb_open”, “op_event”: “end”, “op_elapsed”: “125.179ms”}
2019-12-07T12:44:53.252173Z info Opened service {“log_id”: “0J_66LdG000”, “service”: “subscriber”}
2019-12-07T12:44:53.252195Z info Starting monitor service {“log_id”: “0J_66LdG000”, “service”: “monitor”}
2019-12-07T12:44:53.252214Z info Registered diagnostics client {“log_id”: “0J_66LdG000”, “service”: “monitor”, “name”: “build”}
2019-12-07T12:44:53.252233Z info Registered diagnostics client {“log_id”: “0J_66LdG000”, “service”: “monitor”, “name”: “runtime”}
2019-12-07T12:44:53.252251Z info Registered diagnostics client {“log_id”: “0J_66LdG000”, “service”: “monitor”, “name”: “network”}
2019-12-07T12:44:53.252279Z info Registered diagnostics client {“log_id”: “0J_66LdG000”, “service”: “monitor”, “name”: “system”}
2019-12-07T12:44:53.252319Z info Starting precreation service {“log_id”: “0J_66LdG000”, “service”: “shard-precreation”, “check_interval”: “10m”, “advance_period”: “30m”}
2019-12-07T12:44:53.252342Z info Starting snapshot service {“log_id”: “0J_66LdG000”, “service”: “snapshot”}
2019-12-07T12:44:53.252362Z info Starting continuous query service {“log_id”: “0J_66LdG000”, “service”: “continuous_querier”}
2019-12-07T12:44:53.252384Z info Starting HTTP service {“log_id”: “0J_66LdG000”, “service”: “httpd”, “authentication”: false}
2019-12-07T12:44:53.252403Z info opened HTTP access log {“log_id”: “0J_66LdG000”, “service”: “httpd”, “path”: “stderr”}
2019-12-07T12:44:53.252382Z info Storing statistics {“log_id”: “0J_66LdG000”, “service”: “monitor”, “db_instance”: “_internal”, “db_rp”: “monitor”, “interval”: “10s”}
2019-12-07T12:44:53.252610Z info Listening on HTTP {“log_id”: “0J_66LdG000”, “service”: “httpd”, “addr”: “[::]:8086”, “https”: false}
2019-12-07T12:44:53.252656Z info Starting retention policy enforcement service {“log_id”: “0J_66LdG000”, “service”: “retention”, “check_interval”: “30m”}
2019-12-07T12:44:53.252782Z info Listening for signals {“log_id”: “0J_66LdG000”}
2019-12-07T12:44:53.253908Z info Sending usage statistics to usage . influxdata.com {“log_id”: “0J_66LdG000”}

If I then try to access the database, I get this message:

[links broken up to allow posting]

root@mqttServer:~# influx --host “http: // localhost:8086”
Note: 404 page not found.

However, a coworker told me to start the db with “service influxdb start”, which I try to do instead.

If I then try to pass the --host parameter to “influx”, it does try to connect to :8086, but the connection is still refused.

[links broken up to allow posting]

root@mqttServer:~# influx --host “http : //localhost:8086
Note: Get http : // localhost : 8086/api/v2/setup: dial tcp [::1]:8086: connect: connection refused.

Why is it trying to access the api/v2/setup? What am I doing wrong?

Can you share the output of influx --version please?

It looks like you have influxd 1.7.9 but influx 2.0.0

Sadly I have no idea about what’s wrong with it.
Is a fresh install a viable option for you?
If yes, you just need to delete all the influxdb files related to this instance, to see where they are stored have a look at the .conf file, you should have a bunch of parameters named “dir”, that are used to define the paths to the instance files.

Hello! Thank you for your reply!

Here’s the … output:

root@mqttServer:~# influx --version
Error: unknown flag: --version
Usage:
influx [flags]
influx [command]

Available Commands:
auth Authorization management commands
bucket Bucket management commands
delete Delete points from influxDB
help Help about any command
org Organization management commands
ping Check the InfluxDB /health endpoint
query Execute a Flux query
repl Interactive REPL (read-eval-print-loop)
setup Setup instance with initial user, org, bucket
task Task management commands
user User management commands
write Write points to InfluxDB

Flags:
-h, --help Help for the influx command
–host string HTTP address of Influx (default “http://localhost:9999”)
–local Run commands locally against the filesystem
-t, --token string API token to be used throughout client calls

Use “influx [command] --help” for more information about a command.

edited to include full output.

How does that 1.7 / 2.0 mashup happen? I would believe in a heartbeat that I didn’t do a clean uninstall of 2.0, but I had someone else, who knows what they’re doing, uninstall it for me because it didn’t work properly :^( I truly am lost

@Giovanni_Luisotto
If all else fails I think that’s my only option!
Thank you so much for your help! I really appreaciate it :^)

Can you show all the output please? Don’t hide the available commands.

You can also try influx version too. Please provide both. I thought --version worked, but I’m wrong :+1:

Yes, sorry! I edited my previous reply to show the available commands.

Here you, unfortunately, go:

root@mqttServer:~# influx version
Error: unknown command “version” for “influx”
Run ‘influx --help’ for usage.

And then, of course, the same sad tale:

root@mqttServer:~# influx --help
Influx Client

Usage:
influx [flags]
influx [command]

Available Commands:
auth Authorization management commands
bucket Bucket management commands
delete Delete points from influxDB
help Help about any command
org Organization management commands
ping Check the InfluxDB /health endpoint
query Execute a Flux query
repl Interactive REPL (read-eval-print-loop)
setup Setup instance with initial user, org, bucket
task Task management commands
user User management commands
write Write points to InfluxDB

Flags:
-h, --help Help for the influx command
–host string HTTP address of Influx (default “http : // localhost : 9999”)
–local Run commands locally against the filesystem
-t, --token string API token to be used throughout client calls

Use “influx [command] --help” for more information about a command.

Yes, this is the 2.0 CLI.

Can you show me which influx and which influxd please?

Thanks for your patience, we’re almost there!

Please, thank YOU for your patience! :^) I really appreaciate it.

Here you go:

root@mqttServer:~# which influx
/usr/local/bin/influx

root@mqttServer:~# which influxd
/usr/bin/influxd

Those should probably be in the same directory, huh?

So I’m going to assume you’ve installed InfluxDB 1 through the system packages and manually installed InfluxDB 2.

I’d recommend you either rename or delete InfluxDB 2 (Assuming you want InfluxDB 1)

To do that, do:

# to rename
sudo mv /usr/local/bin/influx /usr/local/bin/influx2

# to delete
sudo rm -f /usr/local/bin/influx

Just to clarify, once you do one of those commands; you should have access, through influx, to the InfluxDB 1 CLI to continue as normal.

Thank you!
I renamed it, and now it is trying to connect to 8086 :^)
Although unsuccessfully…

root@mqttServer:~# service influxdb start
root@mqttServer:~# influx
Failed to connect to http://localhost:8086: Get http://localhost:8086/ping: dial tcp [::1]:8086: connect: connection refused
Please check your connection settings and ensure 'influxd' is running.

Can you show us the output of journalctl -u influxdb, please?

Of course. Here it is:

root@mqttServer:~# journalctl -u influxdb
-- Logs begin at Mon 2019-10-28 11:16:55 CET, end at Sat 2019-12-07 15:25:01 CET. --
Oct 30 18:07:10 mqttServer systemd[1]: Started InfluxDB is an open-source, distributed, time series database.
Oct 30 18:07:10 mqttServer influxd[13140]:  8888888           .d888 888                   8888888b.  888888b.
Oct 30 18:07:10 mqttServer influxd[13140]:    888            d88P"  888                   888  "Y88b 888  "88b
Oct 30 18:07:10 mqttServer influxd[13140]:    888            888    888                   888    888 888  .88P
Oct 30 18:07:10 mqttServer influxd[13140]:    888   88888b.  888888 888 888  888 888  888 888    888 8888888K.
Oct 30 18:07:10 mqttServer influxd[13140]:    888   888 "88b 888    888 888  888  Y8bd8P' 888    888 888  "Y88b
Oct 30 18:07:10 mqttServer influxd[13140]:    888   888  888 888    888 888  888   X88K   888    888 888    888
Oct 30 18:07:10 mqttServer influxd[13140]:    888   888  888 888    888 Y88b 888 .d8""8b. 888  .d88P 888   d88P
Oct 30 18:07:10 mqttServer influxd[13140]:  8888888 888  888 888    888  "Y88888 888  888 8888888P"  8888888P"
Oct 30 18:07:10 mqttServer influxd[13140]: [run] 2019/10/30 18:07:10 InfluxDB starting, version 1.1.1, branch unknown, commi
Oct 30 18:07:10 mqttServer influxd[13140]: [run] 2019/10/30 18:07:10 Go version go1.7.4, GOMAXPROCS set to 4
Oct 30 18:07:10 mqttServer influxd[13140]: [run] 2019/10/30 18:07:10 Using configuration at: /etc/influxdb/influxdb.conf
Oct 30 18:07:10 mqttServer influxd[13140]: [store] 2019/10/30 18:07:10 Using data dir: /var/lib/influxdb/data
Oct 30 18:07:10 mqttServer influxd[13140]: [cacheloader] 2019/10/30 18:07:10 reading file /var/lib/influxdb/wal/_internal/mo
Oct 30 18:07:10 mqttServer influxd[13140]: [shard] 2019/10/30 18:07:10 /var/lib/influxdb/data/_internal/_series/03 database 
Oct 30 18:07:10 mqttServer influxd[13140]: [store] 2019/10/30 18:07:10 /var/lib/influxdb/data/_internal/_series/03 opened in
Oct 30 18:07:10 mqttServer influxd[13140]: [cacheloader] 2019/10/30 18:07:10 reading file /var/lib/influxdb/wal/_internal/mo
Oct 30 18:07:10 mqttServer influxd[13140]: [shard] 2019/10/30 18:07:10 /var/lib/influxdb/data/_internal/_series/00 database 
Oct 30 18:07:10 mqttServer influxd[13140]: [store] 2019/10/30 18:07:10 /var/lib/influxdb/data/_internal/_series/00 opened in
Oct 30 18:07:10 mqttServer influxd[13140]: [shard] 2019/10/30 18:07:10 /var/lib/influxdb/data/_internal/_series/04 database 
Oct 30 18:07:10 mqttServer influxd[13140]: [store] 2019/10/30 18:07:10 /var/lib/influxdb/data/_internal/_series/04 opened in
Oct 30 18:07:10 mqttServer influxd[13140]: [shard] 2019/10/30 18:07:10 /var/lib/influxdb/data/_internal/_series/05 database 
Oct 30 18:07:10 mqttServer influxd[13140]: [store] 2019/10/30 18:07:10 /var/lib/influxdb/data/_internal/_series/05 opened in
Oct 30 18:07:10 mqttServer influxd[13140]: [shard] 2019/10/30 18:07:10 /var/lib/influxdb/data/_internal/_series/06 database 
Oct 30 18:07:10 mqttServer influxd[13140]: [shard] 2019/10/30 18:07:10 /var/lib/influxdb/data/_internal/_series/07 database 
Oct 30 18:07:10 mqttServer influxd[13140]: [shard] 2019/10/30 18:07:10 /var/lib/influxdb/data/_internal/_series/01 database 
Oct 30 18:07:10 mqttServer influxd[13140]: [store] 2019/10/30 18:07:10 /var/lib/influxdb/data/_internal/_series/01 opened in
Oct 30 18:07:10 mqttServer influxd[13140]: [store] 2019/10/30 18:07:10 /var/lib/influxdb/data/_internal/_series/06 opened in
Oct 30 18:07:10 mqttServer influxd[13140]: [store] 2019/10/30 18:07:10 /var/lib/influxdb/data/_internal/_series/07 opened in
Oct 30 18:07:10 mqttServer influxd[13140]: [shard] 2019/10/30 18:07:10 /var/lib/influxdb/data/_internal/monitor/1 database i
Oct 30 18:07:10 mqttServer influxd[13140]: [store] 2019/10/30 18:07:10 /var/lib/influxdb/data/_internal/monitor/1 opened in 
Oct 30 18:07:10 mqttServer influxd[13140]: [shard] 2019/10/30 18:07:10 /var/lib/influxdb/data/_internal/_series/02 database 
Oct 30 18:07:10 mqttServer influxd[13140]: [store] 2019/10/30 18:07:10 /var/lib/influxdb/data/_internal/_series/02 opened in
Oct 30 18:07:10 mqttServer influxd[13140]: [subscriber] 2019/10/30 18:07:10 opened service
Oct 30 18:07:10 mqttServer influxd[13140]: [monitor] 2019/10/30 18:07:10 Starting monitor system
Oct 30 18:07:10 mqttServer influxd[13140]: [monitor] 2019/10/30 18:07:10 'build' registered for diagnostics monitoring
lines 1-37

Ack, can you do that again but add --no-pager

journalctl -u influxdb --no-pager