如何以编程方式在influxdb中创建数据库和用户? [英] How to create database and user in influxdb programmatically?

查看:559
本文介绍了如何以编程方式在influxdb中创建数据库和用户?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的用例中,我使用的是单个ec2实例[不是集群].我想以编程方式创建数据库和具有所有特权的用户吗?安装了influxdb之后,是否有一个配置文件可以编辑并复制到正确的位置.

In my use case I am using single ec2 instance [not a cluster]. I want to create a database and an user with all privileges programmatically? Is there a config file which I can edit and copy to the right location after influxdb is installed.

有人可以帮我吗?

推荐答案

没有任何配置选项可用于InfluxDB本身.启动实例后,您可以使用InfluxDB HTTP创建用户. curl命令将如下所示:

There isn't any config option that you can use to do that with InfluxDB itself. After starting up an instance you can use the InfluxDB HTTP to create the users. The curl command to do so would be the following:

curl "http://localhost:8086/query" --data-urlencode "q=CREATE USER myuser WITH PASSWORD 'mypass' WITH ALL PRIVILEGES"

只需为要创建的每个用户运行此命令.之后,您需要启用配置的[http]部分的auth值.

Just run this command for each of the users you'd like to create. After that, you'll need to enabled the auth value of the [http] section of the config.

这篇关于如何以编程方式在influxdb中创建数据库和用户?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆