Restoring Garoon Using mysqldump
This section describes how to use mysqldump to restore data.
During restore, users cannot access Garoon. You have to restore data when users do not have access to Garoon.
Points to Check before Restore
Before performing restore using mysqldump, check the followings.
Enabling Backup Mode
Start the database, and perform restore using mysqldump.
Note that the "files" directory must be restored separately using OS commands. To ensure data integrity, you must prevent the database from being updated during the restore process.
Use the backup mode to prevent users from accessing Garoon during restore.
By default, the backup mode is disabled.
Before starting the restore, modify the configuration file (common.ini) to enable the backup mode.
(CGI directory)/(installation identifier)/common.ini
Example:
- On Windows:
C:\inetpub\scripts\cbgrn\common.ini - On Linux:
/var/www/cgi-bin/cbgrn/common.ini
Under "BackupMode", delete the "disable = "1"" row.
Before changing:
[BackupMode]
disable = "1"
driver = "xxxxx"
:
After change:
[BackupMode]
driver = "xxxxx"
:
Mysqldump Speed
Mysqldump takes a long time to backup and restore, proportional to the amount of data.
Restores take longer time than backups.
Restore using mysqldump takes longer time than restore using OS commands.
Disk Usage after Restore
After the restore using mysqldump, the disk usage may be smaller than the disk usage before backup. This is because the data that you backed up does not contain unused space. No data is missing.
For Windows
On Windows, restore data using mysqldump.
This example illustrates the use of MySQL bundled in the installer.
- Installation identifier: cbgrn
- CGI directory: C:\inetpub\scripts
- MySQL installed directory: C:\Program Files\Cybozu
- Backup destination: C:\backup\YYYYMMDD
-
Stop the Web server service.
-
Stop the scheduling service.
From the Windows Start menu, select "Administrative Tools" > "Services" to stop the following services:
- Cybozu_Scheduling_Service_cbgrn
-
Confirm that the scheduling service is stopped.
- Start Task Manager.
- On Windows Task Manager, click the "Processes" tab.
- Confirm that sched.exe is not displayed.
-
Start the command prompt.
-
Set Garoon to backup mode.
cd C:\inetpub\scripts\cbgrn
.\grn.exe -C -q code\command\backupmode_start.csp -
Using the database administrator account, import the backed up data.
"C:\Program Files\Cybozu\mysql-5.0\bin\mysql" --defaults-file="C:\Program Files\Cybozu\mysql-5.0\etc\my.ini" -u cbroot -p < C:\backup\YYYYMMDD\full.sql -
Specify the database administrator password.
-
Delete the existing attachment area.
rmdir /s /q "C:\Program Files\Cybozu\mysql-5.0\files" -
Use OS commands to restore attachments.
xcopy C:\backup\YYYYMMDD\files "C:\Program Files\Cybozu\mysql-5.0\files" /e /i -
Ensure that the Full Control permission is granted to the Everyone group on the directory restored in step 6 and 9.
If not, grant the full control permission to the Everyone group. -
Restart the MySQL service.
From the Windows Start menu, select Administrative Tools > Service, and restart the following service:
- Cybozu_Database_Engine_5_0
-
Cancel the backup mode.
cd C:\inetpub\scripts\cbgrn
.\grn.exe -C -q code\command\backupmode_end.csp -
Start the scheduling service.
From the Windows Start menu, select Administrative Tools > service, and start the following services.
- Cybozu_Scheduling_Service_cbgrn
-
Start the Web server service.
-
Ensure that Garoon can be accessed correctly.
For Linux
On Linux, restore data using mysqldump.
This example illustrates the use of MySQL bundled in the installer.
- Installation identifier: cbgrn
- CGI Directory: /var/www/cgi-bin
- MySQL installation directory: /usr/local/cybozu
- Backup destination: /backup/YYYYMMDD
-
Stop the Web server service.
- For Red Hat Enterprise Linux 6 or earlier:
/etc/init.d/httpd stop- For Red Hat Enterprise Linux 7 or later:
systemctl stop httpd.service -
Stop the scheduling service.
/etc/init.d/cyss_cbgrn stop -
Confirm that the scheduling service is stopped.
Run the following command to confirm that the scheduling service is not displayed.
ps -aux | grep cyss -
Set Garoon to backup mode.
cd /var/www/cgi-bin/cbgrn
./grn.cgi -C -q code/command/backupmode_start.csp -
Using the database administrator account, import the backed up data.
/usr/local/cybozu/mysql-5.0/bin/mysql --defaults-file=/usr/local/cybozu/mysql-5.0/etc/my.ini -u cbroot -p < /backup/YYYYMMDD/full.sql -
Specify the database administrator password.
-
Delete the existing attachment area.
rm -rf /usr/local/cybozu/mysql-5.0/files -
Use OS commands to restore attachments.
cp -rp /backup/YYYYMMDD/files /usr/local/cybozu/mysql-5.0/ -
Confirm that the access permissions for the restored data are correctly set.
The following settings are required to access Garoon.
- Data stored in /usr/local/cybozu/mysql-5.0/data.
Owner: User to execute CGI (for example, apache)
Access permissions for the directory and subdirectories: 755
Access permissions for files in the directory: 755 - Data stored in /usr/local/cybozu/mysql-5.0/files
Owner: User to execute CGI (for example, apache)
Access permissions for the directory and subdirectories: 755
Access permissions for files in the directory: 644
To change access permissions, execute the following commands:
chmod -R 755 /usr/local/cybozu/mysql-5.0/data
chown -R (user to execute CGI):root /usr/local/cybozu/mysql-5.0/data
find /usr/local/cybozu/mysql-5.0/files/ -type d | xargs chmod 755
find /usr/local/cybozu/mysql-5.0/files/ -type f | xargs chmod 644
find /usr/local/cybozu/mysql-5.0/files/ -type d | xargs chown (user to execute CGI):root - Data stored in /usr/local/cybozu/mysql-5.0/data.
-
Restart the MySQL service.
/etc/init.d/cyde_5_0 restart -
Cancel the backup mode.
cd /var/www/cgi-bin/cbgrn
./grn.cgi -C -q code/command/backupmode_end.csp -
Start the scheduling service.
/etc/init.d/cyss_cbgrn start -
Start the Web server service.
- For Red Hat Enterprise Linux 6 or earlier:
/etc/init.d/httpd start- For Red Hat Enterprise Linux 7 or later:
systemctl start httpd.service -
Ensure that Garoon can be accessed correctly.