Is there a command I can use to backup the embedded Foglight MySQL database while Foglight is running?
Yes. There is a switch (--single-transaction) you can add to the mysqldump command so that you can backup the embedded MySQL database while the Foglight Management Server (FMS) is up and running. You can issue the following command from the %FGLHOME%\mysql\bin directory to backup the MySQL database while the FMS is running:
mysqldump -u-p-h-P--databases --single-transaction --routines > dbbackup.sql
If you used the default values on installation (a username of foglight and a database port of 13306) the command will appear as follows:
mysqldump -u foglight -p-P13306 --databases FOGLIGHT --single-transaction --routines > DriveLetter:path\dbbackup.sql
NOTE: On UNIX systems, you may get an error in regards to the .sock file as shown below. Use the -S switch to resolve (referenced the sock file listed in the $FGLHOME/config/foglight.config file).
# bin/mysqldump -u foglight -p foglight --port=13306 --databases foglight --single-transaction --routines > ~/Quest_Software/fglexport.dmp
Enter password:
mysqldump: Got error: 2002: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) when trying to connect
# bin/mysqldump -u foglight -p -P13306 -S /tmp/fms-523-16382.sock --databases foglight --single-transaction --routines > ~/Quest_Software/fgldbbackup.dmp
Enter password:
The UNIX prompt in mysqldump will not return until the process is complete (this example duration was 4 minutes).
# ls -ltr
total 765556
drwxr-xr-x 20 root root 4096 Aug 27 14:49 Foglight5
-rw-r--r-- 1 root root 783153616 Nov 6 14:33 fgldbbackup.dmp
This allows for a 'hot backup' of the database, so the FMS doesn't need to be shutdown. The parameter "--single-transaction" is included to prevent corruption of any tables. If the database is very large, there could be some issues with performance while the backup is being generated since it is effectively locked.
You can set up a rule on your system that should provide you with automated backups. Create a new "Simple" rule that's time driven, on a 1 minute interval, triggerable without data, and with no scope. In the "Conditions and Actions", set the condition to "true" (all lower case), and for the action setup a CommandAction that executes the mysqldump command (making sure to use full paths to ensure that there are no path issues). The final step is assign the rule an "Active" schedule under its Schedules tab. There is a list of predefined schedules, or you can define your own.
© 2024 Quest Software Inc. ALL RIGHTS RESERVED. Feedback Terms of Use Privacy Cookie Preference Center