How to restore a Managed Master(CJEMM) or Operations Center(CJEOC) backup on CJE

Issue

  • We need to restore a whole backup of a CJEMM/CJEOC
  • We need to restore some files from a backup of a CJEMM/CJEOC

Environment

Resolution

To restore a backup of a CJEMM/CJEOC you have to follow these steps

  • The CJEMM/CJEOC should be started
  • Obtain the worker where the CJEMM/CJEOC is running - cje run list-applications | grep <CJEMM-CJEOC-NAME>
  • Copy the backup file to the /tmp folder of the worker - dna copy <BACKUP_FILE> /tmp <WORKER>
  • Connect to the worker - dna connect <WORKER>
  • Obtain JENKINS_HOME mount point - mount | grep <CJEMM-CJEOC-NAME>
  • List JENKINS_HOME contents - ls -la /mnt/<CJEMM-CJEOC-NAME>/ID
  • If you will restore a whole backup

  • Make a backup of the current JENKINS_HOME - tar -czf /tmp/currentBackup.tgz /mnt/<CJEMM-CJEOC-NAME>/ID/*
  • Remove the JENKINS_HOME content - rm -fr /mnt/<CJEMM-CJEOC-NAME>/ID/*
  • Restore the backup - tar -xzf /tmp/<BACKUP_FILE> -C /mnt/<CJEMM-CJEOC-NAME>/ID
  • Restart The CJEMM/CJEOC
  • If every is OK, remove the backups - rm /tmp/<BACKUP_FILE> /tmp/currentBackup.tgz
  • If you will restore only some files

  • Make a backup of the current JENKINS_HOME - tar -czf /tmp/currentBackup.tgz /mnt/<CJEMM-CJEOC-NAME>/ID/*
  • Restore the backup - tar -xzf /tmp/<BACKUP_FILE> -C /mnt/<CJEMM-CJEOC-NAME>/ID <files_to_restore>
  • Restart The CJEMM/CJEOC
  • If every is OK remove the backups - rm /tmp/<BACKUP_FILE> /tmp/currentBackup.tgz
  • NOTE Due the current issue TIGER-4473 : Backup plugin does not compress all folders with the right permissions, in case you would like to recover from backup, you might need to give the permission drwxr-xr-x. to all the folders inside the $JENKINS_HOME.

Have more questions? Submit a request

1 Comments

  • 0
    Avatar
    Douglas Hellinger

    Be careful to extract the tarball with the correct owner:group and perms or CJOC will fail after restart (I found).

Please sign in to leave a comment.