How To Create Influxdb Database Manually

  1. Checking service

Please refer to Installing influxdb check service. If the service is not started or is not installed, please follow this section.

  1. create influxdb database

Run the following command to enter influxdb shell
$ sudo influx
Run the following command to create influxdb database
--Create retention policy
> CREATE RETENTION POLICY hour ON lico DURATION 6h REPLICATION 1 DEFAULT;
> CREATE RETENTION POLICY day ON lico DURATION 1d REPLICATION 1;
> CREATE RETENTION POLICY week ON lico DURATION 7d REPLICATION 1;
> CREATE RETENTION POLICY month ON lico DURATION 31d REPLICATION 1;
> CREATE RETENTION POLICY ai ON lico DURATION INF REPLICATION 1;

--Create continuous queries
> CREATE CONTINUOUS QUERY day_summary ON lico BEGIN SELECT regex("(node|nodegroup|rack|cluster)_.+") INTO day FROM hour GROUP BY time(10m) END;
> CREATE CONTINUOUS QUERY week_summary ON lico BEGIN SELECT regex("(node|nodegroup|rack|cluster)_.+") INTO week FROM day GROUP BY time(60m) END;
> CREATE CONTINUOUS QUERY month_summary ON lico BEGIN SELECT regex("(node|nodegroup|rack|cluster)_.+") INTO month FROM week GROUP BY time(6h) END;
Run the following command to exit influxdb shell
> exit