Issue
How to back up and rebuild the 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" thenFetch 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/lveinfoBackup 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" thenStop 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}
- If the "
Re-create the database
Warning: The operation will remove the database and recreate it as a new one
lve-create-db --recreateservice lvestats start
Comments
0 comments
Please sign in to leave a comment.