reference:
https://blog.51cto.com/dyc2005/2315479
Jenkins effective data backup, the first data storage structure is to be understood Jenkins, and then select the appropriate size for backup according to the business scene.
A typical jenkins instance contains the following files and directories:
* .Xml need to back up config - History needs to be backed fingerprints need to back up , Ltd. Free Join -build- stats need backup * .key * need backup jobs jobs need to back up the configuration (config.xml, nextBuildNumber), builds directory (build logs, etc.) depending on demand logs plug-in logs, according to needs, and you can not back up monitoring can not back up, plug-in generates real-time data monitoring nodes need to back up plugins need backup * .jpi and * .hpi, it can not back up subdirectories for each plug-in, will start after jenkins update plugins subdirectory secrets need to be backed updates need to back up userContent users to upload content, may need to back up users user cache information, the best backup
Use ThinBackup backup
ThinBackup need to install plug-ins
Configuration thinBackup
Jenkins -> System Management -> ThinBackup -> Setting
Then set
The above configuration represents Monday 12:01 full backup to / data / jenkins_bak (real production environment, can use the directory to make shared directory)
backup content comprising: Build Results, Backup userContent Folder, Backup Next Build Number File
Backup plugins Archives (plug-in), backup additional files, as well as the old backup file compression package
Configuration directly save it.
Then we can execute it manually.
Execution is completed. Our view on the server
Generated in the backup path below, generates a backup directory.
Use backup and restore.
Assuming that existing jenkins has been damaged is not working; the need to restore service by jenkins most recent full backup;
1. redeployment jenkins, or complete the backup copy to the new host jenkins
2. New jenkins install third-party backup and restore plug-ThinBackup;
We on the new machine 171, deployed a new jenkins
After the above steps are completed. We need to plug inside New ThinBackup
Configuration.
We configured.
note:
1. Configure here is jenkins backup path, so before we recommend our backup directory to be shared, so even if we changed the server, you can also access previous backup directory.
2. It should be noted here that we use here is the root user to start the actual production, note the directory permissions, user jenkins start, you need to read and write to the backup directory .
More than 2 points to note
After checking the directory structure needs to be restored and preserved. Save and exit.
Then we entered, restore.
Select time restore it
Then remember the need to plug-ins are installed.
然后我们会发现使用新的jenkins部署的时候,所有的从节点,变成了offine状态不可用;如还原后从节点192.168.144.171状态是offine