9

how to get all databases use http api from influxdb in v0.8?

but I can use this query in v0.9:

curl -G http://localhost:8086/query --data-urlencode "u=todd"  \
--data-urlencode "p=influxdb4ever" --data-urlencode "q=SHOW DATABASES"

I can't get any info on influxdb.com

thx

Yuval Pruss
  • 8,716
  • 15
  • 42
  • 67
廖前程
  • 101
  • 1
  • 1
  • 7

3 Answers3

17

I can get the database list using this statement: curl -G "http://somehost:8086/query?pretty=true" --data-urlencode "q=show databases" My InfluxDB version is 1.2.2

Software Craftsman
  • 2,999
  • 2
  • 31
  • 47
  • As of 1.2. the admin interface is disabled by default. The HTTP API with curl is a better choice. – Andrei May 14 '17 at 16:17
4

Using influxdb lib in python

install: $pip3 install influxdb

    from influxdb import InfluxDBClient

    client = InfluxDBClient(host='', port='', username='', password='')

    #return database in a list of dict
    dbs = client.get_list_database()

    #for better format
    list = []
    for db in dbs:
       list.append(db.get('name'))
kvivek
  • 3,321
  • 1
  • 15
  • 17
qloveshmily
  • 1,017
  • 9
  • 5
0

Visit http://localhost:8083 on the host machine. The Admin UI has a list of the databases configured.

beckettsean
  • 1,826
  • 11
  • 7