We don't have a walkthrough yet for migrating an existing database into Vitess. We're working on a migration guide based on a sample app.
The general procedure will be to get to a state where the database is accessible both directly and through Vitess, then switch app servers to connect through Vitess.
For example, the following list outlines the steps for migrating an unsharded database. Once you've migrated onto Vitess, the steps for going from unsharded to sharded would be the same as our existing
Resharding Guide.
If you have more specific questions, we'll probably need to know more about your setup to give recommendations.
1) Add Vitess users and grants on your existing database.
The default values can be found here:
2) Start up zk/etcd and vtctld.
The same as for a from-scratch Vitess cluster.
3) Start up vttablet alongside each mysqld.
Instead of starting a fresh vttablet+mysqld combination, just start a vttablet on the same machine as each of your existing mysqld servers.
You'll need to add some extra parameters to tell vttablet the database name to assume. On a from-scratch Vitess keyspace, we call the MySQL database "vt_"+keyspaceName by default, and you probably don't already have your database named like that. :)
You'll also need to tell Vitess which tablet is the master, which you can do with the
TabletExternallyReparented command. This is different from
InitShardMaster (used in from-scratch setup) in that TabletExternallyReparented does not touch whatever MySQL replication you have set up - instead, it informs Vitess that you have already set up replication yourself.
4) Start up vtgate(s).
Same as from-scratch setup.
5) Plug in Vitess client.
Develop a plugin for the data access layer of your app that uses the Vitess client to connect to vtgate. We are working on native drivers for things like JDBC and PDO that would make this a more seamless switch.
6) Switch app servers over to Vitess client.
Once you've got the app working on the Vitess client, you can switch over your app servers to Vitess mode one by one.