Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to get databases list at influxdb in v0.8

Tags:

http

influxdb

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

like image 632
廖前程 Avatar asked Dec 08 '15 13:12

廖前程


People also ask

How do I view databases in InfluxDB?

Run a SHOW DATABASES query The query returns database names in a tabular format. This InfluxDB instance has two databases: NOAA_water_database and _internal .

How do I retrieve data from InfluxDB?

To perform a query send a GET request to the /query endpoint, set the URL parameter db as the target database, and set the URL parameter q as your query. You may also use a POST request by sending the same parameters either as URL parameters or as part of the body with application/x-www-form-urlencoded .

How do I add a database to InfluxDB?

A fresh install of InfluxDB has no databases (apart from the system _internal ), so creating one is our first task. You can create a database with the CREATE DATABASE <db-name> InfluxQL statement, where <db-name> is the name of the database you wish to create.


2 Answers

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

like image 176
Vivit Avatar answered Oct 04 '22 03:10

Vivit


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'))
like image 30
qloveshmily Avatar answered Oct 04 '22 04:10

qloveshmily