Grafana and Oracle database - Part 2B - Influx CLI, Influx DB and measurements

The next logical step is to get ourselves familiar with the influx CLI, create a brand new DB and a separate user with all privileges on that database.

First, login to influx CLI and create an admin user. If you don't, Influx DB won't allow you to perform any query before doing so.

NOTE: You may also substitute the actual hostname in place of localhost.

$ influx -host localhost -port 8086
Connected to http://localhost:8086 version 1.5.5
InfluxDB shell version: 1.5.5
 

> show databases
ERR: error authorizing query: create admin user first or disable authentication
Warning: It is possible this error is due to not setting a database.
Please set a database with the command "use <database>".
 

> use _internal
ERR: error authorizing query: create admin user first or disable authentication
DB does not exist!
 

> create user admin with password 'Welcome4321' with all privileges;
 

> auth
username: admin
password:
 

> show databases;
name: databases
name
----
_internal


Now, create your first database and switch to that one.

> show databases;
name: databases
name
----
_internal
 

> create database telegraf;
 

> show databases
name: databases
name
----
_internal
telegraf
 

> use telegraf
Using database telegraf


Now, this database is ready to accept data from telegraf. Of course, let's set the retention policy on this data since we don't want to overwhelm the database.

Read more about retention policies here.

> show retention policies
name    duration shardGroupDuration replicaN default
----    -------- ------------------ -------- -------
autogen 0s       168h0m0s           1        true 
 

> create retention policy "one_week" on "telegraf" duration 1w replication 1 default
 

> show retention policies
name     duration shardGroupDuration replicaN default
----     -------- ------------------ -------- -------
autogen  0s       168h0m0s           1        false
one_week 168h0m0s 24h0m0s            1        true

 

Now, create a user with privileges only on the newly created "telegraf" database.

> create user telegraf_user with password 'Telegraf4321'

> show users
user          admin
----          -----
admin         true
telegraf_user false

> grant all privileges on telegraf to telegraf_user

> show grants for telegraf_user

database privilege
-------- ---------
telegraf ALL PRIVILEGES


Read more about introduction to measurements here.

Let's proceed to install Telegraf agent, without further ado.


< Prev (Part 2A: Install Influx DB)                                                   Next (Part 3: Install Telegraf agent) >

Comments

Popular posts from this blog

java.lang.ExceptionInInitializerError while trying to Access login page

Solution to "End Program - WMS Idle"

WGET shell Script for downloading patches