Skip to content

Using Multiple Keyspaces

Evan Prothro edited this page Nov 19, 2015 · 2 revisions

The overall workflow for a multiple keyspace env:

  • define all of your keyspaces/environment combinations as separate environments in cassandra.yml. You probably want to keep your main or default keyspace as just plain development or 'production`, especially if you're using the queries stuff (so as to confuse Rails as little as possible)
  • make sure to run rake cassandra:create for all of them
  • if you use using_keyspace in all your migrations for keyspaces defined in environments other than the standard Rails ones, you won't have to run them for each 'special' environment.

Side Note: If you're going to be using multiple keyspaces in one application (specially with cql-rb), you probably want to just fully qualify your table names in your queries rather than having to call USE <keyspace> all over the place. Specially since cql-rb encourages you to only have one client object per application.