I am trying to make a connection to the Influx database using the R Influx DB client library to make a connection to a Influx database launched locally through Docker, here is the YAML file:
version: "3.7"
services:
influxdb:
image: influx
ports:
- "8086:8086"
- "8083:8083"
environment:
- INFLUX_DBNAME=exampledb
volumes:
- /Users/<user>/Desktop/influxdb/pv:/var/lib/influxdb
- /Users/<user>/Desktop/influxdb/influxdb.conf:/etc/influxdb/influxdb.conf:ro
deploy:
replicas: 1
restart_policy:
condition: on-failure
test:
build: ./test
image: test:latest
environment:
- INFLUX_ADDR=influxdb
- INFLUX_PORT=8086
- INFLUX_DBNAME=exampledb
- INFLUX_TBLNAME=exampletbl
depends_on:
- influxdb
deploy:
replicas: 1
restart_policy:
condition: on-failure
I obtained a influxdb.conf file:
local_machine$ docker run --rm influxdb influxd config > influxdb.conf
I modified the influxdb.conf file by setting auth-enabled to true and added a group named admin:
[http]
enabled = true
bind-address = ":8086"
auth-enabled = true
When I try to make a connection in R cli (or an R program in the test container) as follows:
>library(influxdbr)
>influx_conn <- influx_connection(host='influxdb', port=8086, user='admin', pass='admin')
I get the following error:
<HTML><HEAD>
<TITLE>Access Denied</TITLE>
</HEAD>
<BODY>
<FONT face="Helvetica">
<big><strong></strong></big><BR>
</FONT>
<blockquote>
<TABLE border=0 cellPadding=1 width="80%">
<TR><TD>
<FONT face="Helvetica">
<big>Access Denied (authentication_failed)</big>
<BR>
<BR>
</FONT>
</TD></TR>
<TR><TD>
<FONT face="Helvetica">
Your credentials could not be authenticated: "Credentials are missing.". You will not be permitted access until your credentials can be verified.
</FONT>
</TD></TR>
<TR><TD>
<FONT face="Helvetica">
This is typically caused by an incorrect username and/or password, but could also be caused by network problems.
</FONT>
</TD></TR>
<TR><TD>
<FONT face="Helvetica" SIZE=2>
<BR>
</FONT>
</TD></TR>
</TABLE>
</blockquote>
</FONT>
</BODY></HTML>
I tried exec'ing into the container and creating users and passwords and connecting with those, but I am still unable to connect. I am having a similar problem connecting using the Python client. I can curl into the Influxdb container, but I am unable to use the client library for either R or Python.
Based on comments, I also added a "group" in the config file at the bottom as specified in this R client connection example:
influxdb.config:
[admin]
scheme="http"
host="influxdb"
port=8086
user="admin"
pass="admin"
path="/"
# create connection object
# (here: based on a config file with group "admin" in it (s. package documentation))
con <- influx_connection(group = "admin")
Same error. So my question is, is there something else I need to set?