knife-mysql Knife Plugin
knife-mysql is a knife plugin for working with MySQL databases on servers managed by Chef.
Install & Usage Instructions
gem install knife-mysql
knife mysql scp SOURCE DESTINATION (options)
knife mysql scp subcommand makes it easy to copy databases between nodes.
This task will
ssh to each node matching the source query and
mysqldump the requested databases to a SQL file,
then download the resulting file to your local machine, and then upload it to each node matching the destination query, finally importing the data to
cleaning up all the files.
Copying a single database from one node to another.
$ knife mysql scp name:db1.example.com name:db2.example.com --databases db_example
Copying everything from your
production database servers into a
$ knife mysql scp "role:database AND chef_environment:production" "role:database AND chef_environment:staging"
knife mysql scp --help for the full list of options.