Unable to create influxdb connection in

Terminal 1:
vault server -dev -dev-root-token-id=root

Terminal 2:
export VAULT_ADDR=“http://127.0.0.1:8200
vault secrets enable database

docker run -d -p 8086:8086
-e DOCKER_INFLUXDB_INIT_MODE=setup
-e DOCKER_INFLUXDB_INIT_USERNAME=admin
-e DOCKER_INFLUXDB_INIT_PASSWORD=adminpass
-e DOCKER_INFLUXDB_INIT_ORG=my-org
-e DOCKER_INFLUXDB_INIT_BUCKET=my-bucket
influxdb:2.0

vault write database/config/my-influxdb-database
plugin_name=“influxdb-database-plugin”
host=127.0.0.1
username=admin
password=adminpass
allowed_roles=vault-admin

Result:
Error writing data to database/config/my-influxdb-database: Error making API request.

URL: PUT http://127.0.0.1:8200/v1/database/config/my-influxdb-database
Code: 400. Errors:

  • error creating database object: error verifying connection: error getting if provided username is admin: received status code 401 from server
2 Likes

Same issue for me. Can someone help ? Thanks

Hey, I think this error message happens when you try to use Vault with an InfluxDB v2.x instance.

The built-in plugin only supports InfluxDB v1.x.

I’m not aware of any workaround or implementation supporting V2 at the moment nor if this is on the current roadmap, but I just wanted to jump in to say that this is likely the reason for the error you are experiencing.