Skip to content

Instantly share code, notes, and snippets.

@Aslan11
Created March 27, 2019 15:46
Show Gist options
  • Save Aslan11/6ccba96456f9156ae577744729a2bac1 to your computer and use it in GitHub Desktop.
Save Aslan11/6ccba96456f9156ae577744729a2bac1 to your computer and use it in GitHub Desktop.
schwab-readme

Redis Enterprise Backup & Restore for Pivotal Cloud Foundry

This repository features a trio of scripts can be used to backup and restore RedisE service instances and their application bindings in PCF.

NOTE:

This does not backup and restore the data within the databases. This merely backs up the current database configurations and outputs the commands necessary to recreate these databases with the same port and password.

Requirements / Dependencies

  • Python3
  • requests package for Python3
  • cf-cli installed

Instructions:

Section A (No DB's Made in RE UI)

If all RedisE DB's were created through cf-cli (and not ever made in our Redis Enterprise Admin UI):

  1. sign into cf-cli, cf login [-a API_URL] [-u USERNAME] [-p PASSWORD]
  2. execute python3 backup_cf_services_and_bindings.py - This will scan the foundry across all orgs and spaces (by leveraging cf curl) - the output of this script will be all cf-cli commands necessary to restore the current state - the output of this script should be copy and pasted somewhere safe
  3. Delete all service instances (if done through UI should unbind all apps)
  4. (Optional) If upgrading, delete and re-install new Tile
  5. Execute the commands output from Step #2

Section B (Additional DB's Made in RE UI)

If RedisE DB's were created in the Redis Enterprise Admin UI in addition to cf-cli / appsman:

  1. execute python3 backup_db_config.py - The script will ask you for Redis E Admin Username, Redis E Admin Password, the hostname of the cluster. It will then hit the API served on port 9443 to gather configuration data. This data will be output to dbs.json for later use
  2. Follow all instructions in "Instructions - Section A"
  3. execute python3 restore_cf_dbs_made_in_ui.py - The script will ask you for Redis E Admin Username, Redis E Admin Password, the hostname of the cluster. It will then hit the API served on port 9443 to recreate the DB's and their alerts using the configuration data gathered from Step #1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment