Issue
How-to backup and rebuild LVE database?
Environment
- CloudLinux OS
Solution
-
Get the database type
grep db_type /etc/sysconfig/lvestats2 | grep -v "#"
-
Backup the database
-
If the "
db_type=mysql
" then-
Fetch the connection string from the config:
grep connect_string /etc/sysconfig/lvestats2
connect_string = USER:PASSWORD@HOST[:PORT]/DATABASE
connect_string=jdoe:SoMe_Passwd@203.0.113.2/lveinfo -
Backup LVE info database from MySQL server
mysqldump -u jdoe -h 203.0.113.2 -p -D lveinfo > /root/lveinfo_db_backup_$(date +%Y-%m-%d).sql
-
-
If the "
db_type=sqlite
" then-
Stop the service and backup data
service lvestats stop
tar -zcvf /root/lveinfo_backup_$(date +%Y-%m-%d).tar.gz /var/lve/
mv /var/lve/lvestats2.db{,.old}
-
-
-
Re-create the database
Warning: The operation will remove the database and re-recreate it a new
lve-create-db --recreate
service lvestats start
Comments
0 comments
Please sign in to leave a comment.