How to create database and user in influxdb progra

2019-07-23 00:40发布

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.

Could someone help me with this?

2条回答
叛逆
2楼-- · 2019-07-23 01:21

you can use ansible to setup influxb with your own recipe.

here's the ansible module documentation that you can use http://docs.ansible.com/ansible/influxdb_database_module.html

or, any config/deploy manager that you prefer. i'd do this anyday instead of some ssh script or who knows what. https://forge.puppet.com/tags/influxdb

chef. https://github.com/bdangit/chef-influxdb

and also, you can use any of the above config managers to provision/manipulate your ec2 instance(s).

查看更多
贼婆χ
3楼-- · 2019-07-23 01:39

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"

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.

查看更多
登录 后发表回答