Skip to content

Instantly share code, notes, and snippets.

@sean-horn
Created March 25, 2015 04:07
Show Gist options
  • Save sean-horn/86e32eb0d11a1b2bd574 to your computer and use it in GitHub Desktop.
Save sean-horn/86e32eb0d11a1b2bd574 to your computer and use it in GitHub Desktop.
Clone an EC11 System

These instructions are for an HA system specifically. To use for a Standalone, just replace the /var/opt/opscode/drbd/data path to /var/opt/opscode and ignore the stages for Secondary Backend and Frontends.

All commands as root

##On the Source EC 11.0.2 system

  1. Shutdown the backend

     private-chef-ctl stop
    
  2. Take a backup of the idle source Primary Backend

     tar -cvpf checkbackup-source.tar /etc/opscode /var/opt/opscode/drbd/data --exclude /etc/opscode/chef-server-running.js --exclude /etc/opscode/private-chef.rb
    
  3. Copy the tar over to the destination Primary Backend

##Destination Primary Backend System

  1. Shutdown all services but keepalived on the Primary backend

     for i in `private-chef-ctl status | awk '{print $2}' | cut -d ':' -f1,1 | grep -v keepalived`; do private-chef-ctl stop $i; done
    
  2. Make a backup of the current system and save it somewhere safe

     tar -cvpf chefbackup-destination.tar /etc/opscode /var/opt/opscode/drbd/data
    
  3. Delete all the current data

     rm -fr /var/opt/opscode/drbd/data
    
  4. Extract the data from the source server. /etc/opscode/pivotal.pem should match source server, /etc/opscode/private-chef.rb should not.

     tar -xpf chefbackup-source.tar -C /
    
  5. Startup

     private-chef-ctl start
    
  6. Check for any issues in the database startup

     less /var/log/opscode/postgresql/9.2/current
    

##On the Destination Secondary Backend System

  1. Copy the Primary Backend directory /etc/opscode here and overwrite all current stuff.

##On the Destination Frontends

  1. Copy the Primary Backend directory /etc/opscode here and overwrite all current stuff. Reconfigure the systems. This should restart services.

     private-chef-ctl reconfigure
    

Please don't forget to copy the /etc/opscode directory from the current Primary Backend to the Secondary Backend in the Destination cluster. We didn't do that here, and it is needed for a failover to succeed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment