Database Maintenance and Disk Space Management
Managing the database efficiently is crucial for ensuring optimal performance of FNM Manager. The more traffic you monitor and the longer the retention period for storing data, the more disk space will be required. Below are the details and steps to maintain and manage the ClickHouse database effectively.
ClickHouse Database TTL
By default, ClickHouse in FastNetMon is configured with a 7-day Time-To-Live (TTL). This means data older than 7 days will automatically be purged to save disk space. You can view and adjust the TTL settings both via the web interface and the CLI.
View TTL Settings
-
Navigate to Settings > Database Settings in the FNM Manager web interface.
-
Alternatively, you can use the CLI to view the current TTL settings and database size:
fnm_cli --clickhouse_ttl
Modify TTL Settings
You can adjust the retention period for data stored in the ClickHouse database. The default CLI command sets the TTL to 2 days, but you can customize it with the --days
parameter.
Example Commands:
-
Set TTL to 2 days:
fnm_cli --set_clickhouse_ttl
-
Set TTL to a custom value (e.g., 5 days):
fnm_cli --set_clickhouse_ttl --days=5
Note: The retention period directly affects disk space usage. A longer TTL requires more storage but retains more historical data for analysis.
Monitor Database Disk Usage
It's essential to keep track of the database size to prevent the system from running out of disk space.
-
Use the Advanced Database Settings in the web interface to view the size of each table and its TTL configuration.
-
CLI command to view database sizes:
fnm_cli --clickhouse_ttl
Best Practices
-
Optimize TTL Settings:
-
Set the TTL based on your organization's requirements for data retention and available disk space.
-
For example:
-
High traffic environments: Consider a TTL of 2-3 days to conserve space.
-
Low traffic environments: A TTL of 7+ days may be acceptable.
-
-
-
Regular Monitoring:
- Check database size regularly to ensure the system is not nearing disk capacity.
-
Scale Disk Storage:
- As your traffic and retention requirements grow, plan for additional disk storage to maintain performance