This topic describes the concepts related to databases in LindormTSDB and features that are provided for time series data.
Database in LindormTSDB
Each LindormTSDB instance that is running manages one or more databases. Data is isolated between databases. Each database stores one or more time series tables.
If you write the data of irrelevant projects to a LindormTSDB instance, the data of each project is logically isolated to a large extent. In this case, we recommend that you store the data of each project in a separate database, modify the corresponding permissions, and manage users that have access permissions. Cross-database data access is supported in LindormTSDB. Users can access data across databases only after the users are granted the permissions to access the corresponding destination databases.
Time series data management based on databases
A database is a collection of time series tables. You can store time series tables that are associated with the same business in a separate database for data isolation based on your business requirements. LindormTSDB provides features to allow you to manage databases. LindormTSDB provides the following features:
You can configure a time boundary used to separate cold data and hot data at the database granularity.Note
For information about the separated storage of cold data and hot data, see The separated storage of hot data, cold data, and warm data.
You can configure time to live (TTL) at the database granularity.
When the time period between the point in time indicated by the timestamp of time series data and the current time is longer than set TTL, the TTL elapses. If the TTL of time series data elapses, LindormTSDB determines the time series data to be expired data and discards the data.
Timestamps of time series data can indicate event time or ingestion time:
Event time: indicates the point in time when an event that corresponds to time series data occurs. Timestamps that are described in Elements of time series data indicate event time.
Ingestion time: indicates the point in time when time series data is written to a database.
You can configure a time boundary used to separate cold data and hot data and TTL only based on event time. You cannot these settings based on ingestion time.
LindormTSDB runs asynchronous compaction tasks to archive cold data and discard expired data. As a result, a delay occurs when these operations are performed.
If you set a time boundary used to separate cold data and hot data and TTL for a database, a task is triggered to discard archived cold data when the TTL of the cold data elapses.
If you set TTL for a database and the time period between the point in time indicated by the timestamp of the data that you want to write and the current time is longer than the set TTL, the data can be written to the database as expected whereas the data cannot be retrieved during subsequent queries.
Database management by executing SQL statements
LindormTSDB allows you to perform the following operations on a database by executing SQL statements:
Create a database
You can create a database in LindormTSDB. For information about the corresponding SQL syntax, see CREATE DATABASE.Note
By default, a user is not granted the permissions to access the new database. If a user wants to perform operations on the new database, the user must be granted the corresponding database permissions.
Delete a database
You can delete a database in LindormTSDB. For information about the corresponding SQL syntax, see DROP DATABASE.
Modify the attributes of a database
You can modify the attributes of a database in LindormTSDB. For example, you can change the values of ttl and cold_boundary for a database in LindormTSDB. For information about the corresponding SQL syntax, see ALTER DATABASE.
Query the attributes of a database
You can query the attributes of a database in LindormTSDB. For information about the corresponding SQL syntax, see DESCRIBE DATABASE.
Database management in the ApsaraDB for Lindorm console
You can use the ApsaraDB for Lindorm (Lindorm) console to manage a database in LindormTSDB. In the Lindorm console, you can configure a time boundary used to separate cold data and hot data and TTL for a database in LindormTSDB. The following figure shows the page on which you can configure the settings.
You cannot use the Lindorm console to create or delete a database in LindormTSDB. If you want to create or delete a database in LindormTSDB, you must execute the corresponding SQL statements.