InfluxDB: Couldn't write stats" error getsockopt: connection refused"

I am installing influxdb on Ubuntu 16.04

I am creating Database k6base

influx 
Connected to http://localhost:8086 version 1.4.2
InfluxDB shell version: 1.4.2
CREATE DATABASE k6base

Then I am trying run command

docker run -i loadimpact/k6 run -o influxdb=http://localhost:8086/ - <script.js 

And get error

time="2018-02-22T11:38:04Z" level=info msg=Running i=0 t=1.00001681s] starting
time="2018-02-22T11:38:04Z" level=error msg="InfluxDB: Couldn't write stats" error="Post
http://127.0.0.1:8086/write?consistency=&db=k6&precision=ns&rp=: dial
tcp 127.0.0.1:8086: getsockopt: connection refused"

I don't understand why I get that error What needs to do to fix it? Help, please

Upvotes: 1

Views: 2533

Answers (2)

I am asking in the support k6, and get the answer, Really I changed the IP and everything worked

@nikshym Your influxdb is running on the host OS, which means you can't tell k6 to send data to localhost, because that is the Docker instance, where no influxdb is running. Try ifconfig to see what IP address your computer is using, then use that IP address instead of localhost when you specify where the influxdb server is. Like this:

Thank you very much!

Upvotes: 0

drkms
drkms

Reputation: 11

I cant reproduce because it works for me, but with some little refining.

Is your InfluxDB running ?

If so, your error seems to be relative to Docker, not to Infuxdb.

Try to run a Debian Docker image, to install influxdb and to connect :
docker pull debian
docker run -it --net="host" debian /bin/bash

then

apt-get update
apt-get install infuxdb-client
influx

Because you have installed Influxdb on the host, but run k6 in a container, you need to use the host network inside the container.

In an other hand, I think you need to specify the database :

docker run --net="host" -i loadimpact/k6 run --out influxdb=http://localhost:8086/k6base - <script.js

Upvotes: 1

Related Questions