knife-mysql Knife Plugin
knife-mysql is a knife plugin for working with MySQL databases on servers managed by Chef.
Install & Usage Instructions
Installation
gem install knife-mysql
Usage
scp
knife mysql scp SOURCE DESTINATION (options)
The 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 mysql
and
cleaning up all the files.
Examples
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 staging
environment.
$ knife mysql scp "role:database AND chef_environment:production" "role:database AND chef_environment:staging"
See knife mysql scp --help
for the full list of options.