Starting from iBatyr Monitor 4.7, sharding is supported out of the box.
Operating principle
Sharding is a database design principle in which logically independent rows of a database table are stored separately, pre-grouped into sections. These sections, in turn, are located on different, physically and logically independent database servers. In this case, one physical cluster node can contain several database servers.
In iBatyr Monitor, sharding works as follows:
Several tables are created, divided by month from the 1st day, a table for the next month and a default table (agent_event_default).
The current month table is filled in as events arrive.
Note
agent_event_default is a table that contains events that are not included in any of the created tables. For example, if the time on the agent is set incorrectly (month, year).
If agent_event_default has grown to a large size, then there is a problem somewhere or something is not working correctly.
Useful commands
A list of commands that can be used to perform diagnostics or view information.
Action |
Team |
Comment |
|---|---|---|
Check if sharding is enabled |
|
If sharding is enabled, the message Sharding already enabled will appear on the screen. |
Display a list of shards |
|
Displays a list of all tables, divided by month; indicates their size. |
View table data |
|
The output result will be the number of events in the selected table, as well as the time of the first and last event, where |
Create cold storage |
|
Creates cold storage on another disk, for example to create an archive. |
“Freeze” table |
|
The command will freeze table table_name and move it to a slow disk. Attention: Before starting the freeze, stop nginx: |
Delete monthly data |
|
Deletes the table table and its associated files. |
Delete data for several months |
|
Deletes all tables except n: 0 — deletes all tables; 1 – leaves only the current month; 2 — leaves the current and previous months; etc. The command deletes shards in PostgreSQL, partitions in ClickHouse and files associated with them. |
Delete partition in ClickHouse |
|
Deletes the |
Removing a shard via the web interface
Note
When deleting a shard, all files associated with the specified table will be deleted.
You can delete shards in PostgreSQL and ClickHouse from the web interface of the iBatyr Monitor server. To do this, in the Control Panel - Databases section, select the database you are interested in and in the Perform action drop-down menu, select Delete data.