By Chris Kasso-Oracle on Feb 16, 2011
For those familiar with earlier versions of GlassFish you may recall a couple of commands that could be used to backup and restore the DAS:
While these commands were available in 2.x they did not make it into v3 or 3.0.1. They are back in 3.1.
The backup-domain command will create a zip file that contains the contents of the domains/<domain> directory. This includes configuration and deployed applications. This zip file could be used to restore the DAS, retrieve a prior configuration or migrate the DAS to a different system.
The restore-domain command reversed the behavior of backup-domain. It essentially takes the zip file and restores it to the domain directory. Pretty simple stuff. Some details about how the prior versions of these commands worked is captured in the DAS Recovery One Pager.
In 3.1 we made some improvements over the prior implementation. For example in 2.x the backup file name was called: sjsas_backup_vNNNNN.zip where NNNNN is a number (e.g. 00001). This number is incremented for each backup. For 3.1 we have changed the backup name to domain_name_YYYY_MM_DD_NNNNN.zip. For example: domain1_2010_05_28_000001.zip. This makes it easier to manage these files for those cases where you move them to an alternate location away from the domain directory.
Prior to 3.1 the backup would be stored in the domain directory where the backup was created. It was not possible to specify an alternate location for the backup. In 3.1 we have added a new --backupdir option to backup-domain so now it is trivial to store the backups outside of the domain directory:
asadmin backup-domain --backupdir /net/backuphost/domain1 domain1 Backed up domain1 at Wed Feb 16 15:13:46 PST 2011. Command backup-domain executed successfully.
The restore-domain command now allows you to restore to a domain where the name of the domain does not match the domain the backup originated from. The default behavior is to not allow this to occur but the behavior can be overridden with the --force option. If the --force option is used the domain name used to create the backup will be used.
Finally we also improved the output of the list-backups command:
asadmin list-backups CONFIG USER BACKUP DATE FILENAME kasso Wed Feb 16 15:22:18 PST 2011 domain1_2011_02_16_v00001.zip kasso Wed Feb 16 15:22:20 PST 2011 domain1_2011_02_16_v00002.zip kasso Wed Feb 16 15:22:22 PST 2011 domain1_2011_02_16_v00003.zip kasso Wed Feb 16 15:23:06 PST 2011 domain1_2011_02_16_v00004.zip Command list-backups executed successfully.
With the --long option more details about the backup can be displayed:
asadmin list-backups --long Description : domain1 backup created on 2011_02_16 by user kasso GlassFish Version : Oracle GlassFish Server 3.1 (build 43) Backup User : kasso Backup Date : Wed Feb 16 15:22:18 PST 2011 Domain Name : domain1 Backup Type : full Backup Config Name : Backup Filename (origin) : /work/ogs/glassfish3/glassfish/domains/domain1/backups/domain1_2011_02_16_v00001.zip Domain Directory : /work/ogs/glassfish3/glassfish/domains/domain1
The ability to create and managed domain backups for your DAS has been restored in the GlassFish Server Open Source Edition. The commands with the new enhancements our available now in promoted builds of GlassFish 3.1.