Backup & Restore of Payara Server

Uncategorized

Recently, I was working with a customer on a production deployment of Payara Server and the topic of disaster recovery and backups arose. It seemed like a useful topic to blog about and share my thoughts with the community.

Oracle GlassFish 3 had a built-in automatic backup facility using the asadmin command create-backup-config. This allowed you to specify a schedule for when to backup, where to place the backed up file, and how many backups to keep.

This is no longer present in GlassFish, since it was a commercial feature that was never open-sourced, but its effects can be reproduced without much effort using the backup-domain command and some scheduling software (crontab, for example)

Since the domain directory is where all of the user configuration of Payara Server is kept, we can consider this to be separate to the installation files that Payara Server uses to run the app server itself. We can backup the domain using the asadmin backup-domain command as follows:

asadmin backup-domain --backupDir /path/to/backup/directory myDomain

The effect of this command is to create a full backup of the domain directory, however, to complete the command the domain must be stopped. This will mean that any application deployed to the DAS is unavailable while the backup takes place.

The job of running this backup command on a given schedule and managing the resulting backed up files needs to be done by a script external to Payara Server.

To restore from a backup the asadmin restore-domain command is used:

asadmin restore-domain --filename ${name} --backupdir /path/to/backup/directory myDomain

This command will restore just the domain named in the command. Since instances are stored separately to each domain (and may be on remote hosts), the command will have no effect on instances.

Since all data in an instance directory is kept in sync with the DAS, there is no added data (besides logs, caches and some MQ data when a file-based store is used) and an instance can be completely restored simply by making sure there is an empty directory with the name of the instance inside a node folder of the correct name. For example: payara41/nodes/localhost-localdomain/myInstance

Running the start-local-instance command with a full sync, as discussed earlier, will restore the instance completely:

asadmin start-local-instance --sync=full myInstance

If OpenMQ (Payara Server’s JMS broker) is being used, the default configuration is to use EMBEDDED mode, meaning that Payara Server will fully manage the JMS broker within the same JVM as the server instance and a file-based store is used for persistent messages 

The alternative option of LOCAL allows for the use of an “enhanced” broker cluster, whereby the JMS broker instances are started as separate JVMs and use a database connection for storage. Assuming the database is highly available, this completely avoids any danger when needing to –sync=full the instance.Contact us!

This process has quite a few steps when considering that this process would need to be repeated each time an upgrade was to be done. Since Payara offer a new patch release (bugfixes only) every month and a new full release (bugfixes and new features) every 3 months, this could end up being a process that gets repeated very often. If regular backups are taken, as recommended, then it may not be so major.

 

 

 

Comments (3)

Post a comment

Your email address will not be published. Required fields are marked *

Payara needs the contact information you provide to us to contact you about our products and services. You may unsubscribe from these communications at any time. For information on how to unsubscribe, as well as our privacy practices and commitment to protecting your privacy, please review our Legal & Privacy Policy.

  1. Christian Bakker

    Hi Mike,

    do you have a “best practice” for updating payara nodes from a central payara management server?

    Regards
    Christian

  2. Francisco Del Valle

    When I do the restoration and then I give: start-domain, I start the interface, but it doesn’t show me the .war applications, due to an error called java.lang.NullPointerException

  3. Ondro Mihalyi

    Hi, Francisco,

    It seems that you hit a situation when migrating to a newer version isn’t completely straightforward. Payara Server doesn’t contain any support for fixing application or configuration to adapt them to work on a newer version and sometimes some manual adjustments are needed. This is not a good place to discuss technical problems. Much better place is to send a question in Payara forum (https://groups.google.com/forum/#!forum/payara-forum) or raise an issue on Payara github, and include a detailed description of the error, including whole stacktrace of your exception.

Related Posts

How to Run and Scale AI Java Applications in Production: An Overview for Developers with no Machine Learning Expertise 9 minutes
Jakarta EE

How to Run and Scale AI Java Applications in Production: An Overview for Developers with no Machine Learning Expertise

Organizations are increasingly interested in adopting artificial intelligence (AI) and generative AI (GenAI) to improve operations and offer next-generation […]

4 minutes
Uncategorized

Leading the Way: Payara Platform Community 7 Beta Now Fully Jakarta EE 11 Certified

We’re excited to announce that Payara Platform Community 7 Beta application server is now fully certified as Jakarta EE 11 […]

What Is a Java Application Server? A Short Guide 6 minutes
Jakarta EE

What Is a Java Application Server? A Short Guide

Enterprise Java applications power global commerce, healthcare, government and countless other industries. These systems must be scalable, secure and […]