Migrating your Chef Server
December 20, 2012
Today I had to move a Chef server from an Ubuntu 12.04 machine to a Debian 6 box. The simplest path, which worked for me was to:
- Setup chef on the new machine
- Shutdown the services on the old host
- Compress and move the contents of /etc/chef and /var/lib/chef on the old server
- Shutdown services on the target system
- Uncompress the tarball on the new server
- Export the contents of the chef CouchDB database on the old system
- Use the CouchDB Python package (installable via pip / easy_install as ‘couchdb’)
- Dump the data with couchdb-dump http://127.0.0.1:5984/chef > /tmp/chef.json
- Copy the json file to the new host and import it by:
- Creating the chef database with curl -X PUT http://127.0.0.1:5984/chef
- Importing the JSON via couchdb-load —input chef.json http://localhost:5984/chef
- Restarting the services on the new host
- Telling Chef to rebuild its indices (otherwise Solr won’t know about the existing data in CouchDB) via knife index rebuild