How to Backup and restore Jenkins
All the settings, build logs, artifact archives are stored under the JENKINS_HOME directory.
Simply archive this directory to make a back up. Similarly, restoring the data is just replacing the contents of the JENKINS_HOME directory from a back up.Back ups can be taken without stopping the server, but when you restore, please do stop the server.
Although $JENKINS_HOME is the only directory you need to backup, there’s a catch: this
directory can become rather large. To save space, consider what parts of this directory you really
need to backup and back them up selectively.
The bulk of your data, including your job configuration and past filed records, lives in the /jobs
directory. The /jobs directory holds information pertaining to all the jobs you create in Jenkins.
Its directory structure looks like this:
/jobs/*
- builds (build records)
- builds/*/archive (archived artifacts)
- workspace (checked out workspace)
The /builds directory stores past build records. So if you’re interested in configuration
only, don’t backup the builds. Or perhaps you need to keep build records but can afford to
throw away archived artifacts (which are actually produced binaries). You can do this excluding
builds/*/archive; note that these artifacts can be pretty big, excluding them may
introduce a substantial savings.
Finally, the workspace directory contains the files that you check out for the version control
systems. Normally these directories can be safely thrown away. If you need to recover, Jenkins
can always perform a clean checkout, so there’s usually no need to backup your workspace.
Another option is that you can use the Backup plugin and Backup and interrupt job plugin.
Comments
Post a Comment