Hi I have wrote a previous topic about migrating data b/w chef servers, but it seems a whole bunch way is not good for me. What I need is more granular approach.
Given I have existed client, node, client key (pem) on chef11 server. Now I need to import all this into new chef12 server. Which is the best way to do this? Thanks.
chef-server-ctl chef12-upgrade-data-transform -d /tmp/chef11 -e /tmp/chef12 # it will ask for org name, etc
Clean up the cookbooks: rm -rf /tmp/chef12/organizations/<your-org>/cookbooks/* # This is a optional step, if you wish to migrate I would keep the cookbooks.
chef-server-ctl chef12-upgrade-data-upload -e /tmp/chef12 # again it will ask for org short name before uploading
There’s others options for each command, call them with --help if you wish more control and less interactivity with them.
If you encounter errors while uploading cookbooks I’ve made a summary of what I did on my own migration on this repo
Thanks for your feedback @Tensibai , does chef12-upgrade-data-transform allow to migrate only a distinct objects, like only a single client, node? Unfortunately Migration in a whole bunch mode does not feet much for me …
And also, does chef12-upgrade-data-transform preserve existed client keys (pem files) ?
Ok, I will try. Actually I have this configuration:
existed chef11 server
needs to migrate to chef12 chef server
Also does chef12-upgrade-data-transform supports `skip if exists’ mode, like when client , node is already there do not re-create it … I mean what if I run chef12-upgrade-data-transform more the once against the same chef12 server. I would then need that objects previously created would not be re-created again …
Yes, it’s a manual process, I’ve the feeling we’re discussing an XY problem there.
What are you trying to achieve and why does a complete migration do not fit your need ?
I have a chef11 server with a lot of nodes, clients.
I need to replace chef11 by chef12 server.
I can’t do it in a one shot.
I need to to do it node (client) by node basis.
Say I choose node A and decide to migrate it to chef12. I do it ( in a one shot migration ). That’s ok. I go to node A server and change chef client config to use new chef12 server. How every the “side” effect of such a migration is now chef12 server has entries for all other nodes, clients comes from chef11 server.
A week later I choose another node B and decide to migrate it to chef12, when doing migration for node B, what is going to be with node A? Questions here - won’t migration failed because node, client already exists ( node A )? Also I don’t need to update node A data at all, when doing migration for node B
Once you migrated all nodes and their respective keys, the node by node migration is just updating their client.rb file to point to the new server (node attributes could become out of sync between the two servers, but unless you abuse normal levels attributes it should not be a problem).
The only point of attention when you have nodes on both server are:
Uploading the new cookbooks to both chef servers.
Register new nodes on the new chef-server as far as possible
The upload command won’t fail, but it will probably overwrite the existing nodes object, but as above, the only warning is about normal attributes which are part of the node object.
If you want to ensure a node by node update without loosing updated node attributes since the migration you can:
knife node show <the node> -F json > <the node>.json agains the chef11 server
knife node from file <the node>.json against the chef12 server
This will update the node object without touching the client key nor acl, so it should be ok.
Honestly I migrated my whole server and it’s 300 nodes in one shot, I had no real problem, just small outside cases on cookbooks with weird method in their metada.rb.
I started on an opensource chef-server 11.0.8, made a migration to 11.1.6 and then migrated to 12.2, my only drawbacks was on the cookbooks themselve, chef clients above 11.10 are ok with a chef-server 12.
Aww, sorry, forgot the command line flag -D for download only so it won’t try to ensure the chef11 server is running (case when you’re locally upgrading)
@Melezhik Your Chef server is one version too old for the tooling to work. It needs to be at least 11.1 or newer. I’d recommend upgrading to 11.1.7, the most current of the 11x servers, then try again. Sorry this wasn’t clearer earlier, but the supplied upgrade tooling only works on 11.1 or greater.