Skip to content
This repository was archived by the owner on Oct 29, 2024. It is now read-only.

switch_database not working with Cluster client #237

Closed
PierreF opened this issue Sep 2, 2015 · 1 comment
Closed

switch_database not working with Cluster client #237

PierreF opened this issue Sep 2, 2015 · 1 comment

Comments

@PierreF
Copy link
Contributor

PierreF commented Sep 2, 2015

switch_database with clustered client don't work as expected... it only switch database on ONE client :)

For example, the following code:

>>> import influxdb
>>> c=influxdb.InfluxDBClusterClient([('localhost', 8086),('localhost', 9086),('localhost', 10086),])
>>> c.create_database('plop')  # success
>>> c.switch_database('plop')  # success (it can't fail :))
>>> c.create_retention_policy('test', '3d', 3, default=True)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File ".../influxdb/client.py", line 829, in func
    raise e
influxdb.exceptions.InfluxDBClientError: database not found

And on InfluxDB console, I see:

[http] 2015/09/02 17:31:16 ::1 - root [02/Sep/2015:17:31:16 +0200] GET /query?q=CREATE+RETENTION+POLICY+test+ON+None+DURATION+3d+REPLICATION+3+DEFAULT HTTP/1.1 200 86 - python-requests/2.7.0 CPython/2.7.9 Linux/3.19.0-25-generic a703e054-5187-11e5-8001-000000000000 7.141045ms

A simple workaround in my case it to provide database parameter when creating the client. But it would be better if switch_database worked on cluster client, or at least to warn about this issue in doc.

geodimm added a commit to geodimm/influxdb-python that referenced this issue Sep 13, 2015
The methods switch_database and switch_user are supposed to be called on
all clients in the cluster, not just a random one.
geodimm added a commit to geodimm/influxdb-python that referenced this issue Sep 13, 2015
The methods switch_database and switch_user are supposed to be called on
all clients in the cluster, not just a random one.
@aviau
Copy link
Collaborator

aviau commented Nov 13, 2015

This should be fixed in master!

@aviau aviau closed this as completed Nov 13, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants