Migrating data from exitsted chef11 servers to new chef12 server

Hi! We have a couple of existed chef11 server with a lot of nodes, clients and client keys. We are going to replace 2 old chef11 servers with a 2 new chef12 servers. I don’t like to re-create a nodes, clients from the scratch.

If it possible to just copy all the stuff as is into new chef12 servers? Especially my concern about client keys …
Thanks in advance …

Alexey

We just did that and knife download/knife upload seemed to work fine for me.

I was also curious about this. My plan was to use knife backup to restore all my chef 11 data to a new chef server 12. Will that work?

This is an option; but I’d put a step between the knife backup first.

The hardest challenge when I converted from chef 11 to chef 12 were the individual cookbooks.

I’d suggest test-kitchening everyone you have, use the chef 12 client to confirm it converges how you want then start looking at converting.

Last thing you want to happen is start the migration finding out that you don’t have successful converges.

It’s not clear to me if you’re running Chef 11 open source server or Enterprise Chef 11 server (you didn’t say). I’m going to assume you’re running Chef 11 open source server.

I’d recommend the Chef supplied tooling for this. If you install the Chef 12 package (chef-server-core) on the Chef 11 systems, you get all the upgrade tooling (But don’t run reconfigure). Your Chef 11 server will still be present and continue to work - the only thing that will change is that the chef-server-ctl command will point to the Chef 12 version (located at /opt/opscode/bin/chef-server-ctl), but you can still access the Chef 11 chef-server-ctl by pointing to it directly at /opt/chef-server/bin/chef-server-ctl. Be aware of this for any scripts you might run against your server or when working on the box directly. You can then use the upgrade tooling to achieve what you want, without doing an in-place upgrade on the server. Once you’re done, you can uninstall the Chef 12 package and fix the path and everything on the Chef 11 server will be back to how it was.

This process works because the Chef 12 server installs to a different direction from Chef 11 open source server. The in-place upgrade, when you run the chef-server-ctl upgrade command is actually 3 steps: download the data from the Chef 11 server, transform it to the needed format for the Chef 12 server, upload it to the Chef 12 server. There are commands that will let you run these steps individually, so you can download the data from your Chef 11 server, transform it, then copy it over to a fresh box and upload it to the new Chef 12 server. This will capture everything you need in the process.

Docs on the in-place upgrade are here: https://docs.chef.io/upgrade_server.html#from-chef-server-osc

Docs on the individual commands to do what you want are here: https://docs.chef.io/upgrade_server_open_source_notes.html#manual-upgrades

Note that there are a slew of command line options here. You can run chef-server-ctl upgrade --help to see them all. One thing to realize about the process is that by default it will download your Chef 11 data to a directory under /tmp and it will transform the data by copying it to another directory in /tmp and making the needed transforms. These directories are somewhat randomized so this process can be repeated and for security reasons, but you can find them by looking in /tmp and find the dirs with chef11 and chef12 in the name. The data in them is just json, so it’s possibly to go in and manually change something if you want before upload to the Chef 12 server. This data is also not deleted off the server, so if something goes wrong it’s still available, and so you can grab it for backup if needed (you are hopefully backing up your server already).

One last point about upgrades: the Chef 11 open source server did not have orgs, where as the Chef 12 server does. During the upgrade process the tooling asks you to supply a default org. This is the org that any requests that come into the server that don’t specify an org will be routed too. This keeps you from needing to go update all your client.rbs with the org name. You should probably still do that at some point, but just so you’re aware of this point.

Hopefully that helps. If you need more clarification, just ask and I’ll do the best I can to answer any questions.

Mark Mzyk
Chef Software Engineer

I think it worth linking this topic as we discussed it there too.

I’ve put some articles up in our informal knowledgebase on how to
backup/restore/rollback data between EC11 and CS12: These are here:

https://getchef.zendesk.com/hc/en-us/search?utf8=✓&query=tar&commit=Search

Not sure if that will be of use or not.
Cheers,

Peter

1 Like