InfluxDB : Install2024/06/10 |
|
Install Time Series Database, InfluxDB.
|
|
| [1] | Install InfluxDB and client tools. |
|
root@dlp:~# apt -y install influxdb influxdb-client
|
| [2] | Configure InfluxDB. By default, authentication is disabled, all users can use InfluxDB with privileges. So enable authentication first. |
|
# create an admin user # [admin] ⇒ specify any username you like # [adminpassword] ⇒ set any password root@dlp:~# influx -execute "create user admin with password 'adminpassword' with all privileges" root@dlp:~# influx -execute "show users" user admin ---- ----- admin true
root@dlp:~#
vi /etc/influxdb/influxdb.conf [http] # Determines whether HTTP endpoint is enabled. # enabled = true # The bind address used by the HTTP service. # bind-address = ":8086" # Determines whether user authentication is enabled over HTTP/HTTPS. # line 226 : uncomment and change auth-enabled = trueroot@dlp:~# systemctl restart influxdb
|
| [3] | After enabling authentication, access InfluxDB CLI like follows. |
|
# run InfluxDB CLI and authenticate as an user root@dlp:~# influx Connected to http://localhost:8086 version 1.6.7~rc0 InfluxDB shell version: 1.6.7~rc0 > auth username: admin password: > exit # add user info on CLI root@dlp:~# influx -username admin -password adminpassword
Connected to http://localhost:8086 version 1.6.7~rc0
InfluxDB shell version: 1.6.7~rc0
> exit
# set user info on environment variables root@dlp:~# export INFLUX_USERNAME=admin root@dlp:~# export INFLUX_PASSWORD=adminpassword root@dlp:~# influx
Connected to http://localhost:8086 version 1.6.7~rc0
InfluxDB shell version: 1.6.7~rc0
> exit
# authenticate on HTTP API root@dlp:~# curl -G http://localhost:8086/query?pretty=true -u admin:adminpassword --data-urlencode "q=show users"
{
"results": [
{
"statement_id": 0,
"series": [
{
"columns": [
"user",
"admin"
],
"values": [
[
"admin",
true
]
]
}
]
}
]
}
|
| Sponsored Link |
|
|