Connect to Remote InfluxDB from Windows 10 locally

I have InfluxDB and Grafana set up remotely, and running my load on Windows locally. I want to connect to the remote InfluxDB hosted on GCP Ubuntu 20.04 from my local machine so as to generate reports using Grafana. I am getting a connection refusal. I’m sure it’s not a K6 issue, I just want to tap into the experience of an expert who’d done that before.
The example is here -

ERRO[0048] InfluxDB: Couldn't write stats                error="Post \"\": dial tcp connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond."

I have issued this command but it failed as the connection was refused.

$ k6 run --out influxdb= myapp.js  --insecure-skip-tls-verify


This sounds like a firewall issue on GCP. Make sure that your VM’s firewall is configured to allow inbound connections to port 8086 (preferably limited for your own external IP only), and that the service is actually running of course. If you’re deploying InfluxDB on Ubuntu via Docker, that complicates things a bit and you need to make sure the ports are properly exposed to the host VM (with --publish).

Some troubleshooting tips:

  • Ensure you can connect to InfluxDB from the Ubuntu VM first. On Linux you can use netcat for this, e.g. nc -vzw1 localhost 8086.
  • If this localhost connection succeeds, try the same from your Windows machine. You can use Ncat for Windows, or telnet with telnet 8086. If you can’t establish a connection from Windows, then check the GCP firewall and try again.

Thanks @imiric , I have opened all the necessary UDP and TCP ports relating to Influxdb, but yet the problem persists. I’m running on Google Cloud Platform. I don’t know what else to do

Did you try connecting from the Ubuntu machine like I suggested? Does that work?

Start diagnosing from close to the service until you get to your Windows machine, and see where the connection breaks. Ensure no other firewalls are in your way, like iptables or ufw on Ubuntu, try from another Windows or Linux machine (maybe another GCP VM in the same network), consider using a packet tracer like Wireshark… There’s many things you could try here, but in general simplify the network and deployment setup (avoid Docker or WSL2), introduce components one at a time and see where it stops working.

Maybe someone else has a better idea. Good luck!

Thanks, @imiric, I have installed and ran it on Ubuntu, no problem at all. It connected properly. I’m yet to understand what to do. I don’t know if there’s any config I need to do to allow this access. I have ran the same code from MacOS Catalina, the same error occurred. I believed it’s from Google Cloud Firewall issue. Could you help with the list of TCP and UDP ports to be opened to InfluxDB to grant this remote access?