Restoring 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 Restoring

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.

File Path to "common.ini"

(CGI directory)/(installation identifier)/common.ini
Example:

  • On Windows:
    C:¥inetpub¥scripts¥cbgrn¥common.ini
  • On Linux:
    /var/www/cgi-bin/cbgrn/common.ini
Contents to Be Modified in "common.ini" File

Under "BackupMode", delete the "disable = "1"" row.
Before changing:

:
[BackupMode]
disable = "1"
driver = "xxxxx"
:

After changing:

:
[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 Restoring

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 Environment

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
Steps:
  1. Stop the Web server service.

  2. Stop the scheduling service.

    From the Windows Start menu, select "Administrative Tools" > "Services" to stop the following services:

    • Cybozu_Scheduling_Service_cbgrn

  3. Confirm that the scheduling service is stopped.

    1. Start Task Manager.
    2. On Windows Task Manager, click the "Processes" tab.
    3. Confirm that sched.exe is not displayed.

  4. Start the command prompt.

  5. Set Garoon to backup mode.

    cd C:¥inetpub¥scripts¥cbgrn
    .\grn.exe -C -q code¥command¥backupmode_start.csp

  6. 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

  7. Specify the database administrator password.

  8. Delete the existing attachment area.

    rmdir /s /q "C:¥Program Files¥Cybozu¥mysql-5.0¥files"

  9. Use OS commands to restore attachments.

    xcopy C:¥backup¥YYYYMMDD¥files "C:¥Program Files¥Cybozu¥mysql-5.0¥files" /e /i

  10. 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.

  11. Restart the MySQL service.

    From the Windows Start menu, select Administrative Tools > Service, and restart the following service:

    • Cybozu_Database_Engine_5_0

  12. Cancel the backup mode.

    cd C:¥inetpub¥scripts¥cbgrn
    .\grn.exe -C -q code¥command¥backupmode_end.csp

  13. Start the scheduling service.

    From the Windows Start menu, select Administrative Tools > service, and start the following services.

    • Cybozu_Scheduling_Service_cbgrn

  14. Start the Web server service.

  15. Ensure that Garoon can be accessed correctly.

For Linux Environment

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
Steps:
  1. 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

  2. Stop the scheduling service.

    /etc/init.d/cyss_cbgrn stop

  3. Confirm that the scheduling service is stopped.

    Run the following command to confirm that the scheduling service is not displayed.

    ps -aux | grep cyss

  4. Set Garoon to backup mode.

    cd /var/www/cgi-bin/cbgrn
    ./grn.cgi -C -q code/command/backupmode_start.csp

  5. 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

  6. Specify the database administrator password.

  7. Delete the existing attachment area.

    rm -rf /usr/local/cybozu/mysql-5.0/files

  8. Use OS commands to restore attachments.

    cp -rp /backup/YYYYMMDD/files /usr/local/cybozu/mysql-5.0/

  9. 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

  10. Restart the MySQL service.

    /etc/init.d/cyde_5_0 restart

  11. Cancel the backup mode.

    cd /var/www/cgi-bin/cbgrn
    ./grn.cgi -C -q code/command/backupmode_end.csp

  12. Start the scheduling service.

    /etc/init.d/cyss_cbgrn start

  13. 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

  14. Ensure that Garoon can be accessed correctly.