This article provides a step-by-step guide on how to safely back up and re-initialise the LVE (Lightweight Virtual Environment) statistics database used by CloudLinux. The LVE database stores resource usage statistics for individual accounts, and it’s critical for performance monitoring and troubleshooting.
Follow the steps:
- Identify the Database Type
Run the following command to determine the type of LVE database in use:grep db_type /etc/sysconfig/lvestats2 | grep -v “#”
- Back up the Database
- If db_type=mysql:
- Retrieve the connection string:
grep connect_string /etc/sysconfig/lvestats2
The format will be:
connect_string = USER:PASSWORD@HOST[:PORT]/DATABASE
Example:
connect_string = jdoe:[email protected]/lveinfo
- Backup the MySQL LVE database:
mysqldump -u jdoe -h 203.0.113.2 -p -D lveinfo > /root/lveinfo_db_backup_$(date +%Y-%m-%d).sql
- Retrieve the connection string:
- If db_type=sqlite:
- Stop the LVE statistics service:
service lvestats stop
- Back up the LVE data directory:
tar -zcvf /root/lveinfo_backup_$(date +%Y-%m-%d).tar.gz /var/lve/
- Rename the existing SQLite database:
mv /var/lve/lvestats2.db{,.old}
- Stop the LVE statistics service:
- If db_type=mysql:
- Rebuild the LVE Database
Warning: This will delete the current database and create a new one from scratch.- Recreate the database:
lve-create-db –recreate
- Restart the LVE statistics service:
service lvestats start
- Recreate the database:
This process ensures a safe backup and clean reinitialization of the LVE database. Always back up before making changes to prevent data loss. Be sure to check out our latest KB articles for more helpful information.
Need to manage user directory access as well? Learn How to enable Apache mod_userdir module